vkphysicaldevice: fetch queue family video codec operations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-03-20 20:44:28 +01:00 committed by GStreamer Marge Bot
parent dde60fab37
commit 83160fb47c
2 changed files with 36 additions and 4 deletions

View file

@ -260,6 +260,7 @@ gst_vulkan_physical_device_finalize (GObject * object)
g_free (priv->available_extensions); g_free (priv->available_extensions);
priv->available_extensions = NULL; priv->available_extensions = NULL;
g_free (device->queue_family_video_ops);
g_free (device->queue_family_props); g_free (device->queue_family_props);
device->queue_family_props = NULL; device->queue_family_props = NULL;
@ -559,10 +560,11 @@ dump_queue_properties (GstVulkanPhysicalDevice * device, GError ** error)
queue_family_props[i].queueFlags); queue_family_props[i].queueFlags);
GST_LOG_OBJECT (device, GST_LOG_OBJECT (device,
"queue family at index %i supports %i queues " "queue family at index %i supports %i queues "
"with flags (0x%x) \'%s\', %" G_GUINT32_FORMAT " timestamp bits and " "with flags (0x%x) \'%s\', video operations (0x%x), %" G_GUINT32_FORMAT
"a minimum image transfer granuality of %" GST_VULKAN_EXTENT3D_FORMAT, " timestamp bits and a minimum image transfer granuality of %"
i, device->queue_family_props[i].queueCount, GST_VULKAN_EXTENT3D_FORMAT, i, device->queue_family_props[i].queueCount,
device->queue_family_props[i].queueFlags, queue_flags_str, device->queue_family_props[i].queueFlags, queue_flags_str,
device->queue_family_video_ops[i],
device->queue_family_props[i].timestampValidBits, device->queue_family_props[i].timestampValidBits,
GST_VULKAN_EXTENT3D_ARGS (device-> GST_VULKAN_EXTENT3D_ARGS (device->
queue_family_props[i].minImageTransferGranularity)); queue_family_props[i].minImageTransferGranularity));
@ -1003,22 +1005,43 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device,
if (device->n_queue_families > 0) { if (device->n_queue_families > 0) {
VkQueueFamilyProperties2 *props; VkQueueFamilyProperties2 *props;
int i; int i;
void *next = NULL;
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
VkQueueFamilyVideoPropertiesKHR *queue_family_video_props;
queue_family_video_props =
g_new0 (VkQueueFamilyVideoPropertiesKHR, device->n_queue_families);
#endif
props = g_new0 (VkQueueFamilyProperties2, device->n_queue_families); props = g_new0 (VkQueueFamilyProperties2, device->n_queue_families);
for (i = 0; i < device->n_queue_families; i++) { for (i = 0; i < device->n_queue_families; i++) {
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
queue_family_video_props[i].sType =
VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR;
next = &queue_family_video_props[i];
#endif
props[i].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2; props[i].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2;
props[i].pNext = NULL; props[i].pNext = next;
} }
get_queue_props2 (device->device, &device->n_queue_families, props); get_queue_props2 (device->device, &device->n_queue_families, props);
device->queue_family_props = device->queue_family_props =
g_new0 (VkQueueFamilyProperties, device->n_queue_families); g_new0 (VkQueueFamilyProperties, device->n_queue_families);
device->queue_family_video_ops =
g_new (guint32, device->n_queue_families);
for (i = 0; i < device->n_queue_families; i++) { for (i = 0; i < device->n_queue_families; i++) {
memcpy (&device->queue_family_props[i], &props[i].queueFamilyProperties, memcpy (&device->queue_family_props[i], &props[i].queueFamilyProperties,
sizeof (device->queue_family_props[i])); sizeof (device->queue_family_props[i]));
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
device->queue_family_video_ops[i] =
queue_family_video_props[i].videoCodecOperations;
#endif
} }
g_free (props); g_free (props);
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
g_free (queue_family_video_props);
#endif
} }
} else } else
#endif #endif

View file

@ -65,6 +65,15 @@ struct _GstVulkanPhysicalDevice
VkQueueFamilyProperties *queue_family_props; VkQueueFamilyProperties *queue_family_props;
guint32 n_queue_families; guint32 n_queue_families;
/**
* GstVulkanPhysicalDevice.queue_family_video_ops:
*
* vulkan video operations allowed per queue family
*
* Since: 1.24
*/
guint32 *queue_family_video_ops;
/* <private> */ /* <private> */
gpointer _reserved [GST_PADDING]; gpointer _reserved [GST_PADDING];
}; };