From b982fae9c75325114021f4be7252b1e617ed07cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 23 May 2023 11:52:36 +0200 Subject: [PATCH] tests: check if vulkan h264 decoding is supported Part-of: --- .../tests/check/libs/vkimagebufferpool.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-bad/tests/check/libs/vkimagebufferpool.c b/subprojects/gst-plugins-bad/tests/check/libs/vkimagebufferpool.c index 437b43d56a..fc27967786 100644 --- a/subprojects/gst-plugins-bad/tests/check/libs/vkimagebufferpool.c +++ b/subprojects/gst-plugins-bad/tests/check/libs/vkimagebufferpool.c @@ -33,15 +33,19 @@ static GstVulkanQueue *queue = NULL; static gboolean _choose_queue (GstVulkanDevice * device, GstVulkanQueue * _queue, gpointer data) { -#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS guint flags = device->physical_device->queue_family_props[_queue->family].queueFlags; + guint expected_flags = VK_QUEUE_COMPUTE_BIT; - if ((flags & VK_QUEUE_COMPUTE_BIT) != 0) { +#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS + if (data) + expected_flags = VK_QUEUE_VIDEO_DECODE_BIT_KHR; +#endif + + if ((flags & expected_flags) != 0) { gst_object_replace ((GstObject **) & queue, GST_OBJECT_CAST (_queue)); return FALSE; } -#endif return TRUE; } @@ -175,9 +179,23 @@ GST_START_TEST (test_decoding_image) }; /* *INDENT-ON* */ + /* force to use a queue with decoding support */ + if (queue && (device->physical_device->queue_family_ops[queue->family].video + & VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) == 0) + gst_clear_object (&queue); + + if (!queue) { + gst_vulkan_device_foreach_queue (device, _choose_queue, + GUINT_TO_POINTER (1)); + } + if (!queue) return; + if ((device->physical_device->queue_family_ops[queue->family].video + & VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) == 0) + return; + dec_caps = gst_vulkan_video_profile_to_caps (&profile); fail_unless (dec_caps);