[Xorg-driver-geode] what is the effect of RADEON_ALIGN (macros) in ATI-driver?
Hunk.Cui at amd.com
Thu Aug 12 02:06:08 PDT 2010
Congratulations Matt! :-) Thank you for your help.
Now I have a clear concept to understanding it. :)
Following documents give me more help:
It just aligns to a number of bytes, because that is what the hardware expects. Any where we are setting up buffers for the HW to use, things like sizes, height, widths, all need to be aligned, it can improve the system operation ability.
# Realizing pseudo-code,
padding = align - (offset mod align)
new offset = offset + padding = offset + align - (offset mod align)
Above is my summary. :)
> 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. :)
More information about the Xorg-driver-geode