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

Matt Turner mattst88 at gmail.com
Wed Aug 11 20:18:14 PDT 2010


On Wed, Aug 11, 2010 at 10:55 PM, Cui, Hunk <Hunk.Cui at amd.com> wrote:
>        I want to know why the variable should add X (in '(variable +
> X)'), what is the mainly intention? What are the different with HW
> operation?

Good question. If I understand it correctly, I think I can help.

Given some value, say 87, that we need to align to a boundary, for example, 64.

The code for this would be
(87 + 63) & ~63; or just RADEON_ALIGN(87, 64)

The & ~63 does the aligning, by removing all bits lower than our
desired alignment. The + 63 ensures that we align to a boundary
greater than our value.

So, 87 + 63 = 150, and 150 & ~63 gives 128, which is the next 64-byte
aligned boundary after 87. If we didn't add 63, we'd have 87 & ~63,
which is 64 and is too small to store 87 bytes.

Hope that I understood your question and was able to help. :)

Matt


More information about the xorg-devel mailing list