tests: check if vulkan h264 decoding is supported

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4716>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-05-23 11:52:36 +02:00
parent 365454790a
commit b982fae9c7

View file

@ -33,15 +33,19 @@ static GstVulkanQueue *queue = NULL;
static gboolean static gboolean
_choose_queue (GstVulkanDevice * device, GstVulkanQueue * _queue, gpointer data) _choose_queue (GstVulkanDevice * device, GstVulkanQueue * _queue, gpointer data)
{ {
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
guint flags = guint flags =
device->physical_device->queue_family_props[_queue->family].queueFlags; 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)); gst_object_replace ((GstObject **) & queue, GST_OBJECT_CAST (_queue));
return FALSE; return FALSE;
} }
#endif
return TRUE; return TRUE;
} }
@ -175,9 +179,23 @@ GST_START_TEST (test_decoding_image)
}; };
/* *INDENT-ON* */ /* *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) if (!queue)
return; 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); dec_caps = gst_vulkan_video_profile_to_caps (&profile);
fail_unless (dec_caps); fail_unless (dec_caps);