[PATCH weston 1/2] compositor-x11: stop using input_loop

Pekka Paalanen ppaalanen at gmail.com
Thu Mar 24 15:10:18 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

X11 is the only backend that still used the input event loop.

This patch is an identical rewrite of
6deb09ef8a72164947cdfa5f2414e292c7672c9c which was then reverted in
3bebe6461a9de5d8c5c7da0261c70cd250fa1fde for reasons unrecorded. This
patch is also the revert of 22ba60e514e074e4bdee1529aa8d22600712f001.

Originally input devices were moved into their own event loop in
7ea10864c2fc7370f5ada88a3fc91ab5f188da00 and the reason for that is
explained in 7dbf5e2ea744bde56b65ba45b935b77df4a783e1.

The idea behind the input event loop was that it would be beneficial to
process and relay input events to clients just once during an output
repaint cycle, because clients cannot update the image on screen any
faster anyway. All input events also carry a timestamp, so we didn't
lose any timing information. This was supposed to save power by reducing
the process wake-ups and context switches. There was also a mention of
reducing lag.

However, the concept of an output repaint loop does not really work out
when you have several outputs, but the input devices are not exclusive
to a certain output.

The logic for driving the input event loop in Weston core was written to
assume a single output. When you have multiple outputs with independent
repaint cycles, the input event loop handling becomes fairly random, one
output freezes input while another output thaws it, etc.

The DRM backend stopped using the input event loop when it started using
the libinput input backend, which became the default in
3f5e906268448f2d84b115c5f3d22165ce0021b1, and the old code was finally
ripped out in 823ad33ef34fa32b14b300d987fb9d2e2a42e9c4.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 src/compositor-x11.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index f1cb71b..91a7c2e 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -1576,6 +1576,7 @@ x11_backend_create(struct weston_compositor *compositor,
 {
 	struct x11_backend *b;
 	struct x11_output *output;
+	struct wl_event_loop *loop;
 	struct weston_config_section *section;
 	int i, x = 0, output_count = 0;
 	int width, height, scale, count;
@@ -1705,8 +1706,9 @@ x11_backend_create(struct weston_compositor *compositor,
 		x = pixman_region32_extents(&output->base.region)->x2;
 	}
 
+	loop = wl_display_get_event_loop(compositor->wl_display);
 	b->xcb_source =
-		wl_event_loop_add_fd(compositor->input_loop,
+		wl_event_loop_add_fd(loop,
 				     xcb_get_file_descriptor(b->conn),
 				     WL_EVENT_READABLE,
 				     x11_backend_handle_event, b);
-- 
2.7.3



More information about the wayland-devel mailing list