radv: Support VK_IMAGE_TILING_OPTIMAL for quantization maps

Saw this when implementing something else, that I could just add the handling here to radv_choose_tiling in order to expose OPTIMAL.

Signed-off-by: Autumn Ashton <misyl@froggi.es>

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36943>
This commit is contained in:
Autumn Ashton 2025-08-22 20:57:42 +01:00 committed by Marge Bot
parent 70a2eec2ab
commit f4597930ef
3 changed files with 12 additions and 9 deletions

View file

@ -826,6 +826,10 @@ radv_check_modifier_support(struct radv_physical_device *pdev, const VkPhysicalD
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
/* QP map needs linear. */
if (info->usage & VK_IMAGE_USAGE_VIDEO_ENCODE_QUANTIZATION_DELTA_MAP_BIT_KHR && modifier != DRM_FORMAT_MOD_LINEAR)
return VK_ERROR_FORMAT_NOT_SUPPORTED;
/* We can expand this as needed and implemented but there is not much demand
* for more.
* Video can't support array layers with swizzle modes that use slice index

View file

@ -52,6 +52,9 @@ radv_choose_tiling(struct radv_device *device, const VkImageCreateInfo *pCreateI
pCreateInfo->usage & (VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR))
return RADEON_SURF_MODE_LINEAR_ALIGNED;
if (pCreateInfo->usage & VK_IMAGE_USAGE_VIDEO_ENCODE_QUANTIZATION_DELTA_MAP_BIT_KHR)
return RADEON_SURF_MODE_LINEAR_ALIGNED;
/* MSAA resources must be 2D tiled. */
if (pCreateInfo->samples > 1)
return RADEON_SURF_MODE_2D;

View file

@ -1289,17 +1289,13 @@ radv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
VkImageTiling tiling[3];
uint32_t num_tiling = 0;
if (qp_map) {
tiling[num_tiling++] = VK_IMAGE_TILING_OPTIMAL;
if ((src_dst || qp_map) && !dpb)
tiling[num_tiling++] = VK_IMAGE_TILING_LINEAR;
} else {
tiling[num_tiling++] = VK_IMAGE_TILING_OPTIMAL;
if (src_dst && !dpb)
tiling[num_tiling++] = VK_IMAGE_TILING_LINEAR;
if (src_dst && pdev->info.gfx_level >= GFX9)
tiling[num_tiling++] = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
}
if ((src_dst || qp_map) && pdev->info.gfx_level >= GFX9)
tiling[num_tiling++] = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
VK_OUTARRAY_MAKE_TYPED(VkVideoFormatPropertiesKHR, out, pVideoFormatProperties, pVideoFormatPropertyCount);