[Intel-gfx] [PATCH] convert intel_ring_begin count to dword

Chris Wilson chris at chris-wilson.co.uk
Sat Jun 12 11:22:10 CEST 2010


On Sat, 12 Jun 2010 17:14:54 +0800, Zou Nan hai <nanhai.zou at intel.com> wrote:
> convert intel_ring_begin count to dword,
> fix some wrong intel_ring_begin size.
> 
> Signed-off-by: Zou Nan hai <nanhai.zou at intel.com>
> ---
> @@ -723,10 +723,10 @@ int intel_wait_ring_buffer(struct drm_device *dev,
>  void intel_ring_begin(struct drm_device *dev,
>  		struct intel_ring_buffer *ring, int n)

Let's make the prototype a little clearer and s/n/num_dwords/...

>  {

And then: int n = 4 * num_dwords;

> -	if (unlikely(ring->tail + n > ring->size))
> +	if (unlikely(ring->tail + 4*n > ring->size))
>  		intel_wrap_ring_buffer(dev, ring);
> -	if (unlikely(ring->space < n))
> -		intel_wait_ring_buffer(dev, ring, n);
> +	if (unlikely(ring->space < 4*n))
> +		intel_wait_ring_buffer(dev, ring, 4*n);
>  }
>  
>  void intel_ring_emit(struct drm_device *dev,
> @@ -752,7 +752,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);

Admittedly this is the fly in the ointment.
-ickle

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list