[50/50] bread

Submitted by Chris Wilson on Jan. 12, 2019, 10:31 a.m.

Details

Message ID 20190112103146.32401-50-chris@chris-wilson.co.uk
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GFX - Try Bot

Not browsing as part of any series.

Commit Message

Chris Wilson Jan. 12, 2019, 10:31 a.m.
---
 drivers/gpu/drm/i915/intel_breadcrumbs.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index be928bd204d3..f9fd967bb50c 100644
--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
@@ -385,20 +385,23 @@  bool intel_engine_enable_signaling(struct i915_request *rq)
 		return true;
 
 	spin_lock(&b->irq_lock);
-	if (test_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags)) {
+	if (test_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags) &&
+	    !i915_request_completed(rq)) {
 		struct intel_context *ce = rq->hw_context;
-		struct i915_request *pos;
+		struct list_head *pos;
 
 		__intel_breadcrumbs_arm_irq(b);
 
-		list_for_each_entry_reverse(pos, &ce->signals, signal_link) {
-			if (i915_seqno_passed(rq->fence.seqno,
-					      pos->fence.seqno))
+		list_for_each_prev(pos, &ce->signals) {
+			struct i915_request *it =
+				list_entry(pos, typeof(*it), signal_link);
+
+			if (i915_seqno_passed(rq->fence.seqno, it->fence.seqno))
 				break;
 		}
-		list_add(&rq->signal_link, &pos->signal_link);
-
-		list_move_tail(&ce->signal_link, &b->signalers);
+		list_add(&rq->signal_link, pos);
+		if (pos == &ce->signals)
+			list_move_tail(&ce->signal_link, &b->signalers);
 
 		set_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags);
 	}