From 031843ebb14e3c8f18660d56c02035db8493c846 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 4 Jul 2025 13:18:22 +0200 Subject: [PATCH] radv: add support for querying HIC performance info On GFX12, everything is compressed with DCC and it's completely transparent to the userspace driver, so that should be optimal. On older gens, using HIC disables compression which isn't optimal for device access. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_formats.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 3f3c06d8ab6..498512c805a 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -1184,6 +1184,7 @@ radv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, VkSamplerYcbcrConversionImageFormatProperties *ycbcr_props = NULL; VkTextureLODGatherFormatPropertiesAMD *texture_lod_props = NULL; VkImageCompressionPropertiesEXT *image_compression_props = NULL; + VkHostImageCopyDevicePerformanceQueryEXT *host_perf_props = NULL; VkResult result; VkFormat format = radv_select_android_external_format(base_info->pNext, base_info->format); @@ -1220,6 +1221,9 @@ radv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: image_compression_props = (void *)s; break; + case VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT: + host_perf_props = (void *)s; + break; default: break; } @@ -1287,6 +1291,20 @@ radv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, } } + if (host_perf_props) { + bool might_enable_compression = false; + + if (vk_format_is_depth_or_stencil(format)) { + might_enable_compression |= pdev->use_hiz && (base_info->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT); + } else { + might_enable_compression |= + !(instance->debug_flags & RADV_DEBUG_NO_DCC) && (base_info->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); + } + + host_perf_props->optimalDeviceAccess = pdev->info.gfx_level >= GFX12 || !might_enable_compression; + host_perf_props->identicalMemoryLayout = pdev->info.gfx_level >= GFX12 || !might_enable_compression; + } + return VK_SUCCESS; fail: