Skip to content

XWayland: Don't dispatch xwayland events in QAbstractEventDispatcher sleeps

David Edmundson requested to merge work/d_ed/xwayland_no_pointless_dispatch into master

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.

Edited by David Edmundson

Merge request reports

Loading