drm/i915: Double check ring is idle before declaring the GPU wedged
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 11 Aug 2014 08:21:35 +0000 (09:21 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 11 Aug 2014 11:33:49 +0000 (13:33 +0200)
During ring initialisation, sometimes we observe, though not in
production hardware, that the idle flag is not set even though the ring
is empty. Double check before giving up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_ringbuffer.c

index 117543e58d4889a74469a169efb65f94df0ef9da..a059b64a0fb283502bda0c0ac3cfa468fef9d218 100644 (file)
@@ -478,7 +478,12 @@ static bool stop_ring(struct intel_engine_cs *ring)
                I915_WRITE_MODE(ring, _MASKED_BIT_ENABLE(STOP_RING));
                if (wait_for((I915_READ_MODE(ring) & MODE_IDLE) != 0, 1000)) {
                        DRM_ERROR("%s : timed out trying to stop ring\n", ring->name);
-                       return false;
+                       /* Sometimes we observe that the idle flag is not
+                        * set even though the ring is empty. So double
+                        * check before giving up.
+                        */
+                       if (I915_READ_HEAD(ring) != I915_READ_TAIL(ring))
+                               return false;
                }
        }