Commit graph

11419 commits

Author SHA1 Message Date
Georg Lehmann
a87cdfc6b7 radv/nir/rt: preserve inf/nan for emulated RT intersect
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39641>
2026-02-10 18:42:02 +00:00
Samuel Pitoiset
2cd9693a31 radv/meta: remove an useless barrier when fixing up HTILE for copies on compute
The copy operation doesn't use HTILE of the destination image, so the
clear can run in parallel.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:22 +00:00
Samuel Pitoiset
5663ebffc4 radv/meta: skip some HTILE operations when it's decompressed on image stores
Only GFX11-GFX11.5 are affected.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:22 +00:00
Samuel Pitoiset
0996b4c527 radv/meta: do not disable compression for depth/stencil expand on compute
This doesn't make sense for the destination image and this would
prevent COMPRESSION_EN=1 to work correctly.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:22 +00:00
Samuel Pitoiset
452304897f radv: set COMPRESSION_EN=1 for depth or stencil storage images when supported
On GFX10+, the hardware can write decompressed DWORDS to HTILE when
COMPRESSION_EN=1, which means some HTILE decompression/initialization
operations can be avoided because it automatically mark the tiles that
are touched as uncompressed.

Though according to PAL, there are issues with that on GFX10-10.3, so
it's only enabled on GFX11-11.5.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:22 +00:00
Samuel Pitoiset
6f2b048f84 radv/meta: stop fixing up HTILE after a partial copy
The decompression pass already resets HTILE to its uncompressed state,
so this is just redundant.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:21 +00:00
Samuel Pitoiset
4f41818194 radv/meta: add a function to fixup HTILE metadata for copies on compute queue
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:21 +00:00
Samuel Pitoiset
9f5a20abde radv/meta: fix CmdCopyBufferToImage2() on compute queue with compressed HTILE
Only for partial copies because image stores don't decompress on writes
(ie. HTILE isn't updated by image stores).

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39656>
2026-02-10 10:42:21 +00:00
Samuel Pitoiset
17bbd45d59 radv: emit the framebuffer state when rendering begins
Much better.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39731>
2026-02-09 09:43:02 +00:00
Samuel Pitoiset
e178382fb8 radv: add a new dirty bit for the GFX12 HiZ workaround
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39731>
2026-02-09 09:43:02 +00:00
Samuel Pitoiset
a010c2694a radv: move {depth,stencil}_compress_disable to the image view extra info
Doesn't have to be a pipeline parameter.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39731>
2026-02-09 09:43:01 +00:00
Samuel Pitoiset
9abe6d4dc2 radv: remove declared but unused radv_get_dcc_max_uncompressed_block_size()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39731>
2026-02-09 09:43:01 +00:00
Samuel Pitoiset
8d9fb0744e radv: move color/depth-stencil init surface helpers to radv_image_view.c/h
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39731>
2026-02-09 09:43:01 +00:00
Samuel Pitoiset
39719c6c44 radv/meta: remove dead code in the gfx depth/stencil clear path
The driver either does a fast-clear using compute or a slow clear
using graphics, so the "fast" clear using graphics isn't used at all.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39731>
2026-02-09 09:43:00 +00:00
Samuel Pitoiset
e488085942 radv/meta: remove unused saving/restoring rendering state logic
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39729>
2026-02-09 08:41:07 +00:00
Samuel Pitoiset
98186aba36 radv/meta: stop saving/restoring rendering state for color/depth decompressions
These should always happen outside of rendering.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39729>
2026-02-09 08:41:07 +00:00
Samuel Pitoiset
04d5077b00 radv: emit late decompressions for fbfetch slightly earlier
Right after "normal" layout transitions and just before the rendering
state is set, mostly because it doesn't need to be saved/restored
either.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39729>
2026-02-09 08:41:07 +00:00
Samuel Pitoiset
04f6bfae51 radv: only pass custom sample locations when relevant
Custom sample locations are only needed for depth decompression.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39729>
2026-02-09 08:41:07 +00:00
Samuel Pitoiset
ce3539b54f radv: fix late decompressions for fbfetch with more corner cases
With layers, or custom sample locations for depth.
Found this by inspection.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39729>
2026-02-09 08:41:06 +00:00
Reilly Brogan
ece5f671b3 amd,compiler: fix const errors found with C23 glibc support
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
In glibc 2.43 the strstr function now propagate const to the output, triggering -Wincompatible-pointer-types-discards-qualifiers
under clang/gcc with -Werror.

Fix two of these cases by adding the const qualifier.

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39767>
2026-02-08 23:18:15 +00:00
Samuel Pitoiset
c817ef30ee radv/meta: remove dead DCC clear code about E5B9B9R9_UFLOAT_PACK32
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Only GFX10.3+ supports COLOR_ATTACHMENT/STORAGE with this format, so older
gens can't have DCC either.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39689>
2026-02-06 12:49:36 +00:00
Samuel Pitoiset
181bb1fc93 radv/meta: remove dead code for VK_FORMAT_R4G4_UNORM_PACK8
This isn't supported at all.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39689>
2026-02-06 12:49:36 +00:00
Samuel Pitoiset
cd54224a73 radv/meta: remove useless check in radv_CmdClearAttachments()
Rendering must be active.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39689>
2026-02-06 12:49:36 +00:00
Samuel Pitoiset
ad7151f4bf radv/meta: fix the key for DCC decompress on compute
This could return the graphics DCC pipeline if it was created before,
and crash or potentially hang the GPU.

Found this while working on in-progress VKCTS coverage.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39689>
2026-02-06 12:49:36 +00:00
Samuel Pitoiset
18317460bc radv/meta: stop saving/restoring rendering state for FS/HW resolves
This isn't needed because resolves are at the end of the rendering.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39688>
2026-02-06 12:29:40 +00:00
Samuel Pitoiset
30db01ed05 radv/meta: make radv_decompress_resolve_src() static
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39688>
2026-02-06 12:29:40 +00:00
Samuel Pitoiset
7ea6b311d9 radv/meta: decompress resolve src outside of depth/stencil resolves
For consistency with color resolves.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39688>
2026-02-06 12:29:39 +00:00
Daniel Schürmann
b859aa7dce radv: vectorize UBO, SSBO and shared across blocks
Totals from 10898 (12.91% of 84383) affected shaders: (Navi48)
MaxWaves: 279340 -> 279332 (-0.00%); split: +0.00%, -0.00%
Instrs: 21764388 -> 21710270 (-0.25%); split: -0.27%, +0.02%
CodeSize: 116069624 -> 115722304 (-0.30%); split: -0.31%, +0.02%
VGPRs: 693736 -> 693796 (+0.01%); split: -0.00%, +0.01%
SpillSGPRs: 7225 -> 7339 (+1.58%); split: -0.55%, +2.13%
Latency: 338393228 -> 325192648 (-3.90%); split: -3.92%, +0.02%
InvThroughput: 51966571 -> 50173171 (-3.45%); split: -3.46%, +0.01%
VClause: 350568 -> 350287 (-0.08%); split: -0.13%, +0.05%
SClause: 632838 -> 614290 (-2.93%); split: -2.96%, +0.03%
Copies: 1479044 -> 1475429 (-0.24%); split: -0.45%, +0.20%
Branches: 514433 -> 512921 (-0.29%); split: -0.31%, +0.01%
PreSGPRs: 618454 -> 624707 (+1.01%); split: -0.07%, +1.08%
PreVGPRs: 564593 -> 564725 (+0.02%); split: -0.00%, +0.02%
VALU: 11557516 -> 11557859 (+0.00%); split: -0.01%, +0.01%
SALU: 3488945 -> 3486685 (-0.06%); split: -0.16%, +0.10%
VMEM: 615523 -> 614751 (-0.13%)
SMEM: 966514 -> 936739 (-3.08%); split: -3.09%, +0.01%
VOPD: 329318 -> 329406 (+0.03%); split: +0.04%, -0.02%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39373>
2026-02-06 10:16:50 +00:00
Samuel Pitoiset
695cf07f8a radv: remove occurrences of VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
This layout is illegal without VK_KHR_shared_presentable_image which
RADV doesn't support.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39717>
2026-02-06 07:37:23 +00:00
Samuel Pitoiset
f2d7d998a2 radv: track redundant PA_SC_VRS_OVERRIDE_CNTL register writes
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39675>
2026-02-06 07:15:10 +00:00
Samuel Pitoiset
f8153a7c20 radv: emit the VRS surface as part of the framebuffer state on GFX11+
No need to delay this and it slightly better for CPU overhead in the
hot draw path.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39675>
2026-02-06 07:15:10 +00:00
Samuel Pitoiset
65c1c66412 radv: stop delaying decompression passes for feedback loops with DRLR
This was an oversight of VK_KHR_dynamic_rendering_local_read which has
been addressed by VK_KHR_maintenance10 which introduced new flags to
give more information to implementations.

The Vulkan spec says:
    "VK_RENDERING_ATTACHMENT_INPUT_ATTACHMENT_FEEDBACK_BIT_KHR is
     intended to give implementations similar information as a subpass
     where an attachment could be used as both a color attachment and
     input attachment. Some implementations require extra work to make
     this scenario work beyond just considering the image layouts.
     Implementations which have no such considerations may treat this
     flag as a noop. The primary use case for this flag is to enable
     feedback loops inside a single shader."

    "Applications are encouraged to use
     VK_RENDERING_LOCAL_READ_CONCURRENT_ACCESS_CONTROL_BIT_KHR if
     maintenance10 is available and they use feedback loops with
     VK_KHR_dynamic_rendering_local_read. Feedback loops are still
     allowed when not using the rendering flag, but the performance
     implication was an oversight in the original definition of
     VK_KHR_dynamic_rendering_local_read."

Because it's clearly defined by the Vulkan spec, let's just pessimize
always to avoid relying on some shaders state which require to do very
late decompression passes. This will allow us to do more cleanups and
optimizations related to the framebuffer. Also note that DRLR is still
a niche feature.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39538>
2026-02-05 10:55:42 +00:00
Samuel Pitoiset
13c9e529bd radv: emit pending flushes after late decompressions with fbfetch
If the rendering state is inherited in the secondary, otherwise nothing
wait for the pending flushes after a decompression pass. One more
argument to stop delaying this.

Fixes
dEQP-VK.renderpasses.dynamic_rendering.partial_secondary_cmd_buff.local_read.*

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39678>
2026-02-04 13:49:47 +00:00
Samuel Pitoiset
cbf0a38fa4 ac,radv,radeonsi: shorten some emit macro names
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
config -> cfg
uconfig -> ucfg
context -> ctx

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39680>
2026-02-04 13:27:49 +00:00
Samuel Pitoiset
83ca338e37 radv: disable unordered submits when SQTT queue events are enabled
Otherwise the QueuePresent event is missing and RGP is confused.

Fixes: 82d06b58ad ("radv: use vk_drm_syncobj_copy_payloads")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39158>
2026-02-04 13:04:19 +00:00
Samuel Pitoiset
6d7a1bc6ef radv/amdgpu: bypass GL2 for command buffer BOs
Better for latency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39674>
2026-02-04 12:45:06 +00:00
Samuel Pitoiset
cd22fef4be radv/meta: remove unused emit_depth_stencil_resolve()
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/39684>
2026-02-04 09:29:37 +01:00
Samuel Pitoiset
b304718002 radv/amdgpu: remove radv_dummy_winsys_create()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39684>
2026-02-04 09:29:24 +01:00
Samuel Pitoiset
f32721e3ae radv/meta: remove declared but unused radv_decompress_resolve_rendering_src()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39684>
2026-02-04 09:29:24 +01:00
Konstantin Seurer
ce4d338b0d radv: Use stderr for shader printf
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39640>
2026-02-03 20:00:15 +00:00
Konstantin Seurer
24a1e3d8c2 radv/bvh: Make sure internal nodes are collapsed when possible
Avoiding NaNs should have the same effect but it's good practice to not
rely on float OPs for correctness.

Fixes: 95a89f7 ("radv: Report smaller bvh sizes when possible")
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39640>
2026-02-03 20:00:15 +00:00
Konstantin Seurer
2f3a9c10f4 radv/rra: Fix nullptr dereference
cc: mesa-stable

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39640>
2026-02-03 20:00:15 +00:00
Marek Olšák
edffb2d76d ac: add FMASK codes
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39631>
2026-02-03 17:10:32 +00:00
Marek Olšák
6f36a2be2e ac: unify HTILE codes and encoding
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39631>
2026-02-03 17:10:32 +00:00
Marek Olšák
e0c7c642f4 ac: unify and demystify CMASK clear codes
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39631>
2026-02-03 17:10:32 +00:00
Marek Olšák
43e9af713b radv: use DCC definitions more
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39631>
2026-02-03 17:10:31 +00:00
Marek Olšák
6af6197136 ac: unify DCC clear code definitions
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39631>
2026-02-03 17:10:30 +00:00
Marek Olšák
30ee7044bc ac/nir: rename ac_nir_lower_tex -> ac_nir_lower_image_tex
It will lower txf and buffer image loads to load_buffer_amd.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39474>
2026-02-02 17:56:54 +00:00
Marek Olšák
61bfc298ba ac: set missing dest_type for image_deref_load
required for lowering to load_buffer_amd

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39474>
2026-02-02 17:56:53 +00:00
Natalie Vock
3275be503c radv/rt: Fix discardable attributes on chit and traversal shaders
It was incorrect to mark chit/miss arguments as discardable without
the equivalent in the traversal shader. Also, tail calls with modified
parameters that aren't marked discardable are incorrect.

This could lead to random corruption by clobbering parameter values
across two levels of nested calls: A Raygen shader calls traversal,
expecting e.g. the ray tMax parameter to be preserved. Traversal
overwrites the parameter's register with the hit t and tail-calls chit,
which immediately returns to raygen. Now the raygen shader still has the
clobbered tMax (which is actually the ray hit t) - if it calls traversal
multiple times, the second traversal iteration may use the previous
ray's hit t as tMax instead of the intended value.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39579>
2026-01-31 14:26:58 +00:00