[Intel-gfx] [PATCH 66/66] drm/i915/gem: Remove timeline nesting from snb relocs

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 15 11:51:47 UTC 2020


As snb is the only one to require an alternative engine for performing
relocations, we know that we can reuse a common timeline between
engines.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 22 +++++--------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index d9f1403ddfa4..28f5c28a9449 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1965,16 +1965,9 @@ nested_request_create(struct intel_context *ce, struct i915_execbuffer *eb)
 {
 	struct i915_request *rq;
 
-	/* XXX This only works once; replace with shared timeline */
-	if (ce->timeline != eb->context->timeline)
-		mutex_lock_nested(&ce->timeline->mutex, SINGLE_DEPTH_NESTING);
 	intel_context_enter(ce);
-
 	rq = __i915_request_create(ce, GFP_KERNEL);
-
 	intel_context_exit(ce);
-	if (IS_ERR(rq) && ce->timeline != eb->context->timeline)
-		mutex_unlock(&ce->timeline->mutex);
 
 	return rq;
 }
@@ -2021,9 +2014,6 @@ reloc_gpu_flush(struct i915_execbuffer *eb, struct i915_request *rq, int err)
 	intel_gt_chipset_flush(rq->engine->gt);
 	__i915_request_add(rq, &eb->gem_context->sched);
 
-	if (i915_request_timeline(rq) != eb->context->timeline)
-		mutex_unlock(&i915_request_timeline(rq)->mutex);
-
 	return err;
 }
 
@@ -2426,10 +2416,7 @@ static struct i915_request *reloc_gpu_alloc(struct i915_execbuffer *eb)
 	struct reloc_cache *cache = &eb->reloc_cache;
 	struct i915_request *rq;
 
-	if (cache->ce == eb->context)
-		rq = __i915_request_create(cache->ce, GFP_KERNEL);
-	else
-		rq = nested_request_create(cache->ce, eb);
+	rq = nested_request_create(cache->ce, eb);
 	if (IS_ERR(rq))
 		return rq;
 
@@ -2968,13 +2955,14 @@ static int __eb_pin_reloc_engine(struct i915_execbuffer *eb)
 	if (!engine)
 		return -ENODEV;
 
+	if (!intel_engine_has_scheduler(engine))
+		return -ENODEV;
+
 	ce = intel_context_create(engine);
 	if (IS_ERR(ce))
 		return PTR_ERR(ce);
 
-	/* Reuse eb->context->timeline with scheduler! */
-	if (intel_engine_has_scheduler(engine))
-		ce->timeline = intel_timeline_get(eb->context->timeline);
+	ce->timeline = intel_timeline_get(eb->context->timeline);
 
 	i915_vm_put(ce->vm);
 	ce->vm = i915_vm_get(eb->context->vm);
-- 
2.20.1



More information about the Intel-gfx mailing list