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>
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,
}
}
+ /* 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;