[Xcb] icccm

Jamey Sharp jamey at minilop.net
Sun Mar 20 13:03:12 PST 2005


On Sun, Mar 20, 2005 at 12:30:45PM -0800, Josh Triplett wrote:
> Vincent Torri wrote:
> > And for you information, i've finished xcb port of evas !
> >
> > evas xlib : 2.893 (173.6 fps)
> > evas xcb  : 2.831 (169.9 fps)
> >
> > i think that my code is maybe not good enough. maybe i could optimize it.
> 
> Those speeds are nearly identical; assuming you did a direct port of
> every Xlib call to a corresponding XCB call (or pair of calls), then
> that sounds about right.  You don't really get any speed advantages
> until you start taking advantage of XCB's features, such as sending a
> batch of requests and then getting all the replies later.

Although there is some hope that with good profiling we could get a
*small* performance improvement even on code produced this way, due to
cache effects or something. In fact, I've done some very limited
performance tests that suggest that XCB is currently slower than Xlib;
but I don't have the profiling data to say why.

> > And as i think of it, here is a question : should i use XCBSync where
> > there was a XSynch ? or xcb allows to not use it in some cases ?
> 
> All XCBSync does is make a request that has a reply (GetInputFocus),
> then wait for the reply; the semantics of the X protocol require all
> previous requests to be handled before that reply is returned, causing
> a sync.  (The semantics are slightly different than Xlib, since only
> void requests may be batched in Xlib, whereas all requests may be
> batched in XCB.)

True, true.

> XCB never *requires* a call to XCBSync. ...  To the best of my
> knowledge, doing a sync or not doing a sync will not affect the
> correctness of your application.

This is actually an interesting question; I don't think the answer is
entirely clear.

XCBSync guarantees, in particular, that any events caused by requests
you've made have arrived. If Evas is doing a lot with ICCM/NetWM (and
frankly I don't know what Evas is for -- I'm just glad Vincent's porting
it *grin*) then it's doing a lot with properties and events. I could
believe Evas currently needs syncs for those.

I'm going to throw out the hypothesis here, though, that an app that
needs syncs can be re-written into one that doesn't -- one that uses a
more event-driven model, for instance, or that gets work done in those
round-trips. If the hypothesis is true, and the re-writing isn't too
hard, it might be a good idea to do a re-write like that because every
sync is obviously going to prevent the thread from doing anything until
the server catches up.

--Jamey


More information about the xcb mailing list