summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2018-03-13 21:54:53 +0100
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2018-03-14 09:53:42 +0100
commit38f34117dd11ec92e9fda0157b52fa215e310275 (patch)
tree1913a15bf582d51d223990686634df8a7f9b4ca1
parent25a966a23d397cdfd853bc3ee54a11cf3bd3f84d (diff)
radv: fix vkGetDeviceQueue2() when create flags don't match
This fixes CTS: dEQP-VK.api.device_init.create_device_queue2_unmatched_flags Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Dave Airlie <airlied@gmail.com>
-rw-r--r--src/amd/vulkan/radv_device.c23
-rw-r--r--src/amd/vulkan/radv_private.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 0ed3e27c7b..13b2da584e 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1106,6 +1106,7 @@ radv_get_queue_global_priority(const VkDeviceQueueGlobalPriorityCreateInfoEXT *p
static int
radv_queue_init(struct radv_device *device, struct radv_queue *queue,
uint32_t queue_family_index, int idx,
+ VkDeviceQueueCreateFlags flags,
const VkDeviceQueueGlobalPriorityCreateInfoEXT *global_priority)
{
queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
@@ -1113,6 +1114,7 @@ radv_queue_init(struct radv_device *device, struct radv_queue *queue,
queue->queue_family_index = queue_family_index;
queue->queue_idx = idx;
queue->priority = radv_get_queue_global_priority(global_priority);
+ queue->flags = flags;
queue->hw_ctx = device->ws->ctx_create(device->ws, queue->priority);
if (!queue->hw_ctx)
@@ -1266,7 +1268,9 @@ VkResult radv_CreateDevice(
device->queue_count[qfi] = queue_create->queueCount;
for (unsigned q = 0; q < queue_create->queueCount; q++) {
- result = radv_queue_init(device, &device->queues[qfi][q], qfi, q, global_priority);
+ result = radv_queue_init(device, &device->queues[qfi][q],
+ qfi, q, queue_create->flags,
+ global_priority);
if (result != VK_SUCCESS)
goto fail;
}
@@ -1454,8 +1458,23 @@ void radv_GetDeviceQueue2(
VkQueue* pQueue)
{
RADV_FROM_HANDLE(radv_device, device, _device);
+ struct radv_queue *queue;
+
+ queue = &device->queues[pQueueInfo->queueFamilyIndex][pQueueInfo->queueIndex];
+ if (pQueueInfo->flags != queue->flags) {
+ /* From the Vulkan 1.1.70 spec:
+ *
+ * "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."
+ */
+ *pQueue = VK_NULL_HANDLE;
+ return;
+ }
- *pQueue = radv_queue_to_handle(&device->queues[pQueueInfo->queueFamilyIndex][pQueueInfo->queueIndex]);
+ *pQueue = radv_queue_to_handle(queue);
}
void radv_GetDeviceQueue(
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 0ff62aa7de..6449c32900 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -573,6 +573,7 @@ struct radv_queue {
enum radeon_ctx_priority priority;
uint32_t queue_family_index;
int queue_idx;
+ VkDeviceQueueCreateFlags flags;
uint32_t scratch_size;
uint32_t compute_scratch_size;