drm/1915: ringbuffer wait for idle function
authorBen Widawsky <ben@bwidawsk.net>
Sun, 20 Mar 2011 01:14:27 +0000 (18:14 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 10 May 2011 20:56:40 +0000 (13:56 -0700)
Added a new function which waits for the ringbuffer space to be equal to
(total - 8). This is the empty condition of the ringbuffer, and
equivalent to head==tail.

Also modified two users of this functionality elsewhere in the code.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h

index 12876f2795d2b373d9cac4130ec0052b44db23e6..64c6f67777f899215997ac20f29e6262a114df71 100644 (file)
@@ -571,7 +571,7 @@ static int i915_quiescent(struct drm_device *dev)
        struct intel_ring_buffer *ring = LP_RING(dev->dev_private);
 
        i915_kernel_lost_context(dev);
-       return intel_wait_ring_buffer(ring, ring->size - 8);
+       return intel_wait_ring_idle(ring);
 }
 
 static int i915_flush_ioctl(struct drm_device *dev, void *data,
index 884556d9814e3c0d2cdbe9d4d6fb1ecd24344bba..07e59072e12910fd6576b4ef5eeb20926b491bdf 100644 (file)
@@ -873,7 +873,7 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring)
 
        /* Disable the ring buffer. The ring must be idle at this point */
        dev_priv = ring->dev->dev_private;
-       ret = intel_wait_ring_buffer(ring, ring->size - 8);
+       ret = intel_wait_ring_idle(ring);
        if (ret)
                DRM_ERROR("failed to quiesce %s whilst cleaning up: %d\n",
                          ring->name, ret);
index f23cc5f037a6cbf62bec342ec1f237de165d9c72..16cb125eb117bb43dcf1b34d60a49289985bbf30 100644 (file)
@@ -164,7 +164,13 @@ intel_read_status_page(struct intel_ring_buffer *ring,
 #define I915_BREADCRUMB_INDEX          0x21
 
 void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring);
+
 int __must_check intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n);
+static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring)
+{
+       return intel_wait_ring_buffer(ring, ring->space - 8);
+}
+
 int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n);
 
 static inline void intel_ring_emit(struct intel_ring_buffer *ring,