]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Don't show splash by default, instead require client to request it
authorRay Strode <rstrode@redhat.com>
Wed, 21 May 2008 02:37:01 +0000 (22:37 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 21 May 2008 02:37:01 +0000 (22:37 -0400)
plymouthd gets started before the drm modesetting modules are loaded,
so we can't try to access the frame buffer right away.  The plan is to
load the drm modules as soon as possible in the initrd and then tell
plymouthd to put up the splash ASAP.

scripts/plymouth-update-initrd
src/client/ply-boot-client.c
src/client/ply-boot-client.h
src/client/plymouth.c
src/main.c
src/ply-boot-protocol.h
src/ply-boot-server.c
src/ply-boot-server.h

index bb3343aa2023a23b9758c007120d0cc0945140b7..99032ae351ce5b33d53c39c4f754cf6d8affe23a 100755 (executable)
@@ -31,7 +31,7 @@ TMPDIR="$(mktemp -d $PWD/initrd.XXXXXXXXXX)"
 (cd $TMPDIR
     zcat $INITRD | cpio --quiet -Hnewc -i --make-directories
     sed -i -e 's@^#!\(.*\)@#!/bin/plymouthd \1\n@' init 
-    #sed -i -e 's@setquiet@&\n/bin/plymouth --ask-for-password@' init
+    sed -i -e 's@setquiet@&\n/bin/plymouth --show-splash@' init
     (cd $LIBDIR
         DEPS=$(get_lib_deps ${LIBEXECDIR}/plymouth/plymouth ${LIBDIR}/plymouth/fedora-fade-in.so ${LIBDIR}/plymouth/text.so ${LIBDIR}/plymouth/details.so)
         for dep in $DEPS; do
index 08eb6b973ec680cd147468670c7b2ccb08e6eafe..c3498376f929e90c0ec236ff8e6e7e5802a5b2a2 100644 (file)
@@ -467,6 +467,18 @@ ply_boot_client_ask_daemon_for_password (ply_boot_client_t                  *cli
                                  handler, failed_handler, user_data);
 }
 
+void
+ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t                  *client,
+                                            ply_boot_client_response_handler_t  handler,
+                                            ply_boot_client_response_handler_t  failed_handler,
+                                            void                               *user_data)
+{
+  assert (client != NULL);
+
+  ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH,
+                                 NULL, handler, failed_handler, user_data);
+}
+
 void
 ply_boot_client_tell_daemon_to_quit (ply_boot_client_t                  *client,
                                      ply_boot_client_response_handler_t  handler,
index 4c72db242e3cf05c637af303c37a52ccf29472b0..c3240cd2e195f156d466f54bc09c2e9806c4c81c 100644 (file)
@@ -40,7 +40,7 @@ typedef void (* ply_boot_client_disconnect_handler_t) (void              *user_d
 
 #ifndef PLY_HIDE_FUNCTION_DECLARATIONS
 ply_boot_client_t *ply_boot_client_new (void);
-                                                  
+
 void ply_boot_client_free (ply_boot_client_t *client);
 bool ply_boot_client_connect (ply_boot_client_t                    *client,
                               ply_boot_client_disconnect_handler_t  disconnect_handler,
@@ -62,6 +62,10 @@ void ply_boot_client_tell_daemon_system_is_initialized (ply_boot_client_t
                                                         ply_boot_client_response_handler_t  handler,
                                                         ply_boot_client_response_handler_t  failed_handler,
                                                         void                               *user_data);
+void ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t                  *client,
+                                                 ply_boot_client_response_handler_t  handler,
+                                                 ply_boot_client_response_handler_t  failed_handler,
+                                                 void                               *user_data);
 void ply_boot_client_tell_daemon_to_quit (ply_boot_client_t                  *client,
                                           ply_boot_client_response_handler_t  handler,
                                           ply_boot_client_response_handler_t  failed_handler,
index 048563d8a0f70e63c9c58e8e218c7a1c0f1ef1d7..df503fc73a375fa7cc57dcc80476a128a874081a 100644 (file)
@@ -59,7 +59,7 @@ on_disconnect (ply_event_loop_t *loop)
 void
 print_usage (void)
 {
-  ply_log ("rhgb-client [--ping] [--update=STATUS] [--details] [--sysinit] [--quit]");
+  ply_log ("rhgb-client [--ping] [--update=STATUS] [--show-splash] [--details] [--sysinit] [--quit]");
   ply_flush_log ();
 }
 
@@ -69,7 +69,7 @@ main (int    argc,
 {
   ply_event_loop_t *loop;
   ply_boot_client_t *client;
-  bool should_quit, should_ping, should_update, should_sysinit, should_ask_for_password;
+  bool should_quit, should_ping, should_update, should_sysinit, should_ask_for_password, should_show_splash;
   char *status;
   int exit_code;
   int i;
@@ -89,6 +89,7 @@ main (int    argc,
   should_update = false;
   should_quit = false;
   should_ask_for_password = false;
+  should_show_splash = false;
   status = NULL;
   for (i = 1; i < argc; i++)
     {
@@ -103,6 +104,8 @@ main (int    argc,
         should_ping = true;
       else if (strstr (argv[i], "--sysinit") != NULL)
         should_sysinit = true;
+      else if (strstr (argv[i], "--show-splash") != NULL)
+        should_show_splash = true;
       else if (strstr (argv[i], "--ask-for-password") != NULL)
         should_ask_for_password = true;
       else if (strstr (argv[i], "--update") != NULL)
@@ -142,7 +145,13 @@ main (int    argc,
 
   ply_boot_client_attach_to_event_loop (client, loop);
 
-  if (should_quit)
+  if (should_show_splash)
+    ply_boot_client_tell_daemon_to_show_splash (client,
+                                               (ply_boot_client_response_handler_t)
+                                               on_success,
+                                               (ply_boot_client_response_handler_t)
+                                               on_failure, loop);
+  else if (should_quit)
     ply_boot_client_tell_daemon_to_quit (client,
                                          (ply_boot_client_response_handler_t)
                                          on_success,
index 6fc40b78d641c8a5f9fd937ba7b6a54e10c345d2..f0a7b77da58ec8d4c90857ac550211265986a583 100644 (file)
@@ -94,8 +94,9 @@ on_update (state_t     *state,
            const char  *status)
 {
   ply_trace ("updating status to '%s'", status);
-  ply_boot_splash_update_status (state->boot_splash,
-                                 status);
+  if (state->boot_splash != NULL)
+    ply_boot_splash_update_status (state->boot_splash,
+                                   status);
 }
 
 static char *
@@ -115,13 +116,33 @@ on_system_initialized (state_t *state)
                                  "/sysroot/var/log/bootmessages.log");
 }
 
+static void
+on_show_splash (state_t *state)
+{
+  ply_trace ("Showing splash screen");
+  state->boot_splash = start_boot_splash (state,
+                                          PLYMOUTH_PLUGIN_PATH "fedora-fade-in.so");
+
+  if (state->boot_splash == NULL)
+    {
+      ply_trace ("Could not start graphical splash screen,"
+                 "showing text splash screen");
+      state->boot_splash = start_boot_splash (state,
+                                              PLYMOUTH_PLUGIN_PATH "text.so");
+    }
+
+  if (state->boot_splash == NULL)
+    ply_error ("could not start boot splash: %m");
+}
+
 static void
 on_quit (state_t *state)
 {
   ply_trace ("time to quit, closing log");
   ply_terminal_session_close_log (state->session);
   ply_trace ("hiding splash");
-  ply_boot_splash_hide (state->boot_splash);
+  if (state->boot_splash != NULL)
+    ply_boot_splash_hide (state->boot_splash);
   ply_trace ("exiting event loop");
   ply_event_loop_exit (state->loop, 0);
 
@@ -142,6 +163,7 @@ start_boot_server (state_t *state)
 
   server = ply_boot_server_new ((ply_boot_server_update_handler_t) on_update,
                                 (ply_boot_server_ask_for_password_handler_t) on_ask_for_password,
+                                (ply_boot_server_show_splash_handler_t) on_show_splash,
                                 (ply_boot_server_system_initialized_handler_t) on_system_initialized,
                                 (ply_boot_server_quit_handler_t) on_quit,
                                 state);
@@ -447,7 +469,7 @@ int
 main (int    argc,
       char **argv)
 {
-  state_t state;
+  state_t state = { 0 };
   int exit_code;
 
   if (argc <= 1)
@@ -492,21 +514,6 @@ main (int    argc,
 
   state.window = create_window (&state, "/dev/tty1");
 
-  state.boot_splash = start_boot_splash (&state,
-                                         PLYMOUTH_PLUGIN_PATH "fedora-fade-in.so");
-
-  if (state.boot_splash == NULL)
-    {
-      state.boot_splash = start_boot_splash (&state,
-                                             PLYMOUTH_PLUGIN_PATH "text.so");
-    }
-
-  if (state.boot_splash == NULL)
-    {
-      ply_error ("could not start boot splash: %m");
-      return EX_UNAVAILABLE;
-    }
-
   ply_trace ("entering event loop");
   exit_code = ply_event_loop_run (state.loop);
   ply_trace ("exited event loop");
index bdaf4c557ab3854f637c08ecd8200cd8a07e5bc3..5dc0877a21526140265ac9c5fa61d14ba78aa768 100644 (file)
@@ -28,6 +28,7 @@
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_SYSTEM_INITIALIZED "S"
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT "Q"
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*"
+#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH "$"
 #define PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK "\x6"
 #define PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER "\x2"
 
index 5d3ecc90206c7ffe3157fae9d0148ce5d222d7ec..d34d04ac77fb611e9a5a74d4fce44d49ff69f052 100644 (file)
@@ -51,6 +51,7 @@ struct _ply_boot_server
 
   ply_boot_server_update_handler_t update_handler;
   ply_boot_server_system_initialized_handler_t system_initialized_handler;
+  ply_boot_server_show_splash_handler_t show_splash_handler;
   ply_boot_server_ask_for_password_handler_t ask_for_password_handler;
   ply_boot_server_quit_handler_t quit_handler;
   void *user_data;
@@ -61,6 +62,7 @@ struct _ply_boot_server
 ply_boot_server_t *
 ply_boot_server_new (ply_boot_server_update_handler_t  update_handler,
                      ply_boot_server_ask_for_password_handler_t ask_for_password_handler,
+                     ply_boot_server_show_splash_handler_t show_splash_handler,
                      ply_boot_server_system_initialized_handler_t initialized_handler,
                      ply_boot_server_quit_handler_t    quit_handler,
                      void                             *user_data)
@@ -74,6 +76,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t  update_handler,
   server->update_handler = update_handler;
   server->ask_for_password_handler = ask_for_password_handler;
   server->system_initialized_handler = initialized_handler;
+  server->show_splash_handler = show_splash_handler;
   server->quit_handler = quit_handler;
   server->user_data = user_data;
 
@@ -192,6 +195,12 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
       if (server->system_initialized_handler != NULL)
         server->system_initialized_handler (server->user_data, server);
     }
+  else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH) == 0)
+    {
+      ply_trace ("got show splash request");
+      if (server->show_splash_handler != NULL)
+        server->show_splash_handler (server->user_data, server);
+    }
   else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT) == 0)
     {
       if (server->quit_handler != NULL)
@@ -342,6 +351,12 @@ on_system_initialized (ply_event_loop_t *loop)
   printf ("got sysinit done request\n");
 }
 
+static void
+on_show_splash (ply_event_loop_t *loop)
+{
+  printf ("got show splash request\n");
+}
+
 static void
 on_quit (ply_event_loop_t *loop)
 {
@@ -371,6 +386,7 @@ main (int    argc,
 
   server = ply_boot_server_new ((ply_boot_server_update_handler_t) on_update,
                                 (ply_boot_server_ask_for_password_handler_t) on_ask_for_password,
+                                (ply_boot_server_show_splash_handler_t) on_show_splash,
                                 (ply_boot_server_system_initialized_handler_t) on_system_initialized,
                                 (ply_boot_server_quit_handler_t) on_quit,
                                 loop);
index f809af004e4acef7228599078cadc728016d0b4a..7ddab15ce837581e046ca975262b4d497f56c549 100644 (file)
@@ -35,6 +35,9 @@ typedef void (* ply_boot_server_update_handler_t) (void              *user_data,
                                                    const char        *status,
                                                    ply_boot_server_t *server);
 
+typedef void (* ply_boot_server_show_splash_handler_t) (void              *user_data,
+                                                        ply_boot_server_t *server);
+
 typedef char * (* ply_boot_server_ask_for_password_handler_t) (void              *user_data,
                                                              ply_boot_server_t *server);
 
@@ -47,6 +50,7 @@ typedef void (* ply_boot_server_quit_handler_t) (void              *user_data,
 #ifndef PLY_HIDE_FUNCTION_DECLARATIONS
 ply_boot_server_t *ply_boot_server_new (ply_boot_server_update_handler_t update_handler,
                                         ply_boot_server_ask_for_password_handler_t ask_for_password_handler,
+                                        ply_boot_server_show_splash_handler_t show_splash_handler,
                                         ply_boot_server_system_initialized_handler_t initialized_handler,
                                         ply_boot_server_quit_handler_t quit_handler,
                                         void                        *user_data);