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 <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35974>
This commit is contained in:
Samuel Pitoiset 2025-07-04 13:18:22 +02:00 committed by Marge Bot
parent d89b11011f
commit 031843ebb1

View file

@ -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: