kwin/src/xwayland
David Edmundson fbb71f9c0b XWayland: Don't dispatch xwayland events in QAbstractEventDispatcher sleeps
QAbstractEventDispatcher blocks and waits constantly on every external event
processed; every timer or update from an X or wayland client, mouse
move or DRM event.

Right now every time this happens we go and check Xwayland for new
events, this is a system call (poll) that based on strace will
unsurprisingly immediately return with EAGAIN as there's nothing to read
from X. If there is something to read our socket notifier will fire. On block we do still need to read any events read in the meantime that weren't dispatched.

This cuts down our system calls significantly, which hopefully should have a
noticeable impact on performance especially when the kernel is under
load.

---

Found whilst analysing strace (by accident whilst looking for something else!)

In a simple case of xwayland nested running glxgears we go from 28 calls per frame to 21. With many many clients and more input events it'll be an even higher percentage.
2023-02-08 10:34:20 +00:00
..
lib
clipboard.cpp
clipboard.h
CMakeLists.txt
databridge.cpp
databridge.h
datasource.cpp
datasource.h
dnd.cpp
dnd.h
drag.cpp
drag.h
drag_wl.cpp
drag_wl.h
drag_x.cpp
drag_x.h
primary.cpp
primary.h
selection.cpp
selection.h
selection_source.cpp
selection_source.h
transfer.cpp
transfer.h
xwayland.cpp XWayland: Don't dispatch xwayland events in QAbstractEventDispatcher sleeps 2023-02-08 10:34:20 +00:00
xwayland.h XWayland: Don't dispatch xwayland events in QAbstractEventDispatcher sleeps 2023-02-08 10:34:20 +00:00
xwayland_interface.h
xwaylandlauncher.cpp Launch xwayland on demand 2023-02-06 16:24:01 +00:00
xwaylandlauncher.h Launch xwayland on demand 2023-02-06 16:24:01 +00:00
xwldrophandler.cpp
xwldrophandler.h