platform/upstream/mesa.git
16 months agovulkan/device-select-layer: Include vulkan.h
Faith Ekstrand [Thu, 16 Feb 2023 22:40:23 +0000 (16:40 -0600)]
vulkan/device-select-layer: Include vulkan.h

In the upcoming header update, vk_layer.h starts including vulkan_core.h
instead of vulkan.h.  This will break this layer as it needs a couple of
window-system extension #defines.

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

16 months agovulkan/layers: Use PUBLIC instead of VK_LAYER_EXPORT
Faith Ekstrand [Thu, 16 Feb 2023 18:57:36 +0000 (12:57 -0600)]
vulkan/layers: Use PUBLIC instead of VK_LAYER_EXPORT

VK_LAYER_EXPORT is going away in the next Vulkan header update.  We
already have a PUBLIC macro in util/macros.h which does the same thing.
Unlike VK_LAYER_EXPORT, it should work in Windows too.

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

16 months agovulkan: Properly filter structs in vk_physical_device_features
Faith Ekstrand [Thu, 9 Feb 2023 18:20:29 +0000 (12:20 -0600)]
vulkan: Properly filter structs in vk_physical_device_features

This uses get_all_required to filter structs and also filters struct
members based on API.

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

16 months agovulkan: Move the features generator to vulkan/util
Faith Ekstrand [Thu, 9 Feb 2023 16:52:30 +0000 (10:52 -0600)]
vulkan: Move the features generator to vulkan/util

This makes it easier to start depending on vk_extensions.py

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

16 months agovulkan: Filter out provisional extensions
Faith Ekstrand [Thu, 9 Feb 2023 18:25:40 +0000 (12:25 -0600)]
vulkan: Filter out provisional extensions

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

16 months agoVulkan: Properly filter structs in vk_cmd_queue_gen
Faith Ekstrand [Thu, 9 Feb 2023 01:05:01 +0000 (19:05 -0600)]
Vulkan: Properly filter structs in vk_cmd_queue_gen

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

16 months agovulkan: Properly filter by api in enum_to_str
Faith Ekstrand [Thu, 9 Feb 2023 00:37:04 +0000 (18:37 -0600)]
vulkan: Properly filter by api in enum_to_str

This switches us to using get_all_required() for figuring out which
enum types we care about and then carefully filtering every value as
needed.  We also add a number field to Extension so we keep all the
extension XML parsing in one place.

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

16 months agovulkan: Properly filter entrypoints
Faith Ekstrand [Thu, 9 Feb 2023 18:27:34 +0000 (12:27 -0600)]
vulkan: Properly filter entrypoints

We now use get_all_required() to get all required commands and use that
to filter instead of doing it manually.  Also, we can pull entrypoint
extension etc. information from the requirements struct.  Finally, we
also have to filter the actual commands themselves as well as arguments
per-API because there may be multiple versions or variants depending on
the API being used.

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

16 months agovulkan: Add a get_all_required() helper
Faith Ekstrand [Wed, 8 Feb 2023 22:36:26 +0000 (16:36 -0600)]
vulkan: Add a get_all_required() helper

This searches for the names of everything of a particular type: command,
enum, etc. and returns a Requirements struct with any core version and
extensions that require it.

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

16 months agovulkan: Parse the platform in Extensions.from_xml()
Faith Ekstrand [Wed, 8 Feb 2023 22:17:58 +0000 (16:17 -0600)]
vulkan: Parse the platform in Extensions.from_xml()

This makes handling guards on entrypoints a bit easier.

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

16 months agovulkan: Improve extension parsing
Faith Ekstrand [Wed, 8 Feb 2023 19:47:57 +0000 (13:47 -0600)]
vulkan: Improve extension parsing

This adds an Extension.from_xml() helper for doing the parsing so we can
re-use it in other code.  We also improve filtering of extensions.  The
Vulkan XML schema is changing to make the supported attribute a comma-
separated list.  This is to allow for vulkansc to also exist in the XML
schema.

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

16 months agovulkan: Remove unused fields from Extension and ApiVersion
Faith Ekstrand [Wed, 8 Feb 2023 20:27:04 +0000 (14:27 -0600)]
vulkan: Remove unused fields from Extension and ApiVersion

These are a left-over from when these classes were used by ANV to define
extension enables in python.  They haven't been used since we added
extension table structs and move extension enables to C.

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

16 months agoRevert "vk/util: keep track of extension requirements"
Faith Ekstrand [Thu, 16 Feb 2023 19:44:35 +0000 (13:44 -0600)]
Revert "vk/util: keep track of extension requirements"

This reverts commit ca98e4446b690709ce517b33d17cb3e2af3f5084.  The way
extension requirements are specified is about to change significantly.
Since this is so new, it's easier to just revert for now.

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

16 months agoRevert "vk/runtime: turn vk.xml extension requirements into asserts"
Faith Ekstrand [Thu, 16 Feb 2023 19:45:14 +0000 (13:45 -0600)]
Revert "vk/runtime: turn vk.xml extension requirements into asserts"

This reverts commit 6ac830ccb1a54a821c8d035675425f0d97434faa.

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

16 months agoglsl: copy prop vars before scalarizing alus
Timothy Arceri [Mon, 14 Nov 2022 04:16:48 +0000 (15:16 +1100)]
glsl: copy prop vars before scalarizing alus

This generally gives us better results and doing it here in nir will
also allow us to remove more glsl optimisation calls that do a similiar
thing for us.

(Updated shader-db results by idr.)

Tiger Lake, Ice Lake, and Skylake had similar results. (Ice Lake shown)
total instructions in shared programs: 20246333 -> 20240715 (-0.03%)
instructions in affected programs: 235253 -> 229635 (-2.39%)
helped: 425 / HURT: 114

total cycles in shared programs: 891730115 -> 891631113 (-0.01%)
cycles in affected programs: 37347925 -> 37248923 (-0.27%)
helped: 952 / HURT: 692

total spills in shared programs: 7072 -> 6716 (-5.03%)
spills in affected programs: 505 -> 149 (-70.50%)
helped: 7 / HURT: 0

total fills in shared programs: 9897 -> 8511 (-14.00%)
fills in affected programs: 1674 -> 288 (-82.80%)
helped: 7 / HURT: 0

total sends in shared programs: 1053685 -> 1053411 (-0.03%)
sends in affected programs: 2821 -> 2547 (-9.71%)
helped: 30
HURT: 2

LOST:   13
GAINED: 13

Broadwell and Haswell had similar results. (Broadwell shown)
total instructions in shared programs: 18149157 -> 18147271 (-0.01%)
instructions in affected programs: 204630 -> 202744 (-0.92%)
helped: 294 / HURT: 121

total cycles in shared programs: 939488196 -> 939508444 (<.01%)
cycles in affected programs: 36394777 -> 36415025 (0.06%)
helped: 718 / HURT: 620

total sends in shared programs: 1005426 -> 1005152 (-0.03%)
sends in affected programs: 2821 -> 2547 (-9.71%)
helped: 30 / HURT: 2

LOST:   2
GAINED: 2

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19715>

16 months agopanfrost: fix tiny sample_positions BO memory leak
Italo Nicola [Thu, 16 Feb 2023 22:12:04 +0000 (22:12 +0000)]
panfrost: fix tiny sample_positions BO memory leak

Fixes a 4KB memory leak that happens once per-device creation.

Cc: mesa-stable
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Chris Healy healych@amazon.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21372>

16 months agointel/nir: Use nir_lower_mem_access_bit_sizes()
Faith Ekstrand [Wed, 8 Feb 2023 16:46:07 +0000 (10:46 -0600)]
intel/nir: Use nir_lower_mem_access_bit_sizes()

This drops the Intel-specific pass in favor of the new generic one.

No shader-db changes on Skylake or DG2.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21232>

16 months agonir: Add a load/store bit size lowering pass
Faith Ekstrand [Fri, 10 Feb 2023 00:01:16 +0000 (18:01 -0600)]
nir: Add a load/store bit size lowering pass

This is based on brw_nir_lower_mem_access_bit_sizes() but ended up being
substantially different.  While the core concepts are all the same, the
brw_* version made a lot of Intel-specific assumptions.  The new version
takes a callback which takes a number of bytes of data and an alignment
pair and returns a bit size and number of components to load/store.

Reviewed-by: M Henning <drawoc@darkrefraction.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21232>

16 months agoci: enable dEQP-VK.ubo.random.all_shared_buffer.48
Timothy Arceri [Fri, 13 Jan 2023 01:57:23 +0000 (12:57 +1100)]
ci: enable dEQP-VK.ubo.random.all_shared_buffer.48

The previous commits fix the slow compile time, allowing us to
enable this test.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5152

Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/nir_opt_copy_prop_vars: don't call memset when cloning
Timothy Arceri [Sun, 18 Dec 2022 01:44:16 +0000 (12:44 +1100)]
nir/nir_opt_copy_prop_vars: don't call memset when cloning

This makes the pass significantly faster cutting execution time
by around 30% in the cts test
dEQP-GLES31.functional.ubo.random.all_per_block_buffers.20

This 30% improvement is in addition to all the improvements from
the proceeding patches.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/nir_opt_copy_prop_vars: reorder clone calls
Timothy Arceri [Sun, 18 Dec 2022 01:36:15 +0000 (12:36 +1100)]
nir/nir_opt_copy_prop_vars: reorder clone calls

This helps with the reuse of dynamic arrays.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/nir_opt_copy_prop_vars: reuse dynamic arrays
Timothy Arceri [Fri, 16 Dec 2022 05:29:15 +0000 (16:29 +1100)]
nir/nir_opt_copy_prop_vars: reuse dynamic arrays

As per the previous commit if we don't reuse these dynamic arrays
we end up needlessly thrashing the memory handling functions.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/nir_opt_copy_prop_vars: reuse hash tables
Timothy Arceri [Fri, 16 Dec 2022 03:20:21 +0000 (14:20 +1100)]
nir/nir_opt_copy_prop_vars: reuse hash tables

Due to how this pass works we can end up thrashing memory if we
do not reuse these hash tables rather than reusing them.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/nir_opt_copy_prop_vars: avoid comparison explosion
Timothy Arceri [Thu, 15 Dec 2022 00:48:58 +0000 (11:48 +1100)]
nir/nir_opt_copy_prop_vars: avoid comparison explosion

Previously the pass was comparing every deref to every load/store
causing the pass to slow down more the larger the shader is.

Here we use a hash table so we can simple store everything needed
for comparision of a var separately.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/nir_opt_copy_prop_vars: remove extra loop
Timothy Arceri [Tue, 20 Dec 2022 23:29:45 +0000 (10:29 +1100)]
nir/nir_opt_copy_prop_vars: remove extra loop

The fix in 947f7b452a55 introduced an extra loop over the copies
array to find the correct entry in the case it had been moved.

The problem is these loops can be iterated over millions of times
so lets simply update the entry pointer in the case we change its
location in the array.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>

16 months agonir/from_ssa: Move the loop bounds check in resolve_parallel_copy
Faith Ekstrand [Tue, 14 Feb 2023 16:25:54 +0000 (10:25 -0600)]
nir/from_ssa: Move the loop bounds check in resolve_parallel_copy

We loop, effectively, over two stacks: ready and to_do and finish only
when both are empty.  In the case where ready is empty, we pull one off
of to_do, add a copy to a temporary, and push it onto the ready stack.
Previously, we assumed that we would never get to the temporary copy
case if to_do has exactly one entry because that would imply that there
was only one copy left which means there can't possibly be a cycle to
break.  This was true until c7fc44f9ebbe ("nir/from_ssa: Respect and
populate divergence information") which changed things such that
temporary copies sometimes get added in the case where a convergent
value is copied both to convergent and divergent destinations.

This patch adjusts our loop iteration to always attempt to clear the
ready stack before checking if there's anything left on the to_do stack.
I also added an assert to make the exit condition more clear.

Fixes: c7fc44f9ebbe ("nir/from_ssa: Respect and populate divergence information")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8037
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21315>

16 months agonir/from_ssa: Only re-locate values that are destinations
Faith Ekstrand [Mon, 13 Feb 2023 23:32:35 +0000 (17:32 -0600)]
nir/from_ssa: Only re-locate values that are destinations

There is an optimization in the parallel copy algorithm where, after a
copy has been performed, we can treat the destination as the new source
for future copies of the same source.  In particular, consider the
following parallel copy: A -> B, C -> A, A -> C.  In this case, after we
have done the A -> B copy, we can make note that the value in A is now
in B and emit the sequence: A -> B, C -> A, B -> C.  This allows us to
resolve the swap cycle between A anc C without allocating a temporary
register because we know B is also a copy of A.

When one of the registers involved is convergent and the other is
divergent, this optimization is problematic because, while convergent to
divergent copies are fine, we can't re-use the divergent copy in later
copies if any of those copies are to a convergent variable.  We could,
but it would require a read_first_invocation which would get messy.  In
In c7fc44f9ebbe ("nir/from_ssa: Respect and populate divergence
information"), we attempted to deal with this by limiting the rename
optimization to the case where the divergence matched.

The problem is that we did the re-name part whenever the divergence
matched but only marked it as ready if the thing being copied was a
destination.  (We actually left two instances of loc[a] = b, one which
always happened and one which only happened if we also wanted to flag
the source as being ready to use as a destination.)  While this
technically doesn't cause any problems, it may result in more inter-mov
dependencies which hurts instruction scheduling.  For example, if we had
the parallel copy A -> B, A -> C, A -> D, we now end up emitting the
sequence A -> B, B -> C, C -> D which has many more data hazards between
instructions caused by the constant shuffling.

This commit restores the original logic in which we only perform the
rename optimization if the rename would free up a register we will later
use as a destination.  This isn't entirely optimal as it still doesn't
prove that there is a cycle involved first, but it should lead to a
reduction in unnecessary dependencies.

No shader-db changes on SKL or DG2

Fixes: c7fc44f9ebbe ("nir/from_ssa: Respect and populate divergence information")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21315>

16 months agofreedreno/drm: Optimize stateobj re-emit
Rob Clark [Sat, 11 Feb 2023 17:01:28 +0000 (09:01 -0800)]
freedreno/drm: Optimize stateobj re-emit

For long-lived stateobjs, it is common to re-emit to the same submit
multiple times.  By giving each submit a unique sequence # we can detect
this case and skip the extra append_bo().

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

16 months agofreedreno: Add seqno helper
Rob Clark [Sat, 11 Feb 2023 20:22:31 +0000 (12:22 -0800)]
freedreno: Add seqno helper

It is a pretty common pattern to allocate a non-zero sequence # for
lightweight checking if an object is the same, changed, for use in cache
keys, etc.  (And also pretty common to forget to handle the rollover
zero case.)  Add a helper for this.

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

16 months agofreedreno: Drop batch lock
Rob Clark [Sat, 11 Feb 2023 16:08:56 +0000 (08:08 -0800)]
freedreno: Drop batch lock

Now that we are not tracking cross-context batch dependencies, there is
no scenario where one context could trigger flushing another context's
batch.  So we can drop the batch lock intended to protect against this.

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

16 months agofreedreno/batch: Stop tracking cross-context deps
Rob Clark [Mon, 13 Feb 2023 23:25:28 +0000 (15:25 -0800)]
freedreno/batch: Stop tracking cross-context deps

The app is expected to provide suitable cross-context synchronization
(fences, etc), so don't try to do it's job for them.

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

16 months agofreedreno: Avoid taking screen lock
Rob Clark [Sat, 11 Feb 2023 16:08:24 +0000 (08:08 -0800)]
freedreno: Avoid taking screen lock

Avoid taking screen unlock for batch unref.  Instead just split the
destroy fxn into locked and unlocked variants.  That way we only end
up taking the screen lock on final unref but avoid it in the common
case.

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

16 months agofreedreno/a6xx: Pre-compute PROG related LRZ state
Rob Clark [Sat, 11 Feb 2023 16:06:38 +0000 (08:06 -0800)]
freedreno/a6xx: Pre-compute PROG related LRZ state

PROG state mostly just disables various LRZ related flags, which can
be handled as a simple mask.  The exception is ztest mode, which is
either overriden by PROG state, or we use the all 1's value (which
isn't valid from hw standpoint) to signal that it needs to be computed
at draw time, which fortunately fits in with the bitmask approach.

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

16 months agofreedreno: Move FD_MESA_DEBUG cases out of draw_vbo
Rob Clark [Sat, 11 Feb 2023 16:03:35 +0000 (08:03 -0800)]
freedreno: Move FD_MESA_DEBUG cases out of draw_vbo

If the debug options are enabled, just plug in a debug version of
draw_vbo with the additional checks.

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

16 months agofreedreno: Move blend out of dirty-rsc tracking
Rob Clark [Sat, 11 Feb 2023 16:03:18 +0000 (08:03 -0800)]
freedreno: Move blend out of dirty-rsc tracking

This was not doing any actual resource tracking, just updating
gmem_reason.  And furthermore, a6xx+ doesn't care about the bits
it was setting.  So move this to per-gen backend for the gens that
need it, and avoid setting FD_DIRTY_RESOURCE when FD_DIRTY_BLEND
is set.

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

16 months agofreedreno/a6xx: Remove tex-state refcnting
Rob Clark [Sat, 11 Feb 2023 15:55:24 +0000 (07:55 -0800)]
freedreno/a6xx: Remove tex-state refcnting

Now that we use a flag to trigger the tex state invalidation coming from
other contexts, we can drop the refcnt'ing.

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

16 months agofreedreno/drm: Make rb refcnt non-atomic
Rob Clark [Sat, 11 Feb 2023 15:52:42 +0000 (07:52 -0800)]
freedreno/drm: Make rb refcnt non-atomic

Now that the one special case where multiple threads could race to
ref/unref, we can go back to using non-atomic refcnts.

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

16 months agofreedreno/a6xx: Do tex-state invalidates in same ctx
Rob Clark [Sat, 11 Feb 2023 15:49:07 +0000 (07:49 -0800)]
freedreno/a6xx: Do tex-state invalidates in same ctx

If a resource invalidate is triggered by a different ctx (potentially on
a different thread) simply flag that the tex state needs invalidation,
but defer handling it to the ctx that owns the tex state.

This will let us remove atomic refcnt'ing on the tex state, and more
importantly atomic refcnt'ing on the fd_ringbuffer (as this was the one
special case where rb's could be accessed from multiple threads).

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

16 months agofreedreno/a6xx: Multi-draw support
Rob Clark [Sun, 5 Feb 2023 20:18:28 +0000 (12:18 -0800)]
freedreno/a6xx: Multi-draw support

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

16 months agofreedreno/a6xx: Split out flush_streamout() helper
Rob Clark [Sun, 5 Feb 2023 20:10:10 +0000 (12:10 -0800)]
freedreno/a6xx: Split out flush_streamout() helper

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

16 months agofreedreno/a6xx: Drop unused return
Rob Clark [Sun, 5 Feb 2023 19:48:04 +0000 (11:48 -0800)]
freedreno/a6xx: Drop unused return

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

16 months agofreedreno: Push num_draws down to backend
Rob Clark [Sun, 5 Feb 2023 19:45:35 +0000 (11:45 -0800)]
freedreno: Push num_draws down to backend

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

16 months agofreedreno: Account for multi-draw in num_draws
Rob Clark [Sun, 5 Feb 2023 19:36:54 +0000 (11:36 -0800)]
freedreno: Account for multi-draw in num_draws

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

16 months agoradv/rt: don't hash maxPipelineRayRecursionDepth
Daniel Schürmann [Tue, 14 Feb 2023 13:49:00 +0000 (14:49 +0100)]
radv/rt: don't hash maxPipelineRayRecursionDepth

The stack size has no effect on the generated shader anymore.

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

16 months agoradv/rt: use dynamic_callable_stack_base also for static stack_sizes
Daniel Schürmann [Tue, 14 Feb 2023 13:28:37 +0000 (14:28 +0100)]
radv/rt: use dynamic_callable_stack_base also for static stack_sizes

This patch also removes rt_pipeline->dynamic_stack_size and replaces
it by checking for rt_pipeline->stack_size == -1u.

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

16 months agoradv/rt: introduce and set rt_pipeline->stack_size
Daniel Schürmann [Tue, 14 Feb 2023 13:17:59 +0000 (14:17 +0100)]
radv/rt: introduce and set rt_pipeline->stack_size

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

16 months agoradv: unconditionally enable scratch for RT shaders
Daniel Schürmann [Wed, 8 Feb 2023 09:35:30 +0000 (10:35 +0100)]
radv: unconditionally enable scratch for RT shaders

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

16 months agoradv: rename shader_info->cs.uses_sbt -> shader_info->cs.is_rt_shader
Daniel Schürmann [Wed, 8 Feb 2023 09:28:54 +0000 (10:28 +0100)]
radv: rename shader_info->cs.uses_sbt -> shader_info->cs.is_rt_shader

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

16 months agoradv: Clean up dynamic RT stack allocation
Konstantin Seurer [Tue, 7 Feb 2023 16:39:56 +0000 (17:39 +0100)]
radv: Clean up dynamic RT stack allocation

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

16 months agozink: Add missing features to the profile file
Sidney Just [Wed, 25 Jan 2023 23:53:05 +0000 (15:53 -0800)]
zink: Add missing features to the profile file

Fixes: 2ea481b2f0a ("Zink: add Zink profiles file")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20920>

16 months agozink: add check for samplerMirrorClampToEdge Vulkan 1.2 feature
Sidney Just [Sat, 4 Feb 2023 00:41:29 +0000 (16:41 -0800)]
zink: add check for samplerMirrorClampToEdge Vulkan 1.2 feature

This adds a check to advertise PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE when either the extension is present or the Vulkan 1.2 feature is enabled.

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

16 months agohasvk: Fix SPIR-V warning about TF unsupported on gen7.
Emma Anholt [Thu, 9 Feb 2023 05:32:10 +0000 (21:32 -0800)]
hasvk: Fix SPIR-V warning about TF unsupported on gen7.

It's supported now.

Fixes: d82826ad4446 ("anv: Implement VK_EXT_transform_feedback on Gen7")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21228>

16 months agohasvk: Silence conformance warning in CI.
Emma Anholt [Thu, 9 Feb 2023 05:26:51 +0000 (21:26 -0800)]
hasvk: Silence conformance warning in CI.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21228>

16 months agoci: Add a manual full and 1/10th hasvk CTS runs.
Emma Anholt [Wed, 8 Feb 2023 20:14:55 +0000 (12:14 -0800)]
ci: Add a manual full and 1/10th hasvk CTS runs.

These are manual since they're on a runner in my basement that sometimes
can go down, but it'll be nice to have this for throwing the rare hasvk MR
at.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21228>

16 months agoci/tu: Add 1/200 pass to test for stale reg usage
Danylo Piliaiev [Wed, 15 Feb 2023 15:53:17 +0000 (16:53 +0100)]
ci/tu: Add 1/200 pass to test for stale reg usage

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

16 months agodocs/freedreno: Add info about stale reg stomper dbg option
Danylo Piliaiev [Wed, 15 Feb 2023 13:37:33 +0000 (14:37 +0100)]
docs/freedreno: Add info about stale reg stomper dbg option

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

16 months agoturnip: Add debug option to find usage of stale reg values
Danylo Piliaiev [Mon, 6 Feb 2023 19:50:41 +0000 (20:50 +0100)]
turnip: Add debug option to find usage of stale reg values

MESA_VK_ABORT_ON_DEVICE_LOSS=1 \
TU_DEBUG_STALE_REGS_RANGE=0x00000c00,0x0000be01 \
TU_DEBUG_STALE_REGS_FLAGS=cmdbuf,renderpass \
./app

To pinpoint the reg causing a failure reducing regs range could be
used for bisection. Some failures may be caused by multi-reg combination,
in such case set 'inverse' flag which would change the meaning of reg
range to "do not stomp these regs".

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

16 months agoaco: Remove MTBUF zero operand.
Timur Kristóf [Thu, 2 Feb 2023 23:32:06 +0000 (00:32 +0100)]
aco: Remove MTBUF zero operand.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21363>

16 months agoaco: Don't set scalar offset on buffer load instructions when it's zero.
Timur Kristóf [Fri, 3 Feb 2023 01:03:46 +0000 (02:03 +0100)]
aco: Don't set scalar offset on buffer load instructions when it's zero.

This helps generate slightly more optimal instructions.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21363>

16 months agointel/common: Move i915 files to i915 folder
José Roberto de Souza [Thu, 9 Feb 2023 17:32:37 +0000 (09:32 -0800)]
intel/common: Move i915 files to i915 folder

Following the organization done in intel/dev and intel/vulkan.

Probably due to some rebase issue we had a duplicated copyright header
in intel_gem_i915.h that is being removed in here too.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21256>

16 months agovl/dri3: avoid deadlocking when polling deleted windows for events
Mike Blumenkrantz [Wed, 15 Feb 2023 15:10:26 +0000 (10:10 -0500)]
vl/dri3: avoid deadlocking when polling deleted windows for events

upcoming xserver releases will emit PresentConfigureNotify with this
flag set when a window is destroyed, ensuring drivers
don't poll infinitely and deadlock

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21339>

16 months agovulkan/wsi: avoid deadlocking dri3 when polling deleted windows for events
Mike Blumenkrantz [Wed, 15 Feb 2023 15:10:26 +0000 (10:10 -0500)]
vulkan/wsi: avoid deadlocking dri3 when polling deleted windows for events

upcoming xserver releases will emit PresentConfigureNotify with this
flag set when a window is destroyed, ensuring drivers
don't poll infinitely and deadlock

fixes #6685

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21339>

16 months agodri3: avoid deadlocking when polling deleted windows for events
Mike Blumenkrantz [Wed, 15 Feb 2023 15:10:26 +0000 (10:10 -0500)]
dri3: avoid deadlocking when polling deleted windows for events

upcoming xserver releases will emit PresentConfigureNotify with this
flag set when a window is destroyed, ensuring drivers
don't poll infinitely and deadlock

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21339>

16 months agoaco: Get rid of redundant load_vmem_mubuf function.
Timur Kristóf [Thu, 2 Feb 2023 23:59:05 +0000 (00:59 +0100)]
aco: Get rid of redundant load_vmem_mubuf function.

Call emit_load directly from visit_load_buffer instead.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agoradv: Move VS input lowering to new file: radv_nir_lower_vs_inputs.
Timur Kristóf [Fri, 10 Feb 2023 07:29:53 +0000 (08:29 +0100)]
radv: Move VS input lowering to new file: radv_nir_lower_vs_inputs.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agoac/llvm: Change ac_build_tbuffer_load to take format and channel type.
Timur Kristóf [Mon, 13 Feb 2023 10:31:54 +0000 (11:31 +0100)]
ac/llvm: Change ac_build_tbuffer_load to take format and channel type.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agoac/llvm: Fix ac_build_buffer_load to work with more than 4 channels.
Timur Kristóf [Mon, 13 Feb 2023 11:14:04 +0000 (12:14 +0100)]
ac/llvm: Fix ac_build_buffer_load to work with more than 4 channels.

LLVM is unable to select instructions for num_channels > 4, so we
workaround that by manually splitting larger buffer loads.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agoac/llvm: Fix buffer_load_amd with larger than 32-bit channel sizes.
Timur Kristóf [Mon, 13 Feb 2023 09:56:37 +0000 (10:56 +0100)]
ac/llvm: Fix buffer_load_amd with larger than 32-bit channel sizes.

LLVM is unable to select instructions for larger than 32-bit channel types.
Workaround by using i32 and casting to the correct type later.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agoac/llvm: Remove "structurized" argument and instead check vindex.
Timur Kristóf [Sat, 11 Feb 2023 00:32:50 +0000 (01:32 +0100)]
ac/llvm: Remove "structurized" argument and instead check vindex.

Change ac_build_buffer_load_common and ac_build_tbuffer_load so
the use structurized load when the vindex argument is not NULL.
Adjust callers to match the new behaviour.

This fixes the load_buffer_amd intrinsic with index source.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agoac: Port ACO's get_fetch_format to ac_get_safe_fetch_size.
Timur Kristóf [Thu, 2 Feb 2023 16:10:25 +0000 (17:10 +0100)]
ac: Port ACO's get_fetch_format to ac_get_safe_fetch_size.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agonir: Clarify comment above load_buffer_amd.
Timur Kristóf [Sun, 5 Feb 2023 16:52:23 +0000 (17:52 +0100)]
nir: Clarify comment above load_buffer_amd.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>

16 months agomesa/st: refactor st_destroy_texcompress_compute condition
Tapani Pälli [Tue, 14 Feb 2023 12:22:09 +0000 (14:22 +0200)]
mesa/st: refactor st_destroy_texcompress_compute condition

What happened is that we did not call init but still called dtor, this
makes us do some unnecessary work.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21309>

16 months agov3dv: fix stencil view aspect selection of depth/stencil image
Iago Toral Quiroga [Thu, 16 Feb 2023 08:21:38 +0000 (09:21 +0100)]
v3dv: fix stencil view aspect selection of depth/stencil image

Instead of fixing the swizzle to X001, we should compose this
swizzle with the image view's own swizzle.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21354>

16 months agoci/lava: Fix LAVA logs issues for Collabora jobs
Guilherme Gallo [Wed, 15 Feb 2023 01:42:40 +0000 (22:42 -0300)]
ci/lava: Fix LAVA logs issues for Collabora jobs

Since the Collabora LAVA update related to the downtime from
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21119, the
LAVA logs from Collabora continued to use the hack for older versions
which digested some control characters, such as carriage returns acting
as newlines, which made it necessary to recover from split lines to make
Gitlab sections work in job logs as expected.

Collabora's LAVA instance now gives a more raw log output. It is
necessary to pay attention to newlines at the end of each log message,
which may cause double newlines when printed with Python built-in
`print` function. I decided to remove the repeating `\n` from the
received log messages to make them transparent to LogFollower users.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8242

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21325>

16 months agoci/lava: Add LavaFarm class to find LAVA farm from runner tag
Guilherme Gallo [Wed, 15 Feb 2023 01:36:58 +0000 (22:36 -0300)]
ci/lava: Add LavaFarm class to find LAVA farm from runner tag

LavaFarm is a class created to handle the different types of LAVA farms
and their tags in Mesa CI. Since specific jobs may require different
types of LAVA farms to run on, it is essential to determine which farm
the runner is running on to configure the job correctly.

LavaFarm provides an easy-to-use interface for checking the runner tag
and returning the corresponding LAVA farm, making it simple for Mesa CI
to configure jobs appropriately. By adding tests for LavaFarm, the team
can ensure that this class is functioning as expected, allowing for the
smooth execution of Mesa CI jobs on the correct LAVA farm.

The tests ensure that get_lava_farm returns the correct LavaFarm value
when given invalid or valid tags and that it returns LavaFarm.UNKNOWN
when no tag is provided. The tests use Hypothesis strategies to generate
various labels and farms for testing.

Example of use:
```
from lava.utils.lava_farm import LavaFarm, get_lava_farm

lava_farm = get_lava_farm()
if lava_farm == LavaFarm.DUMMY:
    # Configure the job for the DUMMY farm
    ...
elif lava_farm == LavaFarm.COLLABORA:
    # Configure the job for the COLLABORA farm
    ...
elif lava_farm == LavaFarm.KERNELCI:
    # Configure the job for the KERNELCI farm
    ...
else:
    # Handle the case where the LAVA farm is unknown
    ...
```

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21325>

16 months agoci/lava: Move LAVA dependencies to pip
Guilherme Gallo [Wed, 15 Feb 2023 03:13:16 +0000 (00:13 -0300)]
ci/lava: Move LAVA dependencies to pip

Use requirements.txt and requirements-test.txt to organize better Python
dependencies related to LAVA.

Now LAVA tooling can use recent and fixed library versions.
And test-related libs will not trigger container rebuilding anymore.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21325>

16 months agoradv: Hash VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_* flags
Konstantin Seurer [Tue, 14 Feb 2023 19:43:46 +0000 (20:43 +0100)]
radv: Hash VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_* flags

Found by inspection.

Fixes: 687a82d ("radv/rt: Handle no-null shader flags")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21320>

16 months agofrontend/dri: Initialize callbacks in dri_swrast_kms_init_screen
Michel Dänzer [Wed, 15 Feb 2023 11:40:39 +0000 (12:40 +0100)]
frontend/dri: Initialize callbacks in dri_swrast_kms_init_screen

This was missed in the commit below.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8232
Fixes: 7d5b1cd02c4d ("frontend/dri: move callbacks from the VTable into dri_screen, dri_drawable")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21333>

16 months agogallium: Add MCJIT target triplet for Windows ARM64
GH Cao [Thu, 12 Jan 2023 17:04:42 +0000 (01:04 +0800)]
gallium: Add MCJIT target triplet for Windows ARM64

MCJIT on Windows requires a special LLVM target triplet with ELF object
format, add one for Windows ARM64.

Tested locally on real hardware.

Signed-off-by: GH Cao <driver1998.ms@outlook.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20675>

16 months agogallium: Use DETECT_OS_WINDOWS instead of 'WIN32'
driver1998 [Thu, 2 Feb 2023 04:45:19 +0000 (12:45 +0800)]
gallium: Use DETECT_OS_WINDOWS instead of 'WIN32'

Signed-off-by: GH Cao <driver1998.ms@outlook.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20675>

16 months agoradv: revert Metro Exodus workaround which was moved to common code
Tapani Pälli [Wed, 15 Feb 2023 09:53:01 +0000 (11:53 +0200)]
radv: revert Metro Exodus workaround which was moved to common code

This reverts commit 4397c166c01b641c57348d9e0d881a4a1f351455.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21281>

16 months agospirv: add workaround for Metro Exodus in spirv_to_nir
Tapani Pälli [Mon, 13 Feb 2023 08:23:37 +0000 (10:23 +0200)]
spirv: add workaround for Metro Exodus in spirv_to_nir

This is commit 4397c166c01 for spirv_to_nir, otherwise we hit
the same assert with anv driver.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21281>

16 months agoasahi: Vectorize background colour load
Alyssa Rosenzweig [Wed, 15 Feb 2023 03:36:44 +0000 (22:36 -0500)]
asahi: Vectorize background colour load

No point to scalarizing this, the background can handle the vector load fine
since bfa7ec0aa0f ("agx: Don't scalarize preambles in NIR").

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21327>

16 months agoamd/surface: fix base_mip_width of subsampled formats
Pierre-Eric Pelloux-Prayer [Sat, 11 Feb 2023 00:38:33 +0000 (19:38 -0500)]
amd/surface: fix base_mip_width of subsampled formats

base_mip_width is used in si_compute_copy_image when the
SI_IMAGE_ACCESS_BLOCK_FORMAT_AS_UINT flag is used.

   width = tex->surface.u.gfx9.base_mip_width;

This will be incorrect if we don't adjust it. For instance,
with a 260x256 image, surf_pitch and base_mip_width are
320 before surf_pitch is updated to be 192.

Both need to match, or computing the width from base_mip_width
leads to incorrect result.

Cc: mesa-stable
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21253>

17 months agoturnip: avoid FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 for event blits
Chia-I Wu [Wed, 1 Feb 2023 18:38:01 +0000 (10:38 -0800)]
turnip: avoid FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 for event blits

We don't need it for event blits.  It also does not support fast clears
which makes it slower.

For event blits, blob has

  VK_FORMAT_D16_UNORM           -> FMT6_16_UNORM
  VK_FORMAT_X8_D24_UNORM_PACK32 -> FMT6_Z24_UNORM_S8_UINT
  VK_FORMAT_D32_SFLOAT          -> FMT6_32_FLOAT
  VK_FORMAT_S8_UINT             -> FMT6_8_UINT
  VK_FORMAT_D24_UNORM_S8_UINT   -> FMT6_Z24_UNORM_S8_UINT
  VK_FORMAT_D32_SFLOAT_S8_UINT  -> FMT6_32_FLOAT + FMT6_8_UINT

and always sets RB_BLIT_INFO:DEPTH.  It is unclear what
RB_BLIT_INFO:DEPTH is for but we set it anyway.

Improves "glmark2 -b refract" on angle by 15-20% on a618/a635.

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

17 months agovenus: update venus-protocol headers to partially fix WA1
Ryan Neph [Sat, 11 Feb 2023 00:45:21 +0000 (16:45 -0800)]
venus: update venus-protocol headers to partially fix WA1

Begin encoding/decoding
VkDrmFormatModifierPropertiesList2EXT::drmFormatModifierCount to fix a
workaround (WA1) in the venus-protocol.

Signed-off-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21323>

17 months agohasvk: fix KHR_shader_float_controls reporting
Lionel Landwerlin [Wed, 15 Feb 2023 20:05:08 +0000 (22:05 +0200)]
hasvk: fix KHR_shader_float_controls reporting

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 13f68bcce1 ("hasvk: Tell spirv_to_nir float controls are always supported")
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21349>

17 months agoanv: Move execute_simple_batch() and queue_exec_locked() to kmd backend
José Roberto de Souza [Thu, 9 Feb 2023 21:00:46 +0000 (13:00 -0800)]
anv: Move execute_simple_batch() and queue_exec_locked() to kmd backend

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21255>

17 months agoanv: Add gem_mmap to kmd backend
José Roberto de Souza [Thu, 9 Feb 2023 14:29:28 +0000 (06:29 -0800)]
anv: Add gem_mmap to kmd backend

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21255>

17 months agoanv: Add gem_close to kmd backend
José Roberto de Souza [Thu, 9 Feb 2023 14:05:54 +0000 (06:05 -0800)]
anv: Add gem_close to kmd backend

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21255>

17 months agoasahi: Drop agx_device.memctx
Asahi Lina [Wed, 15 Feb 2023 13:12:31 +0000 (22:12 +0900)]
asahi: Drop agx_device.memctx

No longer used.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21348>

17 months agoasahi: Do not use memctx for pools / meta cache
Asahi Lina [Wed, 15 Feb 2023 10:46:37 +0000 (19:46 +0900)]
asahi: Do not use memctx for pools / meta cache

ralloc is not thread-safe, so we can't use dev->memctx for allocating
context-specific things without locking. On top of that, we always
need to explicitly clean up pools anyway since we need to unref the BOs,
so there is no point to using a memctx.

And since pools need to be explicitly cleaned up, the meta cache code
needs explicit cleanup, so add that and drop memctx from there too.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21348>

17 months agoasahi: Fix shader key cloning overreads
Asahi Lina [Wed, 15 Feb 2023 08:58:18 +0000 (17:58 +0900)]
asahi: Fix shader key cloning overreads

We call agx_get_shader_variant through with casted inner shader key
types, so it has to make sure to only copy as much of the union as is
actually valid.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21348>

17 months agoturnip: fix a null descriptor set dereference
Chia-I Wu [Wed, 15 Feb 2023 05:51:55 +0000 (21:51 -0800)]
turnip: fix a null descriptor set dereference

Fixed
dEQP-VK.pipeline.pipeline_library.graphics_library.misc.other.null_descriptor_set_in_monolithic_pipeline.

Fixes: cb3872f2cdc ("tu: Implement VK_EXT_descriptor_buffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21328>

17 months agoturnip: fix a major leak with GPL LTO
Chia-I Wu [Wed, 15 Feb 2023 05:22:48 +0000 (21:22 -0800)]
turnip: fix a major leak with GPL LTO

This allows dEQP-VK.pipeline.pipeline_library.* to run to finish.

Fixes: e9f5de11d40 ("tu: Initial implementation of VK_EXT_graphics_pipeline_library")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21328>

17 months agotu: Don't expose KHR_present_id,KHR_present_wait without KHR_swapchain
Danylo Piliaiev [Wed, 15 Feb 2023 18:09:29 +0000 (19:09 +0100)]
tu: Don't expose KHR_present_id,KHR_present_wait without KHR_swapchain

VK_KHR_present_id and VK_KHR_present_wait depend on VK_KHR_swapchain
being present, which is not present at least on Android/KGSL.

Fixes:
src/vulkan/util/vk_extensions.h:450: void assert_device_extensions_requirements(
 const struct vk_device_extension_table *, const struct vk_instance_extension_table *):
 assertion "!device_ext->KHR_present_id || device_ext->KHR_swapchain" failed

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

17 months agoanv,hasvk: flush what UNIFORM_READ flushes on SHADER_READ
Constantine Shablya [Tue, 14 Feb 2023 13:03:51 +0000 (15:03 +0200)]
anv,hasvk: flush what UNIFORM_READ flushes on SHADER_READ

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8287
Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21310>

17 months agoegl/kopper: Pass ancillary invalidate flush flags down to gallium.
Emma Anholt [Tue, 14 Feb 2023 18:32:57 +0000 (10:32 -0800)]
egl/kopper: Pass ancillary invalidate flush flags down to gallium.

We can just add the flags to the kopper interface, since it's private to
Mesa.  This gets us depth/stencil invalidation on swapbuffers, which is
critical for tiler performance.

glmark2-es2 -b texture (windowed) goes from 1650 to 1930 fps on
zink+turnip with ZINK_DEBUG=rp.

Part of #7321 (we're still a little behind freedreno's 2180 fps)

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21317>

17 months agoegl/kopper: Use the kopper private interface for swapBuffers.
Emma Anholt [Tue, 14 Feb 2023 18:27:31 +0000 (10:27 -0800)]
egl/kopper: Use the kopper private interface for swapBuffers.

I'm going to be introducing an extra flag to indicate EGL vs GLX behavior
in the private interface.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21317>

17 months agoegl: Add a note explaining the swapBuffers badness in dri2_x11_copy_buffers().
Emma Anholt [Tue, 14 Feb 2023 22:48:32 +0000 (14:48 -0800)]
egl: Add a note explaining the swapBuffers badness in dri2_x11_copy_buffers().

I tried to drop the swapBuffers path, but it turns out it's being taken by
softpipe/llvmpipe, and the tests are passing.  The piglit egl-copy-buffers
test even passes on zink, but you end up with a bad display because of an
un-preserved back buffer.

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