drm/i915/gem: Single page objects are naturally contiguous
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 1 Jan 2020 22:07:35 +0000 (22:07 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 2 Jan 2020 21:21:17 +0000 (21:21 +0000)
Small objects that only occupy a single page are naturally contiguous,
so mark them as such and allow them the special abilities that come with
it.

A more thorough treatment would extend i915_gem_object_pin_map() to
support discontiguous lmem objects, following the example of
ioremap_prot() and use get_vm_area() + remap_io_sg().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200101220736.1073007-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_region.c

index d50adac122494c36a3567bcce52d0ac39c49883e..1515384d7e0efacc2c70456aaa9b5f663b1f1d04 100644 (file)
@@ -107,7 +107,10 @@ void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,
 {
        INIT_LIST_HEAD(&obj->mm.blocks);
        obj->mm.region = intel_memory_region_get(mem);
+
        obj->flags |= flags;
+       if (obj->base.size <= mem->min_page_size)
+               obj->flags |= I915_BO_ALLOC_CONTIGUOUS;
 
        mutex_lock(&mem->objects.lock);