sway: request SCHED_RR via RTKit

This tries to connect to DBUS to request RTTimeUSecMax from RTKit and
than changes the scheduling policy of sway to SCHED_RR. I tested the
impact using hackbench, with this patch I don't see any cursor
stuttering while running the following hackbench command:

  $ hackbench -f 100 -l 100000 -s 100000

This also fixes the "your compositor is too slow"-warnings from
libinput.

The rtkit feature is currently auto, so if one of the SD-Bus libraries
is installed we will select it. However we will fail graciously with
only a debug note if we can't reach RTKit and won't touch RLIMIT_RTTIME
in this case. Users who don't want to have DBUS within sway itself can
disable the feature.
This commit is contained in:
Rouven Czerwinski 2022-05-13 20:30:19 +02:00
parent ffc603d451
commit 4fa003dff1
6 changed files with 89 additions and 0 deletions

View file

@ -106,6 +106,12 @@ if get_option('tray').enabled() and not tray_deps_found
endif
have_tray = (not get_option('tray').disabled()) and tray_deps_found
rt_deps_found = sdbus.found()
if get_option('rtkit').enabled() and not rt_deps_found
error('Building with -Drtkit=enabled, but sd-bus has not been not found')
endif
have_rtkit = (not get_option('rtkit').disabled()) and rt_deps_found
conf_data = configuration_data()
conf_data.set10('HAVE_XWAYLAND', have_xwayland)
@ -114,6 +120,7 @@ conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
conf_data.set10('HAVE_TRAY', have_tray)
conf_data.set10('HAVE_RTKIT', have_rtkit)
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
if scdoc.found()
@ -319,6 +326,7 @@ summary({
'xwayland': have_xwayland,
'gdk-pixbuf': gdk_pixbuf.found(),
'tray': have_tray,
'rtkit': have_rtkit,
'man-pages': scdoc.found(),
}, bool_yn: true)