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



commit 1f67b6e407cf2c26d6ba072ca252a4efd0cce98d
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                           | 17 +++++++++++++++++
 2 files changed, 17 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 ce4c625f2..3497c2e7b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -526,6 +526,20 @@ meta_override_compositor_configuration (MetaCompositorType compositor_type,
   _backend_gtype_override = backend_gtype;
 }
 
+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");
+}
+
 /**
  * meta_init: (skip)
  *
@@ -575,6 +589,9 @@ meta_init (void)
 #ifdef HAVE_WAYLAND
   if (compositor_type == META_COMPOSITOR_TYPE_WAYLAND)
     meta_set_is_wayland_compositor (TRUE);
+
+  if (backend_gtype == META_TYPE_BACKEND_NATIVE)
+    meta_set_scheduler ();
 #endif
 
 #ifdef HAVE_LIBCAPNG


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