vkoperation: support for query_result_status

query_result_status can be optional so we should not create
the query pool if the queue does not support it,
ie, AMD does not support VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR

In other use case such as VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR, the
query pool must be created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7043>
This commit is contained in:
Stéphane Cerveau 2024-03-22 12:32:22 +01:00 committed by GStreamer Marge Bot
parent 71ebb20267
commit f40d947c4a

View file

@ -1202,8 +1202,10 @@ gst_vulkan_operation_enable_query (GstVulkanOperation * self,
VkQueryType query_type, guint n_queries, gpointer pnext, GError ** error)
{
GstVulkanOperationPrivate *priv;
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
GstVulkanPhysicalDevice *device;
guint32 queue_family;
#endif
VkQueryPoolCreateInfo query_pool_info = {
.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO,
.pNext = pnext,
@ -1221,15 +1223,24 @@ gst_vulkan_operation_enable_query (GstVulkanOperation * self,
if (priv->query_pool)
return TRUE;
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
queue_family = priv->cmd_pool->queue->family;
device = priv->cmd_pool->queue->device->physical_device;
if (!device->queue_family_ops[queue_family].query_result_status) {
/*
* The VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR can be optional, so .query_result_status
* can be FALSE, see AMD's case.
* vkCreateQueryPool needs to be called when the query is
* VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR to enable it anyway.
*/
if (!device->queue_family_ops[queue_family].query_result_status &&
query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR) {
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_FEATURE_NOT_PRESENT,
"Queue %" GST_PTR_FORMAT
" doesn't support result status query operations",
priv->cmd_pool->queue);
return FALSE;
}
#endif
res = vkCreateQueryPool (priv->cmd_pool->queue->device->device,
&query_pool_info, NULL, &priv->query_pool);