Commit graph

11048 commits

Author SHA1 Message Date
Daniel Schürmann
e1bcbbf3dd radv/shader_info: rename gs_ring_info -> legacy_gs_info and use union with ngg_info
Reduces the size of radv_shader_info from 784 bytes to 760 bytes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37931>
2025-11-03 13:38:38 +01:00
Daniel Schürmann
9b34da3da8 radv/shader_info: use union for precomputed register values of non-overlapping stages
Reduces the size of radv_shader_info from 872 bytes to 784 bytes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37931>
2025-11-03 13:38:38 +01:00
Daniel Schürmann
68ab01b2f2 radv/shader_info: remove unused output_usage_mask
Reduces the size of radv_shader_info from 1000 bytes to 872 bytes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37931>
2025-11-03 13:38:37 +01:00
David Rosca
874e02003a radv/video: Only use write_memory for encode feedback with full support
write_memory is used after encoding every frame to mark the feedback
buffer as ready. Only use it when write_memory can work without PCIe
atomics support.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38184>
2025-11-03 08:39:59 +00:00
David Rosca
8e1d74bbb4 radv/video: Introduce two levels of write_memory support
Print warning when using write_memory with firmwares that require
PCIe atomics support.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38184>
2025-11-03 08:39:59 +00:00
Samuel Pitoiset
f91e5c9cb7 radv: use radv_get_shader_layout() more with ESO
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38106>
2025-11-03 08:00:35 +00:00
Samuel Pitoiset
e5513826aa radv: fix creating linked graphics ESOs with a compute shader
It's valid to create shader objects with linked VS/FS and with a
compute shader.

This reworks radv_CreateShadersEXT() completely to allow this. Unlinked
shaders are created first, then linked shaders.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14193
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38106>
2025-11-03 08:00:35 +00:00
Marek Olšák
9125e34372 amd: lower get_ssbo_size in ac_nir_lower_resinfo
The code for lowering get_ssbo_size will be different in future chips,
so do it in common code to reduce duplication in the future.

Lower get_ssbo_size to ssbo_descriptor_amd + nir_channel.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38097>
2025-11-02 01:42:07 +00:00
Samuel Pitoiset
cb4e0c4140 radv: add a workaround for illegal depth/stencil descriptors with No Man's Sky
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Using descriptors with both depth and stencil aspects is illegal in
Vulkan and this hangs the GPU.

Use NULL descriptors to mitigate the issue. Note that AMDVLK also
ignores them.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13325
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38180>
2025-10-31 15:46:55 +00:00
Samuel Pitoiset
968fb06a94 radv,vulkan: replace VK_RENDERING_INPUT_ATTACHMENT_NO_CONCURRENT_WRITES_BIT_MESA
The new flag from maintenance10 has similar meaning.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:23 +00:00
Samuel Pitoiset
c8aaf3f5b5 radv: advertise VK_KHR_maintenance10
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:22 +00:00
Samuel Pitoiset
14639898d0 radv: add support for controlling sRGB transfer function with resolves
Just need to use UNORM image views.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:22 +00:00
Samuel Pitoiset
0034f5a948 radv: allow ds<->color copies on compute/transfer queues
This should be supported just fine.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:22 +00:00
Samuel Pitoiset
49128926d6 radv: implement new input attachment information for dynamic rendering
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:21 +00:00
Samuel Pitoiset
18fec61c8d radv: reverse the logic for NO_CONCURRENT_WRITES_BITS_MESA
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:21 +00:00
Samuel Pitoiset
d3924f5bd6 radv: add support for depth/stencil resolves with vkCmdResolve2()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:20 +00:00
Samuel Pitoiset
8306256e2a radv: allow NULL pSamplesMask with vkCmdSetSampleMaskEXT()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:19 +00:00
Samuel Pitoiset
d5d2a4ad07 radv: implement vkCmdEndRendering2KHR()
Common runtime code already does CmdEndRendering()->CmdEndRendering2().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38043>
2025-10-31 07:51:19 +00:00
Daniel Schürmann
10be538851 tree-wide: don't call nir_opt_constant_folding after nir_lower_flrp
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37195>
2025-10-30 19:28:07 +00:00
Daniel Schürmann
ef9ecc4058 nir: add nir_imul_nuw() and nir_imul_imm_nuw() helpers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37195>
2025-10-30 19:28:06 +00:00
Samuel Pitoiset
b2badb2b24 radv: ignore dual-source blending when blending isn't enabled for MRT0
The Vulkan spec says:
    "VUID-vkCmdDraw-maxFragmentDualSrcAttachments-09239
     If blending is enabled for any attachment where either the source
     or destination blend factors for that attachment use the secondary
     color input, the maximum value of Location for any output attachment
     statically used in the Fragment Execution Model executed by this
     command must be less than maxFragmentDualSrcAttachments"

Which means it must be disabled.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14190
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38107>
2025-10-30 07:59:50 +00:00
Samuel Pitoiset
14667eef53 radv: fix reserving enough space for emitting the SPM setup
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
4096 is an arbitrary but large enough number to emit everything needed.

Fixes: 22d73fc077 ("amd,radv,radeonsi: add ac_emit_spm_setup()")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38087>
2025-10-30 07:36:27 +00:00
Samuel Pitoiset
0dcb800a07 radv: remove some RADV_DEBUG deprecated options
They have been marked as deprecated in 25.3, so one release cycle
before they are removed completely.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38085>
2025-10-30 07:16:23 +00:00
Marek Olšák
4799dc9447 ac/surface: pass all ac_compute_surface info via ac_surf_config, not radeon_surf
radeon_surf stops being an input to ac_compute_surface. It's only an output
now.

This makes it clear which fields affect ac_compute_surface.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:44 +00:00
Marek Olšák
966cb36722 amd: constify struct radeon_surf
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:44 +00:00
Marek Olšák
feaa359b43 ac/surface: move surf_index and fmask_surf_index into ac_addrlib
They don't have to be in drivers.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:43 +00:00
Marek Olšák
0e44a5a1c6 radv: set RADEON_SURF_SHAREABLE for surf_index logic
use_tile_swizzle uses this flag

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:42 +00:00
Marek Olšák
2bbc7d1db6 radv: move more surf_index logic to use_tile_swizzle
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:41 +00:00
Marek Olšák
ca6ba34669 radv: move VK_IMAGE_USAGE_HOST_TRANSFER_BIT checking to ac_surface.c
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:40 +00:00
Marek Olšák
20eada1bc4 radv: don't check vk_format_is_depth_or_stencil for surf_index
already checked by use_tile_swizzle

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:39 +00:00
Marek Olšák
1271850b9b radv: don't check VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT for surf_index
already checked by use_tile_swizzle

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:39 +00:00
Marek Olšák
f0fde95e20 radv: don't set ac_surf_index::surf_index to NULL
ac_surface.c already checks RADEON_SURF_SCANOUT.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:38 +00:00
Marek Olšák
484a36302d amd: don't use non-existent GL1 packet fields on gfx12
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:34 +00:00
Marek Olšák
12062110ab amd: don't use non-existent GLM packet fields on gfx12
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38093>
2025-10-29 12:50:34 +00:00
Benjamin Cheng
cef8eff74d radv/video: Override H265 SPS unaligned resolutions
VCN requires 64x16 alignment for HEVC. When the app requests non-aligned
resolutions, make up for it with conformance window cropping.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38061>
2025-10-28 08:53:35 +00:00
Benjamin Cheng
84b6d8e0d7 radv/video: Override H265 SPS block size parameters
VCN only supports this set of parameters.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38061>
2025-10-28 08:53:35 +00:00
Samuel Pitoiset
45affb0e53 radv: advertise VK_EXT_shader_uniform_buffer_unsized_array
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38047>
2025-10-28 07:55:40 +01:00
Samuel Pitoiset
a31d3c764c amd,radv,radeonsi: move GFX12 push SH REGS helpers to common code
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38000>
2025-10-27 08:30:02 +00:00
Samuel Pitoiset
bddd7919d3 amd,radv,radeonsi: add ac_buffered_sh_regs
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38000>
2025-10-27 08:30:02 +00:00
Samuel Pitoiset
91bd46d34e amd,radv,radeonsi: add ac_{gfx11_reg_pair,gfx12_reg}
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38000>
2025-10-27 08:30:01 +00:00
Samuel Pitoiset
846b707045 amd,radv,radeonsi: move some GFX12 emit helpers to common code
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38000>
2025-10-27 08:30:00 +00:00
Samuel Pitoiset
2009815d61 radv: add radv_wait_for_vm_map_updates drirc and enable for Forza Horizon 5
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/13321
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38031>
2025-10-27 07:56:45 +00:00
Samuel Pitoiset
fc0cfaae1c radv/amdgpu: add a way to wait for VM updates at alloc time
RADEON_FLAG_VM_UPDATE_WAIT can be passed to wait for VM updates at
allocation time instead of delaying them at submit time. There is no
reason to delay the waiting when the memory is bound to images/buffers
because in DX12 ressources are allocated and bound immediately.

This flag will be used to workaround an use-before-alloc in FH5
(game bug) which causes GPU hangs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38031>
2025-10-27 07:56:44 +00:00
Samuel Pitoiset
bbaffa22ff radv/amdgpu: use radv_amdgpu_bo_va_op() for BOs from pointer
No logical changes because ac_drm_bo_va_op() sets
AMDGPU_VM_PAGE_{READABLE,EXECUTABLE,WRITEABLE}.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38031>
2025-10-27 07:56:44 +00:00
Samuel Pitoiset
f9af7f7b2a radv: use radv_buffer_get_va() more
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38031>
2025-10-27 07:56:44 +00:00
jglrxavpok
09e091fbdf radv/aco: Print source location debug info inside ACO disassembly if we have the information
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36443>
2025-10-26 15:12:58 +00:00
Konstantin Seurer
95a89f7b33 radv: Report smaller bvh sizes when possible
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37830>
2025-10-24 21:17:10 +00:00
Konstantin Seurer
7809af5e46 radv: Always use compact bvh encoding
The compact encoding will make it possible to allocate less space for
internal nodes

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37830>
2025-10-24 21:17:10 +00:00
Alyssa Rosenzweig
b824ef83ab util/dynarray: infer type in append
Most of the time, we can infer the type to append in
util_dynarray_append using __typeof__, which is standardized in C23 and
support in Jesse's MSMSVCV. This patch drops the type argument most of
the time, making util_dynarray a little more ergonomic to use.

This is done in four steps.

First, rename util_dynarray_append -> util_dynarray_append_typed

    bash -c "find . -type f -exec sed -i -e 's/util_dynarray_append(/util_dynarray_append_typed(/g' \{} \;"

Then, add a new append that infers the type. This is much more ergonomic
for what you want most of the time.

Next, use type-inferred append as much as possible, via Coccinelle
patch (plus manual fixup):

    @@
    expression dynarray, element;
    type type;
    @@

    -util_dynarray_append_typed(dynarray, type, element);
    +util_dynarray_append(dynarray, element);

Finally, hand fixup cases that Coccinelle missed or incorrectly
translated, of which there were several because we can't used the
untyped append with a literal (since the sizeof won't do what you want).

All four steps are squashed to produce a single patch changing every
util_dynarray_append call site in tree to either drop a type parameter
(if possible) or insert a _typed suffix (if we can't infer). As such,
the final patch is best reviewed by hand even though it was
tool-assisted.

No Long Linguine Meals were involved in the making of this patch.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38038>
2025-10-24 18:32:07 +00:00
Samuel Pitoiset
849d41dbf8 radv: implement a new descriptor sets allocator
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The previous implementation was horribly slow with a larger number
of descriptor sets.

The new approach uses util_vma_heap (like ANV) which is a perfect fit.

This fixes stuttering in Indiana Jones because that games seems to use
a huge number of descriptor sets which can also be freed.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13901
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37976>
2025-10-24 06:25:17 +00:00