[PATCH 38/46] drm/i915: Pass engine to i915_request_submit()

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 9 21:26:46 UTC 2021


Pass the physical engine to the request submit interface so that we may
pass the real engine to the engine->emit vfuncs.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 .../gpu/drm/i915/gt/intel_execlists_submission.c    |  2 +-
 drivers/gpu/drm/i915/gt/intel_reset.c               |  6 ++++--
 drivers/gpu/drm/i915/gt/intel_ring_scheduler.c      | 13 +++++++------
 drivers/gpu/drm/i915/gt/intel_ring_submission.c     |  2 +-
 drivers/gpu/drm/i915/gt/mock_engine.c               |  4 ++--
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c   |  2 +-
 drivers/gpu/drm/i915/i915_request.c                 |  9 +++++----
 drivers/gpu/drm/i915/i915_request.h                 |  6 ++++--
 drivers/gpu/drm/i915/i915_scheduler.c               |  2 +-
 9 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index 1704e70fa92b..755a47bfd7fe 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -1483,7 +1483,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 			merge = false;
 		}
 
-		if (__i915_request_submit(rq)) {
+		if (__i915_request_submit(rq, engine)) {
 			if (!merge) {
 				*port++ = i915_request_get(last);
 				last = NULL;
diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index fbcebc7b4d77..9bc150d84e5a 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -790,8 +790,10 @@ static void nop_submit_request(struct i915_request *request)
 
 	request = i915_request_mark_eio(request);
 	if (request) {
-		i915_request_submit(request);
-		intel_engine_signal_breadcrumbs(request->engine);
+		struct intel_engine_cs *engine = request->engine;
+
+		i915_request_submit(request, engine);
+		intel_engine_signal_breadcrumbs(engine);
 
 		i915_request_put(request);
 	}
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c b/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
index 938030f1446d..5350e05367db 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
@@ -453,15 +453,16 @@ static void switch_context(struct intel_ring *ring, struct i915_request *rq)
 	remap_l3(ring, engine, ce);
 }
 
-static struct i915_request *ring_submit(struct i915_request *rq)
+static struct i915_request *
+ring_submit(struct intel_engine_cs *engine, struct i915_request *rq)
 {
-	struct intel_ring *ring = rq->engine->legacy.ring;
+	struct intel_ring *ring = engine->legacy.ring;
 
-	__i915_request_submit(rq);
+	__i915_request_submit(rq, engine);
 
-	if (rq->engine->legacy.context != rq->context) {
+	if (engine->legacy.context != rq->context) {
 		switch_context(ring, rq);
-		set_current_context(&rq->engine->legacy.context, rq->context);
+		set_current_context(&engine->legacy.context, rq->context);
 	}
 
 	ring_copy(ring, rq->ring, rq->head, rq->tail);
@@ -554,7 +555,7 @@ static void dequeue(struct i915_sched *se, struct intel_engine_cs *engine)
 			*port++ = i915_request_get(last);
 		}
 
-		last = ring_submit(rq);
+		last = ring_submit(engine, rq);
 	}
 done:
 	spin_unlock(&se->lock);
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
index d30ae2139483..e2ed9240ec30 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
@@ -1228,7 +1228,7 @@ static void passthrough_tasklet(struct tasklet_struct *t)
 
 	spin_lock(&se->lock);
 	i915_sched_dequeue(se, pl, rq, rn) {
-		__i915_request_submit(rq);
+		__i915_request_submit(rq, engine);
 		last = rq;
 	}
 	spin_unlock(&se->lock);
diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
index bbb39b3c9f00..2dbcb004ca55 100644
--- a/drivers/gpu/drm/i915/gt/mock_engine.c
+++ b/drivers/gpu/drm/i915/gt/mock_engine.c
@@ -208,7 +208,7 @@ static void mock_submit_request(struct i915_request *request)
 		container_of(request->engine, typeof(*engine), base);
 	unsigned long flags;
 
-	i915_request_submit(request);
+	i915_request_submit(request, &engine->base);
 
 	spin_lock_irqsave(&engine->hw_lock, flags);
 	list_add_tail(&request->mock.link, &engine->hw_queue);
@@ -248,7 +248,7 @@ static void mock_reset_cancel(struct intel_engine_cs *engine)
 	/* Cancel and submit all pending requests. */
 	list_for_each_entry(rq, &mock->hw_queue, mock.link) {
 		if (i915_request_mark_eio(rq)) {
-			__i915_request_submit(rq);
+			__i915_request_submit(rq, engine);
 			i915_request_put(rq);
 		}
 	}
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 46b7789ee326..cd5c96626da2 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -211,7 +211,7 @@ static void __guc_dequeue(struct intel_engine_cs *engine)
 		}
 
 		list_del_init(&rq->sched.link);
-		__i915_request_submit(rq);
+		__i915_request_submit(rq, engine);
 		submit = true;
 		last = rq;
 	}
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index e0ebdefd35ee..46ae475c84f2 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -461,9 +461,9 @@ struct i915_request *i915_request_mark_eio(struct i915_request *rq)
 	return rq;
 }
 
-bool __i915_request_submit(struct i915_request *request)
+bool __i915_request_submit(struct i915_request *request,
+			   struct intel_engine_cs *engine)
 {
-	struct intel_engine_cs *engine = request->engine;
 	struct i915_sched *se = intel_engine_get_scheduler(engine);
 	bool result = false;
 
@@ -550,7 +550,8 @@ bool __i915_request_submit(struct i915_request *request)
 	return result;
 }
 
-void i915_request_submit(struct i915_request *request)
+void i915_request_submit(struct i915_request *request,
+			 struct intel_engine_cs *engine)
 {
 	struct i915_sched *se = i915_request_get_scheduler(request);
 	unsigned long flags;
@@ -558,7 +559,7 @@ void i915_request_submit(struct i915_request *request)
 	/* Will be called from irq-context when using foreign fences. */
 	spin_lock_irqsave(&se->lock, flags);
 
-	__i915_request_submit(request);
+	__i915_request_submit(request, engine);
 
 	spin_unlock_irqrestore(&se->lock, flags);
 }
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
index 02d923e615fc..8eac6dded03e 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -362,8 +362,10 @@ int i915_request_await_execution(struct i915_request *rq,
 
 void i915_request_add(struct i915_request *rq);
 
-bool __i915_request_submit(struct i915_request *request);
-void i915_request_submit(struct i915_request *request);
+bool __i915_request_submit(struct i915_request *request,
+			   struct intel_engine_cs *engine);
+void i915_request_submit(struct i915_request *request,
+			 struct intel_engine_cs *engine);
 
 void __i915_request_unsubmit(struct i915_request *request);
 void i915_request_unsubmit(struct i915_request *request);
diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
index e3e9f79ab93b..cb89e51afb0d 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.c
+++ b/drivers/gpu/drm/i915/i915_scheduler.c
@@ -1410,7 +1410,7 @@ void __i915_sched_cancel_queue(struct i915_sched *se)
 	/* Flush the queued requests to the timeline list (for retiring). */
 	i915_sched_dequeue(se, pl, rq, rn) {
 		i915_request_put(i915_request_mark_eio(rq));
-		__i915_request_submit(rq);
+		__i915_request_submit(rq, rq->engine);
 	}
 	GEM_BUG_ON(!i915_sched_is_idle(se));
 
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list