From 65e0e790548d3ef65f26d0fc6b1b370d93c577fb Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Thu, 10 Jan 2019 21:12:38 +0100 Subject: [PATCH] turnip: Add msm queue support. --- src/freedreno/vulkan/tu_device.c | 17 ++++++++++++++++- src/freedreno/vulkan/tu_private.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index f7dcaf0c318..ec3fa4ceff6 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -949,7 +949,7 @@ tu_GetPhysicalDeviceMemoryProperties2( physicalDevice, &pMemoryProperties->memoryProperties); } -static int +static VkResult tu_queue_init(struct tu_device *device, struct tu_queue *queue, uint32_t queue_family_index, @@ -962,12 +962,27 @@ tu_queue_init(struct tu_device *device, queue->queue_idx = idx; queue->flags = flags; + struct drm_msm_submitqueue req = { + .flags = 0, + .prio = 0, + }; + + int ret = drmCommandWriteRead(device->physical_device->local_fd, + DRM_MSM_SUBMITQUEUE_NEW, + &req, sizeof(req)); + if (ret) + return VK_ERROR_INITIALIZATION_FAILED; + + queue->msm_queue_id = req.id; return VK_SUCCESS; } static void tu_queue_finish(struct tu_queue *queue) { + drmCommandWrite(queue->device->physical_device->local_fd, + DRM_MSM_SUBMITQUEUE_CLOSE, + &queue->msm_queue_id, sizeof(uint32_t)); } static int diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 2a09d5b14a0..a6310189cdb 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -401,6 +401,8 @@ struct tu_queue uint32_t queue_family_index; int queue_idx; VkDeviceQueueCreateFlags flags; + + uint32_t msm_queue_id; }; struct tu_device -- 2.30.2