drm/i915: Introduce engine_stalled helper
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Tue, 17 Jan 2017 15:59:04 +0000 (17:59 +0200)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 18 Jan 2017 10:44:50 +0000 (10:44 +0000)
Move the engine stalled/pardoned check into a helper function.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1484668747-9120-4-git-send-email-mika.kuoppala@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_gem.c

index 0fe4875580fd0a22be455e6f3242182cc144aa5e..e2a6f482b80f119c84894a19fa45a9c7c0ae1bc6 100644 (file)
@@ -2611,6 +2611,20 @@ i915_gem_find_active_request(struct intel_engine_cs *engine)
        return NULL;
 }
 
+static bool engine_stalled(struct intel_engine_cs *engine)
+{
+       if (!engine->hangcheck.stalled)
+               return false;
+
+       /* Check for possible seqno movement after hang declaration */
+       if (engine->hangcheck.seqno != intel_engine_get_seqno(engine)) {
+               DRM_DEBUG_DRIVER("%s pardoned\n", engine->name);
+               return false;
+       }
+
+       return true;
+}
+
 void i915_gem_reset_prepare(struct drm_i915_private *dev_priv)
 {
        struct intel_engine_cs *engine;
@@ -2669,7 +2683,6 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
 {
        struct drm_i915_gem_request *request;
        struct i915_gem_context *hung_ctx;
-       bool ring_hung;
 
        if (engine->irq_seqno_barrier)
                engine->irq_seqno_barrier(engine);
@@ -2680,15 +2693,7 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
 
        hung_ctx = request->ctx;
 
-       ring_hung = engine->hangcheck.stalled;
-       if (engine->hangcheck.seqno != intel_engine_get_seqno(engine)) {
-               DRM_DEBUG_DRIVER("%s pardoned, was guilty? %s\n",
-                                engine->name,
-                                yesno(ring_hung));
-               ring_hung = false;
-       }
-
-       if (ring_hung) {
+       if (engine_stalled(engine)) {
                i915_gem_context_mark_guilty(hung_ctx);
                skip_request(request);
        } else {