[cairo] [Patch] cairo-xcb: Stop using xcb_take_socket

Uli Schlachter psychon at znc.in
Fri Dec 24 08:37:22 PST 2010

Hash: SHA256


attached is a monster patch that makes cairo-xcb use the functions from xcb
instead of hand-writing all the requests and using xcb_take_socket / xcb_writev
to write it out:

 9 files changed, 125 insertions(+), 1172 deletions(-)

Most of this is obvious changes. Stop taking the socket, use the function from
xcb instead of xcb_writev etc. However, there are four functions that were a
little more complicated.

- -------------------------------

This function makes sure that the uploaded image still fits into the maximum
request size. This is done by splitting the image up into multiple xcb_put_image
calls, if necessary.

- ----------------------------------

This function doesn't upload the whole image, but only a part of it. To make
this work without first copying the "interesting" part of the image into a new
buffer, this uses xcb_send_request to generate the PutImage request. This means
that we can't use the generated functions again, but at least this doesn't have
to take the socket any more.

- -----------------------------------

With xcb_take_socket, we get access to the full, 64-bit sequence number that xcb
uses internally, but the auto-generated functions return the sequence number as
an unsigned int, so we might lose the high bits of the sequence. This shouldn't
be too bad, because this number isn't used anywhere currently and we still got
enough bits to make sure we can detect if the X server finished the request (if
someone ever writes such a patch)

- ----------------------------------

This function sends a request that is part of the RENDER specification and thus
no equivalent xcb-render function call is available. Since nothing manages to
hit this code currently, the old code is "#if 0"'d away and an ASSERT_UNREACHED
is placed in there.

Happy Holidays,
- -- 
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
Version: GnuPG v1.4.10 (GNU/Linux)


More information about the cairo mailing list