anv: Handle external objects allocation in Xe

External(imported or exported) objects needs to have vm_id set to 0.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21885>
This commit is contained in:
José Roberto de Souza
2023-02-10 08:01:59 -08:00
committed by Marge Bot
parent b2d82c25fb
commit eec5ddd0ed
+5 -1
View File
@@ -35,7 +35,11 @@ xe_gem_create(struct anv_device *device,
enum anv_bo_alloc_flags alloc_flags)
{
struct drm_xe_gem_create gem_create = {
.vm_id = device->vm_id,
/* From xe_drm.h: If a VM is specified, this BO must:
* 1. Only ever be bound to that VM.
* 2. Cannot be exported as a PRIME fd.
*/
.vm_id = alloc_flags & ANV_BO_ALLOC_EXTERNAL ? 0 : device->vm_id,
.size = size,
.flags = alloc_flags & ANV_BO_ALLOC_SCANOUT ? XE_GEM_CREATE_FLAG_SCANOUT : 0,
};