Don't show splash by default, instead require client to request it

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.
This commit is contained in:
Ray Strode 2008-05-20 22:37:01 -04:00
parent ff31d108ca
commit 4392b69238
8 changed files with 77 additions and 24 deletions

View file

@ -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

View 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,

View 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,

View 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,

View 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");

View 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"

View 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);

View 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);