Commit graph

10290 commits

Author SHA1 Message Date
Samuel Pitoiset
30ccd97cd2 radv: gather nir shader info at the end of radv_optimize_nir()
Otherwise, outputs_read/outputs_written might not be up-to-date
(mostly after nir_remove_dead_variables) and remove_point_size() might
reach an assertion later because the output variable isn't found.

It seems better to run nir_shader_gather_info() at the very end of
radv_optimize_nir() which can change a lot of things anyways.

No fossils-db changes.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35707>
2025-06-26 06:11:54 +00:00
David Rosca
189bf9fe9a radv/video: Prefer visible VRAM for host visible context buffers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
In most cases this has little to no effect, but AV1 decode on VCN5
is up to 40% slower when the context buffer is in GTT.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35684>
2025-06-25 09:39:11 +00:00
Samuel Pitoiset
2d4b4a296e radv: move pipeline layout implementation to radv_pipeline_layout.c/h
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Samuel Pitoiset
46f78b40f0 radv: simplify add_descriptor_set()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Samuel Pitoiset
f5a71a1262 radv: rename border_color_slot to border_color_index
To match future work.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Samuel Pitoiset
c08a97633c radv: remove an useless check about custom border color
The Vulkan spec is pretty clear and says:
 "VUID-VkSamplerCreateInfo-None-04012
  The maximum number of samplers with custom border colors which can be
  simultaneously created on a device is implementation-dependent and
  specified by the maxCustomBorderColorSamplers member of the
  VkPhysicalDeviceCustomBorderColorPropertiesEXT structure"

So this check can be removed because it would be an application bug
otherwise.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Georg Lehmann
1819e1caef radv: keep fp8 conversions vectorized
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Totals from 11 (0.01% of 80265) affected shaders:
MaxWaves: 102 -> 104 (+1.96%)
Instrs: 24105 -> 21027 (-12.77%)
CodeSize: 190744 -> 167480 (-12.20%)
VGPRs: 1968 -> 1920 (-2.44%)
Latency: 91890 -> 90302 (-1.73%); split: -2.86%, +1.13%
InvThroughput: 100616 -> 98496 (-2.11%); split: -2.24%, +0.13%
VClause: 802 -> 759 (-5.36%); split: -6.48%, +1.12%
Copies: 3131 -> 3329 (+6.32%); split: -0.48%, +6.80%
PreVGPRs: 1816 -> 1802 (-0.77%)
VALU: 12543 -> 11399 (-9.12%)
SALU: 4635 -> 2859 (-38.32%)
VOPD: 1133 -> 1195 (+5.47%); split: +7.33%, -1.85%

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35676>
2025-06-25 05:34:48 +00:00
Georg Lehmann
21523dad96 radv/nir/lower_cmat: use nir_src_as_deref
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35633>
2025-06-24 17:12:34 +00:00
Georg Lehmann
48fc8c8d1c radv/nir/lower_cmat: set optimal load/store alignment
Allows vectorizing load/stores with sub dword types or with robustness.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35633>
2025-06-24 17:12:33 +00:00
Georg Lehmann
ed2ecf9ef8 radv/nir/lower_cmat: share cmat_load/cmat_store code
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35633>
2025-06-24 17:12:33 +00:00
Georg Lehmann
4ac6aae3a4 radv/nir/lower_cmat: fix gfx11 B->ACC conversion
Of course I messed up the one path that's not tested by CTS.

Fixes: 249ccc6b4c ("radv/nir/lower_cmat: implement use conversions/transpose")
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35713>
2025-06-24 15:53:52 +00:00
Georg Lehmann
8256097c0c radv: advertise VK_NV_cooperative_matrix2/cooperativeMatrixConversions behind an env var
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34793>
2025-06-24 07:14:35 +00:00
Georg Lehmann
249ccc6b4c radv/nir/lower_cmat: implement use conversions/transpose
This could potentially be improved using packed 32bit subgroup ops,
but what we actually care about (gfx12 ACC -> B) is free.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34793>
2025-06-24 07:14:34 +00:00
Konstantin Seurer
4cbbdc0a50 vulkan: Pass a structure to most BVH build callbacks
It is annoying to change all function signatures when a driver needs
more information. There are also some callbacks that have a lot of
parameters and there have already been bugs related to that.

This patch tries to clean the interface by adding a struct that contains
all information that might be relevant for the driver and passing that
to most callbacks.

radv changes are:
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>

anv changes are:
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

turnip changes are:
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>

vulkan runtime changes are:

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35385>
2025-06-23 20:43:43 +00:00
Konstantin Seurer
28713789ad vulkan: Replace get_*_key with get_build_config
It is a cleaner API and gives more control about the build to the
driver.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35385>
2025-06-23 20:43:43 +00:00
Bas Nieuwenhuizen
b53602ce71 radv: Use packed invocation ids for newer CDNA.
From inspection.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33963>
2025-06-23 11:23:40 +00:00
Bas Nieuwenhuizen
9574089ea2 radv: Add CDNA register settings.
From inspection.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33963>
2025-06-23 11:23:40 +00:00
Bas Nieuwenhuizen
098770ec51 radv: Don't init gfx preamble without gfx support.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33963>
2025-06-23 11:23:40 +00:00
Bas Nieuwenhuizen
d2e69dc734 radv: Add support for not having gfx queues.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33963>
2025-06-23 11:23:40 +00:00
Georg Lehmann
60796c85d1 radv: expose VK_EXT_shader_float8
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35434>
2025-06-23 07:59:27 +00:00
Georg Lehmann
cbd17cb4d6 radv/nir/lower_cmat: handle float8 conversions
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35434>
2025-06-23 07:59:27 +00:00
Georg Lehmann
c7a6b3318e radv: vectorize float8 conversions
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35434>
2025-06-23 07:59:27 +00:00
Mauro Rossi
28f7bb2418 radv: Fix gnu-empty-initializer error
Fixes the following builing error happening with clang:

../src/amd/vulkan/radv_pipeline.c:817:29: error: use of GNU empty initializer extension [-Werror,-Wgnu-empty-initializer]
   struct amd_stats stats = {};
                            ^
1 error generated.

Fixes: 325dfd80 ("radv,aco: switch to shader statistics framework")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35677>
2025-06-23 07:09:09 +00:00
Yiwei Zhang
41d241bf6e radv: relax the native_handle_t::numFds requirement
For modern gralloc impl, usually there's other fds appended in the
native_handle_t for gralloc buffer metadata sharing. So numFds can be
greater than 1, while the common agreement is still that the format
plane handles being placed at the beginning in the lack of a standard
format plane fd metadata query mapper api.

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

Cc: mesa-stable
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35038>
2025-06-20 16:51:18 +00:00
Rhys Perry
325dfd809a radv,aco: switch to shader statistics framework
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12756
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35583>
2025-06-20 09:26:58 +00:00
Rhys Perry
2382d657ec radv: use vk_outarray for pipeline statistics/executables
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35583>
2025-06-20 09:26:58 +00:00
Dave Airlie
d68a1fc0d4 radv/video: port hevc slice header encoding from radeonsi
The radeonsi code has been improved to handle reference lists
better, port the code to radv and vulkan API.

This has been updated to for Vulkan

Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35628>
2025-06-20 07:31:04 +00:00
Dave Airlie
f7d2939457 radv/video: add some missing hevc header bits
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35628>
2025-06-20 07:31:04 +00:00
Samuel Pitoiset
5e2fcdfea2 radv/meta: add a helper to determine if clearing is a full rect
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35603>
2025-06-20 06:36:19 +00:00
Samuel Pitoiset
59dfa8c2f5 radv: switch to nir_intrinsic_load_input_attachment_coord
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35556>
2025-06-20 06:12:24 +00:00
Mel Henning
f7aa6ba906 vulkan: Specify library_arch in ICD files
This should help vk-icd-loader skip libraries of the wrong bit width.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35567>
2025-06-19 17:30:24 +00:00
Samuel Pitoiset
50c4d5cccd radv: use one descriptor per plane for combined image+sampler with ycbcr
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This removes a very old hack which will also allow us to enable DCC
for multiplanar formats eventually and to reduce the combined
image+sampler descriptor size from 96 to 48 on RDNA3+.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35457>
2025-06-19 12:58:32 +00:00
Samuel Pitoiset
f46126284f radv: reduce the number of bytes written for combined image+sampler desc
Only for non multiplanar formats.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35457>
2025-06-19 12:58:32 +00:00
Samuel Pitoiset
22402dadd3 radv: add a separate path for writing ycbcr combined image+sampler desc
This will allow us to remove the ycbcr hack and to reduce the number
of bytes written for combined image+sampler from 80 to 64.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35457>
2025-06-19 12:58:31 +00:00
Samuel Pitoiset
4f37876c7b radv: replace radv_combined_image_descriptor_sampler_offset() by a constant
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35457>
2025-06-19 12:58:31 +00:00
Georg Lehmann
4a2884237a radv: dump NIR for executable info after nir_to_asm
ACO modifies the NIR, most importantly it updates divergence analysis.

Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32990>
2025-06-19 07:02:20 +00:00
Yiwei Zhang
4efaa64159 vulkan/treewide: add and use common Android HMI hal implementation
There's no need for a per driver HMI implementation since the
vk_icdGetInstanceProcAddr implementation can well populate the required
entrypoints for Android icd.

Changes have to be done in this single commit for simplicity. Otherwise,
I would have to create a separate android shared library in the runtime
like how vk_instance is handled today, so that the target is able to
check per driver enablement def. However, after all drivers have
migrated over within this MR, we still have to clean those up. So I
decided to just do those in a single commit instead.

v2: avoid preloading u_gralloc in vulkan hal open

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v1)
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35561>
2025-06-18 22:23:53 +00:00
Yiwei Zhang
ba48380260 radv: free up hwvulkan_device_t upon driver unloading
Per <hardware/hwvulkan.h>, the hw_device_t::close() function is called
upon driver unloading. The behavior has been like this since Android 10.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35561>
2025-06-18 22:23:51 +00:00
Georg Lehmann
e0cdf4dfdd radv/nir/lower_cmat: use common matrix layout on gfx12
The GFX12 ISA doc describes other layouts for A/B, but they are identical
to the C layout with the exception of the order of the rows (columns for A).
And as long as these are swapped in the same way for both A and B, the muladd
result will be the same. So we use the C layout for all uses.

This will simplify conversions between uses, and allows A/B to use a single
memory access for load/store in wave32.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35570>
2025-06-18 06:33:06 +00:00
David Rosca
31967efd2c radv/video: Fix indentation
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35543>
2025-06-17 16:28:59 +00:00
David Rosca
58085da743 radv/video: Only enable VP9 decode with supported firmware
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35543>
2025-06-17 16:28:59 +00:00
Eve
f4ad6e6d4a radv: add RADV_PERFTEST option to turn off gtt spilling
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8107
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35355>
2025-06-17 06:46:27 +00:00
Samuel Pitoiset
203aacf064 radv/meta: use radv_get_copy_flags_from_bo() more
Cleanups.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35550>
2025-06-17 06:16:07 +00:00
Samuel Pitoiset
061bc6151a radv: fix 1x user sample locations on GFX10+
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Only GFX10+ can support 1x user sample locations, but MSAA_ENABLE
needs to be enabled.

Fixes new VKCTS coverage dEQP-VK.pipeline.*samples_1*.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35492>
2025-06-16 06:18:07 +00:00
Samuel Pitoiset
251b23f6c2 ac/surface: fix aliasing DCC tilings with HiZ info on GFX12
DCC tilings info needs to be set for all surfaces, including
depth/stencil. But because this is a C union, settings those fields
for depth/stencil surfaces might accidentally overwrite HiZ info.

This fixes rendering issues with RADV_DEBUG=nohiz.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35515>
2025-06-16 05:56:45 +00:00
Derek Foreman
07881b085e vulkan: Enable PresentWait2 on many physical devices
PresentWait2 should be possible on any physical device, as it adds a
surface capability query that depends on common wsi code.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35414>
2025-06-13 15:52:02 +00:00
Samuel Pitoiset
3c3684f4d4 radv: fix a compilation warning with Clang in radv_get_depth_clamp_mode()
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35508>
2025-06-13 14:31:22 +00:00
Rhys Perry
a905ff3d54 meson: add dep_llvm to radv_tests
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
It seems this will try to link to LLVM because libvulkan_radeon links to
LLVM. Without the dep_llvm and with the GCC linker (instead of mold), this
will fail if you use a custom built LLVM and it can't find the shared object.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35495>
2025-06-13 11:29:31 +00:00
Samuel Pitoiset
161f27e206 radv: enable shaderImageFloat32AtomicAdd on GFX12 with ACO
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35493>
2025-06-13 08:47:59 +00:00
Samuel Pitoiset
c5bf1caf17 radv: enable shaderBufferFloat32AtomicMinMax on GFX12
This is supported.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35493>
2025-06-13 08:47:59 +00:00