From 1234a01ddae331780dd757eb3d8f502af1b58bc4 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 16 May 2026 16:27:22 +0200 Subject: [PATCH] radv: add radv_force_64_byte_sampled_image dri conf option Cc: mesa-stable Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_device.c | 1 + src/amd/vulkan/radv_instance.c | 2 ++ src/amd/vulkan/radv_instance.h | 1 + src/amd/vulkan/radv_physical_device.c | 2 ++ src/amd/vulkan/radv_physical_device.h | 5 ++++- src/amd/vulkan/radv_shader.h | 3 ++- src/util/driconf.h | 4 ++++ 7 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 439af9d1b23..3d807a41626 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1166,6 +1166,7 @@ radv_device_init_compiler_info(struct radv_device *device) .mesh_shader_queries = mesh_shader_queries, .image_2d_view_of_3d = image_2d_view_of_3d, .use_fmask = pdev->use_fmask, + .force_64_byte_sampled_image = pdev->force_64_byte_sampled_image, .robust_buffer_access = pdev->use_llvm && (device->vk.enabled_features.robustBufferAccess2 || device->vk.enabled_features.robustBufferAccess), .mitigate_smem_oob = pdev->info.compiler_info.has_smem_oob_access_bug && diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c index 1bfc7baabcf..8eadd39cd0b 100644 --- a/src/amd/vulkan/radv_instance.c +++ b/src/amd/vulkan/radv_instance.c @@ -234,6 +234,7 @@ static const driOptionDescription radv_dri_options[] = { DRI_CONF_RADV_WAIT_FOR_VM_MAP_UPDATES(false) DRI_CONF_RADV_NO_IMPLICIT_VARYING_SUBGROUP_SIZE(false) DRI_CONF_RADV_HIDE_REBAR_ON_DGPU(false) + DRI_CONF_RADV_FORCE_64_BYTE_SAMPLED_IMAGE(false) DRI_CONF_SECTION_END }; // clang-format on @@ -280,6 +281,7 @@ radv_init_dri_debug_options(struct radv_instance *instance) drirc->debug.rt_wave64 = driQueryOptionb(&drirc->options, "radv_rt_wave64"); drirc->debug.hide_rebar_on_dgpu = driQueryOptionb(&drirc->options, "radv_hide_rebar_on_dgpu"); + drirc->debug.force_64_byte_sampled_image = driQueryOptionb(&drirc->options, "radv_force_64_byte_sampled_image"); } static void diff --git a/src/amd/vulkan/radv_instance.h b/src/amd/vulkan/radv_instance.h index a9c24cd9ff6..e9c4a9f32c1 100644 --- a/src/amd/vulkan/radv_instance.h +++ b/src/amd/vulkan/radv_instance.h @@ -61,6 +61,7 @@ struct radv_drirc { bool no_implicit_varying_subgroup_size; bool rt_wave64; bool hide_rebar_on_dgpu; + bool force_64_byte_sampled_image; char *app_layer; int override_uniform_offset_alignment; } debug; diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index e395f3a6e21..caac379d12c 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -2591,6 +2591,8 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm pdev->use_fmask = pdev->info.compiler_info.has_fmask && !(instance->debug_flags & RADV_DEBUG_NO_FMASK); + pdev->force_64_byte_sampled_image = !pdev->use_fmask && instance->drirc.debug.force_64_byte_sampled_image; + pdev->use_hiz = !(instance->debug_flags & RADV_DEBUG_NO_HIZ); if (pdev->info.gfx_level == GFX12) { diff --git a/src/amd/vulkan/radv_physical_device.h b/src/amd/vulkan/radv_physical_device.h index d03249911ad..e444ff4c0ba 100644 --- a/src/amd/vulkan/radv_physical_device.h +++ b/src/amd/vulkan/radv_physical_device.h @@ -89,6 +89,9 @@ struct radv_physical_device { /* Whether to enable FMASK compression for MSAA textures (GFX6-GFX10.3) */ bool use_fmask; + /* Whether to use space for 2 descriptors for sampled image descriptors, even when fmask is disabled. */ + bool force_64_byte_sampled_image; + /* Whether to enable HTILE compression for depth/stencil images. */ bool use_hiz; @@ -274,7 +277,7 @@ static inline uint32_t radv_get_sampled_image_desc_size(const struct radv_physical_device *pdev) { /* Main descriptor + FMASK desccriptor if needed. */ - return 32 + (pdev->use_fmask ? 32 : 0); + return 32 + (pdev->use_fmask || pdev->force_64_byte_sampled_image ? 32 : 0); } static inline uint32_t diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 726ee6c772e..b030a1c19e4 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -525,6 +525,7 @@ struct radv_compiler_info { uint32_t mesh_shader_queries : 1; uint32_t image_2d_view_of_3d : 1; uint32_t use_fmask : 1; + uint32_t force_64_byte_sampled_image : 1; uint32_t robust_buffer_access : 1; /* Only used by LLVM. */ uint32_t mitigate_smem_oob : 1; uint32_t mitigate_smem_with_null_prt : 1; @@ -544,7 +545,7 @@ struct radv_compiler_info { uint32_t tex_non_uniform : 1; uint32_t lower_terminate_to_discard : 1; uint32_t no_implicit_varying_subgroup_size : 1; - uint32_t padding : 31; + uint32_t padding : 30; int32_t force_aniso; diff --git a/src/util/driconf.h b/src/util/driconf.h index b1d6eafd826..a3289c202bc 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -862,6 +862,10 @@ DRI_CONF_OPT_B(radv_hide_rebar_on_dgpu, def, \ "Hide resizable bar on dGPUs by exposing a fake carveout of 256MiB.") +#define DRI_CONF_RADV_FORCE_64_BYTE_SAMPLED_IMAGE(def) \ + DRI_CONF_OPT_B(radv_force_64_byte_sampled_image, def, \ + "Force sampled images size to 64 bytes.") + /** * \brief ANV specific configuration options */