[PATCH] drm/radeon/kms/blit: fix blit copy for very large buffers

Michel Dänzer michel at daenzer.net
Thu Feb 2 00:50:25 PST 2012


On Mit, 2012-02-01 at 17:07 -0500, Ilija Hadzic wrote: 
> 
> diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
> index d996f43..32dcc95 100644
> --- a/drivers/gpu/drm/radeon/r600_blit_kms.c
> +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
> @@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev)
>  	radeon_ring_write(ring, sq_stack_resource_mgmt_2);
>  }
>  
> +#define I2F_MAX_BITS 15
> +#define I2F_MAX_INPUT  ((2 << I2F_MAX_BITS) - 1)

Should be ((1 << I2F_MAX_BITS) - 1): 2^n == (1 << n)


> static uint32_t i2f(uint32_t input)
>  {
>  	u32 result, i, exponent, fraction;
>  
> -	if ((input & 0x3fff) == 0)
> -		result = 0; /* 0 is a special case */
> +	WARN_ON(input > I2F_MAX_INPUT);

Use WARN_ON_ONCE here to avoid spamming the kernel output. If this is
ever hit again, it won't happen just once.


Looks good to me otherwise.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the dri-devel mailing list