mirror of
https://github.com/brl/mutter.git
synced 2025-08-09 09:54:40 +00:00
core: Set SCHED_RR by default on Wayland sessions
This still may fail if the executable is missing the right capability. This can no longer depend on a setting as we want this to happen before capabilities are dropped (and before other threads are spawned). The necessary bits (eg. "setcap CAP_SYS_NICE=+ep `which gnome-shell`") are still left up to users/distributors. https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
This commit is contained in:
@@ -522,6 +522,22 @@ meta_override_compositor_configuration (MetaCompositorType compositor_type,
|
||||
_backend_gtype_override = backend_gtype;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
static void
|
||||
meta_set_scheduler (void)
|
||||
{
|
||||
int retval;
|
||||
struct sched_param sp = {
|
||||
.sched_priority = sched_get_priority_min (SCHED_RR)
|
||||
};
|
||||
|
||||
retval = sched_setscheduler (0, SCHED_RR | SCHED_RESET_ON_FORK, &sp);
|
||||
|
||||
if (retval != 0)
|
||||
g_warning ("Failed to set RT scheduler: %m");
|
||||
}
|
||||
#endif /* HAVE_NATIVE_BACKEND */
|
||||
|
||||
/**
|
||||
* meta_init: (skip)
|
||||
*
|
||||
@@ -573,6 +589,11 @@ meta_init (void)
|
||||
meta_set_is_wayland_compositor (TRUE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
if (backend_gtype == META_TYPE_BACKEND_NATIVE)
|
||||
meta_set_scheduler ();
|
||||
#endif
|
||||
|
||||
g_unix_signal_add (SIGTERM, on_sigterm, NULL);
|
||||
|
||||
if (g_get_home_dir ())
|
||||
|
Reference in New Issue
Block a user