[PATCH 15/15] drm/i915/breadcrumbs: Flush fence signals on removing the breadcrumb
Chris Wilson
chris at chris-wilson.co.uk
Thu Jan 4 16:04:49 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 | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index c0469298b8e8..849eb9dd899d 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
@@ -867,6 +878,11 @@ int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine)
spin_lock_init(&b->rb_lock);
spin_lock_init(&b->irq_lock);
+ /* We want to allow nesting of multiple engines locks */
+ BUILD_BUG_ON(I915_NUM_ENGINES > MAX_LOCKDEP_SUBCLASSES);
+ lockdep_set_subclass(&b->rb_lock, engine->id);
+ lockdep_set_subclass(&b->irq_lock, engine->id);
+
timer_setup(&b->fake_irq, intel_breadcrumbs_fake_irq, 0);
timer_setup(&b->hangcheck, intel_breadcrumbs_hangcheck, 0);
--
2.15.1
More information about the Intel-gfx-trybot
mailing list