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

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

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.

_cairo_xcb_connection_put_image
- -------------------------------

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.

_cairo_xcb_connection_put_subimage
- ----------------------------------

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.

_cairo_xcb_connection_shm_put_image
- -----------------------------------

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)

_cairo_xcb_connection_render_spans
- ----------------------------------

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,
Uli
- -- 
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBCAAGBQJNFMxAAAoJECLkKOvLj8sGefIIAKgyRZfqTPjMjSVh4iN2/CG5
OYMMaJ35U7v/7/PF5nSG7zL7tVTYsaSIonQ9hqCorvrrxGrhjDv12AoqVc0B3B9J
X9ZZ9MbboZWiLpjXIKl1IvnDT6HXeRCL3JTLEURF40t/6p5XaKz/smn/AoR5c7Bg
n14wlPnhWT5VaHv4FmwN35I14+xP9B1HrJJx24iI7wr5NNuUr4ZaB70fCA3RaJ0j
1ULi2X3BUJTdvRVCNaTd4yzHSVGV7ctH+SJvZ3Vl2KFGd0k2Q4hxSJgd4Tud+I+c
lEsx1qaGqCu18z7noIF2egjEi5Q5nmE7TiLpO//0bt+HIB1vQg/kLj0Mc4+pMfE=
=CVJI
-----END PGP SIGNATURE-----


More information about the cairo mailing list