intel: Sync xe_drm.h final part
Sync xe_drm.h with commit a8ff56e160bb ("drm/xe/uapi: Remove reset uevent for now"). This is the last xe_drm.h uAPI break. The only relevant change for ANV and Iris is that now VM bind uAPI is asynchronous only so I had to bring back the syncobj creation, wait and destruction. Is still in the Xe port TODO list to make VM binds truly asynchronous. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26699>
This commit is contained in:

committed by
Marge Bot

parent
2ac78b5096
commit
dea6c82437
File diff suppressed because it is too large
Load Diff
@@ -106,8 +106,25 @@ xe_gem_vm_bind_op(struct iris_bo *bo, uint32_t op)
|
|||||||
{
|
{
|
||||||
const struct intel_device_info *devinfo = iris_bufmgr_get_device_info(bo->bufmgr);
|
const struct intel_device_info *devinfo = iris_bufmgr_get_device_info(bo->bufmgr);
|
||||||
uint32_t handle = op == DRM_XE_VM_BIND_OP_UNMAP ? 0 : bo->gem_handle;
|
uint32_t handle = op == DRM_XE_VM_BIND_OP_UNMAP ? 0 : bo->gem_handle;
|
||||||
|
struct drm_xe_sync xe_sync = {
|
||||||
|
.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
|
||||||
|
.flags = DRM_XE_SYNC_FLAG_SIGNAL,
|
||||||
|
};
|
||||||
|
struct drm_syncobj_create syncobj_create = {};
|
||||||
|
struct drm_syncobj_destroy syncobj_destroy = {};
|
||||||
|
struct drm_syncobj_wait syncobj_wait = {
|
||||||
|
.timeout_nsec = INT64_MAX,
|
||||||
|
.count_handles = 1,
|
||||||
|
};
|
||||||
uint64_t range, obj_offset = 0;
|
uint64_t range, obj_offset = 0;
|
||||||
int ret;
|
int ret, fd;
|
||||||
|
|
||||||
|
fd = iris_bufmgr_get_fd(bo->bufmgr);
|
||||||
|
ret = intel_ioctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &syncobj_create);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
xe_sync.handle = syncobj_create.handle;
|
||||||
|
|
||||||
if (iris_bo_is_imported(bo))
|
if (iris_bo_is_imported(bo))
|
||||||
range = bo->size;
|
range = bo->size;
|
||||||
@@ -127,6 +144,8 @@ xe_gem_vm_bind_op(struct iris_bo *bo, uint32_t op)
|
|||||||
|
|
||||||
struct drm_xe_vm_bind args = {
|
struct drm_xe_vm_bind args = {
|
||||||
.vm_id = iris_bufmgr_get_global_vm_id(bo->bufmgr),
|
.vm_id = iris_bufmgr_get_global_vm_id(bo->bufmgr),
|
||||||
|
.num_syncs = 1,
|
||||||
|
.syncs = (uintptr_t)&xe_sync,
|
||||||
.num_binds = 1,
|
.num_binds = 1,
|
||||||
.bind.obj = handle,
|
.bind.obj = handle,
|
||||||
.bind.obj_offset = obj_offset,
|
.bind.obj_offset = obj_offset,
|
||||||
@@ -135,11 +154,17 @@ xe_gem_vm_bind_op(struct iris_bo *bo, uint32_t op)
|
|||||||
.bind.op = op,
|
.bind.op = op,
|
||||||
.bind.pat_index = pat_index,
|
.bind.pat_index = pat_index,
|
||||||
};
|
};
|
||||||
ret = intel_ioctl(iris_bufmgr_get_fd(bo->bufmgr), DRM_IOCTL_XE_VM_BIND, &args);
|
ret = intel_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &args);
|
||||||
if (ret) {
|
if (ret == 0) {
|
||||||
|
syncobj_wait.handles = (uintptr_t)&xe_sync.handle;
|
||||||
|
ret = intel_ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &syncobj_wait);
|
||||||
|
} else {
|
||||||
DBG("vm_bind_op: DRM_IOCTL_XE_VM_BIND failed(%i)", ret);
|
DBG("vm_bind_op: DRM_IOCTL_XE_VM_BIND failed(%i)", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncobj_destroy.handle = xe_sync.handle;
|
||||||
|
intel_ioctl(fd, DRM_IOCTL_SYNCOBJ_DESTROY, &syncobj_destroy);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -116,13 +116,24 @@ static inline int
|
|||||||
xe_vm_bind_op(struct anv_device *device,
|
xe_vm_bind_op(struct anv_device *device,
|
||||||
struct anv_sparse_submission *submit)
|
struct anv_sparse_submission *submit)
|
||||||
{
|
{
|
||||||
int ret;
|
struct drm_xe_sync xe_sync = {
|
||||||
|
.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
|
||||||
|
.flags = DRM_XE_SYNC_FLAG_SIGNAL,
|
||||||
|
};
|
||||||
struct drm_xe_vm_bind args = {
|
struct drm_xe_vm_bind args = {
|
||||||
.vm_id = device->vm_id,
|
.vm_id = device->vm_id,
|
||||||
.num_binds = submit->binds_len,
|
.num_binds = submit->binds_len,
|
||||||
.bind = {},
|
.bind = {},
|
||||||
|
.num_syncs = 1,
|
||||||
|
.syncs = (uintptr_t)&xe_sync,
|
||||||
};
|
};
|
||||||
|
struct drm_syncobj_create syncobj_create = {};
|
||||||
|
struct drm_syncobj_destroy syncobj_destroy = {};
|
||||||
|
struct drm_syncobj_wait syncobj_wait = {
|
||||||
|
.timeout_nsec = INT64_MAX,
|
||||||
|
.count_handles = 1,
|
||||||
|
};
|
||||||
|
int ret;
|
||||||
|
|
||||||
STACK_ARRAY(struct drm_xe_vm_bind_op, xe_binds_stackarray,
|
STACK_ARRAY(struct drm_xe_vm_bind_op, xe_binds_stackarray,
|
||||||
submit->binds_len);
|
submit->binds_len);
|
||||||
@@ -173,7 +184,22 @@ xe_vm_bind_op(struct anv_device *device,
|
|||||||
xe_bind->userptr = (uintptr_t)bo->map;
|
xe_bind->userptr = (uintptr_t)bo->map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_CREATE, &syncobj_create);
|
||||||
|
if (ret)
|
||||||
|
goto out_stackarray;
|
||||||
|
|
||||||
|
xe_sync.handle = syncobj_create.handle;
|
||||||
ret = intel_ioctl(device->fd, DRM_IOCTL_XE_VM_BIND, &args);
|
ret = intel_ioctl(device->fd, DRM_IOCTL_XE_VM_BIND, &args);
|
||||||
|
if (ret)
|
||||||
|
goto out_destroy_syncobj;
|
||||||
|
|
||||||
|
syncobj_wait.handles = (uintptr_t)&xe_sync.handle;
|
||||||
|
ret = intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_WAIT, &syncobj_wait);
|
||||||
|
|
||||||
|
out_destroy_syncobj:
|
||||||
|
syncobj_destroy.handle = xe_sync.handle;
|
||||||
|
intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_DESTROY, &syncobj_destroy);
|
||||||
|
out_stackarray:
|
||||||
STACK_ARRAY_FINISH(xe_binds_stackarray);
|
STACK_ARRAY_FINISH(xe_binds_stackarray);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user