what is the effect of RADEON_ALIGN (macros) in ATI-driver?

Tomas Carnecky tom at dbservice.com
Wed Aug 11 03:49:28 PDT 2010


On 8/11/10 12:38 PM, Cui, Hunk wrote:
> Hi, Tom,
> 
>> -----Original Message-----
>> From: Tomas Carnecky [mailto:tom at dbservice.com]
>> Sent: Wednesday, August 11, 2010 6:23 PM
>> To: Cui, Hunk
>> Cc: xorg-devel at lists.x.org
>> Subject: Re: what is the effect of RADEON_ALIGN (macros) in
> ATI-driver?
>>
>> On 8/11/10 12:03 PM, Cui, Hunk wrote:
>>> 	But I'm confused by the code, not really sure of the calculate:
>>> YDstPitch = (width + 31) & ~31; & UVDstPitch = ((width >> 1) + 15) &
>>> ~15;
>>
>> '(variable + X) & ~X' is a common idiom to align the variable to the
>> next multiple of (X+1).
> 
> 	Thank you for your hints, Could you give more explanation and
> some example to describe it? :)
> 	I need more info about this. :)

Some hardware requires that memory access be aligned to certain
boundaries. Even on x86 CPUs this is true to some extent (aligned memory
access is faster than unaligned).
See the description of 'unaligned access' and the example at
http://en.wikipedia.org/wiki/Bus_error.
http://www.alexonlinux.com/aligned-vs-unaligned-memory-access also looks
like a good description of what unaligned memory access is (it even has
pretty pictures).

tom



More information about the xorg-devel mailing list