aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/vulkan/tu_device.c14
-rw-r--r--src/freedreno/vulkan/tu_drm.c26
-rw-r--r--src/freedreno/vulkan/tu_private.h8
3 files changed, 36 insertions, 12 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index e321f4ad39f..d5a65aadf53 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -949,27 +949,17 @@ 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));
+ int ret = tu_drm_submitqueue_new(device, 0, &queue->msm_queue_id);
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));
+ tu_drm_submitqueue_close(queue->device, queue->msm_queue_id);
}
static int
diff --git a/src/freedreno/vulkan/tu_drm.c b/src/freedreno/vulkan/tu_drm.c
index b28de8f2c06..b86520b0f37 100644
--- a/src/freedreno/vulkan/tu_drm.c
+++ b/src/freedreno/vulkan/tu_drm.c
@@ -78,6 +78,32 @@ tu_drm_get_gmem_size(const struct tu_physical_device *dev, uint32_t *size)
return 0;
}
+int
+tu_drm_submitqueue_new(const struct tu_device *dev,
+ int priority,
+ uint32_t *queue_id)
+{
+ struct drm_msm_submitqueue req = {
+ .flags = 0,
+ .prio = priority,
+ };
+
+ int ret = drmCommandWriteRead(dev->physical_device->local_fd,
+ DRM_MSM_SUBMITQUEUE_NEW, &req, sizeof(req));
+ if (ret)
+ return ret;
+
+ *queue_id = req.id;
+ return 0;
+}
+
+void
+tu_drm_submitqueue_close(const struct tu_device *dev, uint32_t queue_id)
+{
+ drmCommandWrite(dev->physical_device->local_fd, DRM_MSM_SUBMITQUEUE_CLOSE,
+ &queue_id, sizeof(uint32_t));
+}
+
/**
* Return gem handle on success. Return 0 on failure.
*/
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index a2deb98abf8..c37920c5779 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -1195,6 +1195,14 @@ tu_drm_get_gpu_id(const struct tu_physical_device *dev, uint32_t *id);
int
tu_drm_get_gmem_size(const struct tu_physical_device *dev, uint32_t *size);
+int
+tu_drm_submitqueue_new(const struct tu_device *dev,
+ int priority,
+ uint32_t *queue_id);
+
+void
+tu_drm_submitqueue_close(const struct tu_device *dev, uint32_t queue_id);
+
uint32_t
tu_gem_new(struct tu_device *dev, uint64_t size, uint32_t flags);
void