[PATCH 11/18] drm/i915/create: apply ALLOC_TOPDOWN by default

Matthew Auld matthew.auld at intel.com
Thu Jan 13 16:57:18 UTC 2022


For LMEM objects we should by default hint that normal userspace
allocations should ideally be allocated in the non-mappable portion of
LMEM.  Note that dumb buffers are not included here, since these are
not "GPU accelerated" and likely need CPU access.

In a future patch, if we later fault the object(before using the object
in an execbuf), we will still attempt to place the object in the
mappable portion of LMEM, or system memory, if permitted.  Otherwise, if
the pages have already been allocated then the fault handler will
attempt to migrate the pages.

Later userspace will be able to provide a hint if CPU access to the
buffer is needed.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_create.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_create.c b/drivers/gpu/drm/i915/gem/i915_gem_create.c
index 9402d4bf4ffc..e7456443f163 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_create.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_create.c
@@ -424,6 +424,15 @@ i915_gem_create_ext_ioctl(struct drm_device *dev, void *data,
 		ext_data.n_placements = 1;
 	}
 
+	/*
+	 * TODO: add a userspace hint to force CPU_ACCESS for the object, which
+	 * can override this.
+	 */
+	if (!IS_DG1(i915) && (ext_data.n_placements > 1 ||
+			      ext_data.placements[0]->type !=
+			      INTEL_MEMORY_SYSTEM))
+		ext_data.flags |= I915_BO_ALLOC_TOPDOWN;
+
 	obj = __i915_gem_object_create_user_ext(i915, args->size,
 						ext_data.placements,
 						ext_data.n_placements,
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list