platform/upstream/mesa.git
3 years agonir/opt_load_store_vectorize: fix check_for_robustness() with deref access
Rhys Perry [Tue, 15 Jun 2021 16:50:57 +0000 (17:50 +0100)]
nir/opt_load_store_vectorize: fix check_for_robustness() with deref access

We could do better if we knew the nir_address_format to obtain
addition_bits, but the only affected driver (Turnip) probably won't
benefit because it doesn't vectorize across vec4.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 2e7bceb2204 ("nir/load_store_vectorizer: fix check_for_robustness() with indirect loads")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4922
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11382>

3 years agoanv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is...
Ella-0 [Sun, 27 Jun 2021 19:29:08 +0000 (19:29 +0000)]
anv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is not enabled

Fixes: e9e1e0362b6c2d ("anv: implement VK_EXT_physical_device_drm")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11616>

3 years agoradeonsi: move the accepting code into the bbox cull branch in prim discard CS
Marek Olšák [Tue, 1 Jun 2021 05:40:37 +0000 (01:40 -0400)]
radeonsi: move the accepting code into the bbox cull branch in prim discard CS

This reduces the number of jumps. No change in behavior.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11510>

3 years agoradeonsi: add optimal multi draws and draw-level splitting for prim discard CS
Marek Olšák [Tue, 1 Jun 2021 01:59:28 +0000 (21:59 -0400)]
radeonsi: add optimal multi draws and draw-level splitting for prim discard CS

This is a partial rewrite of some parts of the code.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11510>

3 years agoradeonsi: fix issues with draw-level splitting for the prim discard CS
Marek Olšák [Tue, 1 Jun 2021 01:58:37 +0000 (21:58 -0400)]
radeonsi: fix issues with draw-level splitting for the prim discard CS

- move the unreachable statement up by inlining u_decomposed_prims_for_vertices
- the last draw was not submitted after splitting
- move "count" to the non-multi draw path

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11510>

3 years agoradeonsi: change how the prim discard CS is enabled and splitting limits
Marek Olšák [Tue, 1 Jun 2021 01:48:28 +0000 (21:48 -0400)]
radeonsi: change how the prim discard CS is enabled and splitting limits

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11510>

3 years agoradeonsi: remove the GDS variants of compute-based primitive discard
Marek Olšák [Mon, 31 May 2021 01:28:53 +0000 (21:28 -0400)]
radeonsi: remove the GDS variants of compute-based primitive discard

The GDS ordered append variant is unstable due to kernel and firmware bugs.
The unordered GDS variant isn't faster than the memory-based variant.

Only the memory-based variant is kept.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11510>

3 years agointel/fs: use stack for temporary array
Marcin Ślusarz [Thu, 6 May 2021 12:24:03 +0000 (14:24 +0200)]
intel/fs: use stack for temporary array

"regs" is an array of 2 ->
  "m" must be <= 2 ->
  "components" array can be allocated on the stack

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11575>

3 years agointel/blorp: initialize BLEND_STATE using braced initializer list
Marcin Ślusarz [Thu, 24 Jun 2021 15:01:43 +0000 (17:01 +0200)]
intel/blorp: initialize BLEND_STATE using braced initializer list

Coverity complains that memset has no effect, because of size 0.
Size of BLEND_STATE struct is 0 on gfx [6, 7.5], so memset has
nothing to do there. This is of course harmless, but we can make
code simpler by replacing memset with an empty initializer list
and at the same time avoid a warning from Coverity.

CID: 1486015

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agointel/tools: fix potential memory leaks
Marcin Ślusarz [Thu, 24 Jun 2021 11:40:11 +0000 (13:40 +0200)]
intel/tools: fix potential memory leaks

CID: 1444041
CID: 1444104

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agointel/tools: fix invalid type in argument to printf format specifier
Marcin Ślusarz [Thu, 24 Jun 2021 11:22:42 +0000 (13:22 +0200)]
intel/tools: fix invalid type in argument to printf format specifier

Also mark parse_error as printf-like to catch such errors with gcc.

CID: 1473100
CID: 1473101

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agointel/tools: fix int-to-pointer/pointer-to-int cast warnings on 32-bit
Marcin Ślusarz [Thu, 24 Jun 2021 11:18:35 +0000 (13:18 +0200)]
intel/tools: fix int-to-pointer/pointer-to-int cast warnings on 32-bit

gcc complains:
../src/intel/tools/aub_write.c: In function ‘populate_ppgtt_table’:
../src/intel/tools/aub_write.c:254:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  254 |                (void *)(aub->phys_addrs_allocator++ << 12);
      |                ^
../src/intel/tools/aub_write.c:258:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  258 |                        i, (uint64_t)table->subtables[i]);
      |                           ^
../src/intel/tools/aub_write.c:273:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  273 |          (level == 1 ? (uint64_t)table->subtables[i] :
      |                        ^
../src/intel/tools/aub_write.c: In function ‘ppgtt_lookup’:
../src/intel/tools/aub_write.c:346:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  346 |    return (uint64_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
      |           ^
../src/intel/tools/intel_sanitize_gpu.c: In function ‘bo_size’:
../src/intel/tools/intel_sanitize_gpu.c:99:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   99 |    return e ? (uint64_t)e->data : UINT64_MAX;
      |               ^

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agointel/tools: fix left shift overflow on 32-bit
Marcin Ślusarz [Thu, 24 Jun 2021 11:15:55 +0000 (13:15 +0200)]
intel/tools: fix left shift overflow on 32-bit

gcc complains:
../src/intel/tools/aub_write.c:394:53: warning: left shift count >= width of type [-Wshift-count-overflow]
  394 |    assert((aub->phys_addrs_allocator + size) < (1UL << 32));
      |                                                     ^~

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agoanv: fix potential integer overflows
Marcin Ślusarz [Thu, 24 Jun 2021 10:20:33 +0000 (12:20 +0200)]
anv: fix potential integer overflows

In all cases both variables has a type of uint32_t, so multiplying
them will also generate uint32_t. The results of those multiplications
are used as uint64_t's, so Coverity thinks there might be integer
overflows here.
I don't think it's possible to hit them (query BOs should be relatively
small), but let's avoid those overflows.

CID: 1472820
CID: 1472821
CID: 1472822
CID: 1472824
CID: 1475934
CID: 1475927

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agointel/decoder: add assert for register size
Marcin Ślusarz [Thu, 24 Jun 2021 09:30:03 +0000 (11:30 +0200)]
intel/decoder: add assert for register size

Coverity complains about out-of-bounds access in
intel_field_iterator_init, because it doesn't know that the GT_MODE
register has a size of 4 bytes. Add an assertion to verify that.

CID: 1474552

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

3 years agomesa/shaderapi: add an optional shader override mechanism
Pierre-Eric Pelloux-Prayer [Thu, 27 May 2021 14:06:15 +0000 (16:06 +0200)]
mesa/shaderapi: add an optional shader override mechanism

MESA_SHADER_READ_PATH is handy but it's not usable in
all cases.

This commit allows to implement an alternative mechanism
without assuming too much about how it's done, nor where/how
the shaders are stored.

When this is enabled MESA_SHADER_DUMP_PATH,
MESA_SHADER_CAPTURE_PATH and MESA_GLSL env var handling is
disabled.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11621>

3 years agomesa/shaderapi: change construct_name signature
Pierre-Eric Pelloux-Prayer [Thu, 27 May 2021 13:38:04 +0000 (15:38 +0200)]
mesa/shaderapi: change construct_name signature

Pass the sha1 as an argument.
This will be used by the next commit.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11621>

3 years agoUpdate libva requirement
Jeremy Newton [Mon, 21 Jun 2021 20:24:03 +0000 (16:24 -0400)]
Update libva requirement

Bump libva requirement since mesa references API not present prior to
libva API version 1.1.0 (libva 2.1.0 release).

See fbf6511e35, which added VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2
requiring API version 1.1.0 or later.

Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11508>

3 years agomesa: lower GL_CLAMP in texture and sampler functions instead of st/mesa
Marek Olšák [Mon, 7 Jun 2021 11:34:45 +0000 (07:34 -0400)]
mesa: lower GL_CLAMP in texture and sampler functions instead of st/mesa

This moves the GL_CLAMP translation out of st/mesa.
This should be faster assuming constant sampler states.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: add IsBorderColorNonZero to skip border color update for st/mesa faster
Marek Olšák [Sun, 6 Jun 2021 18:23:49 +0000 (14:23 -0400)]
mesa: add IsBorderColorNonZero to skip border color update for st/mesa faster

0.8% less overhead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: add LodBias quantization from st/mesa
Marek Olšák [Sun, 6 Jun 2021 18:08:33 +0000 (14:08 -0400)]
mesa: add LodBias quantization from st/mesa

Apparently the quantization math isn't cheap.

This further reduces overhead by 2% for drawoverhead/8 textures.
The improvement is measured by looking at the sysprof percentage delta and
multiplying by 2 (because we have the frontend and gallium threads with
equal overhead, so the benefit is doubled compared to 1 thread).

Both per-sampler and per-unit lod bias values are quantized.

The difference in behavior is that both values are quantized separately
and then added up, instead of first added up and then quantized.
The worst case error is +- 1/256 in the reduced precision, i.e. off by one
in a fixed-point representation, which should be fine.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: translate into pipe_sampler_state in GL functions
Marek Olšák [Sun, 6 Jun 2021 17:37:38 +0000 (13:37 -0400)]
mesa: translate into pipe_sampler_state in GL functions

- pipe_sampler_state is added into gl_sampler_attrib.
- The border color field is redundant, so the non-gallium field is removed.
- Other GL fields are still tracked because of glGet.
- Some fields are not set by GL functions because they are always derived
  from multiple states.
- The behavior in GL functions is the same as st_convert_sampler.

This reduces overhead by 2% for drawoverhead/8 textures, and more is going
to be done.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: remove mutex locking from a glBindTexture early out path
Marek Olšák [Mon, 7 Jun 2021 15:03:10 +0000 (11:03 -0400)]
mesa: remove mutex locking from a glBindTexture early out path

The locking doesn't seem to be needed. This removes large locking
overhead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: use atomics instead of mutexes for refcounting renderbuffers
Marek Olšák [Mon, 7 Jun 2021 13:26:55 +0000 (09:26 -0400)]
mesa: use atomics instead of mutexes for refcounting renderbuffers

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: use atomics instead of mutexes for refcounting sampler objects
Marek Olšák [Mon, 7 Jun 2021 13:26:55 +0000 (09:26 -0400)]
mesa: use atomics instead of mutexes for refcounting sampler objects

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: use atomics instead of mutexes for refcounting texture objects
Marek Olšák [Mon, 7 Jun 2021 13:26:55 +0000 (09:26 -0400)]
mesa: use atomics instead of mutexes for refcounting texture objects

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agocso: don't look up a sampler CSO if the last one is identical
Marek Olšák [Mon, 7 Jun 2021 13:58:48 +0000 (09:58 -0400)]
cso: don't look up a sampler CSO if the last one is identical

This is benefical when sampler states are identical often, and detrimental
if they are not. The average case seems to be in favor of this.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agocso: update max_sampler_seen only once in cso_set_samplers
Marek Olšák [Mon, 7 Jun 2021 13:58:05 +0000 (09:58 -0400)]
cso: update max_sampler_seen only once in cso_set_samplers

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agocso: disallow NULL sampler state templates in cso_single_sampler
Marek Olšák [Sun, 6 Jun 2021 20:27:36 +0000 (16:27 -0400)]
cso: disallow NULL sampler state templates in cso_single_sampler

No code passes NULL into this except the single place that is updated.
Let's remove the if. The next commit depends on this.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: remove the sampler min_lod/max_lod value swap
Marek Olšák [Mon, 7 Jun 2021 10:55:12 +0000 (06:55 -0400)]
st/mesa: remove the sampler min_lod/max_lod value swap

It might not be needed at all.

v2: fix v3d assertion failure

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: add a mechanism to bypass atomics when binding sampler views
Marek Olšák [Sun, 6 Jun 2021 10:08:07 +0000 (06:08 -0400)]
st/mesa: add a mechanism to bypass atomics when binding sampler views

This is the same mechanism we already use for buffers. The code is mostly
copied from there. See the big comment for explanation.

This will be very effective when take_ownership is added into pipe_context
::set_sampler_views because that and this commit together will eliminate
atomics for sample views almost entirely.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: sink refcounting from st_get_sampler_views into st_sampler_view.c
Marek Olšák [Sun, 6 Jun 2021 09:23:30 +0000 (05:23 -0400)]
st/mesa: sink refcounting from st_get_sampler_views into st_sampler_view.c

Do it deeper in the sampler view return path. It minimizes the deltas
for the next commit.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: remove the const qualifier for a few st_sampler_view instances
Marek Olšák [Sun, 6 Jun 2021 09:35:31 +0000 (05:35 -0400)]
st/mesa: remove the const qualifier for a few st_sampler_view instances

It will be needed by following commits.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: return sview from st_update_single_texture via return value, not param
Marek Olšák [Sun, 6 Jun 2021 08:48:47 +0000 (04:48 -0400)]
st/mesa: return sview from st_update_single_texture via return value, not param

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: read Target only once in st_update_single_texture
Marek Olšák [Sun, 6 Jun 2021 08:42:17 +0000 (04:42 -0400)]
st/mesa: read Target only once in st_update_single_texture

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: sink _mesa_get_samplerobj into st_update_single_texture
Marek Olšák [Sun, 6 Jun 2021 08:42:03 +0000 (04:42 -0400)]
st/mesa: sink _mesa_get_samplerobj into st_update_single_texture

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: don't memset the sampler view array, don't init trailing slots to NULL
Marek Olšák [Sun, 6 Jun 2021 02:35:09 +0000 (22:35 -0400)]
st/mesa: don't memset the sampler view array, don't init trailing slots to NULL

No functional change.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: don't track FS sampler views for bitmap/drawpix in st_context
Marek Olšák [Sun, 6 Jun 2021 02:10:12 +0000 (22:10 -0400)]
st/mesa: don't track FS sampler views for bitmap/drawpix in st_context

Just query the sampler views from the update function. This will help
optimize sampler view updates.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: don't track VS sampler views for st_draw_feedback in st_context
Marek Olšák [Sun, 6 Jun 2021 02:10:12 +0000 (22:10 -0400)]
st/mesa: don't track VS sampler views for st_draw_feedback in st_context

Just query the sampler views from the update function. This will help
optimize sampler view updates.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agoturnip: Add CrOS Gralloc support
Rob Clark [Fri, 25 Jun 2021 19:45:03 +0000 (12:45 -0700)]
turnip: Add CrOS Gralloc support

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11612>

3 years agoturnip: Fix AcquireImageANDROID() handle type
Rob Clark [Fri, 25 Jun 2021 18:24:59 +0000 (11:24 -0700)]
turnip: Fix AcquireImageANDROID() handle type

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11612>

3 years agoturnip: Use drmIoctl()
Rob Clark [Thu, 24 Jun 2021 18:11:08 +0000 (11:11 -0700)]
turnip: Use drmIoctl()

Replace open-coded ioctl with drmIoctl() to get restart on interrupted
system calls.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11612>

3 years agoanv: allocate bigger batches as we grow command buffers
Lionel Landwerlin [Sat, 19 Jun 2021 10:14:16 +0000 (13:14 +0300)]
anv: allocate bigger batches as we grow command buffers

This is the first time we see an application running out of mmap().

We essentially allocate too many batches (+65k) and end up not being
able to mmap them, at which point we can't mmap anything anymore and
things go sideways.

This change allocates bigger batch BOs as we grow an existing command
buffer. This drastically reduces the number of BOs we need to allocate
(the benchmark that reported the issue now reaches a max of ~630 BOs,
instead of reaching 65k and failing previously).

v2: Track the total batch size of command buffers (Jason)
    Just give 0 for batch_len to i915 (Jason)

v3: Fix indentation (Jason)

v4: Drop uncessary reshuffling of error labels (Jason)

v5: Remove empty lines (Marcin)

v6: Limit BO growing to chunks of 16Mb (Jason)

v7: Add assert on initial size (Jason)

v8: Add define for max size (Jason)

v9: Fixup v7 assert for non softpin platforms (Lionel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4956
Cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11482>

3 years agoanv: Advertise VK_KHR_shader_subgroup_uniform_control_flow
Caio Marcelo de Oliveira Filho [Wed, 23 Jun 2021 22:58:40 +0000 (15:58 -0700)]
anv: Advertise VK_KHR_shader_subgroup_uniform_control_flow

This is always valid for Intel, so we don't need to do anything
different if the Execution Mode is being used.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

3 years agospirv: Support SPV_KHR_subgroup_uniform_control_flow
Caio Marcelo de Oliveira Filho [Wed, 23 Jun 2021 22:57:31 +0000 (15:57 -0700)]
spirv: Support SPV_KHR_subgroup_uniform_control_flow

There's no SPIR-V Capability associated, so check in the Execution
Mode.  For now, don't keep track of whether a shader uses uniform
control flow in the shader_info, we can add that when/if a driver
actually need that information.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

3 years agospirv: Update headers and metadata from latest Khronos commit
Caio Marcelo de Oliveira Filho [Wed, 9 Jun 2021 22:13:06 +0000 (15:13 -0700)]
spirv: Update headers and metadata from latest Khronos commit

This corresponds to f95c3b3761ee1b1903f54ae69b526ed6f0edc3b9
("Merge pull request #219 from cmarcelo/SPV_EXT_shader_atomic_float16_add")
in https://github.com/KhronosGroup/SPIRV-Headers.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

3 years agonir: Add test to check edge case in Split ALU optimization
Caio Marcelo de Oliveira Filho [Wed, 23 Jun 2021 22:28:40 +0000 (15:28 -0700)]
nir: Add test to check edge case in Split ALU optimization

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

3 years agonir/opt_if: Don't split ALU for single block infinite loops
Caio Marcelo de Oliveira Filho [Fri, 18 Jun 2021 19:24:11 +0000 (12:24 -0700)]
nir/opt_if: Don't split ALU for single block infinite loops

Some infinite loop cases were already covered by other
restrictions (e.g. if the loop had a body), but the case with a single
block in the loop body wasn't yet.

This prevents an infinite loop when optimizing the shader in
dEQP-VK.reconvergence.subgroup_uniform_control_flow_ballot.compute.nesting2.3.2
and various others reconvergence tests.

Fixes: 0881e90c099 ("nir: Split ALU instructions in loops that read phis")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

3 years agoi965: Prevent invalid framebuffer usage
Miguel Gomez [Thu, 3 Jun 2021 14:44:30 +0000 (16:44 +0200)]
i965: Prevent invalid framebuffer usage

When a surfaceless context is in use, driDrawablePriv might be NULL, so needs to
be checked before calling dri2InvalidateDrawable. Same for read calls.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
See https://gitlab.freedesktop.org/mesa/mesa/-/issues/778

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11459>

3 years agoi915: Prevent invalid framebuffer usage
Philippe Normand [Sun, 11 Apr 2021 12:27:56 +0000 (13:27 +0100)]
i915: Prevent invalid framebuffer usage

When a surfaceless context is in use, driDrawablePriv might be NULL, so needs to
be checked before calling dri2InvalidateDrawable. Same for read calls.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Closes https://gitlab.freedesktop.org/mesa/mesa/-/issues/778

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11459>

3 years agoamd/ci: Use MESA_VK_IGNORE_CONFORMANCE_WARNING to reduce warnings
Matt Turner [Wed, 23 Jun 2021 20:19:14 +0000 (13:19 -0700)]
amd/ci: Use MESA_VK_IGNORE_CONFORMANCE_WARNING to reduce warnings

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11563>

3 years agoci: Unify on MESA_VK_IGNORE_CONFORMANCE_WARNING
Matt Turner [Wed, 23 Jun 2021 20:22:03 +0000 (13:22 -0700)]
ci: Unify on MESA_VK_IGNORE_CONFORMANCE_WARNING

Move and rename warn_non_conformant_implementation() to common location
of src/vulkan/util/vk_util.c as vk_warn_non_conformant_implementation().

In freedreno/ci,  move MESA_VK_IGNORE_CONFORMANCE_WARNING to common
location of .baremetal-deqp-test-freedreno-vk.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11563>

3 years agoanv: VK_EXT_multi_draw implementation
Mike Blumenkrantz [Tue, 22 Jun 2021 16:53:15 +0000 (12:53 -0400)]
anv: VK_EXT_multi_draw implementation

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11531>

3 years agoanv: unify some draw state vertex constant emission
Mike Blumenkrantz [Tue, 22 Jun 2021 18:42:48 +0000 (14:42 -0400)]
anv: unify some draw state vertex constant emission

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11531>

3 years agozink: repack zink_context struct a bit
Mike Blumenkrantz [Fri, 7 May 2021 13:41:45 +0000 (09:41 -0400)]
zink: repack zink_context struct a bit

Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11593>

3 years agofreedreno, tu: Set SP_XS_PVT_MEM_HW_STACK_OFFSET
Connor Abbott [Thu, 24 Jun 2021 16:30:24 +0000 (18:30 +0200)]
freedreno, tu: Set SP_XS_PVT_MEM_HW_STACK_OFFSET

Theoretically this register should only be used when function calls in
the shader are used, which we don't support. But with the default value
of 0 it seems like pvtmem doesn't work on a650. Just set it to the total
per-SP size, effectively leaving no space for the return-address stack,
like the blob does.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4949
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11581>

3 years agofreedreno/a6xx: Make SP_XS_PVT_MEM_HW_STACK_OFFSET non-inline
Connor Abbott [Fri, 25 Jun 2021 13:06:12 +0000 (15:06 +0200)]
freedreno/a6xx: Make SP_XS_PVT_MEM_HW_STACK_OFFSET non-inline

Otherwise we can't use the helper to pack it as it collides with the
function in a6xx-pack.xml.h.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11581>

3 years agoir3: add ldg.a,stg.a which allow complex in-place offset calculation
Danylo Piliaiev [Wed, 16 Jun 2021 11:43:19 +0000 (14:43 +0300)]
ir3: add ldg.a,stg.a which allow complex in-place offset calculation

The full form for ldg.a/stg.a offset is:
 g[reg_address + reg_offset << (imm_shift + 2) + imm_offset << 2]

where imm_shift is in [0, 3] and imm_offset is in [0, 3]

a6xx blob was found to produce a bit simplier offset calculations
for TES/TCS shaders in GTA V:

 [c002000a_03c14215] ldg.a.f32 r2.z, g[r1.y+((r2.z+1)<<2)], 3;
 [c0020004_01c14609] ldg.a.f32 r1.x, g[r1.y+((r1.x+3)<<2)], 1;

Our new syntax:
 stg.a.u32 g[r2.x+(r1.x+1)<<2], r5.x, 1
 stg.a.u32 g[r2.x+r1.x<<4+3<<2], r5.x, 1
 ldg.a.f32 r1.w, g[r1.y+(r1.w+1)<<2], 3
 ldg.a.f32 r1.w, g[r1.y+r1.w<<5+2<<2], 3

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11431>

3 years agofreedreno/isa: add uoffset type to print positive-only offsets
Danylo Piliaiev [Fri, 18 Jun 2021 15:09:01 +0000 (18:09 +0300)]
freedreno/isa: add uoffset type to print positive-only offsets

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11431>

3 years agofreedreno/computerator: pass iova of buffer to const register
Danylo Piliaiev [Wed, 16 Jun 2021 18:31:03 +0000 (21:31 +0300)]
freedreno/computerator: pass iova of buffer to const register

The syntax is:
  @buf 32 (c2.x)
The "(c2.x)" is optional.

This makes possible to test stg, ldg, and global atomics.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11431>

3 years agoanv: do not dereference VkPipelineMultisampleStateCreateInfo always
Samuel Iglesias Gonsálvez [Fri, 25 Jun 2021 08:14:21 +0000 (10:14 +0200)]
anv: do not dereference VkPipelineMultisampleStateCreateInfo always

VkGraphicsPipelineCreateInfo.pMultisampleState is a pointer to a
VkPipelineMultisampleStateCreateInfo structure, and is ignored if the
pipeline has rasterization disabled.

Fixes a crash in one CTS tests that checks this.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11601>

3 years agoturnip: early exit in tu6_draw_common to save cpu cycles
Danylo Piliaiev [Wed, 23 Jun 2021 10:55:06 +0000 (13:55 +0300)]
turnip: early exit in tu6_draw_common to save cpu cycles

Improves Zink + drawoverhead perf up to 4%

Before:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 3981
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 3977

After:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 4136
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 4163

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11556>

3 years agoturnip: do not re-emit same vs params
Danylo Piliaiev [Tue, 22 Jun 2021 14:24:43 +0000 (17:24 +0300)]
turnip: do not re-emit same vs params

Improves drawoverhead perf through Zink up to 260%

Before:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 1518
After:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 3981

This brings it close to Freedreno, which has around 4300.

In vkQuake vs params re-emission now occurs in 0.23% of draw calls.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11556>

3 years agointel/genxml: Remove old scratch fields on GFX version 12.5
Jason Ekstrand [Tue, 20 Oct 2020 21:36:00 +0000 (16:36 -0500)]
intel/genxml: Remove old scratch fields on GFX version 12.5

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agoanv: Add support for scratch on XeHP
Jason Ekstrand [Tue, 20 Oct 2020 21:11:45 +0000 (16:11 -0500)]
anv: Add support for scratch on XeHP

Rework:
 * Jordan: Handle per_thread_scratch==0 in anv_scratch_pool_get_surf
 * Jordan: Update subslices in anv_scratch_pool_alloc
 * Jason: Clean up the patch a bit

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agoiris: Add support for scratch on XeHP
Jason Ekstrand [Tue, 20 Oct 2020 19:27:58 +0000 (14:27 -0500)]
iris: Add support for scratch on XeHP

Rework:
 * Jordan: Handle prog_data->total_scratch==0 in iris_upload_compute_walker
 * Jordan: Resolve iris_get_scratch_space conflict with e2c5ef6cd65
 * Jordan: Rebase on 4256f7ed584. broken
 * Ken: Mostly fixed the rebase
 * Jordan: Fix two small compilation issues
 * Jordan: Rebase on Ken's ("iris: Make a pin_scratch_space() helper")
 * Lionel: Fix a few bugs with scratch handles
 * Jason: Tidy the patch up a bit

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agoiris: Add a MEMZONE_BINDLESS and uploader
Jason Ekstrand [Wed, 21 Oct 2020 02:29:50 +0000 (21:29 -0500)]
iris: Add a MEMZONE_BINDLESS and uploader

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agointel/genxml: Add new ScratchSpaceBuffer fields on GFX version 12.5
Jason Ekstrand [Tue, 20 Oct 2020 21:34:25 +0000 (16:34 -0500)]
intel/genxml: Add new ScratchSpaceBuffer fields on GFX version 12.5

Rework:
 * Jordan: Fix MEMZONE_BINDER_START detection
 * Jordan: Bump the IRIS_BINDLESS_SIZE to 8M

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agointel/fs: Implement load/store_scratch on XeHP
Jason Ekstrand [Tue, 20 Oct 2020 22:47:17 +0000 (17:47 -0500)]
intel/fs: Implement load/store_scratch on XeHP

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agointel/fs: Implement spilling on XeHP
Jason Ekstrand [Tue, 20 Oct 2020 22:42:21 +0000 (17:42 -0500)]
intel/fs: Implement spilling on XeHP

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agointel/isl: Add support for scratch buffers
Jason Ekstrand [Tue, 20 Oct 2020 18:23:31 +0000 (13:23 -0500)]
intel/isl: Add support for scratch buffers

XeHP adds support for a new surface type for scratch.  It's similar to
SURFTYPE_STRBUF in that it's a 2D array-of-struct format but the one
key difference is that the U coordinate is computed automatically based
on the thread ID and only the V coordinate is provided in the dataport
message.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agointel/genxml: Add SURFTYPE_SCRATCH on GFX version 12.5
Jason Ekstrand [Tue, 20 Oct 2020 18:09:23 +0000 (13:09 -0500)]
intel/genxml: Add SURFTYPE_SCRATCH on GFX version 12.5

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11582>

3 years agoRevert "freedreno: Cooperate with tc to stop checking the BC for resource_busy()."
Emma Anholt [Thu, 24 Jun 2021 20:37:52 +0000 (13:37 -0700)]
Revert "freedreno: Cooperate with tc to stop checking the BC for resource_busy()."

This reverts commit 5cb043cf82af4af88dbfe83ce1eff4cc41e2a766.

While the numbers were impressive for drawoverhead, it comes at the cost
of additional flushes, which for gmem access (what we actually care about
most!) would greatly increase the actual cost to render.  Also, gl_driver2
overhead is increased, probably due to spending time in the kernel for the
flushes.

drawoverhead's win came from the increased flushing causing the GPU to
start processing the buffers sooner on everything but test 1, which
already had some incremental flushing happening.  That was certainly not
intended by the change.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11599>

3 years agozink: flush pending clears if a resource is bound as a descriptor
Mike Blumenkrantz [Sat, 24 Apr 2021 17:16:20 +0000 (13:16 -0400)]
zink: flush pending clears if a resource is bound as a descriptor

ensure that resource data is in sync with the expected command stream

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agozink: only queue deferred descriptor layout change on first bind or change
Mike Blumenkrantz [Fri, 16 Apr 2021 14:27:54 +0000 (10:27 -0400)]
zink: only queue deferred descriptor layout change on first bind or change

otherwise, the layout is either already correct or already queued

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agozink: improve automatic layout transitions for sampler+image descriptors
Mike Blumenkrantz [Fri, 16 Apr 2021 14:23:16 +0000 (10:23 -0400)]
zink: improve automatic layout transitions for sampler+image descriptors

binding new images may require auto-transitions for the other pipeline, and
unbinding an image requires that any persistent sampler binds have their layouts
updated

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agozink: use bind counts to more accurately determine image descriptor's exact layout
Mike Blumenkrantz [Fri, 16 Apr 2021 14:21:39 +0000 (10:21 -0400)]
zink: use bind counts to more accurately determine image descriptor's exact layout

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agozink: only do deferred image barriers if layout changes
Mike Blumenkrantz [Fri, 9 Apr 2021 14:30:49 +0000 (10:30 -0400)]
zink: only do deferred image barriers if layout changes

otherwise these should be handled by apps using glMemoryBarrier

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agozink: split deferring of barriers to image and buffer functions
Mike Blumenkrantz [Mon, 10 May 2021 20:51:49 +0000 (16:51 -0400)]
zink: split deferring of barriers to image and buffer functions

make this more explicit

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agozink: break out image descriptor layout into util function
Mike Blumenkrantz [Wed, 7 Apr 2021 14:59:41 +0000 (10:59 -0400)]
zink: break out image descriptor layout into util function

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>

3 years agoci/windows: fix zink msvc build-rules
Erik Faye-Lund [Thu, 24 Jun 2021 20:45:20 +0000 (22:45 +0200)]
ci/windows: fix zink msvc build-rules

When I added the build-rules for zink to the windows build, I
accidentally added it to .windows-test-rules instead of
.windows-build-rules. This seems to trigger a build-error if we trigger
*just* a test due to a zink-change, but not a build.

Hopefully this fixes the problems Mike has had with Zink CI recently.

Fixes: a426d7c2643 ("ci/windows: enable msvc builds of zink")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11597>

3 years agomicrosoft/spirv_to_dxil: Add drive_location assignment
Enrico Galli [Tue, 25 May 2021 21:41:33 +0000 (14:41 -0700)]
microsoft/spirv_to_dxil: Add drive_location assignment

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agomicrosoft/compiler: Switch io sort to use nir_sort_variables_with_modes
Enrico Galli [Tue, 8 Jun 2021 01:07:46 +0000 (18:07 -0700)]
microsoft/compiler: Switch io sort to use nir_sort_variables_with_modes

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agonir: Add modes filter to nir_sort_variables
Enrico Galli [Thu, 10 Jun 2021 20:46:15 +0000 (13:46 -0700)]
nir: Add modes filter to nir_sort_variables

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agonir: Add a function for sorting variables
Jason Ekstrand [Fri, 6 Nov 2020 23:19:53 +0000 (15:19 -0800)]
nir: Add a function for sorting variables

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agoutil: Add qsort_r/s args adapter for MSVC and BSD/macOS
Enrico Galli [Mon, 7 Jun 2021 22:52:29 +0000 (15:52 -0700)]
util: Add qsort_r/s args adapter for MSVC and BSD/macOS

MSVC's qsort_s behaves similarly to sort_r. Unfortunately, qsort_s's
compare function has the "context"/"args" as its first argument. BSD's
qsort_r has a different order than GNU's qsort_r. Finally, C11 added
qsort_s's which look like GNU's gsort_r.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agoutil: Add simple test for util_qsort_r
Enrico Galli [Tue, 15 Jun 2021 04:02:24 +0000 (21:02 -0700)]
util: Add simple test for util_qsort_r

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agoutil: Add an implementation of qsort_r for non-GNU platforms
Jason Ekstrand [Tue, 10 Nov 2020 17:00:54 +0000 (11:00 -0600)]
util: Add an implementation of qsort_r for non-GNU platforms

Android and MSVC don't have qsort_r() so let's provide a util wrapper
that uses the old qsort and thread-local storage.  We use C++ for this
because thread_local is built into C++11 and we can't rely on C11
everywhere.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agod3d12, microsoft/compiler: Moving driver_location allocation to compiler
Enrico Galli [Tue, 25 May 2021 21:40:09 +0000 (14:40 -0700)]
d3d12, microsoft/compiler: Moving driver_location allocation to compiler

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agod3d12, microsoft/compiler: Switching semantic names to TEXCOORD
Enrico Galli [Tue, 11 May 2021 01:00:57 +0000 (18:00 -0700)]
d3d12, microsoft/compiler: Switching semantic names to TEXCOORD

Switching from GENERIC/VARYING to TEXCOORD. This change better aligns
with other dxil generators (SPIRV-Cross, Tint).

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agomicrosoft/compiler: Remove de-duplication of arbitrary semantic names
Enrico Galli [Thu, 24 Jun 2021 02:25:14 +0000 (19:25 -0700)]
microsoft/compiler: Remove de-duplication of arbitrary semantic names

Since DXC doesn't perform de-duplication for arbitrary semantic names,
and the DXIL validator checks against this behavior. We need to remove
the de-duplication.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989>

3 years agovulkan/wsi/wayland: implement the full format table
Niklas Haas [Mon, 26 Apr 2021 11:40:38 +0000 (13:40 +0200)]
vulkan/wsi/wayland: implement the full format table

This code was written but (rightfully) commented out, because it
referenced non-existing vulkan formats.

The correct vulkan analogs come in the form _PACK16 and _PACK32,
respectively, which have their component ordering in high->low bit
order. This is compatible with the DRM format ordering on little endian
systems, so we can just implement them all in the obvious way. On big
endian systems, the _PACKN formats have no analogs, because the
corresponding DRM formats are specified as always being little endian.

I implemented all of the formats I could, while excluding those that
don't map to vulkan at all (e.g. BGRA1010102), and commenting out the
ones that require an extra extension (e.g. ARGB4444) because they
probably need to be checked for extension presence first.

List slightly re-ordered to make it more neatly organized. Tested
working with the 2101010 and 565 variants. Was not able to test the 4444
or 1555 formats, but I verified the channel order was correct so they
should be working in theory.

Signed-off-by: Niklas Haas <git@haasn.xyz>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9737>

3 years agotu/kgsl: Fix file descriptor double close
Alexey Nurmukhametov [Wed, 23 Jun 2021 16:38:06 +0000 (19:38 +0300)]
tu/kgsl: Fix file descriptor double close

tu_kgsl.c: tu_enumerate_devices closed fd previously closed by
tu_physical_device_init function.

Move out the fd closing from tu_physical_device_init function because
they do not belong to it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11561>

3 years agoci/windows: enable msvc builds of zink
Erik Faye-Lund [Wed, 23 Jun 2021 04:40:21 +0000 (06:40 +0200)]
ci/windows: enable msvc builds of zink

This depends on both the Vulkan SDK and the Vulkan Runtime, so let's
install those first.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11424>

3 years agoci/windows: work around meson encoding issues
Erik Faye-Lund [Tue, 22 Jun 2021 10:42:50 +0000 (12:42 +0200)]
ci/windows: work around meson encoding issues

It turns out, some combinations of Meson and MSVC doesn't handle UTF-8
symbols in source-files as gracefully as we'd like. Luckily, there's a
work-around; forcing UTF-8 as the default-encoding.

Please see this Meson ticket for details:
https://github.com/mesonbuild/meson/issues/8263

Cc: mesa-stable
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11424>

3 years agozink: cast pointers to uintptr_t
Erik Faye-Lund [Thu, 24 Jun 2021 11:30:20 +0000 (13:30 +0200)]
zink: cast pointers to uintptr_t

The way p_atomic_cmpxchg is implemented on Windows really wants us to
use integers instead of things like pointers. So let's use uintptr_t
here. It seems cleaner to use that than the value zero for the last
argument, because it shows the intent of the code more clearly.

Fixes: d80d9e1c935 ("zink: queue v3.0")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11424>

3 years agoaux/trace: fix bool argument
Erik Faye-Lund [Tue, 22 Jun 2021 14:01:49 +0000 (16:01 +0200)]
aux/trace: fix bool argument

The second argument to debug_get_bool_option is a boolean, not a
pointer. Passing a NULL-pointer there triggers a warning, which we treat
as an error on MSVC:

---8<---
../src/gallium/auxiliary/driver_trace/tr_screen.c(1071): error C2220:
the following warning is treated as an error
../src/gallium/auxiliary/driver_trace/tr_screen.c(1071): warning C4047:
'function': 'bool' differs in levels of indirection from 'void *'
../src/gallium/auxiliary/driver_trace/tr_screen.c(1071): error C4024:
'debug_get_bool_option': different types for formal and actual parameter 2
---8<---

Fixes: c1270d4845d ("aux/trace: add screen deduplication for zink+lavapipe tracing")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11424>

3 years agoturnip: Disable buffer texturing on 422 formats.
Emma Anholt [Wed, 23 Jun 2021 21:37:55 +0000 (14:37 -0700)]
turnip: Disable buffer texturing on 422 formats.

Fixes:
dEQP-VK.api.info.format_properties.g8b8g8r8_422_unorm
dEQP-VK.api.info.format_properties.b8g8r8g8_422_unorm

and part of:
dEQP-VK.api.info.format_properties.g8_b8_r8_3plane_420_unorm
dEQP-VK.api.info.format_properties.g8_b8r8_2plane_420_unorm

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>

3 years agoci/turnip: Document create_instance_device_intentional_alloc_fail's fail.
Emma Anholt [Wed, 23 Jun 2021 18:06:49 +0000 (11:06 -0700)]
ci/turnip: Document create_instance_device_intentional_alloc_fail's fail.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>

3 years agoturnip: Use vk_startup_errorf() in more startup paths.
Emma Anholt [Mon, 21 Jun 2021 22:37:36 +0000 (15:37 -0700)]
turnip: Use vk_startup_errorf() in more startup paths.

This does the logging for you.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>