diff options
author | Zou Nan hai <nanhai.zou@intel.com> | 2010-06-12 05:40:24 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-06-14 21:26:25 -0400 |
commit | be26a10bd10271b4a810ece2e540c0cdd77881bc (patch) | |
tree | 7a860721c42779eb2f461e1a0f302f256b8b69bd /drivers | |
parent | 45ac22c81b1088f5ac08dc5367f78c192d68d756 (diff) |
drm/i915: Fix incorrect intel_ring_begin size in BSD ringbuffer.
The ring_begin API was taking a number of bytes, while all of our
other begin/end macros take number of dwords. Change the API over to
dwords to prevent future bugs.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 9ed8ecd95801..f3f681fca76a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1075,7 +1075,7 @@ extern int intel_trans_dp_port_sel (struct drm_crtc *crtc); | |||
1075 | drm_i915_private_t *dev_priv = dev->dev_private; \ | 1075 | drm_i915_private_t *dev_priv = dev->dev_private; \ |
1076 | if (I915_VERBOSE) \ | 1076 | if (I915_VERBOSE) \ |
1077 | DRM_DEBUG(" BEGIN_LP_RING %x\n", (int)(n)); \ | 1077 | DRM_DEBUG(" BEGIN_LP_RING %x\n", (int)(n)); \ |
1078 | intel_ring_begin(dev, &dev_priv->render_ring, 4*(n)); \ | 1078 | intel_ring_begin(dev, &dev_priv->render_ring, (n)); \ |
1079 | } while (0) | 1079 | } while (0) |
1080 | 1080 | ||
1081 | 1081 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index cea4f1a8709e..a3cac5791d76 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -94,7 +94,7 @@ render_ring_flush(struct drm_device *dev, | |||
94 | #if WATCH_EXEC | 94 | #if WATCH_EXEC |
95 | DRM_INFO("%s: queue flush %08x to ring\n", __func__, cmd); | 95 | DRM_INFO("%s: queue flush %08x to ring\n", __func__, cmd); |
96 | #endif | 96 | #endif |
97 | intel_ring_begin(dev, ring, 8); | 97 | intel_ring_begin(dev, ring, 2); |
98 | intel_ring_emit(dev, ring, cmd); | 98 | intel_ring_emit(dev, ring, cmd); |
99 | intel_ring_emit(dev, ring, MI_NOOP); | 99 | intel_ring_emit(dev, ring, MI_NOOP); |
100 | intel_ring_advance(dev, ring); | 100 | intel_ring_advance(dev, ring); |
@@ -358,7 +358,7 @@ bsd_ring_flush(struct drm_device *dev, | |||
358 | u32 invalidate_domains, | 358 | u32 invalidate_domains, |
359 | u32 flush_domains) | 359 | u32 flush_domains) |
360 | { | 360 | { |
361 | intel_ring_begin(dev, ring, 8); | 361 | intel_ring_begin(dev, ring, 2); |
362 | intel_ring_emit(dev, ring, MI_FLUSH); | 362 | intel_ring_emit(dev, ring, MI_FLUSH); |
363 | intel_ring_emit(dev, ring, MI_NOOP); | 363 | intel_ring_emit(dev, ring, MI_NOOP); |
364 | intel_ring_advance(dev, ring); | 364 | intel_ring_advance(dev, ring); |
@@ -721,8 +721,9 @@ int intel_wait_ring_buffer(struct drm_device *dev, | |||
721 | } | 721 | } |
722 | 722 | ||
723 | void intel_ring_begin(struct drm_device *dev, | 723 | void intel_ring_begin(struct drm_device *dev, |
724 | struct intel_ring_buffer *ring, int n) | 724 | struct intel_ring_buffer *ring, int num_dwords) |
725 | { | 725 | { |
726 | int n = 4*num_dwords; | ||
726 | if (unlikely(ring->tail + n > ring->size)) | 727 | if (unlikely(ring->tail + n > ring->size)) |
727 | intel_wrap_ring_buffer(dev, ring); | 728 | intel_wrap_ring_buffer(dev, ring); |
728 | if (unlikely(ring->space < n)) | 729 | if (unlikely(ring->space < n)) |
@@ -752,7 +753,7 @@ void intel_fill_struct(struct drm_device *dev, | |||
752 | { | 753 | { |
753 | unsigned int *virt = ring->virtual_start + ring->tail; | 754 | unsigned int *virt = ring->virtual_start + ring->tail; |
754 | BUG_ON((len&~(4-1)) != 0); | 755 | BUG_ON((len&~(4-1)) != 0); |
755 | intel_ring_begin(dev, ring, len); | 756 | intel_ring_begin(dev, ring, len/4); |
756 | memcpy(virt, data, len); | 757 | memcpy(virt, data, len); |
757 | ring->tail += len; | 758 | ring->tail += len; |
758 | ring->tail &= ring->size - 1; | 759 | ring->tail &= ring->size - 1; |