diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.c index edd1ba4003..7134c7b8d3 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkoperation.c @@ -23,7 +23,7 @@ #endif #include "gstvkoperation.h" -#include "gstvkphysicaldevice-private.h" +#include "gstvkvideo-private.h" /** * SECTION:vkoperation @@ -146,34 +146,7 @@ gst_vulkan_operation_get_property (GObject * object, guint prop_id, } } -static gboolean -_video_maintenance1_supported (GstVulkanOperation * self) -{ -#if defined(VK_KHR_video_maintenance1) - GstVulkanOperationPrivate *priv; - GstVulkanDevice *device; - const VkPhysicalDeviceFeatures2 *features; - const VkBaseOutStructure *iter; - g_return_val_if_fail (GST_IS_VULKAN_OPERATION (self), FALSE); - - priv = GET_PRIV (self); - - device = priv->cmd_pool->queue->device; - - features = gst_vulkan_physical_device_get_features (device->physical_device); - for (iter = (const VkBaseOutStructure *) features; iter; iter = iter->pNext) { - - if (iter->sType == - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR) { - const VkPhysicalDeviceVideoMaintenance1FeaturesKHR *video_maintenance1 = - (const VkPhysicalDeviceVideoMaintenance1FeaturesKHR *) iter; - return video_maintenance1->videoMaintenance1; - } - } -#endif - return FALSE; -} static void gst_vulkan_operation_constructed (GObject * object) @@ -215,7 +188,7 @@ gst_vulkan_operation_constructed (GObject * object) priv->has_video = gst_vulkan_device_is_extension_enabled (device, VK_KHR_VIDEO_QUEUE_EXTENSION_NAME); #endif - priv->has_video_maintenance1 = _video_maintenance1_supported (self); + priv->has_video_maintenance1 = gst_vulkan_video_has_maintenance1 (device); #if defined(VK_KHR_timeline_semaphore) priv->has_timeline = gst_vulkan_device_is_extension_enabled (device, diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c index 64a79bc958..69bb5e6382 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c @@ -23,6 +23,7 @@ #endif #include "gstvkvideo-private.h" +#include "gstvkphysicaldevice-private.h" #include "gstvkinstance.h" #include @@ -114,6 +115,12 @@ gst_vulkan_video_session_create (GstVulkanVideoSession * session, g_return_val_if_fail (vk, FALSE); g_return_val_if_fail (session_create, FALSE); +#if defined(VK_KHR_video_maintenance1) + if (gst_vulkan_video_has_maintenance1 (device)) { + session_create->flags |= VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR; + } +#endif + res = vk->CreateVideoSession (device->device, session_create, NULL, &vk_session); if (gst_vulkan_error_to_g_error (res, error, "vkCreateVideoSessionKHR") @@ -312,3 +319,23 @@ gst_vulkan_video_image_create_view (GstBuffer * buf, gboolean layered_dpb, return gst_vulkan_get_or_create_image_view_with_info (vkmem, &view_create_info); } + +gboolean +gst_vulkan_video_has_maintenance1 (GstVulkanDevice * device) +{ +#if defined(VK_KHR_video_maintenance1) + const VkPhysicalDeviceFeatures2 *features; + const VkBaseOutStructure *iter; + + features = gst_vulkan_physical_device_get_features (device->physical_device); + for (iter = (const VkBaseOutStructure *) features; iter; iter = iter->pNext) { + if (iter->sType == + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR) { + const VkPhysicalDeviceVideoMaintenance1FeaturesKHR *video_maintenance1 = + (const VkPhysicalDeviceVideoMaintenance1FeaturesKHR *) iter; + return video_maintenance1->videoMaintenance1; + } + } +#endif + return FALSE; +} diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.h b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.h index 3ae6a2f600..a1cbddc8f4 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.h @@ -97,4 +97,6 @@ GstVulkanImageView * gst_vulkan_video_image_create_view (GstBuffer * buf, gboolean is_out, GstVulkanHandle * sampler); +gboolean gst_vulkan_video_has_maintenance1 (GstVulkanDevice * device); + G_END_DECLS