nvk/queue: Pull DRM specfc stuff into nvk_queue_drm.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27205>
This commit is contained in:

committed by
Marge Bot

parent
88445fc12a
commit
88b19ccc3f
@@ -323,23 +323,22 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
queue->vk.driver_submit = nvk_queue_submit;
|
||||
|
||||
nvk_queue_state_init(&queue->state);
|
||||
|
||||
queue->vk.driver_submit = nvk_queue_submit;
|
||||
int err = drmSyncobjCreate(dev->ws_dev->fd, 0, &queue->syncobj_handle);
|
||||
if (err < 0) {
|
||||
result = vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
result = nvk_queue_init_drm_nouveau(dev, queue);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_init;
|
||||
}
|
||||
|
||||
|
||||
result = nvk_queue_init_context_draw_state(queue);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_empty_push;
|
||||
goto fail_drm;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_empty_push:
|
||||
fail_drm:
|
||||
nvk_queue_finish_drm_nouveau(dev, queue);
|
||||
fail_init:
|
||||
vk_queue_finish(&queue->vk);
|
||||
|
||||
@@ -350,8 +349,7 @@ void
|
||||
nvk_queue_finish(struct nvk_device *dev, struct nvk_queue *queue)
|
||||
{
|
||||
nvk_queue_state_finish(dev, &queue->state);
|
||||
ASSERTED int err = drmSyncobjDestroy(dev->ws_dev->fd, queue->syncobj_handle);
|
||||
assert(err == 0);
|
||||
nvk_queue_finish_drm_nouveau(dev, queue);
|
||||
vk_queue_finish(&queue->vk);
|
||||
}
|
||||
|
||||
|
@@ -47,10 +47,11 @@ VkResult nvk_queue_state_update(struct nvk_device *dev,
|
||||
struct nvk_queue {
|
||||
struct vk_queue vk;
|
||||
|
||||
struct {
|
||||
uint32_t syncobj;
|
||||
} drm;
|
||||
|
||||
struct nvk_queue_state state;
|
||||
|
||||
|
||||
uint32_t syncobj_handle;
|
||||
};
|
||||
|
||||
static inline struct nvk_device *
|
||||
@@ -73,6 +74,12 @@ VkResult nvk_queue_submit_simple(struct nvk_queue *queue,
|
||||
uint32_t extra_bo_count,
|
||||
struct nouveau_ws_bo **extra_bos);
|
||||
|
||||
VkResult nvk_queue_init_drm_nouveau(struct nvk_device *dev,
|
||||
struct nvk_queue *queue);
|
||||
|
||||
void nvk_queue_finish_drm_nouveau(struct nvk_device *dev,
|
||||
struct nvk_queue *queue);
|
||||
|
||||
VkResult nvk_queue_submit_simple_drm_nouveau(struct nvk_queue *queue,
|
||||
uint32_t push_dw_count,
|
||||
struct nouveau_ws_bo *push_bo,
|
||||
|
@@ -246,7 +246,7 @@ push_submit(struct push_builder *pb, struct nvk_queue *queue, bool sync)
|
||||
assert(pb->req.sig_count < NVK_PUSH_MAX_SYNCS);
|
||||
pb->req_sig[pb->req.sig_count++] = (struct drm_nouveau_sync) {
|
||||
.flags = DRM_NOUVEAU_SYNC_SYNCOBJ,
|
||||
.handle = queue->syncobj_handle,
|
||||
.handle = queue->drm.syncobj,
|
||||
.timeline_value = 0,
|
||||
};
|
||||
}
|
||||
@@ -262,7 +262,7 @@ push_submit(struct push_builder *pb, struct nvk_queue *queue, bool sync)
|
||||
}
|
||||
if (sync) {
|
||||
err = drmSyncobjWait(pb->dev->ws_dev->fd,
|
||||
&queue->syncobj_handle, 1, INT64_MAX,
|
||||
&queue->drm.syncobj, 1, INT64_MAX,
|
||||
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
|
||||
NULL);
|
||||
if (err) {
|
||||
@@ -285,6 +285,33 @@ push_submit(struct push_builder *pb, struct nvk_queue *queue, bool sync)
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
nvk_queue_init_drm_nouveau(struct nvk_device *dev,
|
||||
struct nvk_queue *queue)
|
||||
{
|
||||
VkResult result;
|
||||
int err;
|
||||
|
||||
err = drmSyncobjCreate(dev->ws_dev->fd, 0, &queue->drm.syncobj);
|
||||
if (err < 0) {
|
||||
result = vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
goto fail_init;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_init:
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nvk_queue_finish_drm_nouveau(struct nvk_device *dev,
|
||||
struct nvk_queue *queue)
|
||||
{
|
||||
ASSERTED int err = drmSyncobjDestroy(dev->ws_dev->fd, queue->drm.syncobj);
|
||||
assert(err == 0);
|
||||
}
|
||||
|
||||
VkResult
|
||||
nvk_queue_submit_simple_drm_nouveau(struct nvk_queue *queue,
|
||||
uint32_t push_dw_count,
|
||||
|
Reference in New Issue
Block a user