x11-compositor event handling bug

Bill Spitzak spitzak at gmail.com
Tue Aug 14 09:47:27 PDT 2012

Weston x11 compositor is working very badly for me, due to some bug that 
appears to be in xcb. This bug has been true for 3 versions of Ubuntu, 
and does not depend on what window manager I am using and whether it is 
compositing or not (there was a previous claim it was a compiz bug). It 
also does not depend on the terminal program.

As far as I can tell, xcb_poll_for_event will ALWAYS fail the second 
time it is called after poll() calls x11_compositor_handle_event. If 
there is more than one event ready, it really should work.

The result is that wayland runs really slowly and looks like crap. 
Updates can fall so far behind mouse movement that it is impossible to use.

It can be "fixed" by adding the following patch and running wayland with 
output directed to another x terminal:

--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -953,6 +953,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, 
void *dat
                 if (prev != event)
                         free (event);
+       if (count) printf("count = %d\n", count);

         switch (prev ? prev->response_type & ~0x80 : 0x80) {
         case XCB_KEY_RELEASE:

This "fix" breaks if I redirect stdout to /dev/null, and if I change the 
output to {putchar('.'); fflush(stdout);}. Thus it appears the scrolling 
of the terminal that gets it to work. Note that this fix is *after* the 
loop that handles events!

Obviously this is a bug in xcb and my X driver but considering I have 
not seen this effect in other programs using it, there must be a 
workaround. I have to admit I see nothing wrong with the weston code...

More information about the wayland-devel mailing list