Patch that "fixes" compositor-x11

Kristian Høgsberg hoegsberg at gmail.com
Tue Jun 5 08:13:03 PDT 2012


On Sun, Jun 03, 2012 at 12:12:20AM -0700, Bill Spitzak wrote:
> 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!

What do you mean by "produces a composite" and how do you know?  The
x11 backend renders every 10ms when it's rendering continuously, not
after every X event.  At least that's how it's supposed to work (and
how it works here), if that doesn't happen for you, it would be nice
if you could get some more details on what actually happens and why.

> 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.

Is there a case where we return 0 but actually handled events in the
loop?  I don't see the code path where that may happen, if we handle
an event, 'event' will be non-NULL and we'll return 1.  The mainloop
only cares whether the return values is 0 or positive, the actual
number of events processed doesn't matter.

Kristian

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

> 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)

> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel



More information about the wayland-devel mailing list