[Xcb] sizeof paramters for length less lists

chris at demorecorder.com chris at demorecorder.com
Wed Feb 25 22:58:57 PST 2015


Hi Jaya,

Thank you for this question.

I have thought more about this topic after our previous off-list communication.

The real issue is not in the parameter list but somewhere else:

I think that the sizeof-function should not use the length field of the request 
internally to compute something,
(Otherwise, the all sizeof-functions of requests would trivially just return
the length-field multiplied by 4. Clearly the intention of the sizeof-function
was different.)

Therefore I suggest the following:
* Keep the rectangles_len parameter
* use it inside.
* don't use the length-field to compute the sizeof-result.
* so, don't use "(length - 3)/2" inside, but use rectangles_len.
  More specifically, don't generate:
    xcb_block_len += ((_aux->length - 3) / 2) * sizeof(xcb_rectangle_t);
  but generate:
    xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);

This way, you don't need to change the parameter list,
and we fulfill the initial intention of the sizeof-functions better.

Sorry for not thinking about this earlier.

Regards,

Chris

P.S.: @all: Here's some context, so people on this list can understand what's this about:

In current XCB, the length of the rectangles list of request SetPictureClipRectangles
is not specified in render.xml:
  <request name="SetPictureClipRectangles" opcode="6">
    <field type="PICTURE" name="picture" />
    <field type="INT16" name="clip_x_origin" />
    <field type="INT16" name="clip_y_origin" />
    <list type="RECTANGLE" name="rectangles" />
  </request>

This needs to be fixed for some applications, including server-side XCB.
So, the xml will be changed as follows, by using the length-field of the
request to compute the length of the rectangles-list:

  <request name="SetPictureClipRectangles" opcode="6">
    <field type="PICTURE" name="picture" />
    <field type="INT16" name="clip_x_origin" />
    <field type="INT16" name="clip_y_origin" />
    <list type="RECTANGLE" name="rectangles" >
	<op op="/">
            <op op="-">
                <fieldref>length</fieldref>
                <value>3</value>
    	    </op>
            <value>2</value>
        </op>
    </list>
  </request>

This creates some specific challenges for the generator,
because the length-field is an internal field.

Jaya has already solved most of these challenges.
The sizeof-function is the only thing left.

See
   https://bitbucket.org/jaya_tiwari
for the current state of her work.

P.P.S.: We will switch our communication from off-list
to the list.
The off-list communication was just use to get Jaya
( and Asalle ) up-to-speed with X11-technology and XCB etc.

Jaya Tiwari wrote on 25.02.2015 18:59:

> 
> 
> Hi All,
> 
> 
> I have tried having length less lists to have the length calculated by using request length.
> 
> I took render extension for start, and had the SetPictureClipRectangles to have length calculated from request length.
> 
> 
> I have sizeof generated for set_picture_clip_rectangles with rectangles_len as parameter, but unlike before, rectangles_len is no more used in the body of sizeof, as it is now replaced by request length ( which is (length - 3)/2 for rectangles list ).
> 
> 
> So, is it feasible to remove rectangles_len parameter from the sizeof now for such length less lists which now use request length in list length calculation ?
> 
> 
> Will this change bring any compatibility issues?
> 
> 
> Can anyone please guide me on this .
> 
> 
> --
> 
> 
> Regards,
> 
> Jaya
> 
>


More information about the Xcb mailing list