[Xcb] [PATCH] XVMC: Use XCB DRI2 instead of cargo-culting our own copy of the protocol.
jamey at minilop.net
Thu Oct 15 15:01:02 PDT 2009
This sure makes me happy. :-)
Quirks that will bite you here:
On Thu, Oct 15, 2009 at 2:25 PM, Eric Anholt <eric at anholt.net> wrote:
> + query_version_cookie = xcb_dri2_query_version(c, 1, 0);
You want to call xcb_get_extension_data (a cached version of
QueryExtension) and verify that the extension is present before using
any requests from the extension. The stubs will do this for you if you
forget, but will shut down your X connection if the extension is not
present, which would be unfortunate.
...I don't see that documented anywhere. Oops. Anyone know where we
wrote this down, or mind adding it someplace appropriate?
> + xvmc_driver->fd = open(xcb_dri2_connect_device_name(connect_reply),
> + O_RDWR);
Does the protocol specify that the device name field is
null-terminated? Can you really trust it? XCB won't null-terminate
things for you; it gives you exactly what it got off the wire.
Otherwise, while it's unfortunate that this takes four completely
sequential round-trips, it looks like good XCB client code.
You could probably be optimistic and issue the Connect request while
waiting for the QueryVersion reply, and just expect an error from
Connect if you got one from QueryVersion. Just wait for both replies
before returning, or you'll leak memory inside XCB.
More information about the Xcb