All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Remove local timeline var from submit/unsubmit
@ 2018-03-22 12:48 Chris Wilson
  2018-03-22 12:55 ` [PATCH v2] " Chris Wilson
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Chris Wilson @ 2018-03-22 12:48 UTC (permalink / raw)
  To: intel-gfx

Both request_submit and request_unsubmit deal with transferring the
request from the client's timeline onto the execution timeline and back
again. As both functions deal with a pair of timeline's, using a
shorthand for just one of them is slightly confusing, especially as the
different functions use the shorthand for the alternate timeline.
Instead, use the full version of each timeline so it should be easier to
keep track of the transfer between the request/client and the engine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_request.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 2325886d1d55..024169383d6a 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -495,7 +495,6 @@ static u32 timeline_get_seqno(struct intel_timeline *tl)
 void __i915_request_submit(struct i915_request *request)
 {
 	struct intel_engine_cs *engine = request->engine;
-	struct intel_timeline *timeline;
 	u32 seqno;
 
 	GEM_TRACE("%s fence %llx:%d -> global_seqno %d\n",
@@ -506,12 +505,9 @@ void __i915_request_submit(struct i915_request *request)
 	GEM_BUG_ON(!irqs_disabled());
 	lockdep_assert_held(&engine->timeline->lock);
 
-	/* Transfer from per-context onto the global per-engine timeline */
-	timeline = engine->timeline;
-	GEM_BUG_ON(timeline == request->timeline);
 	GEM_BUG_ON(request->global_seqno);
 
-	seqno = timeline_get_seqno(timeline);
+	seqno = timeline_get_seqno(engine->timeline);
 	GEM_BUG_ON(!seqno);
 	GEM_BUG_ON(i915_seqno_passed(intel_engine_get_seqno(engine), seqno));
 
@@ -525,8 +521,10 @@ void __i915_request_submit(struct i915_request *request)
 	engine->emit_breadcrumb(request,
 				request->ring->vaddr + request->postfix);
 
+	/* Transfer from per-context onto the global per-engine timeline */
+	GEM_BUG_ON(engine->timeline == request->timeline);
 	spin_lock(&request->timeline->lock);
-	list_move_tail(&request->link, &timeline->requests);
+	list_move_tail(&request->link, &engine->timeline->requests);
 	spin_unlock(&request->timeline->lock);
 
 	trace_i915_request_execute(request);
@@ -550,7 +548,6 @@ void i915_request_submit(struct i915_request *request)
 void __i915_request_unsubmit(struct i915_request *request)
 {
 	struct intel_engine_cs *engine = request->engine;
-	struct intel_timeline *timeline;
 
 	GEM_TRACE("%s fence %llx:%d <- global_seqno %d\n",
 		  request->engine->name,
@@ -578,12 +575,10 @@ void __i915_request_unsubmit(struct i915_request *request)
 	spin_unlock(&request->lock);
 
 	/* Transfer back from the global per-engine timeline to per-context */
-	timeline = request->timeline;
-	GEM_BUG_ON(timeline == engine->timeline);
-
-	spin_lock(&timeline->lock);
-	list_move(&request->link, &timeline->requests);
-	spin_unlock(&timeline->lock);
+	GEM_BUG_ON(request->timeline == engine->timeline);
+	spin_lock(&request->timeline->lock);
+	list_move(&request->link, &request->timeline->requests);
+	spin_unlock(&request->timeline->lock);
 
 	/*
 	 * We don't need to wake_up any waiters on request->execute, they
-- 
2.16.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-22 16:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 12:48 [PATCH] drm/i915: Remove local timeline var from submit/unsubmit Chris Wilson
2018-03-22 12:55 ` [PATCH v2] " Chris Wilson
2018-03-22 13:01   ` Chris Wilson
2018-03-22 13:10 ` [PATCH v3] " Chris Wilson
2018-03-22 13:24   ` Mika Kuoppala
2018-03-22 16:00     ` Chris Wilson
2018-03-22 13:17 ` ✓ Fi.CI.BAT: success for drm/i915: Remove local timeline var from submit/unsubmit (rev2) Patchwork
2018-03-22 13:48 ` ✓ Fi.CI.BAT: success for drm/i915: Remove local timeline var from submit/unsubmit (rev3) Patchwork
2018-03-22 14:38 ` ✗ Fi.CI.IGT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.