mesa.git
6 years agoanv/batch_chain: Simplify secondary batch return chaining
Jason Ekstrand [Thu, 31 May 2018 05:07:30 +0000 (22:07 -0700)]
anv/batch_chain: Simplify secondary batch return chaining

Previously, we did this weird thing where we left space and an empty
relocation for use in a hypothetical MI_BATCH_BUFFER_START that would be
added to the secondary later.  Then, when it came time to chain it into
the primary, we would back that out and emit an MI_BATCH_BUFFER_START.
This worked well but it was always a bit hacky, fragile and ugly.  This
commit instead adds a helper for rewriting the MI_BATCH_BUFFER_START at
the end of an anv_batch_bo and we use that helper for both batch bo list
cloning and handling returns from secondaries.  The new helper doesn't
actually modify the batch in any way but instead just adjusts the
relocation as needed.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/batch_chain: Call batch_bo_finish at the end of end_batch_buffer
Jason Ekstrand [Thu, 31 May 2018 05:01:46 +0000 (22:01 -0700)]
anv/batch_chain: Call batch_bo_finish at the end of end_batch_buffer

The only reason we were calling it in the middle was that one of the
cases for figuring out the secondary command buffer execution type
wanted batch_bo->length which gets set by batch_bo_finish.  It's easy
enough to recalculate and now batch_bo_finish is called in a sensible
location.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Soft-pin client-allocated memory
Jason Ekstrand [Wed, 30 May 2018 23:06:39 +0000 (16:06 -0700)]
anv: Soft-pin client-allocated memory

Now that we've done all that refactoring, addresses are now being
directly written into surface states by ISL and BLORP whenever a BO is
pinned so there's really nothing to do besides enable it.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/allocator: Support softpin in the BO cache
Jason Ekstrand [Wed, 30 May 2018 22:25:04 +0000 (15:25 -0700)]
anv/allocator: Support softpin in the BO cache

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/allocator: Set the BO flags in bo_cache_alloc/import
Jason Ekstrand [Wed, 30 May 2018 22:34:25 +0000 (15:34 -0700)]
anv/allocator: Set the BO flags in bo_cache_alloc/import

It's safer to set them there because we have the opportunity to properly
handle combining flags if a BO is imported more than once.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: For pinned BOs, skip relocations, but track bo usage
Scott D Phillips [Tue, 13 Mar 2018 17:57:39 +0000 (10:57 -0700)]
anv: For pinned BOs, skip relocations, but track bo usage

References to pinned BOs won't need to be relocated at a later
point, so just write the final value of the reference into the bo
directly.

Add a `set` to the relocation lists for tracking dependencies that
were previously tracked by relocations. When a batch is executed, we
add the referenced pinned BOs to the exec list.

v2: - visit bos from the dependency set in a deterministic order (Jason)
v3: - compar => compare, drat (Jason)
    - Reworded commit message, provided by (Jordan)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Use a separate pool for binding tables when soft pinning
Scott D Phillips [Wed, 14 Mar 2018 17:31:16 +0000 (10:31 -0700)]
anv: Use a separate pool for binding tables when soft pinning

Soft pinning lets us satisfy the binding table address
requirements without using both sides of a growing state_pool.

If you do use both sides of a state pool, then you need to read
the state pool's center_bo_offset (with the device mutex held) to
know the final offset of relocations that target the state pool
bo.

By having a separate pool for binding tables that only grows in
the forward direction, the center_bo_offset is always 0 and
relocations don't need an update pass to adjust relocations with
the mutex held.

v2: - don't introduce a separate state flag for separate binding tables (Jason)
    - replace bo and map accessors with a single binding_table_pool accessor (Jason)
v3: - assert bt_block->offset >= 0 for the separate binding table (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoanv: Soft-pin state pools
Scott D Phillips [Thu, 1 Mar 2018 17:25:44 +0000 (09:25 -0800)]
anv: Soft-pin state pools

The state_pools reserve virtual address space of the full
BLOCK_POOL_MEMFD_SIZE, but maintain the current behavior of
growing from the middle.

v2: - rename block_pool::offset to block_pool::start_address (Jason)
    - assign state pool start_address statically (Jason)
v3: - remove unnecessary bo_flags tampering for the dynamic pool (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agonir: Lower !f2b(x) to x == 0.0
Ian Romanick [Thu, 31 May 2018 19:56:00 +0000 (12:56 -0700)]
nir: Lower !f2b(x) to x == 0.0

Some trivial help now, but it also prevents ~40 regressions caused by
Samuel's "nir: implement the GLSL equivalent of if simplication in
nir_opt_if" patch.

All Gen4+ platforms had similar results. (Skylake shown)
total instructions in shared programs: 14369557 -> 14369555 (<.01%)
instructions in affected programs: 442 -> 440 (-0.45%)
helped: 2
HURT: 0

total cycles in shared programs: 532425772 -> 532425743 (<.01%)
cycles in affected programs: 6086 -> 6057 (-0.48%)
helped: 2
HURT: 0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agonir: Add some missing "optimization undo" patterns
Ian Romanick [Thu, 31 May 2018 01:06:57 +0000 (18:06 -0700)]
nir: Add some missing "optimization undo" patterns

d8d18516b0a and 03fb13f6467 added some patterns to undo conversions like

   (('ior', ('flt', a, b), ('flt', a, c)), ('flt', a, ('fmax', b, c)))

If further optimization cause some of the operands to either be the same
or be constants, undoing the transformation can lead to further savings.

I don't know why these patterns were not added in those patches.  I did
not check to see which specific patterns actually helped.  I just added
all of them for symmetry.  This prevents some loop unrolling regressions
Plane Shift caused by Samuel's "nir: implement the GLSL equivalent of if
simplication in nir_opt_if" patch.

Skylake and Broadwell had similar results. (Skylake shown)
total instructions in shared programs: 14369768 -> 14369557 (<.01%)
instructions in affected programs: 44076 -> 43865 (-0.48%)
helped: 141
HURT: 0
helped stats (abs) min: 1 max: 5 x̄: 1.50 x̃: 1
helped stats (rel) min: 0.07% max: 1.52% x̄: 0.66% x̃: 0.60%
95% mean confidence interval for instructions value: -1.67 -1.32
95% mean confidence interval for instructions %-change: -0.72% -0.59%
Instructions are helped.

total cycles in shared programs: 532430629 -> 532425772 (<.01%)
cycles in affected programs: 1170832 -> 1165975 (-0.41%)
helped: 101
HURT: 5
helped stats (abs) min: 1 max: 160 x̄: 48.54 x̃: 32
helped stats (rel) min: <.01% max: 8.49% x̄: 2.76% x̃: 2.03%
HURT stats (abs)   min: 2 max: 22 x̄: 9.20 x̃: 4
HURT stats (rel)   min: <.01% max: 0.05% x̄: 0.02% x̃: <.01%
95% mean confidence interval for cycles value: -53.64 -38.00
95% mean confidence interval for cycles %-change: -3.06% -2.20%
Cycles are helped.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agodocs/meson: mention how to use array options
Eric Engestrom [Mon, 14 May 2018 15:39:42 +0000 (16:39 +0100)]
docs/meson: mention how to use array options

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: drop unused empty string array element
Eric Engestrom [Thu, 10 May 2018 15:12:12 +0000 (16:12 +0100)]
meson: drop unused empty string array element

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix platforms=[]
Eric Engestrom [Thu, 10 May 2018 15:11:29 +0000 (16:11 +0100)]
meson: fix platforms=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix vulkan-drivers=[]
Eric Engestrom [Thu, 10 May 2018 15:05:05 +0000 (16:05 +0100)]
meson: fix vulkan-drivers=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix gallium-drivers=[]
Eric Engestrom [Thu, 10 May 2018 15:04:26 +0000 (16:04 +0100)]
meson: fix gallium-drivers=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix dri-drivers=[]
Eric Engestrom [Thu, 10 May 2018 15:03:30 +0000 (16:03 +0100)]
meson: fix dri-drivers=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoREVIEWERS: add root meson.build to the Meson reviewers group
Eric Engestrom [Thu, 31 May 2018 10:18:31 +0000 (11:18 +0100)]
REVIEWERS: add root meson.build to the Meson reviewers group

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoglsl: Add ir_binop_vector_extract in NIR
Juan A. Suarez Romero [Wed, 9 May 2018 15:17:59 +0000 (15:17 +0000)]
glsl: Add ir_binop_vector_extract in NIR

Implement ir_binop_vector_extract using NIR operations. Based on SPIR-V
to NIR approach.

This fixes:
dEQP-GLES3.functional.shaders.indexing.moredynamic.with_value_from_indexing_expression_fragment
Piglit's glsl-fs-vec4-indexing-8.shader_test

CC: mesa-stable@lists.freedesktop.org
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral <itoral@igalia.com>
6 years agodoc: update calendar, add news and link release notes for 18.1.1
Dylan Baker [Fri, 1 Jun 2018 15:36:12 +0000 (08:36 -0700)]
doc: update calendar, add news and link release notes for 18.1.1

6 years agodocs/relnotes: Add sha256 sums for mesa 18.1.1
Dylan Baker [Fri, 1 Jun 2018 15:34:21 +0000 (08:34 -0700)]
docs/relnotes: Add sha256 sums for mesa 18.1.1

6 years agodocs: Add release notes for 18.1.1
Dylan Baker [Thu, 31 May 2018 22:22:49 +0000 (15:22 -0700)]
docs: Add release notes for 18.1.1

6 years agoi965: Add ARB_fragment_shader_interlock support.
Plamena Manolova [Fri, 27 Apr 2018 14:06:56 +0000 (15:06 +0100)]
i965: Add ARB_fragment_shader_interlock support.

Adds suppport for ARB_fragment_shader_interlock. We achieve
the interlock and fragment ordering by issuing a memory fence
via sendc.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agomesa: Add GL/GLSL plumbing for ARB_fragment_shader_interlock.
Plamena Manolova [Fri, 27 Apr 2018 13:12:30 +0000 (14:12 +0100)]
mesa: Add GL/GLSL plumbing for ARB_fragment_shader_interlock.

This extension provides new GLSL built-in functions
beginInvocationInterlockARB() and endInvocationInterlockARB()
that delimit a critical section of fragment shader code. For
pairs of shader invocations with "overlapping" coverage in a
given pixel, the OpenGL implementation will guarantee that the
critical section of the fragment shader will be executed for
only one fragment at a time.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agocompiler/spirv: reject invalid shader code properly
Martin Pelikán [Fri, 1 Jun 2018 12:27:24 +0000 (14:27 +0200)]
compiler/spirv: reject invalid shader code properly

After bebe3d626e5, b->fail_jump is prepared after vtn_create_builder
which can longjmp(3) to it through its vtx_assert()s.  This corrupts
the stack and creates confusing core dumps, so we need to avoid it.

While there, I decided to print the offending values for debugability.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agodocs: change release manager for 18.1
Juan A. Suarez Romero [Thu, 31 May 2018 11:13:16 +0000 (11:13 +0000)]
docs: change release manager for 18.1

Dylan will replace Emil as the release manager for 18.1.x series.

CC: Emil Velikov <emil.l.velikov@gmail.com>
CC: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agovirgl: Always assume that ORIGIN_UPPER_LEFT and PIXEL_CENTER* are supported
Gert Wollny [Wed, 16 May 2018 16:35:29 +0000 (18:35 +0200)]
virgl: Always assume that ORIGIN_UPPER_LEFT and PIXEL_CENTER* are supported

The driver must support at least one of

  PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT
  PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT

and one of

  PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER
  PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER

otherwise glsl_to_tgsi will fire an assert.

ORIGIN_UPPER_LEFT is the default convention, and is supported by
all mesa drivers, hence it seems reasonable to always report the caps
to be enabled.  On gles ORIGIN_LOWER_LEFT is generally not supported,
so we rely on the caps reported by the host that depend on whether we
run on an GL or an EGL host.

For PIXEL_CENTER it is completely host driver dependend on what is
supported, and since we do not report the actual host driver capabilities
it is best to mark both as supported, this is how it works for a GL
host too.

Fixes:
   dEQP-GLES3.functional.shaders.builtin_variable.fragcoord_xyz
   dEQP-GLES3.functional.shaders.metamorphic.bubblesort_flag.variant_1
   dEQP-GLES3.functional.shaders.metamorphic.bubblesort_flag.variant_2

Reviewed-by: Gurchetan Singh <gurcetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agoradeonsi: Fix crash on shaders using MSAA image load/store
Alex Smith [Wed, 30 May 2018 08:39:27 +0000 (09:39 +0100)]
radeonsi: Fix crash on shaders using MSAA image load/store

The value returned by tgsi_util_get_texture_coord_dim() does not
account for the sample index. This means image_fetch_coords() will not
fetch it, leading to a null deref in ac_build_image_opcode() which
expects it to be present (the return value of ac_num_coords() *does*
include the sample index).

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradv: Handle GFX9 merged shaders in radv_flush_constants()
Alex Smith [Thu, 31 May 2018 14:28:27 +0000 (15:28 +0100)]
radv: Handle GFX9 merged shaders in radv_flush_constants()

This was not previously handled correctly. For example,
push_constant_stages might only contain MESA_SHADER_VERTEX because
only that stage was changed by CmdPushConstants or
CmdBindDescriptorSets.

In that case, if vertex has been merged with tess control, then the
push constant address wouldn't be updated since
pipeline->shaders[MESA_SHADER_VERTEX] would be NULL.

Use radv_get_shader() instead of getting the shader directly so that
we get the right shader if merged. Also, skip emitting the address
redundantly - if two merged stages are set in push_constant_stages
this change would have made the address get emitted twice.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: Consolidate GFX9 merged shader lookup logic
Alex Smith [Thu, 31 May 2018 14:18:52 +0000 (15:18 +0100)]
radv: Consolidate GFX9 merged shader lookup logic

This was being handled in a few different places, consolidate it into a
single radv_get_shader() function.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: Set active_stages the same whether or not shaders were cached
Alex Smith [Thu, 31 May 2018 14:02:32 +0000 (15:02 +0100)]
radv: Set active_stages the same whether or not shaders were cached

With GFX9 merged shaders, active_stages would be set to the original
stages specified if shaders were not cached, but to the stages still
present after merging if they were.

Be consistent and use the original stages.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agost/mesa: relax requirements for ARB_ES3_compatibility
Marek Olšák [Thu, 31 May 2018 19:20:48 +0000 (15:20 -0400)]
st/mesa: relax requirements for ARB_ES3_compatibility

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106748

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv/blorp: Write relocated values into surface states
Scott D Phillips [Thu, 31 May 2018 03:24:15 +0000 (20:24 -0700)]
anv/blorp: Write relocated values into surface states

v2 (Jason Ekstrand):
 - Split the blorp bit into it's own patch and re-order a bit
 - Use anv_address helpers

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Use an address for each anv_image plane
Jason Ekstrand [Thu, 31 May 2018 01:55:00 +0000 (18:55 -0700)]
anv: Use an address for each anv_image plane

This is better than having BO and offset fields.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/cmd_buffer: Rework surface relocation helpers
Jason Ekstrand [Thu, 31 May 2018 01:30:50 +0000 (18:30 -0700)]
anv/cmd_buffer: Rework surface relocation helpers

This commit renames add_surface_state_reloc to add_surface_reloc and
makes it takes an address.  We also rename add_image_view_relocs to
add_surface_state_relocs because it takes an anv_surface_state and
doesn't really care about the image view anymore.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Use an anv_address in anv_buffer
Jason Ekstrand [Thu, 31 May 2018 01:05:54 +0000 (18:05 -0700)]
anv: Use an anv_address in anv_buffer

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/cmd_buffer: Use anv_address for handling indirect parameters
Jason Ekstrand [Thu, 31 May 2018 01:02:43 +0000 (18:02 -0700)]
anv/cmd_buffer: Use anv_address for handling indirect parameters

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Use an anv_address in anv_buffer_view
Jason Ekstrand [Thu, 31 May 2018 00:36:49 +0000 (17:36 -0700)]
anv: Use an anv_address in anv_buffer_view

Instead of storing a BO and offset separately, use an anv_address.  This
changes anv_fill_buffer_surface_state to use anv_address and we now call
anv_address_physical and pass that into ISL.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Use full anv_addresses in anv_surface_state
Jason Ekstrand [Thu, 31 May 2018 00:16:52 +0000 (17:16 -0700)]
anv: Use full anv_addresses in anv_surface_state

This refactors surface state filling to work entirely in terms of
anv_addresses instead of offsets.  This should make things simpler for
when we go to soft-pin image buffers.  Among other things,
add_image_view_relocs now only cares about the addresses in the surface
state and doesn't really need the image view anymore.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Add some anv_address helpers
Jason Ekstrand [Thu, 31 May 2018 01:16:50 +0000 (18:16 -0700)]
anv: Add some anv_address helpers

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Add vma_heap allocators in anv_device
Scott D Phillips [Wed, 7 Mar 2018 17:18:37 +0000 (09:18 -0800)]
anv: Add vma_heap allocators in anv_device

These will be used to assign virtual addresses to soft pinned
buffers in a later patch.

Two allocators are added for separate 'low' and 'high' virtual
memory areas. Another alternative would have been to add a
double-sided allocator, which wasn't done here just because it
didn't appear to give any code complexity advantages.

v2 (Scott Phillips):
 - rename has_exec_softpin to use_softpin (Jason)
 - Only remove bottom one page and top 4 GiB from virt (Jason)
 - refer to comment in anv_allocator about state address + size
   overflowing 48 bits (Jason)
 - Mention hi/lo allocators vs double-sided allocator in
   commit message (Chris)
 - assign state pool memory ranges statically (Jason)

v3 (Jason Ekstrand):
 - Use (LOW|HIGH)_HEAP_(MIN|MAX)_ADDRESS rather than (1 << 31) for
   determining which heap to use in anv_vma_free
 - Only return de-canonicalized addresses to the heap

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agointel/common: Add an address de-canonicalization helper
Jason Ekstrand [Thu, 31 May 2018 03:00:37 +0000 (20:00 -0700)]
intel/common: Add an address de-canonicalization helper

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoutil: Add a randomized test for the virtual memory allocator
Scott D Phillips [Sat, 5 May 2018 00:11:13 +0000 (17:11 -0700)]
util: Add a randomized test for the virtual memory allocator

The test pseudo-randomly makes allocations and deallocations with
the virtual memory allocator and checks that the results are
consistent. Specifically, we test that:

 * no result from the allocator overlaps an already allocated range
 * allocated memory fulfills the stated alignment requirement
 * a failed result from the allocator could not have been fulfilled
 * memory freed to the allocator can later be allocated again

v2: - fix if() in test() to actually run fill()
v3: - add c++11 build flag (Jason)
    - test the full 64-bit range (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoutil: Add a virtual memory allocator
Jason Ekstrand [Sun, 7 Jan 2018 01:28:01 +0000 (17:28 -0800)]
util: Add a virtual memory allocator

This is simple linear-walk first-fit allocator roughly based on the
allocator in the radeon winsys code.  This allocator has two primary
functional differences:

 1) It cleanly returns 0 on allocation failure

 2) It allocates addresses top-down instead of bottom-up.

The second one is needed for Intel because high addresses (with bit 47
set) need to be canonicalized in order to work properly.  If we allocate
bottom-up, then high addresses will be very rare (if they ever happen).
We'd rather always have high addresses so that the canonicalization code
gets better testing.

v2: - [scott-ph] remove _heap_validate() if NDEBUG is defined (Jordan)

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
Tested-by: Scott D Phillips <scott.d.phillips@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Add startup debug option.
Bas Nieuwenhuizen [Wed, 30 May 2018 23:49:38 +0000 (01:49 +0200)]
radv: Add startup debug option.

This adds a RADV_DEBUG=startup option to dump more info about
instance creation and device enumeration.

A common question end users have is why the direver is not loading
for them, and this has two common reasons:
1) They did not install the driver.
2) AMDGPU is not used for the card in the kernel.

This adds some info messages so we can easily get a some useful
output from end users.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: Add option to print errors even in optimized builds.
Bas Nieuwenhuizen [Wed, 30 May 2018 23:06:41 +0000 (01:06 +0200)]
radv: Add option to print errors even in optimized builds.

Errors are not that common of a case so we can eat a slight perf
hit in having to call a function and do a runtime check.

In turn this makes debugging random errors happening for end users
easier, because they don't have to have a debug build on hand.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: Make the sem_info allocate/free functions static.
Bas Nieuwenhuizen [Wed, 30 May 2018 22:57:55 +0000 (00:57 +0200)]
radv: Make the sem_info allocate/free functions static.

They are only used in 1 file.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agonir: optimize iand(ieq(a, 0), ieq(b, 0)) to ieq(ior(a, b), 0)
Samuel Pitoiset [Wed, 30 May 2018 08:48:31 +0000 (10:48 +0200)]
nir: optimize iand(ieq(a, 0), ieq(b, 0)) to ieq(ior(a, b), 0)

Totals from affected shaders:
SGPRS: 80 -> 80 (0.00 %)
VGPRS: 48 -> 48 (0.00 %)
Code Size: 2120 -> 2096 (-1.13 %) bytes
Max Waves: 16 -> 16 (0.00 %)

Only two Rise of Tomb Raider shaders are affected on my side.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa: don't call Driver.TexEnv with invalid arguments
Tapani Pälli [Tue, 29 May 2018 11:24:10 +0000 (14:24 +0300)]
mesa: don't call Driver.TexEnv with invalid arguments

Patch skips useless and possibly dangerous calls down to the driver
in case invalid arguments were given. I noticed this would be happening
with demo of Darwinia game. AFAIK this does not fix anything but makes
this path safer and more like how other API functions are implemented.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agov3d: Fix automake linking error.
Vinson Lee [Tue, 22 May 2018 00:17:45 +0000 (00:17 +0000)]
v3d: Fix automake linking error.

  CXXLD    gallium_dri.la
../../../../src/broadcom/.libs/libbroadcom.a(clif_dump.o): In function `clif_dump_packet':
src/broadcom/clif/clif_dump.c:87: undefined reference to `v3d33_clif_dump_packet'
src/broadcom/clif/clif_dump.c:85: undefined reference to `v3d41_clif_dump_packet'
../../../../src/broadcom/.libs/libbroadcom.a(clif_dump.o): In function `clif_process_worklist':
src/broadcom/clif/clif_dump.c:140: undefined reference to `v3d41_clif_dump_gl_shader_state_record'
src/broadcom/clif/clif_dump.c:144: undefined reference to `v3d33_clif_dump_gl_shader_state_record'

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agovirgl: Update virgl_hw.h
Jakob Bornecrantz [Tue, 3 Apr 2018 16:04:57 +0000 (17:04 +0100)]
virgl: Update virgl_hw.h

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agovirgl: add ARB_transform_feedback_overflow_query support
Dave Airlie [Mon, 28 May 2018 01:53:35 +0000 (11:53 +1000)]
virgl: add ARB_transform_feedback_overflow_query support

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agovirgl: add polygon offset clamp
Dave Airlie [Mon, 28 May 2018 01:53:34 +0000 (11:53 +1000)]
virgl: add polygon offset clamp

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agovirgl: add derivative control support
Dave Airlie [Mon, 28 May 2018 01:53:33 +0000 (11:53 +1000)]
virgl: add derivative control support

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agovirgl: add ARB_conditional_render_inverted support
Dave Airlie [Mon, 28 May 2018 01:53:32 +0000 (11:53 +1000)]
virgl: add ARB_conditional_render_inverted support

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agovirgl: update caps bitset to latest version.
Dave Airlie [Mon, 28 May 2018 01:53:31 +0000 (11:53 +1000)]
virgl: update caps bitset to latest version.

This makes this use all 32 bits, so future sets need to be
defined in a new struct.

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agonir: add unsigned comparison simplifications
Timothy Arceri [Wed, 30 May 2018 10:32:24 +0000 (20:32 +1000)]
nir: add unsigned comparison simplifications

This avoids loop unrolling regressions in Wolfenstein II on DXVK
with an upcoming optimisation series from Samuel.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: Only expose subgroup shuffles on VI+.
Bas Nieuwenhuizen [Wed, 30 May 2018 06:50:03 +0000 (08:50 +0200)]
radv: Only expose subgroup shuffles on VI+.

The current implementation depends on bpermute, which
is VI+.

Fixes: f2c6a550611 "radv: enable subgroup capabilities"
Reviewed-by: Daniel Schürmann <daniel.schuermann@campus.tu-berlin.de>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: fix emitting descriptor pointers with LLVM < 7
Samuel Pitoiset [Wed, 30 May 2018 09:15:12 +0000 (11:15 +0200)]
radv: fix emitting descriptor pointers with LLVM < 7

This was terribly wrong, I forced use of 32-bit pointers when
emitting shader descriptor pointers. This fixes GPU hangs with
LLVM 5&6 because 32-bit pointers are only supported with LLVM 7.

Fixes: 88d1ed0f81 ("radv: emit shader descriptor pointers consecutively")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonv30: add a couple of missed shader caps
Ilia Mirkin [Mon, 28 May 2018 15:15:55 +0000 (11:15 -0400)]
nv30: add a couple of missed shader caps

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agonv30: ensure that displayable formats are marked accordingly
Ilia Mirkin [Mon, 28 May 2018 15:07:08 +0000 (11:07 -0400)]
nv30: ensure that displayable formats are marked accordingly

Fixes: f7604d8af52 ("st/dri: only expose config formats that are display targets")
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agomesa: expose ARB_tessellation_shader in the compatibility profile
Marek Olšák [Wed, 23 May 2018 05:47:55 +0000 (01:47 -0400)]
mesa: expose ARB_tessellation_shader in the compatibility profile

Gallium drivers don't expose this yet due to:
    "st/mesa: use PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY"

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: expose AMD_vertex_shader_layer in the compatibility profile
Marek Olšák [Thu, 15 Feb 2018 00:20:46 +0000 (01:20 +0100)]
mesa: expose AMD_vertex_shader_layer in the compatibility profile

This requires layered FBOs from GL 3.2.

Gallium drivers don't expose this yet due to:
    "st/mesa: use PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY"

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: expose ARB_gpu_shader5 in the compatibility profile
Marek Olšák [Wed, 14 Feb 2018 21:38:15 +0000 (22:38 +0100)]
mesa: expose ARB_gpu_shader5 in the compatibility profile

Gallium drivers don't expose this yet due to:
    "st/mesa: use PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY"

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agost/mesa: use PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY
Marek Olšák [Wed, 23 May 2018 04:46:02 +0000 (00:46 -0400)]
st/mesa: use PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium: add PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY
Marek Olšák [Thu, 15 Feb 2018 00:32:08 +0000 (01:32 +0100)]
gallium: add PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: update fixed-func state constants for TCS, TES, GS
Marek Olšák [Wed, 23 May 2018 05:37:12 +0000 (01:37 -0400)]
mesa: update fixed-func state constants for TCS, TES, GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: print Compatibility Profile in the version string
Marek Olšák [Wed, 14 Feb 2018 20:21:24 +0000 (21:21 +0100)]
mesa: print Compatibility Profile in the version string

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoglsl: parse #version XXX compatibility
Marek Olšák [Wed, 14 Feb 2018 20:00:09 +0000 (21:00 +0100)]
glsl: parse #version XXX compatibility

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agost/mesa: fix assertion failures with GL_UNSIGNED_INT64_ARB (v2)
Marek Olšák [Fri, 25 May 2018 20:37:29 +0000 (16:37 -0400)]
st/mesa: fix assertion failures with GL_UNSIGNED_INT64_ARB (v2)

Bindless texture handles can be passed via vertex attribs using this type.
They use the double codepath, so don't use st_pipe_vertex_format.

Cc: 18.0 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agomesa: handle GL_UNSIGNED_INT64_ARB properly (v2)
Marek Olšák [Fri, 25 May 2018 20:37:29 +0000 (16:37 -0400)]
mesa: handle GL_UNSIGNED_INT64_ARB properly (v2)

Bindless texture handles can be passed via vertex attribs using this type.
This fixes a bunch of bindless piglit tests on radeonsi.

Cc: 18.0 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agomesa: add display list support for glPatchParameter{i,fv}()
Timothy Arceri [Mon, 28 May 2018 10:57:37 +0000 (20:57 +1000)]
mesa: add display list support for glPatchParameter{i,fv}()

This is required for tessellation shader Compat profile support.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglx/drisw: make the shm/non-shm loader extensions separately.
Dave Airlie [Tue, 29 May 2018 03:04:03 +0000 (13:04 +1000)]
glx/drisw: make the shm/non-shm loader extensions separately.

I disliked removing the const here, function tables are meant
to be const just to avoid having to think about them,
make a second table for the shm vs non-shm paths to use.

Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodrisw/glx: implement getImageShm
Marc-André Lureau [Mon, 15 Jun 2015 13:07:34 +0000 (15:07 +0200)]
drisw/glx: implement getImageShm

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodrisw: use getImageShm() if available
Marc-André Lureau [Mon, 15 Jun 2015 13:09:58 +0000 (15:09 +0200)]
drisw: use getImageShm() if available

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodrisw: learn to query shmid handle type
Marc-André Lureau [Mon, 15 Jun 2015 12:48:27 +0000 (14:48 +0200)]
drisw: learn to query shmid handle type

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodrisw/glx: use XShm if possible
Marc-André Lureau [Wed, 10 Jun 2015 15:58:31 +0000 (17:58 +0200)]
drisw/glx: use XShm if possible

Implements putImageShm from DRIswrastLoaderExtension.

If XShm extension is not available, or fails, it will fallback on
regular XPutImage().

Tested on Linux only with 16bpp and 32bpp visual.

(airlied: tested on 24bpp as well)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodrisw: use shared memory when possible
Marc-André Lureau [Wed, 10 Jun 2015 15:45:11 +0000 (17:45 +0200)]
drisw: use shared memory when possible

If drisw_loader_funcs implements put_image_shm, allocates display
target data with shared memory and display with put_image_shm().

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodrisw: use putImageShm if available
Marc-André Lureau [Wed, 10 Jun 2015 15:34:15 +0000 (17:34 +0200)]
drisw: use putImageShm if available

If the DRIswrastLoaderExtension implements putImageShm, bind it to
drisw_loader_funcs.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agodri: add putImageShm and getImageShm to swrastLoader
Marc-André Lureau [Wed, 10 Jun 2015 15:28:47 +0000 (17:28 +0200)]
dri: add putImageShm and getImageShm to swrastLoader

Add new API to put and get an image using shared memory. Instead of only
passing the data pointer, 3 arguments are given: the shmid, the data
offset and the shmaddr.

Bump interface version.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agogallium/winsys: rename DRM_API_HANDLE_* to WINSYS_HANDLE_*
Dave Airlie [Tue, 29 May 2018 01:21:38 +0000 (11:21 +1000)]
gallium/winsys: rename DRM_API_HANDLE_* to WINSYS_HANDLE_*

This just renames this as we want to add an shm handle which
isn't really drm related.

Originally by: Marc-André Lureau <marcandre.lureau@gmail.com>
(airlied: I used this sed script instead)
This was generated with:
 git grep -l 'DRM_API_' | xargs sed -i 's/DRM_API_/WINSYS_/g'

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium: move winsys handle to it's own file.
Marc-André Lureau [Tue, 29 May 2018 01:17:11 +0000 (11:17 +1000)]
gallium: move winsys handle to it's own file.

This will be used in the drisw interface later, which isn't
drm specific.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agointel/fs: Add explicit last_rt flag to fb writes orthogonal to eot.
Francisco Jerez [Fri, 13 Jan 2017 22:01:45 +0000 (14:01 -0800)]
intel/fs: Add explicit last_rt flag to fb writes orthogonal to eot.

When using multiple RT write messages to the same RT such as for
dual-source blending or all RT writes in SIMD32, we have to set the
"Last Render Target Select" bit on all write messages that target the
last RT but only set EOT on the last RT write in the shader.
Special-casing for dual-source blend works today because that is the
only case which requires multiple RT write messages per RT.  When we
start doing SIMD32, this will become much more common so we add a
dedicated bit for it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel/fs: Replace the CINTERP opcode with a simple MOV
Francisco Jerez [Fri, 18 May 2018 22:20:43 +0000 (15:20 -0700)]
intel/fs: Replace the CINTERP opcode with a simple MOV

The only reason it was it's own opcode was so that we could detect it
and adjust the source register based on the payload setup.  Now that
we're using the ATTR file for FS inputs, there's no point in having a
magic opcode for this.

v2 (Jason Ekstrand):
 - Break the bit which removes the CINTERP opcode into its own patch

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel/fs: Use the ATTR file for FS inputs
Francisco Jerez [Tue, 26 Apr 2016 01:33:22 +0000 (18:33 -0700)]
intel/fs: Use the ATTR file for FS inputs

This replaces the special magic opcodes which implicitly read inputs
with explicit use of the ATTR file.

v2 (Jason Ekstrand):
 - Break into multiple patches
 - Change the units of the FS ATTR to be in logical scalars

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel/fs: Rename a local variable so it doesn't shadow component()
Francisco Jerez [Fri, 18 May 2018 22:13:25 +0000 (15:13 -0700)]
intel/fs: Rename a local variable so it doesn't shadow component()

v2 (Jason Ekstrand):
 - Break the refactor into its own patch

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel/eu: Remove brw_codegen::compressed_stack.
Francisco Jerez [Fri, 6 Jan 2017 03:26:13 +0000 (19:26 -0800)]
intel/eu: Remove brw_codegen::compressed_stack.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel/fs: Use groups for SIMD16 LINTERP on gen11+
Jason Ekstrand [Thu, 17 May 2018 00:33:17 +0000 (17:33 -0700)]
intel/fs: Use groups for SIMD16 LINTERP on gen11+

This is better than compression control because it naturally extends to
SIMD32.

v2:
 - Push/pop instruction state around adjusted codegen (Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agointel/fs: Assert that the gen4-6 plane restrictions are followed
Jason Ekstrand [Thu, 17 May 2018 00:30:04 +0000 (17:30 -0700)]
intel/fs: Assert that the gen4-6 plane restrictions are followed

The fall-back does not work correctly in SIMD16 mode and the register
allocator should ensure that we never hit this case anyway.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agotravis: Add clover llvm-6.0 build
Jan Vesely [Tue, 22 May 2018 22:36:32 +0000 (18:36 -0400)]
travis: Add clover llvm-6.0 build

v2: Don't force build using gcc-4.8
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-By: Aaron Watry <awatry@gmail.com>
6 years agoclover: Cleanup compat code for llvm < 3.9
Jan Vesely [Tue, 22 May 2018 22:27:39 +0000 (18:27 -0400)]
clover: Cleanup compat code for llvm < 3.9

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-By: Aaron Watry <awatry@gmail.com>
6 years agoclover: Fix build after llvm r332881.
Jan Vesely [Tue, 22 May 2018 21:52:30 +0000 (17:52 -0400)]
clover: Fix build after llvm r332881.

v2: fix whitespace and indentation

r332881 added an extra parameter to the emit function.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106619
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-By: Aaron Watry <awatry@gmail.com>
Tested-By: Aaron Watry <awatry@gmail.com>
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
6 years agoi965: Only emit VF cache invalidations when the high bits changes
Chris Wilson [Tue, 29 May 2018 16:28:07 +0000 (17:28 +0100)]
i965: Only emit VF cache invalidations when the high bits changes

Commit 92f01fc5f914 ("i965: Emit VF cache invalidates for 48-bit
addressing bugs with softpin.") tried to only emit the VF invalidate if
the high bits changed, but it accidentally always set need_invalidate to
true; causing it to emit unconditionally emit the pipe control before
every primitive.

Fixes: 92f01fc5f914 ("i965: Emit VF cache invalidates for 48-bit addressing bugs with softpin.")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106708
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agovulkan: don't free uninitialised memory
Eric Engestrom [Fri, 18 May 2018 16:12:53 +0000 (17:12 +0100)]
vulkan: don't free uninitialised memory

The modifiers array hasn't been initialised by then, much less with data
that would need freeing.
Move the label after the loop to fix this.

Fixes: c80c08e22603 ("vulkan/wsi/x11: Add support for DRI3 v1.2")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agodri: replace two-way switch case with a table lookup
Eric Engestrom [Fri, 18 May 2018 14:58:58 +0000 (15:58 +0100)]
dri: replace two-way switch case with a table lookup

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
---
v2: rebased on top of 432df741e0b85c021da0 "dri_util: Add
R10G10B10{A,X}2 translation between DRI and mesa_format."

6 years agodri: fix error value returned by driGLFormatToImageFormat()
Eric Engestrom [Fri, 18 May 2018 14:53:58 +0000 (15:53 +0100)]
dri: fix error value returned by driGLFormatToImageFormat()

0 is not a valid value for the __DRI_IMAGE_FORMAT_* enum.
It is, however, the value of MESA_FORMAT_NONE, which two of the callers
(i915 & i965) checked for.

The other callers (that check for errors, ie. st/dri) already check for
__DRI_IMAGE_FORMAT_NONE.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/x11: fix build with DRI3 disabled
Eric Engestrom [Tue, 29 May 2018 15:59:18 +0000 (16:59 +0100)]
egl/x11: fix build with DRI3 disabled

Fixes: 473af0b541b2583f4c72 "egl/x11: deduplicate depth-to-format logic"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Yogesh Marathe <yogesh.marathe@intel.com>
6 years agomeson: require shared glapi when using DRI based libGL
Emil Velikov [Fri, 23 Feb 2018 19:32:03 +0000 (19:32 +0000)]
meson: require shared glapi when using DRI based libGL

Just like we do in the autotools build.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: remove unreachable with_glx == 'auto' check
Emil Velikov [Fri, 23 Feb 2018 19:32:02 +0000 (19:32 +0000)]
meson: remove unreachable with_glx == 'auto' check

Cannot happen since, props to the autodetection further up.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agotegra: Treat resources with modifiers as scanout
Thierry Reding [Wed, 4 Apr 2018 14:04:25 +0000 (16:04 +0200)]
tegra: Treat resources with modifiers as scanout

Resources created with modifiers are treated as scanout because there is
no way for applications to specify the usage (though that capability may
be useful to have in the future). Currently all the resources created by
applications with modifiers are for scanout, so make sure they have bind
flags set accordingly.

This is necessary in order to properly export buffers for such resources
so that they can be shared with scanout hardware.

Tested-by: Daniel Kolesa <daniel@octaforge.org>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Thierry Reding <treding@nvidia.com>
6 years agotegra: Fix scanout resources without modifiers
Thierry Reding [Thu, 15 Mar 2018 20:59:02 +0000 (21:59 +0100)]
tegra: Fix scanout resources without modifiers

Resources created for scanout but without modifiers need to be treated
as pitch-linear. This is because applications that don't use modifiers
to create resources must be assumed to not understand modifiers and in
turn won't be able to create a DRM framebuffer and passing along which
modifiers were picked by the implementation.

Tested-by: Daniel Kolesa <daniel@octaforge.org>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Thierry Reding <treding@nvidia.com>