[Xcb] new, improved Xlib

Jamey Sharp jamey at minilop.net
Mon Mar 21 01:19:20 PST 2005


If any of you are testing Xlib/XCB, would you please cvs update both XCB
and Xlib and rebuild them? I fixed something that was an old ugly hack,
and I have some reason to think things might work better as a result.

When I started working on porting all of Xlib to use XCB (as opposed to
the earlier XCL project), I added a hook to XCB where Xlib could
register a callback function that XCB would call if it ever got a reply
that it didn't expect.

That hook has bugged me ever since. It's the only callback function in
XCB's API, and the registered function is called from the middle of an
internal XCB routine that has various structures locked and all sorts of
invariants to maintain. More than once I've thought that some of the
assertion failure bugs we've seen in Xlib/XCB were caused by this
design, though I've never proven it.

Well, I finally figured out how to make that hook go away, and the fixes
are committed to both Xlib and XCB CVS. Xlib just has to tell XCB to
expect a reply from *every* request that Xlib sends, and then sort out
which ones actually got replies later. This means that over the lifetime
of an Xlib app there are an extra number of mallocs and frees linear in
the number of requests made through Xlib, but that doesn't seem to have
any noticeable impact on performance.

My first try at this change did have a terrible impact on performance,
though, and I hereby reccomend kcachegrind and valgrind-callgrind as
wonderful tools for profiling applications. The GUI call graph
visualization, the ability to run on unmodified binaries and get data
about all functions everywhere in applications and libraries, the
support for threads...

I'm re-running the X test suite now. The CloseDisplay tests still
trigger assertion failures, and of course anything using
ListFontsWithInfo fails pretty badly. Otherwise the tests aren't
crashing, but I don't remember if that was true before this change.
Josh, might you have time to re-run the test suite and report on whether
this helped?

--Jamey


More information about the xcb mailing list