From 5ce784e5c9354f3ffd9ade8dde8a0fe4e8485f70 Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 13 Jun 2023 17:50:29 +0200 Subject: [PATCH] radv/video: reject unsupported hevc profiles and bit depths Reviewed-by: Dave Airlie Part-of: --- src/amd/vulkan/radv_video.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index 5f3ad6bf51a..07016cae151 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -468,6 +468,20 @@ radv_GetPhysicalDeviceVideoCapabilitiesKHR(VkPhysicalDevice physicalDevice, case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR: { struct VkVideoDecodeH265CapabilitiesKHR *ext = (struct VkVideoDecodeH265CapabilitiesKHR *) vk_find_struct(pCapabilities->pNext, VIDEO_DECODE_H265_CAPABILITIES_KHR); + + const struct VkVideoDecodeH265ProfileInfoKHR *h265_profile = + vk_find_struct_const(pVideoProfile->pNext, + VIDEO_DECODE_H265_PROFILE_INFO_KHR); + + if (h265_profile->stdProfileIdc != STD_VIDEO_H265_PROFILE_IDC_MAIN && + h265_profile->stdProfileIdc != STD_VIDEO_H265_PROFILE_IDC_MAIN_10 && + h265_profile->stdProfileIdc != STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE) + return VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR; + + if (pVideoProfile->lumaBitDepth != VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR && + pVideoProfile->lumaBitDepth != VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR) + return VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR; + pCapabilities->maxDpbSlots = NUM_H264_REFS; pCapabilities->maxActiveReferencePictures = NUM_H265_REFS; /* for h265 on navi21+ separate dpb images should work */