diff mbox

[07/10] drm/i915: Rearrange gen8_cs_irq_handler

Message ID 20180514093710.7730-8-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 14, 2018, 9:37 a.m. UTC
After using direct submission from the irq handler, it is very likely
that the ENGINE_IRQ_EXECLISTS bit is unset and so we do not need to
test it first. It also follows that we then want to do a direct
submission evertime the irq_posted bit is set, and can use that as our
boolean rather than a separate local.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_irq.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index e1b3a7575fe7..034c603867e6 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1459,31 +1459,21 @@  static void snb_gt_irq_handler(struct drm_i915_private *dev_priv,
 		ivybridge_parity_error_irq_handler(dev_priv, gt_iir);
 }
 
-static void
-gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir)
+static void gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir)
 {
 	struct intel_engine_execlists * const execlists = &engine->execlists;
-	bool tasklet = false;
 
 	if (iir & GT_CONTEXT_SWITCH_INTERRUPT && READ_ONCE(execlists->active))
-		tasklet = !test_and_set_bit(ENGINE_IRQ_EXECLIST,
-					    &engine->irq_posted);
+		set_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted);
 
 	if (iir & GT_RENDER_USER_INTERRUPT) {
+		if (USES_GUC_SUBMISSION(engine->i915))
+			set_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted);
+
 		notify_ring(engine);
-		/*
-		 * notify_ring() may trigger direct submission onto this
-		 * engine, clearing the ENGINE_IRQ_EXECLIST bit. In that
-		 * case, we don't want to resubmit and so clear the tasklet
-		 * boolean. GuC never sets the ENGINE_IRQ_EXECLIST bit and
-		 * so when using the GuC this equates to an unconditional
-		 * setting of tasklet to true.
-		 */
-		if (!test_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted))
-			tasklet = USES_GUC_SUBMISSION(engine->i915);
 	}
 
-	if (tasklet)
+	if (engine && test_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted))
 		i915_tasklet(&execlists->tasklet);
 }