From b30462535b9d4ea83bda3f1dc4339bfcb7903903 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 15 Aug 2024 14:24:13 +1000 Subject: [PATCH] radv/video: add KHR_video_maintenance1 support This just adds support for allowing worst case image sizing with no specified profiles and for using inline queries. Reviewed-by: Lynne Reviewed-by: Samuel Pitoiset Part-of: --- docs/relnotes/new_features.txt | 1 + src/amd/vulkan/radv_image.c | 3 ++- src/amd/vulkan/radv_physical_device.c | 4 ++++ src/amd/vulkan/radv_video.c | 18 +++++++++++------- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 9f672523186..a591f2526bf 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -1,3 +1,4 @@ Expose Vulkan 1.3 on v3dv, both rpi4 and rpi5 VK_EXT_descriptor_buffer on nvk VK_EXT_post_depth_coverage on nvk +VK_KHR_video_maintenance1 on radv diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 7e6dc172591..118ff61e091 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -1102,7 +1102,8 @@ radv_image_create_layout(struct radv_device *device, struct radv_image_create_in if (image->vk.usage & (VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR)) { - assert(profile_list); + if (!device->vk.enabled_features.videoMaintenance1) + assert(profile_list); uint32_t width_align, height_align; radv_video_get_profile_alignments(pdev, profile_list, &width_align, &height_align); image_info.width = align(image_info.width, width_align); diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 6f75dda8cac..0a6cffda419 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -573,6 +573,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .KHR_uniform_buffer_standard_layout = true, .KHR_variable_pointers = true, .KHR_vertex_attribute_divisor = true, + .KHR_video_maintenance1 = true, .KHR_video_queue = !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE) || pdev->video_encode_enabled, .KHR_video_decode_av1 = (pdev->info.vcn_ip_version >= VCN_3_0_0 && pdev->info.vcn_ip_version != VCN_3_0_33 && VIDEO_CODEC_AV1DEC && !!(instance->perftest_flags & RADV_PERFTEST_VIDEO_DECODE)), @@ -1233,6 +1234,9 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc /* VK_KHR_maintenance7 */ .maintenance7 = true, + + /* VK_KHR_video_maintenance1 */ + .videoMaintenance1 = true, }; } diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index daa4e295500..cf49cbb4d85 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -2706,14 +2706,18 @@ radv_video_get_profile_alignments(struct radv_physical_device *pdev, const VkVid { vk_video_get_profile_alignments(profile_list, width_align_out, height_align_out); bool is_h265_main_10 = false; - for (unsigned i = 0; i < profile_list->profileCount; i++) { - if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR) { - const struct VkVideoDecodeH265ProfileInfoKHR *h265_profile = - vk_find_struct_const(profile_list->pProfiles[i].pNext, VIDEO_DECODE_H265_PROFILE_INFO_KHR); - if (h265_profile->stdProfileIdc == STD_VIDEO_H265_PROFILE_IDC_MAIN_10) - is_h265_main_10 = true; + + if (profile_list) { + for (unsigned i = 0; i < profile_list->profileCount; i++) { + if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR) { + const struct VkVideoDecodeH265ProfileInfoKHR *h265_profile = + vk_find_struct_const(profile_list->pProfiles[i].pNext, VIDEO_DECODE_H265_PROFILE_INFO_KHR); + if (h265_profile->stdProfileIdc == STD_VIDEO_H265_PROFILE_IDC_MAIN_10) + is_h265_main_10 = true; + } } - } + } else + is_h265_main_10 = true; uint32_t db_alignment = radv_video_get_db_alignment(pdev, 64, is_h265_main_10); *width_align_out = MAX2(*width_align_out, db_alignment);