Commit graph

20564 commits

Author SHA1 Message Date
Mike Blumenkrantz
d4d7055aee radv: add RADV_QUEUE_DISABLE env var for selectively disabling queues
it is sometimes useful to test radv without certain queues disabled in order
to exercise alternative codepaths. this exposes that capability

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41086>
2026-04-29 15:08:28 +00:00
Benjamin Cheng
656b3814c2 radv/wsi: Re-use transfer queue if it exists
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This avoids writing past the end of pdev->vk_queue_to_radv if all the
queue families are available.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/14834
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41155>
2026-04-29 12:38:02 +00:00
Rhys Perry
aac8787fda radv: remove radv_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/41022>
2026-04-29 08:10:12 +00:00
Rhys Perry
44b09b8396 radv: remove 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/41022>
2026-04-29 08:10:12 +00:00
Rhys Perry
27815719aa radv: remove most fields from 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/41022>
2026-04-29 08:10:12 +00:00
Rhys Perry
9ad0cd7e38 radv: hash radv_compiler_info::key into the cache key
This will replace both the pdev and device cache keys.

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/41022>
2026-04-29 08:10:12 +00:00
Rhys Perry
1ac306c11e radv: remove radv_compiler_info::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/41022>
2026-04-29 08:10:11 +00:00
Rhys Perry
c6c4f523af radv: add fields to radv_compiler_info from 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/41022>
2026-04-29 08:10:11 +00:00
Rhys Perry
3aa6903883 radv: move fields to radv_compiler_info::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/41022>
2026-04-29 08:10:10 +00:00
Rhys Perry
7c93a6e91c radv: move use_llvm to radv_compiler_info::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/41022>
2026-04-29 08:10:10 +00:00
Rhys Perry
5f3b73b2f0 radv: move load_grid_size_from_user_sgpr to radv_physical_device
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-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/41022>
2026-04-29 08:10:10 +00:00
Rhys Perry
48645f21b5 radv: initialize nir_shader_compiler_options directly in compiler info
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-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/41022>
2026-04-29 08:10:09 +00:00
Rhys Perry
0249fcfbb6 radv: assert there is no padding in cache keys
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-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/41022>
2026-04-29 08:10:08 +00:00
Rhys Perry
5ee0935861 ac: move has_cs_regalloc_hang_bug to ac_compiler_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/41022>
2026-04-29 08:10:08 +00:00
Rhys Perry
e40457b136 ac: move lds_size_per_workgroup to ac_compiler_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/41022>
2026-04-29 08:10:08 +00:00
Peyton Lee
ab878cc1ea amd/gmlib: add tm_generate_formatted_3DLut
Adds a utility to format a 3D LUT into the required memory layout and write it into a given buffer.

Signed-off-by: Peyton Lee <peytolee@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41190>
2026-04-29 07:46:28 +00:00
Samuel Pitoiset
669d3915c6 radv: slightly rework initializing the default graphics state
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
All these parameters are only used for graphics.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
461154fd5c radv: remove useless tracking about non-coherent RBs with secondaries
Either the rendering begins in the primary and the information is
already known, or if it begins in the secondary, non-coherent RBs
should already be flushed in EndCommandBuffer().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
bcd74a7af0 radv: add RADV_CMD_DIRTY_RAY_TRACING_PIPELINE
This seems cleaner than storing the last emitted ray tracing pipeline.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
20f7fba442 radv: add RADV_CMD_DIRTY_COMPUTE_PIPELINE
This seems cleaner than storing the last emitted compute pipeline.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
c7c2ce13ae radv: stop tracking the last emitted graphics pipeline
This shouldn't have any effects because there is a dirty bit and
binding the same graphics pipeline doesn't trigger it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
6af89db05c radv: rename RADV_CMD_DIRTY_PIPELINE to RADV_CMD_DIRTY_GRAPHICS_PIPELINE
This is really only used for graphics pipelines.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
75e5ba9a03 radv: simplify resetting pipeline state for ESO
Checking if there is a bound graphics pipeline should be enough to
reset the appropriate states. Also clear the dirty pipeline bit only
for graphics pipelines because it's not used for compute pipelines.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41136>
2026-04-28 17:06:42 +00:00
Samuel Pitoiset
d1a428606e radv: add missing VkMemoryRangeBarriersInfoKHR from DAC
This is used to declare barrier dependencies for an addr range
(because no VkBuffer with DAC).

This fixes new dEQP-VK.api.device_address.misc.memory_range_barrier.

Fixes: a97c889a7b ("radv: implement VK_KHR_device_address_commands")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41198>
2026-04-28 16:39:26 +00:00
Samuel Pitoiset
df3de4acbb ac,radv,radeonsi: replace mesh_fast_launch_2 by gfx_level checks
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41204>
2026-04-28 06:50:43 +00:00
Samuel Pitoiset
94ae99f16f radv: replace use_ngg_streamout by gfx_level checks
There is no way to enable/disable via debug options or so, it's only
used on GFX11+.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41204>
2026-04-28 06:50:43 +00:00
Timothy Arceri
a42c55da46 amd/radeonsi: dont clamp packed user varyings
ac_nir_optimize_outputs() might pack user varyings into the color
built-ins. If this happens we skip adding clamping to the
components that contain the user varying.

This change also fixes a second bug where a color built-in can be
packed into a non-color slot and was no longer being clamped.

Fixes: 3777a5d7 ("radeonsi: assign param export indices before compilation")
Closes: #14443

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40594>
2026-04-27 22:59:58 +00:00
Marek Olšák
0684976de8 ac/nir: add ac_nir_assign_fs_input_locations to set PS input locations in stone
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
No intended functional change.

This prevents possible breakage due to DCE removing input loads followed
by nir_shader_gather_info updating input masks and changing the result of
ac_nir_get_io_driver_location after PS input register contents are already
determined.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41175>
2026-04-27 21:05:53 +00:00
Suresh Guttula
71508d90aa ac: Add vcn_5_3_0 support
Enable hardware decode/encode capabilities for VCN 5.3.0 by
configuring the supported codec list. This allows vainfo to
properly enumerate available codec capabilities.

Signed-off-by: Suresh Guttula <suresh.guttula@amd.com>
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41202>
2026-04-27 17:13:18 +00:00
Benjamin Cheng
0e04954c9a radv/video_enc: Use correct swizzle mode for VCN5 with GFX11
Signed-off-by: Suresh Guttula <suresh.guttula@amd.com>
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41202>
2026-04-27 17:13:18 +00:00
Benjamin Cheng
922d04c9a5 ac/vcn: Rename VCN5 swizzle mode to GFX12
The original naming is inaccurate, it depends on the GFX version, not
VCN.

Signed-off-by: Suresh Guttula <suresh.guttula@amd.com>
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41202>
2026-04-27 17:13:18 +00:00
Matt Turner
acba4c9fd8 radv: expose VK_KHR_performance_query on GFX11
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Enable VK_KHR_performance_query on GFX11 (RDNA3 / RDNA3.5) now that the
selector tables and packet emission are in place.

Tested on Strix Halo with dEQP-VK.query_pool.performance_query.* (6 pass,
6 not-supported for the allowCommandBufferQueryCopies cases).

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41157>
2026-04-27 16:16:00 +00:00
Matt Turner
8499d86b94 radv/perfcounter: add GFX11 performance counter selectors
GFX11 reorganizes the shader perfcounter blocks: wave counts move from
SQ to the SQG registers (still mapped as the SQ block in ac/), while
per-instruction counters move from SQ to the new SQ_WGP block.

Add GFX11-specific selector enums using the new block assignments and
branch radv_query_perfcounter_descs to select them on GFX11+. GL2C,
GL1C, and TCP selectors are unchanged between GFX10.3 and GFX11.

The "Instructions" (total count) counter is dropped on GFX11 as there
is no direct SQ_WGP equivalent for INSTS_ALL.

Selector indices verified against gpu_performance_api's
gpa_hw_counter_gfx11.cc.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41157>
2026-04-27 16:15:59 +00:00
Matt Turner
703de21af8 radv/perfcounter: guard select1 access in radv_emit_select
Some perfcounter blocks (e.g. SQ_WGP on GFX11) define num_spm_modules
but have no select1 register array. Skip the select1 loop when the
array is NULL.

This is a prerequisite for enabling performance queries on GFX11.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41157>
2026-04-27 16:15:59 +00:00
Matt Turner
2595940b0d radv: fix UB in radv_format_pack_clear_color for snorm formats
Casting a negative float to uint64_t is undefined behavior. GCC 15 with
-O2 produces 0xFFFFFFFFFFFFFFFF for (uint64_t)(-32767.5f), causing snorm
clear values to be packed incorrectly (e.g. 0xFFFF instead of 0x8001 for
snorm16 -1.0). This results in wrong DCC comp-to-single clear colors and
~966 CTS snorm multisample_resolve test failures.

Fix by casting through int64_t first, which is well-defined (truncation
toward zero) and preserves the two's complement bit pattern.

Fixes: 585c25be1e ("radv: fix color conversions for normalized uint/sint formats")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41164>
2026-04-27 15:44:09 +00:00
Jaishankar Rajendran
cd941d3970 vulkan/runtime: enable parametrization of ASTC software decode
Enable the driver to select :
  - LUT allocation alignment
  - LUT memory flags selection

Signed-off-by: Prakhar Vishwakarma <prakhar.vishwakarma@intel.com>
Signed-off-by: Jaishankar Rajendran <jaishankar.rajendran@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41205>
2026-04-27 15:17:04 +00:00
Samuel Pitoiset
bd62c72223 radv: cleanup invalidating vertex draw state
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/41159>
2026-04-27 10:32:10 +00:00
Samuel Pitoiset
8c425351e9 radv: stop dirtying some states after DGC execute
The Vulkan spec says:
    "After a call to vkCmdExecuteGeneratedCommandsEXT, command buffer
     state will become undefined according to the tokens executed. This
     table specifies the relationship between tokens used and state
     invalidation."

The application must re-bind the states that are updated using DGC.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41159>
2026-04-27 10:32:10 +00:00
Samuel Pitoiset
4996cd82f6 radv: only emit the "normal" index buffer when needed with DGC
Only if DGC emits an indexed draw without providing the index buffer
as part of the tokens. This avoids emitting useless packets.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41159>
2026-04-27 10:32:10 +00:00
Samuel Pitoiset
dc816ce4ac radv: remove an useless check when emitting the index buffer
index_type is uint32_t, so this checks is always FALSE.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41159>
2026-04-27 10:32:09 +00:00
Trigger Huang
8d60001d69 radv: enable protected memory
Advertise protectedMemory feature for application when TMZ is available

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Julia Zhang
1f9d1366f8 radv: save protected queue and non-protected queue seperately
Save protected radv_queue in device->queues_protected so it can be
relased in radv_destroy_device.

Without this, device->queues[] will point to a new queues to record
the queue created according to the queueCreateInfo. When queueCreateInfo
include both protected and unprotected queue info, the device->queues[]
will be created twice and record one queue at each time. So we will lose
either protected queue or unprotected queue which created first.

Signed-off-by: Julia Zhang <Julia.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Julia Zhang
0e36d7112c radv: set TMZ bit in sdma_copy packet
Pass secure and set TMZ bit in sdma_copy packet for protected image

Signed-off-by: Julia Zhang <Julia.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Julia Zhang
bfc54d444d radv: enable surface protected capability
Pass protected support flag to wsi_device to enable surface protected
capability when radv_physical_device::has_tmz_support.

Signed-off-by: Julia Zhang <Julia.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Julia Zhang
60bd766299 radv: create encrypted BOs for protected cmd_buffers
Create encrypted fence_bo and eop_bug_bo when the radv_cmd_buffer is
created from a protected pool which is marked with flag
VK_COMMAND_POOL_CREATE_PROTECTED_BIT

Signed-off-by: Julia Zhang <Julia.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Julia Zhang
501f72bc89 radv: allocate encrypted rings BOs
Pass secure flag to radv_update_preamble_cs() if this queue is created
with vk flag VK_QUEUE_PROTECTED_BIT and create encrypted tess/ge ring
BOs and compute_scratch_bo according to this secure flag.

Signed-off-by: Julia Zhang <Julia.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Trigger Huang
68db27f0b4 radv: add protected type bits for memory requirements
Add protected type bits for memory requirements of protected resources

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:34 +00:00
Trigger Huang
540864685d radv: support secure submission
Set AMDGPU_IB_FLAGS_SECURE on IBs to support secure submission

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:33 +00:00
Trigger Huang
535207a075 radv: allow creation of protected queues
Advertise VK_QUEUE_PROTECTED_BIT on gfx and transfer queues to allow
creation of protected queues.

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:33 +00:00
Trigger Huang
af35a99435 radv: supports protected memory allocation
Add memory type for protected memory to support TMZ encrypted memory
allocation

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
2026-04-27 09:03:33 +00:00