[PATCH 15/15] drm/i915/breadcrumbs: Flush fence signals on removing the breadcrumb

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 4 15:21:59 UTC 2018


When the wait->seqno has passed and we have an attached fence, signal
the fence on removing the waiter.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_breadcrumbs.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index f3d70539d391..380ce7104361 100644
--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
@@ -355,10 +355,21 @@ static inline struct intel_wait *to_wait(struct rb_node *node)
 static inline void __intel_breadcrumbs_finish(struct intel_breadcrumbs *b,
 					      struct intel_wait *wait)
 {
+	struct drm_i915_gem_request *rq = wait->request;
+
 	lockdep_assert_held(&b->rb_lock);
 	GEM_BUG_ON(b->irq_wait == wait);
 
-	/* This request is completed, so remove it from the tree, mark it as
+	if (rq && intel_wait_check_request(wait, rq)) {
+		if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &rq->fence.flags)) {
+			spin_lock_nested(&rq->lock, SINGLE_DEPTH_NESTING);
+			dma_fence_signal_locked(&rq->fence);
+			spin_unlock(&rq->lock);
+		}
+	}
+
+	/*
+	 * This request is completed, so remove it from the tree, mark it as
 	 * complete, and *then* wake up the associated task. N.B. when the
 	 * task wakes up, it will find the empty rb_node, discern that it
 	 * has already been removed from the tree and skip the serialisation
-- 
2.15.1



More information about the Intel-gfx-trybot mailing list