From d3a6d4467ca44833bcb4ba1893a7aeaae939e4d5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 30 Jul 2008 12:21:20 -0700 Subject: [PATCH] i915: Track progress inside of batchbuffers for determining wedgedness. This avoids early termination for long-running commands. Signed-off-by: Eric Anholt Signed-off-by: Dave Airlie --- drivers/gpu/drm/i915/i915_dma.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 27a1f78a7f1a..aa9e8da9f716 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -40,11 +40,15 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller) { drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_ring_buffer_t *ring = &(dev_priv->ring); + u32 acthd_reg = IS_I965G(dev) ? ACTHD_I965 : ACTHD; + u32 last_acthd = I915_READ(acthd_reg); + u32 acthd; u32 last_head = I915_READ(PRB0_HEAD) & HEAD_ADDR; int i; - for (i = 0; i < 10000; i++) { + for (i = 0; i < 100000; i++) { ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR; + acthd = I915_READ(acthd_reg); ring->space = ring->head - (ring->tail + 8); if (ring->space < 0) ring->space += ring->Size; @@ -55,8 +59,13 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller) if (ring->head != last_head) i = 0; + if (acthd != last_acthd) + i = 0; last_head = ring->head; + last_acthd = acthd; + msleep_interruptible(10); + } return -EBUSY; -- 2.20.1