turnip: Add msm queue support.
authorBas Nieuwenhuizen <basni@chromium.org>
Thu, 10 Jan 2019 20:12:38 +0000 (21:12 +0100)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 11 Mar 2019 17:01:41 +0000 (10:01 -0700)
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_private.h

index f7dcaf0c3187430b985deeae295f71074527ffb8..ec3fa4ceff67f99b19d46b249e58871fcc8264d4 100644 (file)
@@ -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
index 2a09d5b14a05c03ba6be052972d6686f97cd1c43..a6310189cdb74914eb60d567a3fec9b2240d5c43 100644 (file)
@@ -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