[mutter/wip/carlosg/drop-caps: 3/7] core: Set SCHED_RR by default on Wayland sessions



commit a171625bc5957f579eec8ce352770b38e66e9103
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Feb 27 19:02:25 2019 +0100

    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).
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/923

 src/backends/native/meta-backend-native.c | 15 ---------------
 src/core/main.c                           | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index 0bfae6d30..fc178f0a0 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -341,7 +341,6 @@ static void
 meta_backend_native_post_init (MetaBackend *backend)
 {
   ClutterDeviceManager *manager = clutter_device_manager_get_default ();
-  MetaSettings *settings = meta_backend_get_settings (backend);
 
   META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend);
 
@@ -349,20 +348,6 @@ meta_backend_native_post_init (MetaBackend *backend)
                                                              NULL, NULL);
   meta_device_manager_native_set_relative_motion_filter (manager, relative_motion_filter,
                                                          meta_backend_get_monitor_manager (backend));
-
-  if (meta_settings_is_experimental_feature_enabled (settings,
-                                                     META_EXPERIMENTAL_FEATURE_RT_SCHEDULER))
-    {
-      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");
-    }
 }
 
 static MetaMonitorManager *
diff --git a/src/core/main.c b/src/core/main.c
index 35e71a4ef..82694d5d8 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -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 ())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]