diff mbox series

[1/2] drm/i915/gem: Remove special casing from reloc-gtt

Message ID 20210121124932.2143-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/gem: Remove special casing from reloc-gtt | expand

Commit Message

Chris Wilson Jan. 21, 2021, 12:49 p.m. UTC
By observing that we only use reloc-gtt on objects that are device
coherent and idle, we can avoid the set-to-domain call. Then noting that
our preferred partial GGTT mapping path automatically copes with tiling
(it does not use a fence) and handles all the error cases of pinning,
that dramatically simplifies that branch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 21 +++++++------------
 1 file changed, 7 insertions(+), 14 deletions(-)

Comments

Matthew Auld Jan. 21, 2021, 5:10 p.m. UTC | #1
On Thu, 21 Jan 2021 at 12:49, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> By observing that we only use reloc-gtt on objects that are device
> coherent and idle, we can avoid the set-to-domain call. Then noting that
> our preferred partial GGTT mapping path automatically copes with tiling
> (it does not use a fence) and handles all the error cases of pinning,
> that dramatically simplifies that branch.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index d70ca36f74f6..fe170186dd42 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1151,23 +1151,16 @@  static void *reloc_iomap(struct drm_i915_gem_object *obj,
 		struct i915_vma *vma;
 		int err;
 
-		if (i915_gem_object_is_tiled(obj))
-			return ERR_PTR(-EINVAL);
-
 		if (use_cpu_reloc(cache, obj))
 			return NULL;
 
-		err = i915_gem_object_set_to_gtt_domain(obj, true);
-		if (err)
-			return ERR_PTR(err);
-
-		vma = i915_gem_object_ggtt_pin_ww(obj, &eb->ww, NULL, 0, 0,
-						  PIN_MAPPABLE |
-						  PIN_NONBLOCK /* NOWARN */ |
-						  PIN_NOEVICT);
-		if (vma == ERR_PTR(-EDEADLK))
-			return vma;
-
+		vma = ERR_PTR(-ENODEV);
+		if (!i915_gem_object_is_tiled(obj))
+			vma = i915_gem_object_ggtt_pin_ww(obj, &eb->ww,
+							  NULL, 0, 0,
+							  PIN_MAPPABLE |
+							  PIN_NONBLOCK /* NOWARN */ |
+							  PIN_NOEVICT);
 		if (IS_ERR(vma)) {
 			memset(&cache->node, 0, sizeof(cache->node));
 			mutex_lock(&ggtt->vm.mutex);