[2/4] drm/i915: Move ringbuffer accounting to begin/advance.
diff mbox

Message ID 1280931495-31744-3-git-send-email-chris@chris-wilson.co.uk
State Deferred, archived
Headers show

Commit Message

Chris Wilson Aug. 4, 2010, 2:18 p.m. UTC
None

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index b5ccee5..c153d4e 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -751,6 +751,8 @@  void intel_ring_begin(struct drm_device *dev,
 		intel_wrap_ring_buffer(dev, ring);
 	if (unlikely(ring->space < n))
 		intel_wait_ring_buffer(dev, ring, n);
+
+	ring->space -= n;
 }
 
 void intel_ring_emit(struct drm_device *dev,
@@ -759,13 +761,12 @@  void intel_ring_emit(struct drm_device *dev,
 	unsigned int *virt = ring->virtual_start + ring->tail;
 	*virt = data;
 	ring->tail += 4;
-	ring->tail &= ring->size - 1;
-	ring->space -= 4;
 }
 
 void intel_ring_advance(struct drm_device *dev,
 		struct intel_ring_buffer *ring)
 {
+	ring->tail &= ring->size - 1;
 	ring->advance_ring(dev, ring);
 }