aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-07-30 15:21:20 -0400
committerDave Airlie <airlied@linux.ie>2008-10-17 17:10:10 -0400
commitd3a6d4467ca44833bcb4ba1893a7aeaae939e4d5 (patch)
tree6d2cc2717ba64598ee5dc4cfae81a1098a228968 /drivers/gpu
parented4cb4142b242d8090d3811d5eb4abf6aa985bc8 (diff)
i915: Track progress inside of batchbuffers for determining wedgedness.
This avoids early termination for long-running commands. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c11
1 files changed, 10 insertions, 1 deletions
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)
40{ 40{
41 drm_i915_private_t *dev_priv = dev->dev_private; 41 drm_i915_private_t *dev_priv = dev->dev_private;
42 drm_i915_ring_buffer_t *ring = &(dev_priv->ring); 42 drm_i915_ring_buffer_t *ring = &(dev_priv->ring);
43 u32 acthd_reg = IS_I965G(dev) ? ACTHD_I965 : ACTHD;
44 u32 last_acthd = I915_READ(acthd_reg);
45 u32 acthd;
43 u32 last_head = I915_READ(PRB0_HEAD) & HEAD_ADDR; 46 u32 last_head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
44 int i; 47 int i;
45 48
46 for (i = 0; i < 10000; i++) { 49 for (i = 0; i < 100000; i++) {
47 ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR; 50 ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
51 acthd = I915_READ(acthd_reg);
48 ring->space = ring->head - (ring->tail + 8); 52 ring->space = ring->head - (ring->tail + 8);
49 if (ring->space < 0) 53 if (ring->space < 0)
50 ring->space += ring->Size; 54 ring->space += ring->Size;
@@ -55,8 +59,13 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
55 59
56 if (ring->head != last_head) 60 if (ring->head != last_head)
57 i = 0; 61 i = 0;
62 if (acthd != last_acthd)
63 i = 0;
58 64
59 last_head = ring->head; 65 last_head = ring->head;
66 last_acthd = acthd;
67 msleep_interruptible(10);
68
60 } 69 }
61 70
62 return -EBUSY; 71 return -EBUSY;