anv/xe: make vm_binds async

Our sparse implementation will require us to issue partial unbinds,
but partial unbinds are not supported in synchronous vm_bind ioctls,
requiring us to to have our VM be marked with the ASYNC flag. This is
not properly documented and is subject to change in the next
iterations of the API.

Error handling with async binds is also not documented anywhere and is
being actively discussed in the mailing lists, so whatever we decide
to implement here is likely to end up changing in a few weeks. Also, I
haven't seen these errors happening in the real world, so for now
they're a very corner case. So for now just foward errors to
user-space and hope things work.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24681>
This commit is contained in:
Paulo Zanoni
2023-08-04 17:00:04 -07:00
committed by Marge Bot
parent 7018e64d79
commit 935a1d2c8f
2 changed files with 8 additions and 1 deletions

View File

@@ -37,7 +37,8 @@ bool anv_xe_device_destroy_vm(struct anv_device *device)
VkResult anv_xe_device_setup_vm(struct anv_device *device)
{
struct drm_xe_vm_create create = {
.flags = DRM_XE_VM_CREATE_SCRATCH_PAGE,
.flags = DRM_XE_VM_CREATE_SCRATCH_PAGE |
DRM_XE_VM_CREATE_ASYNC_BIND_OPS,
};
if (intel_ioctl(device->fd, DRM_IOCTL_XE_VM_CREATE, &create) != 0)
return vk_errorf(device, VK_ERROR_INITIALIZATION_FAILED,

View File

@@ -153,6 +153,12 @@ xe_vm_bind_op(struct anv_device *device, int num_binds,
}
}
/* TODO: do proper error handling here, once the way to do it is
* settled. As of right now the final interface is still under
* discussion.
*/
xe_bind->op |= XE_VM_BIND_FLAG_ASYNC;
/* userptr and bo_offset are an union! */
if (bo && bo->from_host_ptr)
xe_bind->userptr = (uintptr_t)bo->map;