Commit graph

2429 commits

Author SHA1 Message Date
Rhys Perry
3b52d61bb0 radv: don't copy radv_vertex_input_state in CmdSetVertexInputEXT
This doubles vkoverhead's draw_16vattrib_change_dynamic performance.

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/40603>
2026-03-27 13:38:29 +00:00
Samuel Pitoiset
c5619aec32 Revert "radv: remove adding a BO to the per-cmdbuf list when unnecessary"
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This breaks Gamescope because WSI BOs aren't added to the global BO
list because this might affect implicit sync. Let's revert this commit
for now until I found a better solution.

This reverts commit 9f224289b0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40602>
2026-03-25 07:27:08 +00:00
Samuel Pitoiset
23e34532bd radv: cleanup redundant radv_image_has_hiz_metadata() checks
All callers check that already.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40176>
2026-03-23 15:33:26 +00:00
Samuel Pitoiset
8b993f46f5 radv: ignore the GFX12 HiZ WA for internal blits
To update HiZ properly during depth/stencil clears. There is a risk
but it's very minimal and it's also much better for performance.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40176>
2026-03-23 15:33:25 +00:00
Samuel Pitoiset
9f224289b0 radv: remove adding a BO to the per-cmdbuf list when unnecessary
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
All BOs allocated from vkAllocateMemory are either local BOs or added
to the global BO list. Only BOs allocated internally should be added
to the per-cmdbuf list.

Verified this by doing a full CTS run with amdgpu.debug=0x1.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40466>
2026-03-23 09:50:41 +00:00
Samuel Pitoiset
b24c18667d radv: remove radv_device::use_global_bo_list
This is always TRUE now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40466>
2026-03-23 09:50:40 +00:00
Samuel Pitoiset
57e2b272d5 radv: emit PFP_SYNC_ME right after STRMOUT_BUFFER_UPDATE is emitted
This is likely less frequent than the draws, and it's only needed
when the VA is used.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40341>
2026-03-23 08:40:23 +00:00
Samuel Pitoiset
a0471ddad8 radv: update color/ds clear metadata in ME
It's probably sligthly better because loading the clear registers
is likely more frequent than updating them.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40341>
2026-03-23 08:40:23 +00:00
Samuel Pitoiset
fd019c24e9 radv: remove useless PFP_SYNC_ME when loading color/ds metadata on GFX6-7
WRITE_DATA is emitted in PFP and the COPY_DATA in ME, so this shouldn't
be necessary.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40341>
2026-03-23 08:40:23 +00:00
Samuel Pitoiset
2751a427e1 radv: use LOAD_CONTEXT_REG_INDEX when supported for streamout
It's supported on GFX9+ and on GFX8+ with a specific fw version. It's
more correct with preemption.

Also rewrite the comment now that we got more information from Marek.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40341>
2026-03-23 08:40:22 +00:00
Zeyang Lyu
70a487adfb radv: Fix incorrect misaligned_mask_invalid for VK_EXT_vertex_input_dynamic_state
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The cmd_buffer->vertex_bindings was not cleared when resetting the command buffer.

The previous misaligned_mask_invalid bits were not preserved when calling radv_CmdBindVertexBuffers2 multiple times.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40312>
2026-03-17 06:56:48 +00:00
Samuel Pitoiset
205fe011ea radv: always use separate depth/stencil layouts for rendering
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40154>
2026-03-16 09:16:09 +00:00
Samuel Pitoiset
5192ee3c88 radv: handle separate depth/stencil layouts correctly for barriers
Need to split the transitions, one for each aspect.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40154>
2026-03-16 09:16:08 +00:00
Samuel Pitoiset
3c26a2fdb1 radv: handle separate depth/stencil layouts correctly for fbfetch decompressions
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40154>
2026-03-16 09:16:08 +00:00
Samuel Pitoiset
58441d014e radv: stop checking whether HTILE is compressed with the UNDEFINED layout
This doesn't make sense.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40154>
2026-03-16 09:16:07 +00:00
Samuel Pitoiset
a55b49569f radv: only set the relevant image views for custom depth/stencil resolves
So the rendering state has correct information, like the aspects.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40154>
2026-03-16 09:16:07 +00:00
Samuel Pitoiset
1746837a71 radv/meta: remove CB_RESOLVE
CB_RESOLVE isn't very fast and we already have two different paths,
it's been removed in hw since GFX11. PAL and RadeonSI removed support
for it too.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39957>
2026-03-16 08:12:46 +00:00
Samuel Pitoiset
744cedf3a1 radv: remove unused radv_device parameter to few functions
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40375>
2026-03-16 07:50:00 +00:00
Samuel Pitoiset
2afbf363ca radv: handle FRAGMENT_SHADING_RATE_ATTACHMENT_READ properly on GFX10.3
When VRS rates are copied from the VRS image to HTILE. Only the
vector cache needs to be flushed becaue it's using VMEM.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40342>
2026-03-12 18:38:21 +00:00
Samuel Pitoiset
99b3f4c7ab radv: implement VK_KHR_copy_memory_indirect
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37634>
2026-03-12 12:33:02 +00:00
Marek Olšák
796e1749c6 ac: replace some packet field definitions in sid.h by generated ones
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40183>
2026-03-11 18:54:20 +00:00
Samuel Pitoiset
dfdaf6a277 radv: rewrite a comment explaining why PFP waits for ME with streamout
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40327>
2026-03-11 07:34:45 +00:00
Samuel Pitoiset
d9420eed9e radv: fix missing L2 cache invalidation with streamout on GFX12
COPY_DATA emitted from the CP isn't coherent with L2, in case the
buffer filled size needs to be copied.

This fixes rare and random flickering with Mafia 3 Definitive Edition
on RDNA4.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14697
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40327>
2026-03-11 07:34:45 +00:00
Samuel Pitoiset
6c1d9612ef radv: only emit FORCE_S_VALID(1) for MSAA depth/stencil images
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This affects GFX12 only.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40303>
2026-03-10 17:38:55 +00:00
Samuel Pitoiset
7cd3d40f86 radv: set {color,ds}_samples for inherited rendering state
There is no distinction for secondaries.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40303>
2026-03-10 17:38:55 +00:00
Samuel Pitoiset
0da3714bd3 ac,radv,radeonsi: add has_db_force_stencil_valid_bug
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40303>
2026-03-10 17:38:54 +00:00
Samuel Pitoiset
cb5f2a0521 radv: initialize HiZ for UNDEFINED transitions on transfer queue
This doesn't consider layers/mips because it doesn't seem possible,
but it doesn't hurt correctness either, it just means HiZ is disabled.

This fixes dEQP-VK.api.copy_and_blit.core.use_after_copy.*_tq on GFX12.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40304>
2026-03-10 16:51:57 +00:00
Samuel Pitoiset
e293993fff radv: optimize clipping performance with PA_SU_HARDWARE_SCREEN_OFFSET
This optimization was missing in RADV for a very long time.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6492
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40249>
2026-03-10 12:07:46 +00:00
Samuel Pitoiset
c7cfa5324d radv: use common guardband computations
That shouldn't change anything.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40249>
2026-03-10 12:07:46 +00:00
Samuel Pitoiset
8f10e2886c radv: dump the PS epilog in the GPU hang report
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40219>
2026-03-09 09:53:27 +00:00
Samuel Pitoiset
1a00587c44 radv: fix a GPU hang with PS epilogs and secondary command buffers
If the secondary changes the fragment output state and if the same
PS epilog used before ExecuteCommands() is re-bind immediately after
that call, the PS epilog state wouldn't be re-emitted.

Apply the same change for VS prologs, although the logic is slightly
different and the bug shouldn't occur. The whole logic of secondaries
should be completely rewritten because it's definitely not robust.

This fixes a GPU hang in Where Winds Meet, see
https://github.com/doitsujin/dxvk/issues/5436.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40221>
2026-03-09 08:16:49 +00:00
Samuel Pitoiset
ac3fd06987 radv: always enable DISABLE_CONSERVATIVE_ZPASS_COUNTS on GFX11
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This might cause incorrect occlusion queries count.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40235>
2026-03-09 07:26:25 +00:00
Samuel Pitoiset
395132432b radv: initialize HiZ also for depth-only images
This is actually needed to initialize it to full expanded HiZ range.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40213>
2026-03-05 13:58:18 +00:00
Samuel Pitoiset
ab3ae53906 radv: add radv_image_has_hiz_metadata()
And rename few things.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40213>
2026-03-05 13:58:18 +00:00
Samuel Pitoiset
6358e48820 radv: add radv_image_has_hiz()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40213>
2026-03-05 13:58:17 +00:00
Rhys Perry
7de3552f3f radv: don't mask PS epilog spi_shader_col_format with dual source blending
In case the FS only writes one output.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40005>
2026-03-05 09:38:24 +00:00
Marek Olšák
f421eecebe radv,radeonsi: PA_SC_BINNER changes for gfx12
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40022>
2026-03-04 21:14:56 +00:00
Rhys Perry
5c3b5688a1 amd: rename ac_cu_info to ac_compiler_info
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40042>
2026-03-03 08:50:12 +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
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
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
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
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
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
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
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