mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 10:00:14 +01:00
panvk: Remove dependency on vk_device::drm_fd
Move to panvk_device so we can remove drm_fd from the base class. Signed-off-by: Rob Clark <robdclark@chromium.org> Acked-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33433>
This commit is contained in:
parent
e76b1acbfe
commit
3f5dc6329a
6 changed files with 34 additions and 31 deletions
|
|
@ -463,18 +463,18 @@ init_subqueue(struct panvk_queue *queue, enum panvk_subqueue_id subqueue)
|
|||
.queue_submits = DRM_PANTHOR_OBJ_ARRAY(1, &qsubmit),
|
||||
};
|
||||
|
||||
int ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_GROUP_SUBMIT, &gsubmit);
|
||||
int ret = drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_GROUP_SUBMIT, &gsubmit);
|
||||
if (ret)
|
||||
return panvk_errorf(dev->vk.physical, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to initialized subqueue: %m");
|
||||
|
||||
ret = drmSyncobjWait(dev->vk.drm_fd, &queue->syncobj_handle, 1, INT64_MAX, 0,
|
||||
ret = drmSyncobjWait(dev->drm_fd, &queue->syncobj_handle, 1, INT64_MAX, 0,
|
||||
NULL);
|
||||
if (ret)
|
||||
return panvk_errorf(dev->vk.physical, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"SyncobjWait failed: %m");
|
||||
|
||||
drmSyncobjReset(dev->vk.drm_fd, &queue->syncobj_handle, 1);
|
||||
drmSyncobjReset(dev->drm_fd, &queue->syncobj_handle, 1);
|
||||
|
||||
if (debug & PANVK_DEBUG_TRACE) {
|
||||
pandecode_user_msg(dev->debug.decode_ctx, "Init subqueue %d binary\n\n",
|
||||
|
|
@ -610,7 +610,7 @@ create_group(struct panvk_queue *queue,
|
|||
.vm_id = pan_kmod_vm_handle(dev->kmod.vm),
|
||||
};
|
||||
|
||||
int ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_GROUP_CREATE, &gc);
|
||||
int ret = drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_GROUP_CREATE, &gc);
|
||||
if (ret)
|
||||
return panvk_errorf(dev, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to create a scheduling group");
|
||||
|
|
@ -628,7 +628,7 @@ destroy_group(struct panvk_queue *queue)
|
|||
};
|
||||
|
||||
ASSERTED int ret =
|
||||
drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_GROUP_DESTROY, &gd);
|
||||
drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_GROUP_DESTROY, &gd);
|
||||
assert(!ret);
|
||||
}
|
||||
|
||||
|
|
@ -665,7 +665,7 @@ init_tiler(struct panvk_queue *queue)
|
|||
};
|
||||
|
||||
int ret =
|
||||
drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE, &thc);
|
||||
drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE, &thc);
|
||||
if (ret) {
|
||||
result = panvk_errorf(dev, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to create a tiler heap context");
|
||||
|
|
@ -699,7 +699,7 @@ cleanup_tiler(struct panvk_queue *queue)
|
|||
.handle = tiler_heap->context.handle,
|
||||
};
|
||||
ASSERTED int ret =
|
||||
drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY, &thd);
|
||||
drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY, &thd);
|
||||
assert(!ret);
|
||||
|
||||
panvk_pool_free_mem(&tiler_heap->desc);
|
||||
|
|
@ -1052,7 +1052,7 @@ panvk_queue_submit_ioctl(struct panvk_queue_submit *submit)
|
|||
DRM_PANTHOR_OBJ_ARRAY(submit->qsubmit_count, submit->qsubmits),
|
||||
};
|
||||
|
||||
ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_GROUP_SUBMIT, &gsubmit);
|
||||
ret = drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_GROUP_SUBMIT, &gsubmit);
|
||||
if (ret)
|
||||
return vk_queue_set_lost(&queue->vk, "GROUP_SUBMIT: %m");
|
||||
|
||||
|
|
@ -1072,7 +1072,7 @@ panvk_queue_submit_process_signals(struct panvk_queue_submit *submit,
|
|||
|
||||
if (submit->force_sync) {
|
||||
uint64_t point = util_bitcount(submit->used_queue_mask);
|
||||
ret = drmSyncobjTimelineWait(dev->vk.drm_fd, &queue->syncobj_handle,
|
||||
ret = drmSyncobjTimelineWait(dev->drm_fd, &queue->syncobj_handle,
|
||||
&point, 1, INT64_MAX,
|
||||
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL, NULL);
|
||||
assert(!ret);
|
||||
|
|
@ -1084,7 +1084,7 @@ panvk_queue_submit_process_signals(struct panvk_queue_submit *submit,
|
|||
vk_sync_as_drm_syncobj(signal->sync);
|
||||
assert(syncobj);
|
||||
|
||||
drmSyncobjTransfer(dev->vk.drm_fd, syncobj->syncobj, signal->signal_value,
|
||||
drmSyncobjTransfer(dev->drm_fd, syncobj->syncobj, signal->signal_value,
|
||||
queue->syncobj_handle, 0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -1092,7 +1092,7 @@ panvk_queue_submit_process_signals(struct panvk_queue_submit *submit,
|
|||
const struct vk_drm_syncobj *syncobj =
|
||||
vk_sync_as_drm_syncobj(queue->utrace.sync);
|
||||
|
||||
drmSyncobjTransfer(dev->vk.drm_fd, syncobj->syncobj,
|
||||
drmSyncobjTransfer(dev->drm_fd, syncobj->syncobj,
|
||||
queue->utrace.next_value++, queue->syncobj_handle, 0,
|
||||
0);
|
||||
|
||||
|
|
@ -1100,7 +1100,7 @@ panvk_queue_submit_process_signals(struct panvk_queue_submit *submit,
|
|||
u_trace_context_process(&dev->utrace.utctx, false);
|
||||
}
|
||||
|
||||
drmSyncobjReset(dev->vk.drm_fd, &queue->syncobj_handle, 1);
|
||||
drmSyncobjReset(dev->drm_fd, &queue->syncobj_handle, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1238,7 +1238,7 @@ panvk_per_arch(queue_init)(struct panvk_device *dev, struct panvk_queue *queue,
|
|||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
int ret = drmSyncobjCreate(dev->vk.drm_fd, 0, &queue->syncobj_handle);
|
||||
int ret = drmSyncobjCreate(dev->drm_fd, 0, &queue->syncobj_handle);
|
||||
if (ret) {
|
||||
result = panvk_errorf(dev, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to create our internal sync object");
|
||||
|
|
@ -1267,7 +1267,7 @@ err_cleanup_tiler:
|
|||
cleanup_tiler(queue);
|
||||
|
||||
err_destroy_syncobj:
|
||||
drmSyncobjDestroy(dev->vk.drm_fd, queue->syncobj_handle);
|
||||
drmSyncobjDestroy(dev->drm_fd, queue->syncobj_handle);
|
||||
|
||||
err_finish_queue:
|
||||
vk_queue_finish(&queue->vk);
|
||||
|
|
@ -1282,7 +1282,7 @@ panvk_per_arch(queue_finish)(struct panvk_queue *queue)
|
|||
cleanup_queue(queue);
|
||||
destroy_group(queue);
|
||||
cleanup_tiler(queue);
|
||||
drmSyncobjDestroy(dev->vk.drm_fd, queue->syncobj_handle);
|
||||
drmSyncobjDestroy(dev->drm_fd, queue->syncobj_handle);
|
||||
vk_queue_finish(&queue->vk);
|
||||
}
|
||||
|
||||
|
|
@ -1295,7 +1295,7 @@ panvk_per_arch(queue_check_status)(struct panvk_queue *queue)
|
|||
};
|
||||
|
||||
int ret =
|
||||
drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_GROUP_GET_STATE, &state);
|
||||
drmIoctl(dev->drm_fd, DRM_IOCTL_PANTHOR_GROUP_GET_STATE, &state);
|
||||
if (!ret && !state.state)
|
||||
return VK_SUCCESS;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ panvk_per_arch(queue_finish)(struct panvk_queue *queue)
|
|||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
|
||||
vk_queue_finish(&queue->vk);
|
||||
drmSyncobjDestroy(dev->vk.drm_fd, queue->sync);
|
||||
drmSyncobjDestroy(dev->drm_fd, queue->sync);
|
||||
}
|
||||
|
||||
VkResult panvk_per_arch(queue_init)(struct panvk_device *device,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ panvk_per_arch(CreateEvent)(VkDevice _device,
|
|||
.flags = 0,
|
||||
};
|
||||
|
||||
int ret = drmIoctl(device->vk.drm_fd, DRM_IOCTL_SYNCOBJ_CREATE, &create);
|
||||
int ret = drmIoctl(device->drm_fd, DRM_IOCTL_SYNCOBJ_CREATE, &create);
|
||||
if (ret)
|
||||
return panvk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ panvk_per_arch(DestroyEvent)(VkDevice _device, VkEvent _event,
|
|||
return;
|
||||
|
||||
struct drm_syncobj_destroy destroy = {.handle = event->syncobj};
|
||||
drmIoctl(device->vk.drm_fd, DRM_IOCTL_SYNCOBJ_DESTROY, &destroy);
|
||||
drmIoctl(device->drm_fd, DRM_IOCTL_SYNCOBJ_DESTROY, &destroy);
|
||||
|
||||
vk_object_free(&device->vk, pAllocator, event);
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ panvk_per_arch(GetEventStatus)(VkDevice _device, VkEvent _event)
|
|||
.flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
|
||||
};
|
||||
|
||||
int ret = drmIoctl(device->vk.drm_fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
|
||||
int ret = drmIoctl(device->drm_fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
|
||||
if (ret) {
|
||||
if (errno == ETIME)
|
||||
signaled = false;
|
||||
|
|
@ -95,7 +95,7 @@ panvk_per_arch(SetEvent)(VkDevice _device, VkEvent _event)
|
|||
* command executes.
|
||||
* https://docs.vulkan.org/spec/latest/chapters/cmdbuffers.html#commandbuffers-submission-progress
|
||||
*/
|
||||
if (drmIoctl(device->vk.drm_fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &objs))
|
||||
if (drmIoctl(device->drm_fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &objs))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -111,7 +111,7 @@ panvk_per_arch(ResetEvent)(VkDevice _device, VkEvent _event)
|
|||
.handles = (uint64_t)(uintptr_t)&event->syncobj,
|
||||
.count_handles = 1};
|
||||
|
||||
if (drmIoctl(device->vk.drm_fd, DRM_IOCTL_SYNCOBJ_RESET, &objs))
|
||||
if (drmIoctl(device->drm_fd, DRM_IOCTL_SYNCOBJ_RESET, &objs))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ panvk_queue_submit_batch(struct panvk_queue *queue, struct panvk_batch *batch,
|
|||
.jc = batch->vtc_jc.first_job,
|
||||
};
|
||||
|
||||
ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||
ret = drmIoctl(dev->drm_fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||
assert(!ret);
|
||||
|
||||
if (debug & (PANVK_DEBUG_TRACE | PANVK_DEBUG_SYNC)) {
|
||||
ret = drmSyncobjWait(dev->vk.drm_fd, &submit.out_sync, 1, INT64_MAX, 0,
|
||||
ret = drmSyncobjWait(dev->drm_fd, &submit.out_sync, 1, INT64_MAX, 0,
|
||||
NULL);
|
||||
assert(!ret);
|
||||
}
|
||||
|
|
@ -108,10 +108,10 @@ panvk_queue_submit_batch(struct panvk_queue *queue, struct panvk_batch *batch,
|
|||
submit.in_sync_count = nr_in_fences;
|
||||
}
|
||||
|
||||
ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||
ret = drmIoctl(dev->drm_fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||
assert(!ret);
|
||||
if (debug & (PANVK_DEBUG_TRACE | PANVK_DEBUG_SYNC)) {
|
||||
ret = drmSyncobjWait(dev->vk.drm_fd, &submit.out_sync, 1, INT64_MAX, 0,
|
||||
ret = drmSyncobjWait(dev->drm_fd, &submit.out_sync, 1, INT64_MAX, 0,
|
||||
NULL);
|
||||
assert(!ret);
|
||||
}
|
||||
|
|
@ -146,12 +146,12 @@ panvk_queue_transfer_sync(struct panvk_queue *queue, uint32_t syncobj)
|
|||
.fd = -1,
|
||||
};
|
||||
|
||||
ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &handle);
|
||||
ret = drmIoctl(dev->drm_fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &handle);
|
||||
assert(!ret);
|
||||
assert(handle.fd >= 0);
|
||||
|
||||
handle.handle = syncobj;
|
||||
ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &handle);
|
||||
ret = drmIoctl(dev->drm_fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &handle);
|
||||
assert(!ret);
|
||||
|
||||
close(handle.fd);
|
||||
|
|
@ -197,7 +197,7 @@ panvk_signal_event_syncobjs(struct panvk_queue *queue,
|
|||
.handles = (uint64_t)(uintptr_t)&event->syncobj,
|
||||
.count_handles = 1};
|
||||
|
||||
int ret = drmIoctl(dev->vk.drm_fd, DRM_IOCTL_SYNCOBJ_RESET, &objs);
|
||||
int ret = drmIoctl(dev->drm_fd, DRM_IOCTL_SYNCOBJ_RESET, &objs);
|
||||
assert(!ret);
|
||||
break;
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ panvk_per_arch(queue_init)(struct panvk_device *device,
|
|||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
int ret = drmSyncobjCreate(device->vk.drm_fd, DRM_SYNCOBJ_CREATE_SIGNALED,
|
||||
int ret = drmSyncobjCreate(device->drm_fd, DRM_SYNCOBJ_CREATE_SIGNALED,
|
||||
&queue->sync);
|
||||
if (ret) {
|
||||
vk_queue_finish(&queue->vk);
|
||||
|
|
@ -347,7 +347,7 @@ panvk_per_arch(QueueWaitIdle)(VkQueue _queue)
|
|||
if (vk_device_is_lost(&dev->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
int ret = drmSyncobjWait(queue->vk.base.device->drm_fd, &queue->sync, 1,
|
||||
int ret = drmSyncobjWait(dev->drm_fd, &queue->sync, 1,
|
||||
INT64_MAX, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL, NULL);
|
||||
assert(!ret);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ struct panvk_device {
|
|||
struct u_printf_ctx ctx;
|
||||
struct panvk_priv_bo *bo;
|
||||
} printf;
|
||||
|
||||
int drm_fd;
|
||||
};
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(panvk_device, vk.base, VkDevice, VK_OBJECT_TYPE_DEVICE)
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device,
|
|||
u_printf_init(&device->printf.ctx, device->printf.bo,
|
||||
device->printf.bo->addr.host);
|
||||
|
||||
device->drm_fd = device->kmod.dev->fd;
|
||||
vk_device_set_drm_fd(&device->vk, device->kmod.dev->fd);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue