diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-08-04 10:18:13 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-08-09 14:24:31 -0400 |
commit | d97ed3396399126cfca1e12e2b2e2d8bbc4924e5 (patch) | |
tree | 831529a147ec7cd85ae080e415a84b351af574fe | |
parent | 1741dd4aa7552055659bf74ab829a21579407f10 (diff) |
drm/i915: Move ringbuffer accounting to begin/advance.
As we check that the ringbuffer will not wrap upon emission, we do not
need to check that incrementing the tail wrapped every time. However, we
do upon advancing just in case the tail is now pointing at the very end
of the ring.
Likewise we can account for the space used during emission in begin()
and avoid decrementing it for every emit.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index df8302a11eb5..7ab72af045ec 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -731,6 +731,8 @@ void intel_ring_begin(struct drm_device *dev, | |||
731 | intel_wrap_ring_buffer(dev, ring); | 731 | intel_wrap_ring_buffer(dev, ring); |
732 | if (unlikely(ring->space < n)) | 732 | if (unlikely(ring->space < n)) |
733 | intel_wait_ring_buffer(dev, ring, n); | 733 | intel_wait_ring_buffer(dev, ring, n); |
734 | |||
735 | ring->space -= n; | ||
734 | } | 736 | } |
735 | 737 | ||
736 | void intel_ring_emit(struct drm_device *dev, | 738 | void intel_ring_emit(struct drm_device *dev, |
@@ -739,13 +741,12 @@ void intel_ring_emit(struct drm_device *dev, | |||
739 | unsigned int *virt = ring->virtual_start + ring->tail; | 741 | unsigned int *virt = ring->virtual_start + ring->tail; |
740 | *virt = data; | 742 | *virt = data; |
741 | ring->tail += 4; | 743 | ring->tail += 4; |
742 | ring->tail &= ring->size - 1; | ||
743 | ring->space -= 4; | ||
744 | } | 744 | } |
745 | 745 | ||
746 | void intel_ring_advance(struct drm_device *dev, | 746 | void intel_ring_advance(struct drm_device *dev, |
747 | struct intel_ring_buffer *ring) | 747 | struct intel_ring_buffer *ring) |
748 | { | 748 | { |
749 | ring->tail &= ring->size - 1; | ||
749 | ring->advance_ring(dev, ring); | 750 | ring->advance_ring(dev, ring); |
750 | } | 751 | } |
751 | 752 | ||