vulkan{up,down}load: check for a graphics family queue

Vulkan queue retrieved from peer elements should be a graphics family one.
Otherwise, get a compatible queue from the given device.

Co-Authored-By: Víctor Jáquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7162>
This commit is contained in:
Stéphane Cerveau 2023-12-21 09:32:25 +01:00 committed by GStreamer Marge Bot
parent 800961cf28
commit 9736b9e7b7
2 changed files with 34 additions and 7 deletions

View file

@ -585,16 +585,29 @@ gst_vulkan_download_change_state (GstElement * element,
}
}
if (!gst_vulkan_queue_run_context_query (GST_ELEMENT (vk_download),
if (gst_vulkan_queue_run_context_query (GST_ELEMENT (vk_download),
&vk_download->queue)) {
GST_DEBUG_OBJECT (vk_download, "No queue retrieved from peer elements");
guint32 flags, idx;
GST_DEBUG_OBJECT (vk_download, "Queue retrieved from peer elements");
idx = vk_download->queue->family;
flags = vk_download->device->physical_device->queue_family_props[idx]
.queueFlags;
if ((flags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_TRANSFER_BIT)) == 0) {
GST_DEBUG_OBJECT (vk_download,
"Queue does not support VK_QUEUE_GRAPHICS_BIT with VK_QUEUE_TRANSFER_BIT");
gst_clear_object (&vk_download->queue);
}
}
if (!vk_download->queue) {
vk_download->queue =
gst_vulkan_device_select_queue (vk_download->device,
VK_QUEUE_GRAPHICS_BIT);
}
if (!vk_download->queue) {
GST_ELEMENT_ERROR (vk_download, RESOURCE, NOT_FOUND,
("Failed to create/retrieve vulkan queue"), (NULL));
("Failed to create/retrieve a valid vulkan queue"), (NULL));
return GST_STATE_CHANGE_FAILURE;
}
break;

View file

@ -1165,17 +1165,31 @@ gst_vulkan_upload_change_state (GstElement * element, GstStateChange transition)
return GST_STATE_CHANGE_FAILURE;
}
}
if (!gst_vulkan_queue_run_context_query (GST_ELEMENT (vk_upload),
// Issue with NVIDIA driver where the output gets artifacts if I select another
// queue seen the codec one does not support VK_QUEUE_GRAPHICS_BIT but VK_QUEUE_TRANSFER_BIT.
if (gst_vulkan_queue_run_context_query (GST_ELEMENT (vk_upload),
&vk_upload->queue)) {
GST_DEBUG_OBJECT (vk_upload, "No queue retrieved from peer elements");
guint32 flags, idx;
GST_DEBUG_OBJECT (vk_upload, "Queue retrieved from peer elements");
idx = vk_upload->queue->family;
flags = vk_upload->device->physical_device->queue_family_props[idx]
.queueFlags;
if ((flags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_TRANSFER_BIT)) == 0) {
GST_DEBUG_OBJECT (vk_upload,
"Queue does not support VK_QUEUE_GRAPHICS_BIT with VK_QUEUE_TRANSFER_BIT");
gst_clear_object (&vk_upload->queue);
}
}
if (!vk_upload->queue) {
vk_upload->queue =
gst_vulkan_device_select_queue (vk_upload->device,
VK_QUEUE_GRAPHICS_BIT);
}
if (!vk_upload->queue) {
GST_ELEMENT_ERROR (vk_upload, RESOURCE, NOT_FOUND,
("Failed to create/retrieve vulkan queue"), (NULL));
("Failed to create/retrieve a valid vulkan queue"), (NULL));
return GST_STATE_CHANGE_FAILURE;
}
break;