[Mesa-dev] [PATCH 26/56] anv/device: GetDeviceQueue2 should only return queues with matching flags

Jason Ekstrand jason at jlekstrand.net
Wed Mar 7 14:35:14 UTC 2018


From: Iago Toral Quiroga <itoral at igalia.com>

>From the Vulkan 1.1 spec, VkDeviceQueueInfo2 structure:

   "The queue returned by vkGetDeviceQueue2 must have the same flags value
    from this structure as that used at device creation time in a
    VkDeviceQueueCreateInfo instance. If no matching flags were specified
    at device creation time then pQueue will return VK_NULL_HANDLE."

For us this means no flags at all since we don't support any.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/intel/vulkan/anv_device.c  | 6 +++++-
 src/intel/vulkan/anv_private.h | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 7d63168..bccb669 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1273,6 +1273,7 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue)
    queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
    queue->device = device;
    queue->pool = &device->surface_state_pool;
+   queue->flags = 0;
 }
 
 static void
@@ -1755,7 +1756,10 @@ void anv_GetDeviceQueue2(
 
    assert(pQueueInfo->queueIndex == 0);
 
-   *pQueue = anv_queue_to_handle(&device->queue);
+   if (pQueueInfo->flags == device->queue.flags)
+      *pQueue = anv_queue_to_handle(&device->queue);
+   else
+      *pQueue = NULL;
 }
 
 VkResult
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 34e6159..ee53358 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -839,6 +839,8 @@ struct anv_queue {
     struct anv_device *                         device;
 
     struct anv_state_pool *                     pool;
+
+    VkDeviceQueueCreateFlags                    flags;
 };
 
 struct anv_pipeline_cache {
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list