Patch that "fixes" compositor-x11

Bill Spitzak spitzak at gmail.com
Sun Jun 3 00:12:20 PDT 2012


For me weston compositor-x11 always ran really slow, as it produces a 
composite after every X event. I managed to "fix" this with the attached 
patch, and now multiple X events are read at a time, making wayland look 
*much* faster!

However this only fixes it because it prints something into a gnome 
terminal on the same X server. So it obviously relies on some 
side-effect of this X window updating. Simpler text, such as doing 
{putchar('.'); fflush(stdout);} was insufficient, the newline is 
necessary to get the correction. Anyway I suspect some bug in xcb, and I 
hope you X experts may be able to figure this out.

This patch also makes x11_compositor_handle_event return non-zero, which 
I believe was intended. But that does not fix the bug.

I'm using Xorg on Ubuntu 11.04 using nouveau and the classic Gnome.


-------------- next part --------------
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index d23553e..f329cc4 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -619,9 +619,11 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
 	uint32_t *k;
 	uint32_t i, set;
 	wl_fixed_t x, y;
+	int count = 0;
 
 	prev = NULL;
 	while (x11_compositor_next_event(c, &event, mask)) {
+		++count;
 		switch (prev ? prev->response_type & ~0x80 : 0x80) {
 		case XCB_KEY_RELEASE:
 			key_release = (xcb_key_press_event_t *) prev;
@@ -773,8 +775,8 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
 	default:
 		break;
 	}
-
-	return event != NULL;
+	if (count) printf("count = %d\n", count);
+	return count;
 }
 
 #define F(field) offsetof(struct x11_compositor, field)


More information about the wayland-devel mailing list