From fd0c70adedaf9d77d78b55e999a52c0087deda47 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 15 Jul 2025 12:17:23 +0200 Subject: [PATCH] radv/video: Add bit depth and profile check for VP9 decode Fixes: b8ac2d47e79 ("radv/video: add KHR_video_decode_vp9 support.") Reviewed-by: Dave Airlie Part-of: --- src/amd/vulkan/radv_video.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index 98b8abb2ffa..044f8377b0d 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -861,6 +861,18 @@ radv_GetPhysicalDeviceVideoCapabilitiesKHR(VkPhysicalDevice physicalDevice, cons case VK_VIDEO_CODEC_OPERATION_DECODE_VP9_BIT_KHR: { struct VkVideoDecodeVP9CapabilitiesKHR *ext = vk_find_struct(pCapabilities->pNext, VIDEO_DECODE_VP9_CAPABILITIES_KHR); + + const struct VkVideoDecodeVP9ProfileInfoKHR *vp9_profile = + vk_find_struct_const(pVideoProfile->pNext, VIDEO_DECODE_VP9_PROFILE_INFO_KHR); + + if (vp9_profile->stdProfile != STD_VIDEO_VP9_PROFILE_0 && + vp9_profile->stdProfile != STD_VIDEO_VP9_PROFILE_2) + 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 = RADV_VIDEO_VP9_MAX_DPB_SLOTS; pCapabilities->maxActiveReferencePictures = RADV_VIDEO_VP9_MAX_NUM_REF_FRAME; if (pdev->info.vcn_ip_version >= VCN_3_0_0)