From f7ff9b240df43e3a7446e232aedae73c5a7154b4 Mon Sep 17 00:00:00 2001 From: Hyunjun Ko Date: Thu, 27 Feb 2025 11:44:14 +0900 Subject: [PATCH] anv: Do not support the tiling of DRM modifier if DECODE_DST Fixes: 04709e4f ("anv: fix video profile lists"); Signed-off-by: Hyunjun Ko Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_video.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/intel/vulkan/anv_video.c b/src/intel/vulkan/anv_video.c index 111a3c33d27..09f068ec615 100644 --- a/src/intel/vulkan/anv_video.c +++ b/src/intel/vulkan/anv_video.c @@ -345,6 +345,14 @@ anv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice, const struct VkVideoProfileListInfoKHR *prof_list = (struct VkVideoProfileListInfoKHR *) vk_find_struct_const(pVideoFormatInfo->pNext, VIDEO_PROFILE_LIST_INFO_KHR); + /* We only support VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT with + * Y-tiling/Tile4, as supported by the hardware for video decoding. + * However, we are unable to determine the tiling without modifiers here. + * So just disable them all. + */ + const bool decode_dst = !!(pVideoFormatInfo->imageUsage & + VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR); + if (prof_list) { for (unsigned i = 0; i < prof_list->profileCount; i++) { const VkVideoProfileInfoKHR *profile = &prof_list->pProfiles[i]; @@ -359,12 +367,14 @@ anv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice, p->imageUsageFlags = pVideoFormatInfo->imageUsage; } - vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p) { - p->format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; - p->imageCreateFlags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; - p->imageType = VK_IMAGE_TYPE_2D; - p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT; - p->imageUsageFlags = pVideoFormatInfo->imageUsage; + if (!decode_dst) { + vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p) { + p->format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM; + p->imageCreateFlags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; + p->imageType = VK_IMAGE_TYPE_2D; + p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT; + p->imageUsageFlags = pVideoFormatInfo->imageUsage; + } } } @@ -377,12 +387,14 @@ anv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice, p->imageTiling = VK_IMAGE_TILING_OPTIMAL; p->imageUsageFlags = pVideoFormatInfo->imageUsage; } - vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p) { - p->format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16; - p->imageCreateFlags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; - p->imageType = VK_IMAGE_TYPE_2D; - p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT; - p->imageUsageFlags = pVideoFormatInfo->imageUsage; + if (!decode_dst) { + vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p) { + p->format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16; + p->imageCreateFlags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; + p->imageType = VK_IMAGE_TYPE_2D; + p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT; + p->imageUsageFlags = pVideoFormatInfo->imageUsage; + } } } }