Commit graph

11510 commits

Author SHA1 Message Date
Samuel Pitoiset
255439fd9c radv/meta: fix the shader stage for push constants in the fragment resolve path
RADV doesn't use it but better to set it correctly.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:37 +00:00
Samuel Pitoiset
ed546ce809 radv/meta: add a single function for color/depth&stencil compute resolves
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:36 +00:00
Samuel Pitoiset
94234f35fd radv/meta: simplify creating pipelines for color/depth&stencil compute resolves
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:36 +00:00
Samuel Pitoiset
1c7b416daa radv/meta: pass a resolve mode for compute color resolves
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:36 +00:00
Samuel Pitoiset
2ae32d709c radv/meta: inline one function in the compute resolve path
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:35 +00:00
Samuel Pitoiset
e3e52c348c radv/meta: use the same shader for color/depth&stencil compute resolves
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:35 +00:00
Samuel Pitoiset
08f147d92c radv/meta: add depth/stencil support to the core resolve shader
This removes lot of duplicated code.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:34 +00:00
Samuel Pitoiset
1e561eb1d7 radv/meta: replace radv_meta_resolve_type by VkImageAspectFlags
It's either depth or stencil.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40064>
2026-02-27 08:21:34 +00:00
Rhys Perry
070a741855 radv: don't cache esgs_ring_size/gsvs_ring_size
These are calculated using ac_gpu_info::max_se.

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/39992>
2026-02-26 15:49:15 +00:00
Rhys Perry
7c66adf97e ac/llvm: pass ac_cu_info to ac_llvm_context_init
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/39992>
2026-02-26 15:49:15 +00:00
Rhys Perry
43603f9b1d amd: add ac_cu_info::local_invocation_ids_packed
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/39992>
2026-02-26 15:49:15 +00:00
Rhys Perry
5963eff1a2 amd: add ac_cu_info::has_vrs_frag_pos_z_bug
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/39992>
2026-02-26 15:49:14 +00:00
Rhys Perry
29f8237d30 amd: move various flags to ac_cu_info
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/39992>
2026-02-26 15:49:14 +00:00
Rhys Perry
78b3e07bed ac/nir: remove ac_nir_lower_ps_late_options::family
This is unused.

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/39992>
2026-02-26 15:49:12 +00:00
Rhys Perry
6d31054d86 ac/nir: remove gfx_level parameter from ac_nir_lower_indirect_derefs
This was unused.

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/39992>
2026-02-26 15:49:12 +00:00
Rhys Perry
724f65f96c radv: remove radv_physical_device::max_shared_size
lds_size_per_workgroup is the same thing.

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/39992>
2026-02-26 15:49:11 +00:00
Rhys Perry
8017478074 radv: fix size of reserved in radv_physical_device_cache_key
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/39992>
2026-02-26 15:49:11 +00:00
Benjamin Cheng
39839af4e1 radv/video: Disable qp map for h265 on vcn1
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Quantization maps cannot work with cu_qp_delta_enabled = 1, and VCN1 is
unlikely to ever support it.

See 1dda9d56cb ("radv/video: Disable rate control modes for H265 encode on VCN1")
for additional details.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40052>
2026-02-26 11:54:13 +00:00
Samuel Pitoiset
4b52a537a5 radv: remove an useless check for VK_IMAGE_LAYOUT_PREINITIALIZED
VK_IMAGE_LAYOUT_PREINITIALIZED is only well defined for linear images
in Vulkan, and linear images can't have DCC. So, this was dead code.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40070>
2026-02-26 07:44:39 +00:00
Samuel Pitoiset
5c371010c1 radv/meta: stop using pdev for some query resolve shaders
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/40041>
2026-02-26 07:21:06 +00:00
Samuel Pitoiset
122958344a radv/meta: stop using pdev for building the resolve meta shaders
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40041>
2026-02-26 07:21:06 +00:00
Samuel Pitoiset
81932d6731 radv/meta: stop using pdev for shaders that use addr<->coord helpers
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40041>
2026-02-26 07:21:06 +00:00
Samuel Pitoiset
e8710152fb ac/nir: stop passing radeon_info for addr->coord helpers
Only for gb_addr_config.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40041>
2026-02-26 07:21:06 +00:00
Samuel Pitoiset
52aaf307df radv: use radv_physical_cache_key::clear_lds more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:44 +00:00
Samuel Pitoiset
229e892e42 radv: use radv_physical_cache_key::disable_shrink_image_store more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:44 +00:00
Samuel Pitoiset
55691035e8 radv: use radv_physical_cache_key::disable_aniso_single_level more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:43 +00:00
Samuel Pitoiset
f045c04b50 radv: use radv_physical_cache_key::disable_trunc_coord more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:43 +00:00
Samuel Pitoiset
d7447012ef radv/nir: use radv_physical_cache_key::bvh8 more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:43 +00:00
Samuel Pitoiset
1457c39f5a radv/nir: use radv_physical_cache_key::emulate_rt more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:43 +00:00
Samuel Pitoiset
246b8501ce radv/nir: use radv_physical_cache_key::no_rt more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40088>
2026-02-25 20:28:41 +00:00
Samuel Pitoiset
c4d5090d69 radv: fix potential GPU hangs with secondaries on transfer queue
Cache flushes should be skipped on SDMA. In practice,
radv_emit_cache_flush() should only be called on GFX/ACE.

SDMA NOP packets are emitted in barriers directly.

This fixes recent VKCTS coverage
dEQP-VK.api.command_buffers.secondary_on_transfer_queue.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39964>
2026-02-25 08:16:57 +01:00
Rhys Perry
05586fae67 radv: combine v_mov_dpp into fma in frag_coord.z adjust
This wasn't possible before because of the literal.

fossil-db (vangogh):
Totals from 3766 (3.36% of 112041) affected shaders:
Instrs: 5646975 -> 5642967 (-0.07%); split: -0.09%, +0.02%
CodeSize: 30751152 -> 30749956 (-0.00%); split: -0.02%, +0.02%
VGPRs: 262640 -> 262672 (+0.01%); split: -0.01%, +0.02%
Latency: 184869423 -> 184883681 (+0.01%); split: -0.02%, +0.03%
InvThroughput: 43462111 -> 43456113 (-0.01%); split: -0.03%, +0.02%
VClause: 93337 -> 93353 (+0.02%); split: -0.10%, +0.12%
SClause: 186857 -> 186833 (-0.01%); split: -0.07%, +0.06%
Copies: 390583 -> 390327 (-0.07%); split: -0.44%, +0.38%
Branches: 106070 -> 106086 (+0.02%); split: -0.03%, +0.05%
VALU: 4112856 -> 4108839 (-0.10%); split: -0.12%, +0.02%
SALU: 593814 -> 593758 (-0.01%); split: -0.05%, +0.04%

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/40013>
2026-02-24 18:34:38 +00:00
Rhys Perry
437a3d5ade radv: disable fast math for frag_coord.z adjust
No fossil-db changes.

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/40013>
2026-02-24 18:34:37 +00:00
Caterina Shablia
5e25953690 radv: move all image checks into radv_image_need_retile
There's no reason to have these checks be smeared between
radv_image_need_retile and radv_retile_transition.

Make radv_image_need_retile verify that the image might ever
need to have its displayable DCC updated.

Also, radv_image_need_retile should not care about the command
buffer. We should never try to do retile transition on a
command buffer that can't do compute to begin with.

Make radv_retile_transition only check whether the layout
we're transitioning to might involve reading the displayable
DCC, and perform retiling if so.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39990>
2026-02-24 18:08:53 +00:00
Caterina Shablia
4529be010b radv: skip retiling if transitioning away from ZERO_INITIALIZED
Zeros are already a sensible value for display DCC metadata
to have and correctly represent a zeroed image.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39990>
2026-02-24 18:08:53 +00:00
Benjamin Cheng
2bb26573e7 radv/video: Split cdf buffer and encode ctx
These resources are fundamentally different and should be treated as
such.

Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40050>
2026-02-24 12:29:25 +00:00
Samuel Pitoiset
755cb6cb75 radv: fix independent sets with dynamic buffers and GPL
If a set layout is missing the driver can't compute the dynamic buffer
start offsets correctly. The only solution is to load these offsets from
an user SGPR.

To avoid adding more complexity, these offsets are re-emitted every
time dynamic buffers are dirty. That shouldn't matter because the
combination of dynamic buffers and independent sets is just super rare.

This fixes new VKCTS coverage
dEQP-VK.pipeline.pipeline_library.graphics_library.independent_sets_random.*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39988>
2026-02-24 11:12:14 +00:00
Georg Lehmann
c6e1c23faf radv: expose VK_VALVE_shader_mixed_float_dot_product on supported hardware
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
In practice this means Vega20, Navi14, and RDNA2+.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40003>
2026-02-24 08:55:53 +00:00
Samuel Pitoiset
06949b74eb radv: suspend/resume dynamic rendering completely
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The Vulkan spec says:
    "The contents of pRenderingInfo must match between suspended
     render pass instances and the render pass instances that resume
     them, other than the presence or absence of the0
     VK_RENDERING_RESUMING_BIT, VK_RENDERING_SUSPENDING_BIT, and
     VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT flags. No
     action or synchronization commands, or other render pass
     instances, are allowed between suspending and resuming render
     pass instances. All pairs of resuming and suspending render passes
     must be submitted in the same batch. "

So it should be safe to avoid re-emitting the rendering state because
nothing can blow it up.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40004>
2026-02-24 07:33:28 +00:00
Samuel Pitoiset
e6523feed9 radv: handle the cache flush workaround for mips before emitting the fb
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40004>
2026-02-24 07:33:28 +00:00
Samuel Pitoiset
cc08a1594e radv: skip some redundant operations when rendering is resumed
No need to do it twice, and nothing can blow it up between
suspend/resume rendering operations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40004>
2026-02-24 07:33:28 +00:00
Samuel Pitoiset
d45586f1c0 radv: reserve CS space for the HiZ WA on GFX12
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40004>
2026-02-24 07:33:28 +00:00
Samuel Pitoiset
ab6147e8ef radv/meta: fix depth/stencil resolves with different regions
This is possible since VK_KHR_maintenance10.

This fixes new VKCTS coverage in
dEQP-VK.pipeline.*.multisample.m10_resolve.*.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39956>
2026-02-24 07:09:17 +00:00
Natalie Vock
b08f9f192c radv/nir: Correctly handle workgroup sizes not aligned to 32
Since the stride is always 32 dwords, we need to treat the workgroup
size as multiples of that value. Using MAX2() only works for cases where
the workgroup size is less than 32, which was hit by some CTS with 1x1
workgroups.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39981>
2026-02-23 12:42:24 +00:00
Samuel Pitoiset
7d03a1fc5b radv: skip some operations when the image is already zero-initialized
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
No need to clear to zero because it should already be cleared.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40012>
2026-02-23 09:06:21 +00:00
Samuel Pitoiset
837078b8d5 radv: fix potential corruption after FMASK decompression on GFX6-8
While reworking image resolves completely in RADV, I found a very weird
bug where the only fix was to emit caches immediately after
decompressing the source resolve image (after FMASK_DECOMPRESS).

I have been struggling this for few hours and figured that it was
something related to context rolls (ie. as long the context was rolled
out, emitting the flushes immediately was required).

It turns out this was a known hardware bug on GFX6 that was implemented
in PAL. Though PAL only applies on GFX6 but GFX7-8 are also affected
based on my testing. Note that RadeonSI flushes CB_META too.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39959>
2026-02-23 08:32:53 +00:00
Samuel Pitoiset
8b5296b01c radv: simplify buffer-to-image and image-to-image operations for 96-bit formats
It's possible to use the existing shaders with a small tweak. This
removes a bunch of code in meta.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39935>
2026-02-19 07:12:47 +00:00
Natalie Vock
47e4a68a83 radv: Initialize nir_lower_io_to_scalar progress variable
The NIR_PASS macro only overwrites this when the pass actually makes
progress. If the pass doesn't make progress, the variable stays
uninitialized.

Clang correctly spots this and warns about it.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39968>
2026-02-18 21:44:49 +00:00
Natalie Vock
59a397793e radv/rt: Only use ds_bvh_stack_rtn if the stack base is possible to encode
The hardware only provides 13 bits for encoding the stack base (in
dwords). That translates to the stack base being required to be below
8192 dwords, or 32kB. It's possible to exceed this - LDS is 64kB after
all. Add an explicit check to make sure we don't end up with offsets
that overflow the hw's address fields. This fixes Metro Exodus Enhanced
Edition, which was using ray queries in a 1024-thread sized workgroup,
resulting in exactly 64kB of LDS being required for the stack.

This check isn't required for RT pipelines as we always use 32 or 64
wide workgroups with no other LDS used, so it's impossible to reach this
stack base limit.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39691>
2026-02-18 19:12:18 +00:00
Konstantin Seurer
ae84d41d48 radv/meta: Rework saving/restoring state
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The current approach of explicitly saving/restoring some states is
unnecessarily complicated and inefficient. For example, some meta OPs
that use memory fills/copies will have nested save/restores. This patch
is the first step towards avoiding unnecessary state re-emits around
meta OPs.

The changes are:
- Move radv_meta_saved_state to radv_cmd_buffer::state
- Add radv_meta_begin/end helpers that initialize radv_meta_saved_state
and restore states used by the meta OP
- Remove all explicit saves/restores, use the new helpers

radv_meta_begin/end is called inside the entrypoint and not some nested
helper function which means that state is only restored once per meta
OP.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39774>
2026-02-18 09:37:55 +01:00