[Xcb] XCB-XML: Specification for alignments?

Evgeny M. Zubok evgeny.zubok at tochka.ru
Mon Nov 1 17:11:57 PDT 2010


Peter Harris writes:

> On 2010-10-31 19:43, Evgeny M. Zubok wrote:
>> 
>> What do you think about new tag for XCB-XML specification to
>> explicitly insert the alignment bytes into requests, replies, events
>> and structures?
>
> I think it's a great idea. XCB-XML should always explicitly pad
> wherever there is padding. There was an effort to spell out all the
> static pads a while back, and I think we've got them all
> now. Unfortunately, I haven't had the time to look at dynamic padding
> in sufficient detail myself.

I will try to inspect all XMLs and insert alignment where it is
required.

>> <align><value>4</value></align> 
>
> Or even <pad align="4" /> (but that's just bikeshedding; if you're
> implementing it, you get to pick the syntax).
>
> There is at least one place where we already spell this out the long way
> (grep for alignment_pad in xf86vidmode.xml). Ick.

Not only there. Also in the dri2.xml in "Connect" request. c_client.py
(git) refuses to work at this place and quits with error message and
passes if I comment the alignment_pad description. Also the
"alignment_pad" variant is very verbose, IMO.

I have two options:

(i) To insert <pad align="4" />. This variant is more clear and
intuitive. When the code generator meets this construct, it can insert
alignment code into xcb_parts:

xcb_parts[<n>].iov_base = 0;
xcb_parts[<n>].iov_len = -xcb_parts[<n-1>].iov_len & 3;

But it need to make a simple stub in c_client.py for a while in order to
do not break the old behaviour (at present, the c_client.py fails if it
encounters 'pad' with unknown attribule 'align').

(ii) To insert align="4" tag into field/list attributes.

Advantage: No need to rewrite c_client.py at first step, because it will
not see this attribute. Also it seems easier to change c_client.py in
order to take into account this attribute.



More information about the Xcb mailing list