drm/i915/ringbuffer: Check that we setup the ringbuffer
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 28 Oct 2010 10:18:07 +0000 (11:18 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 28 Oct 2010 11:33:17 +0000 (12:33 +0100)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_ringbuffer.c

index 8eaa60cc5d25056d0d63e02d025d3cdd686121cd..e88214ef24b11a23182747891ded07e4f87fc9cc 100644 (file)
@@ -176,9 +176,10 @@ static int init_ring_common(struct intel_ring_buffer *ring)
                        ((ring->gem_object->size - PAGE_SIZE) & RING_NR_PAGES)
                        | RING_NO_REPORT | RING_VALID);
 
-       head = I915_READ_HEAD(ring) & HEAD_ADDR;
        /* If the head is still not zero, the ring is dead */
-       if (head != 0) {
+       if ((I915_READ_CTL(ring) & RING_VALID) == 0 ||
+           I915_READ_START(ring) != obj_priv->gtt_offset ||
+           (I915_READ_HEAD(ring) & HEAD_ADDR) != 0) {
                DRM_ERROR("%s initialization failed "
                                "ctl %08x head %08x tail %08x start %08x\n",
                                ring->name,