vkdevice: add callback iteration over the device queue's

This commit is contained in:
Matthew Waters 2016-02-16 11:49:24 +11:00
parent eb4419b49b
commit ca8f2b0826
2 changed files with 27 additions and 0 deletions

View file

@ -349,6 +349,28 @@ gst_vulkan_device_get_queue (GstVulkanDevice * device, guint32 queue_family,
return ret; return ret;
} }
void
gst_vulkan_device_foreach_queue (GstVulkanDevice * device,
GstVulkanDeviceForEachQueueFunc func, gpointer user_data)
{
gboolean done = FALSE;
guint i;
for (i = 0; i < device->n_queues; i++) {
GstVulkanQueue *queue =
queue =
gst_vulkan_device_get_queue (device, device->queue_family_id, i);
if (!func (device, queue, user_data))
done = TRUE;
gst_object_unref (queue);
if (done)
break;
}
}
gpointer gpointer
gst_vulkan_device_get_proc_address (GstVulkanDevice * device, gst_vulkan_device_get_proc_address (GstVulkanDevice * device,
const gchar * name) const gchar * name)

View file

@ -36,6 +36,8 @@ GType gst_vulkan_device_get_type (void);
#define GST_VULKAN_DEVICE_CONTEXT_TYPE_STR "gst.vulkan.device" #define GST_VULKAN_DEVICE_CONTEXT_TYPE_STR "gst.vulkan.device"
typedef gboolean (*GstVulkanDeviceForEachQueueFunc) (GstVulkanDevice * device, GstVulkanQueue * queue, gpointer user_data);
struct _GstVulkanDevice struct _GstVulkanDevice
{ {
GstObject parent; GstObject parent;
@ -71,6 +73,9 @@ gboolean gst_vulkan_device_open (GstVulkanDevice * d
gpointer gst_vulkan_device_get_proc_address (GstVulkanDevice * device, gpointer gst_vulkan_device_get_proc_address (GstVulkanDevice * device,
const gchar * name); const gchar * name);
void gst_vulkan_device_foreach_queue (GstVulkanDevice * device,
GstVulkanDeviceForEachQueueFunc func,
gpointer user_data);
GstVulkanQueue * gst_vulkan_device_get_queue (GstVulkanDevice * device, GstVulkanQueue * gst_vulkan_device_get_queue (GstVulkanDevice * device,
guint32 queue_family, guint32 queue_family,
guint32 queue_i); guint32 queue_i);