drm/i915: Fix incorrect intel_ring_begin size in BSD ringbuffer.
authorZou Nan hai <nanhai.zou@intel.com>
Sat, 12 Jun 2010 09:40:24 +0000 (17:40 +0800)
committerEric Anholt <eric@anholt.net>
Tue, 15 Jun 2010 01:26:25 +0000 (18:26 -0700)
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>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_ringbuffer.c

index 9ed8ecd95801e94734716a2c64ba62d540d4600c..f3f681fca76a7e69e2e1d8c4cac91944f96a83cf 100644 (file)
@@ -1075,7 +1075,7 @@ extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
        drm_i915_private_t *dev_priv = dev->dev_private;                \
        if (I915_VERBOSE)                                               \
                DRM_DEBUG("   BEGIN_LP_RING %x\n", (int)(n));           \
-       intel_ring_begin(dev, &dev_priv->render_ring, 4*(n));           \
+       intel_ring_begin(dev, &dev_priv->render_ring, (n));             \
 } while (0)
 
 
index cea4f1a8709ec775913fda1bab17d7868c944be4..a3cac5791d76272b21128399979658e0fe69d3bc 100644 (file)
@@ -94,7 +94,7 @@ render_ring_flush(struct drm_device *dev,
 #if WATCH_EXEC
                DRM_INFO("%s: queue flush %08x to ring\n", __func__, cmd);
 #endif
-               intel_ring_begin(dev, ring, 8);
+               intel_ring_begin(dev, ring, 2);
                intel_ring_emit(dev, ring, cmd);
                intel_ring_emit(dev, ring, MI_NOOP);
                intel_ring_advance(dev, ring);
@@ -358,7 +358,7 @@ bsd_ring_flush(struct drm_device *dev,
                u32     invalidate_domains,
                u32     flush_domains)
 {
-       intel_ring_begin(dev, ring, 8);
+       intel_ring_begin(dev, ring, 2);
        intel_ring_emit(dev, ring, MI_FLUSH);
        intel_ring_emit(dev, ring, MI_NOOP);
        intel_ring_advance(dev, ring);
@@ -721,8 +721,9 @@ int intel_wait_ring_buffer(struct drm_device *dev,
 }
 
 void intel_ring_begin(struct drm_device *dev,
-               struct intel_ring_buffer *ring, int n)
+               struct intel_ring_buffer *ring, int num_dwords)
 {
+       int n = 4*num_dwords;
        if (unlikely(ring->tail + n > ring->size))
                intel_wrap_ring_buffer(dev, ring);
        if (unlikely(ring->space < n))
@@ -752,7 +753,7 @@ void intel_fill_struct(struct drm_device *dev,
 {
        unsigned int *virt = ring->virtual_start + ring->tail;
        BUG_ON((len&~(4-1)) != 0);
-       intel_ring_begin(dev, ring, len);
+       intel_ring_begin(dev, ring, len/4);
        memcpy(virt, data, len);
        ring->tail += len;
        ring->tail &= ring->size - 1;