From 365454790a367ad80557e7dc38151eaf751c61cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 23 May 2023 12:26:37 +0200 Subject: [PATCH] vkphysicaldevice: fetch queue family query result support And merged in a single structure the queue family operations report. Part-of: --- girs/GstVulkan-1.0.gir | 15 +++++++++++-- .../gst-libs/gst/vulkan/gstvkphysicaldevice.c | 21 ++++++++++++++----- .../gst-libs/gst/vulkan/gstvkphysicaldevice.h | 19 ++++++++++++++--- .../gst-libs/gst/vulkan/vulkan_fwd.h | 1 + 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/girs/GstVulkan-1.0.gir b/girs/GstVulkan-1.0.gir index 9f686efcb5..6acc5b7fd3 100644 --- a/girs/GstVulkan-1.0.gir +++ b/girs/GstVulkan-1.0.gir @@ -4528,8 +4528,8 @@ called. number of elements in @queue_family_props - - + + @@ -4702,6 +4702,17 @@ See gst_vulkan_queue_submit_lock() for details on when this call is needed. + + + + video operation supported by queue family + + + + if queue family supports queries + + + diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c index b30a01dd08..28cb6b4947 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c @@ -261,7 +261,7 @@ gst_vulkan_physical_device_finalize (GObject * object) g_free (priv->available_extensions); priv->available_extensions = NULL; - g_free (device->queue_family_video_ops); + g_free (device->queue_family_ops); g_free (device->queue_family_props); device->queue_family_props = NULL; @@ -565,7 +565,7 @@ dump_queue_properties (GstVulkanPhysicalDevice * device, GError ** error) " timestamp bits and a minimum image transfer granuality of %" GST_VULKAN_EXTENT3D_FORMAT, i, device->queue_family_props[i].queueCount, device->queue_family_props[i].queueFlags, queue_flags_str, - device->queue_family_video_ops[i], + device->queue_family_ops[i].video, device->queue_family_props[i].timestampValidBits, GST_VULKAN_EXTENT3D_ARGS (device-> queue_family_props[i].minImageTransferGranularity)); @@ -1009,15 +1009,24 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device, void *next = NULL; #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS VkQueueFamilyVideoPropertiesKHR *queue_family_video_props; + VkQueueFamilyQueryResultStatusPropertiesKHR *queue_family_query_props; queue_family_video_props = g_new0 (VkQueueFamilyVideoPropertiesKHR, device->n_queue_families); + queue_family_query_props = + g_new0 (VkQueueFamilyQueryResultStatusPropertiesKHR, + device->n_queue_families); #endif props = g_new0 (VkQueueFamilyProperties2, device->n_queue_families); for (i = 0; i < device->n_queue_families; i++) { #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS + queue_family_query_props[i].sType = + VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_KHR; + queue_family_video_props[i].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR; + queue_family_video_props[i].pNext = &queue_family_query_props[i]; + next = &queue_family_video_props[i]; #endif props[i].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2; @@ -1028,15 +1037,17 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device, device->queue_family_props = g_new0 (VkQueueFamilyProperties, device->n_queue_families); - device->queue_family_video_ops = - g_new (guint32, device->n_queue_families); + device->queue_family_ops = + g_new0 (GstVulkanQueueFamilyOps, device->n_queue_families); for (i = 0; i < device->n_queue_families; i++) { memcpy (&device->queue_family_props[i], &props[i].queueFamilyProperties, sizeof (device->queue_family_props[i])); #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS - device->queue_family_video_ops[i] = + device->queue_family_ops[i].video = queue_family_video_props[i].videoCodecOperations; + device->queue_family_ops[i].query = + queue_family_query_props[i].queryResultStatusSupport; #endif } g_free (props); diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.h b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.h index 53544ad193..092cc7443e 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.h @@ -35,6 +35,19 @@ G_BEGIN_DECLS GST_VULKAN_API GType gst_vulkan_physical_device_get_type (void); +/** + * GstVulkanQueueFamilyOps: + * @video: video operation supported by queue family + * @query: if queue family supports queries + * + * Since: 1.24 + */ +struct _GstVulkanQueueFamilyOps +{ + guint32 video; + gboolean query; +}; + /** * GstVulkanPhysicalDevice: * @parent: the parent #GstObject @@ -66,13 +79,13 @@ struct _GstVulkanPhysicalDevice guint32 n_queue_families; /** - * GstVulkanPhysicalDevice.queue_family_video_ops: + * GstVulkanPhysicalDevice.queue_family_ops: * - * vulkan video operations allowed per queue family + * vulkan operations allowed per queue family * * Since: 1.24 */ - guint32 *queue_family_video_ops; + GstVulkanQueueFamilyOps *queue_family_ops; /* */ gpointer _reserved [GST_PADDING]; diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/vulkan_fwd.h b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/vulkan_fwd.h index dce0509ed3..0bfbbe256b 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/vulkan_fwd.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/vulkan_fwd.h @@ -111,6 +111,7 @@ typedef struct _GstVulkanFullScreenQuad GstVulkanFullScreenQuad; typedef struct _GstVulkanFullScreenQuadClass GstVulkanFullScreenQuadClass; typedef struct _GstVulkanFullScreenQuadPrivate GstVulkanFullScreenQuadPrivate; +typedef struct _GstVulkanQueueFamilyOps GstVulkanQueueFamilyOps; typedef struct _GstVulkanVideoProfile GstVulkanVideoProfile; G_END_DECLS