Blame SOURCES/0038-manager-don-t-kill-initial-setup-before-starting-use.patch

a1b388
From c65a0dbd195be52f0db0c49ea0355fe1b5eb4c09 Mon Sep 17 00:00:00 2001
a1b388
From: Ray Strode <rstrode@redhat.com>
a1b388
Date: Fri, 31 Aug 2018 15:48:38 -0400
a1b388
Subject: [PATCH 38/51] manager: don't kill initial-setup before starting user
a1b388
 session on wayland
a1b388
a1b388
Right now we kill initial-setup before starting the session for the user
a1b388
initial-setup created.  This is the right thing to do for Xorg, since
a1b388
Xorg can't be killed in the background, but it adds unncessary flicker
a1b388
for wayland.
a1b388
a1b388
This commit checks if it's wayland and avoids killing it right away
a1b388
in that case.
a1b388
---
a1b388
 daemon/gdm-manager.c | 26 +++++++++++++++++++++-----
a1b388
 1 file changed, 21 insertions(+), 5 deletions(-)
a1b388
a1b388
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
a1b388
index e896c8945..0823e8638 100644
a1b388
--- a/daemon/gdm-manager.c
a1b388
+++ b/daemon/gdm-manager.c
a1b388
@@ -1639,105 +1639,121 @@ create_display_for_user_session (GdmManager *self,
a1b388
         GdmDisplay *display;
a1b388
         /* at the moment we only create GdmLocalDisplay objects on seat0 */
a1b388
         const char *seat_id = "seat0";
a1b388
 
a1b388
         display = gdm_local_display_new ();
a1b388
 
a1b388
         g_object_set (G_OBJECT (display),
a1b388
                       "session-class", "user",
a1b388
                       "seat-id", seat_id,
a1b388
                       "session-id", session_id,
a1b388
                       NULL);
a1b388
         gdm_display_store_add (self->priv->display_store,
a1b388
                                display);
a1b388
         g_object_set_data (G_OBJECT (session), "gdm-display", display);
a1b388
         g_object_set_data_full (G_OBJECT (display),
a1b388
                                 "gdm-user-session",
a1b388
                                 g_object_ref (session),
a1b388
                                 (GDestroyNotify)
a1b388
                                 clean_user_session);
a1b388
 }
a1b388
 
a1b388
 static gboolean
a1b388
 on_start_user_session (StartUserSessionOperation *operation)
a1b388
 {
a1b388
         GdmManager *self = operation->manager;
a1b388
         gboolean migrated;
a1b388
         gboolean fail_if_already_switched = TRUE;
a1b388
         gboolean doing_initial_setup = FALSE;
a1b388
         GdmDisplay *display;
a1b388
         const char *session_id;
a1b388
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
a1b388
+        g_autofree char *display_session_type = NULL;
a1b388
+#endif
a1b388
 
a1b388
         g_debug ("GdmManager: start or jump to session");
a1b388
 
a1b388
         /* If there's already a session running, jump to it.
a1b388
          * If the only session running is the one we just opened,
a1b388
          * start a session on it.
a1b388
          */
a1b388
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
a1b388
 
a1b388
         g_debug ("GdmManager: migrated: %d", migrated);
a1b388
         if (migrated) {
a1b388
                 /* We don't stop the manager here because
a1b388
                    when Xorg exits it switches to the VT it was
a1b388
                    started from.  That interferes with fast
a1b388
                    user switching. */
a1b388
                 gdm_session_reset (operation->session);
a1b388
                 destroy_start_user_session_operation (operation);
a1b388
                 goto out;
a1b388
         }
a1b388
 
a1b388
         display = get_display_for_user_session (operation->session);
a1b388
 
a1b388
-        g_object_get (G_OBJECT (display), "doing-initial-setup", &doing_initial_setup, NULL);
a1b388
+        g_object_get (G_OBJECT (display),
a1b388
+                      "doing-initial-setup", &doing_initial_setup,
a1b388
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
a1b388
+                      "session-type", &display_session_type,
a1b388
+#endif
a1b388
+                      NULL);
a1b388
 
a1b388
         session_id = gdm_session_get_conversation_session_id (operation->session,
a1b388
                                                               operation->service_name);
a1b388
 
a1b388
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
a1b388
                 /* In this case, the greeter's display is morphing into
a1b388
                  * the user session display. Kill the greeter on this session
a1b388
                  * and let the user session follow the same display. */
a1b388
                 gdm_display_stop_greeter_session (display);
a1b388
                 g_object_set (G_OBJECT (display),
a1b388
                                 "session-class", "user",
a1b388
                                 "session-id", session_id,
a1b388
                                 NULL);
a1b388
         } else {
a1b388
                 uid_t allowed_uid;
a1b388
 
a1b388
                 g_object_ref (display);
a1b388
                 if (doing_initial_setup) {
a1b388
-                        g_debug ("GdmManager: closing down initial setup display");
a1b388
-                        gdm_display_stop_greeter_session (display);
a1b388
-                        gdm_display_unmanage (display);
a1b388
-                        gdm_display_finish (display);
a1b388
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
a1b388
+                        if (g_strcmp0 (display_session_type, "wayland") == 0) {
a1b388
+                                g_debug ("GdmManager: closing down initial setup display in background");
a1b388
+                                g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
a1b388
+                        }
a1b388
+#endif
a1b388
+                        if (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
a1b388
+                                g_debug ("GdmManager: closing down initial setup display");
a1b388
+                                gdm_display_stop_greeter_session (display);
a1b388
+                                gdm_display_unmanage (display);
a1b388
+                                gdm_display_finish (display);
a1b388
+                        }
a1b388
                 } else {
a1b388
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
a1b388
                 }
a1b388
 
a1b388
                 /* The user session is going to follow the session worker
a1b388
                  * into the new display. Untie it from this display and
a1b388
                  * create a new session for a future user login. */
a1b388
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
a1b388
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
a1b388
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
a1b388
                 create_user_session_for_display (operation->manager, display, allowed_uid);
a1b388
 
a1b388
                 /* Give the user session a new display object for bookkeeping purposes */
a1b388
                 create_display_for_user_session (operation->manager,
a1b388
                                                  operation->session,
a1b388
                                                  session_id);
a1b388
 
a1b388
                 if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
a1b388
                     !gdm_session_client_is_connected (operation->session)) {
a1b388
                         /* remove the unused prepared greeter display since we're not going
a1b388
                          * to have a greeter */
a1b388
                         gdm_display_store_remove (self->priv->display_store, display);
a1b388
                         g_object_unref (display);
a1b388
 
a1b388
                         self->priv->automatic_login_display = g_object_get_data (G_OBJECT (operation->session), "gdm-display");
a1b388
                         g_object_add_weak_pointer (G_OBJECT (self->priv->automatic_login_display), (gpointer *) &self->priv->automatic_login_display);
a1b388
                 }
a1b388
         }
a1b388
 
a1b388
         start_user_session (operation->manager, operation);
a1b388
-- 
a1b388
2.27.0
a1b388