Ray Strode [Mon, 22 Mar 2010 02:59:09 +0000 (22:59 -0400)]
[main] Ensure second quit blocks until quit processed
When it comes to quitting, which must be carefully coordinated
with other subsystems during the boot process, we need to make
sure the client doesn't return early.
Ray Strode [Mon, 22 Mar 2010 02:59:09 +0000 (22:59 -0400)]
[main] Ensure second deactivate blocks until deactivation
When it comes to deactivation where the various steps of boot
have to be carefully synchronized, we need to make sure that
the client doesn't return early.
Likewise if plymouth quit is called when we're waiting for the boot
splash to become idle, we also end up asserting that there's not
already an idle trigger.
Fix it in the same way as deactive, ignore the second quit command
except for pulling its trigger.
If plymouth deactivate is called when we're waiting for the boot
splash to become idle, we end up asserting that there's not
already an idle trigger.
Fix it by checking for an existing deactive trigger, and if there
is, ignoring the new deactivate command (except for pulling its
trigger so it doesn't block).
[main] give quit command precedence over deactivate
In the cases where the boot splash plugin does not become idle
immediately, we go back into the main loop and can receive additional
commands.
Since quit and deactive both use this facility, one scenario is the
quit command arriving after the deactivate command, but before the
deactivate command has actually been run.
In that situation, we want to quit, not deactivate.
One of the main differences between Ubuntu's use of Plymouth and
Fedora's is that on Ubuntu we've tried to keep the X server on VT7
so that the historical documentation of Ctrl-Alt-F1 giving you a
text console is preserved.
This obviously means that for a smooth transition, Plymouth must also
run on VT7.
We discovered that although Plymouth does have code to attempt to deal
with VTs, none of it is quite right and there are many paths that don't
work unless Plymouth is run on VT1.
This patch set fixes our known problems with the VT handling making it
possible to run Plymouth on any VT of your choosing, with VT1 remaining
the default.
Add a command-line option to specify the TTY that plymouth should
use. This is mostly useful for debugging, for example you can put
plymouth onto a TTY not used by the X server; or if you're feeling
particularly sneaky, plymouth into an xterm.
Change the renderer so that it defaults to inactive, then when we
map to the device, activate the renderer by activating the VT;
unless the VT is already active in which case activate the
renderer directly.
Change the renderer so that it defaults to inactive, then when we
map to the device, activate the renderer by activating the VT;
unless the VT is already active in which case activate the
renderer directly.
[terminal,text,details] move activate vt into plugins
Move the responsiblity to activate the VT into the text and details
plugins; this not only matches the graphical renderers, but it also
ensures we activate the VT in all possible code paths.
Previously if we fell back to text.so because we couldn't activate
a renderer, this would not activate the VT.
[terminal] move terminal opening into renderers/plugins
Move the responsibility to actually open the terminal to the renderers
and text/details plugin, this allows the X11 renderer to not actually
open the terminal - and thus not crash the X server.
When we activate our VT, now we actually have it in VT_PROCESS not the
VT we started from, we get the proper signal so don't need an ioctl to
wait until its active.
If we were to leave our VT, we'd get the opposite signal as well and
we don't really care whether we actually get to the other VT, just
that we leave ours.
[terminal] don't keep track of active vt, just if vt is active
Trying to keep track of whatever VT is actually active is inherently
racy; instead just keep track of whether our VT is the active one.
Since we guarantee that's the VT in VT_PROCESS now, this is easy.
Rather simplifies the on_vt_changed functions in renderers too.
Now we can simply test whether a terminal is virtual or not, add
a guard in the mode and vt change functions that ensure they only
operate on virtual terminals.
We want to be able to query whether a terminal is an ordinary terminal
or a virtual terminal, rather than looking up the vt number and knowing
what the right numbers are, add a function that knows that.
Remove all of the references to ply_console_t from the code, now
we operate exclusively on the terminal object. In some places
this means switching from one to the other, but in many it just
means dropping the console object and using the terminal object
we were already passed.
This removes the separation in code of "console" functions and
"terminal" functions; this never really made sense, and doesn't
particularly map to the behaviour of Linux virtual terminals.
The three principle operations that Plymouth was using "console"
for were:
* changing the active VT
* notification of changes to the active VT through VT_PROCESS
* switching between text and graphics mode
And it was using the "foreground terminal" alias /dev/tty0 to do
this. While this is fine for the first of those, since any console
device will do, it's always wrong for the latter two which should
always be on the actual VT we want Plymouth to run from.
If running on tty7, only tty7 should be in VT_PROCESS mode (since
we want to know when we enter this VT and leave this VT), and
certainly only tty7 should be in graphics mode.
Since you can use that same tty to obtain the current active VT,
and switch VT, you don't need another; so the need for a separate
"console" functionality goes away.
Since script implements a set_keyboard function (the only plugin to
do so), the previous commit reveals a bug where set_keyboard is
called for the plugin but unset_keyboard isn't called if the plugin
fails to be loaded
The script plugin only works on pixel displays, however there wasn't
any check for this, so if a script-based theme was your default
Plymouth would not fallback to using the text plugin instead.
Richard Maw [Wed, 10 Mar 2010 20:28:09 +0000 (20:28 +0000)]
[script] Add SubString function to the script string library
Adds the SubString function which returns a string segment. The two paramiters
are the sub-string start and end indicies. Negative start and end values return
a NULL, as does start index being beyond the end index. Start being beyond the
end of the string returns an empty string.
The on_draw() function inside the script plugin isn't referenced
anywhere, but references a static function from script-lib-sprite.c;
if building without optimisation, it's possible that gcc won't elide
this code so will fail during linking.
[scripts] Don't hardcode LIBEXECDIR and DATADIR paths
The scripts hard-coded the paths for LIBEXECDIR and DATADIR, unless
passed as environment variables. Instead of doing this, which breaks
if plymouth is installed outside of /usr, set these derived from the
configure $libexecdir and $datadir variables just as we do for
pkg-config, etc.
Since we use so many variables, it makes more sense to generate these
scripts from config.status rather than having special Makefile rules
for them.
Add a --pid-file option to plymouthd that will cause the daemon's
pid to be written to the named file. Useful to avoid grovelling
through ps output to find it again.
[client] Install libply-boot-client library and headers
When communicating with Plymouth from another process, it's
inconvenient to have to keep spawning the plymouth client binary
and keeping track of it - not to mention slow.
It's far cleaner to be able to link to the same boot client code
that the plymouth binary does, and communicate directly.
Place that code in a new libply-boot-client library, and install
the headers along with it.
Ray Strode [Thu, 25 Feb 2010 20:37:43 +0000 (15:37 -0500)]
[keyboard] Handle tty hangup better
We currently reconnect the terminal object on tty disconnects,
but we don't rewatch the keyboard. A disconnect will invalidate
the fd watch, so we need to handle it to prevent crashes.
Ray Strode [Tue, 26 Jan 2010 06:13:33 +0000 (01:13 -0500)]
[main] Defer password requests to client if daemon unavailable
There are times when plymouthd isn't in a position to ask for
the password (for instance, if the initramfs is about to run
init=/bin/bash or something). In those cases, any password
requests need to be handled by the client.
Ray Strode [Mon, 25 Jan 2010 22:07:56 +0000 (17:07 -0500)]
[client] Run ask-for-password command unconditionally
Even if we can't contact the daemon, we should still run the
ask-for-password command. This is because the command may
do things important for boot up to continue like unlocking
the root partition.
Charlie Brej [Mon, 25 Jan 2010 20:36:35 +0000 (20:36 +0000)]
[script] Use floor when implementing Int
Previously the Math.Int function converted to int and back to double.
The floor function works larger than those represented by integers and it
correctly handles NaN and Inf.
Ray Strode [Thu, 14 Jan 2010 22:05:15 +0000 (17:05 -0500)]
[branch-merge] Drop libpng requirements from base install
Right now, plymouthd links against libplybootsplash which links
against libpng. Only graphical splashes use libpng, but it's
always pulled in.
This merge splits libplybootsplash into two libraries: the core
bits, and the extractable graphical bits. Only the graphical splashes
link against the latter library. This way server installations can
get plymouth without pulling in libpng. This will reduce the amount
of security errata deployed to those server installations.
Ray Strode [Wed, 13 Jan 2010 19:27:46 +0000 (14:27 -0500)]
[splash] Rename libplybootsplash to libply-splash-core
Splashes aren't just shown for "boot" so including "boot" in
the name isn't right. Also, right now we link against libpng
even if we don't have any splash that uses it. This is the first
step toward making libpng only get linked to graphical splashes.
We'll need to move the graphical bits to their own library to
complete the process.
Ray Strode [Wed, 16 Dec 2009 18:20:34 +0000 (13:20 -0500)]
[branch-merge] Add man page
This merges the "man-page" branch to master.
Thanks to Adrian Glaubitz we now have a man page for plymouth.
This is a good start to documenting the basics of plymouth.
We'll eventually need more comprehensive reference documentation
before 1.0 is released, and now we have some of the ground work
(a docs/ directory) for that.
Ray Strode [Wed, 16 Dec 2009 13:48:45 +0000 (08:48 -0500)]
[docs] Remove instructions about boot loader
They weren't completely accurate, you don't need to reinstall
grub after editing its config, since it has built-in filesystem
drivers. Also, those details very from system to system, so we
should probably just leave it out.
Ray Strode [Wed, 16 Dec 2009 13:41:33 +0000 (08:41 -0500)]
[docs] Remove distribution references from man page
We don't want to provide a history of what distributions
used before plymouth, because that history could get long,
isn't super relevant, and will add noise for a users looking
for help (they probably only care about their distributions,
not others).
Adrian Glaubitz [Sat, 5 Dec 2009 17:05:10 +0000 (12:05 -0500)]
[set-default-theme] Add --help option
When running new, unfamiliar commands I usually invoke them with
--help to see what options they have. For plymouth-set-default-theme,
there is no --help option which I find a bit confusing, especially
since the usage is not straight-forward.
There is now an additional function "show_help" which displays an
help output when invoking plymouth-set-default-theme with --help.
Charlie Brej [Sun, 29 Nov 2009 02:35:10 +0000 (02:35 +0000)]
[label] Add color control
Previously we drew two overlapping labels, one in black and one in white, to
make sure it was vsible on all backgrounds. Now we can pick an appropreate
color for each theme. The default is white. If changing the label color once it
has been shown, it will redraw that part of the screen.
Charlie Brej [Sun, 29 Nov 2009 01:19:37 +0000 (01:19 +0000)]
[script] Allow setting the position of the windows
Although the windows are set up to in a reasonable default configuration, the
themes may align the windows differently to not crop some important elements.
The Window.SetX and SetY allow positioning the window anywhere on the canvas.
Use this sparingly as it induces a full refresh of all screens.
If there is a desire to have totally different scenes, the second window can be
positioned somewhere far away so there is overlap and a complete different set
of sprites is used. Another sensible configuration is to have the screens side
by side and allow sprites to span the gap. Remember to create password dialogs
for each screen as not all may be visible.
Charlie Brej [Sun, 29 Nov 2009 00:20:52 +0000 (00:20 +0000)]
[script] Handle multiple displays with one script instance
When multiple displays were introduced, each display had its own script plugin
instance. This made things easy as the scripts would not have to be rewritten
for multiple screens. Unfortunately this also meant that each image was loaded
multiple times, and the scripts consumed much more processing power.
Additionally the scripts were not aware of each other.
This patch allows a single script instance to control multiple displays while
maintaining reasonable backward compatibility. All sprites are placed on a
virtual canvas. Displays (or windows) then expose parts of this canvas to the
user.
As a default, window 0 is placed at 0,0. Further windows are placed on top of
the window 0 area matching the centre point so the password dialog (which is
placed in the centre) is visible on all windows. If you target window 0 only
and you place dialogs in the middle of the screen, then everything should work
fine.
Window.GetWidth/GetHeight now takes a window number (if none supplied it will
assume 0). If it replies a NULL, then you accessed beyond the end of the
window set.
Charlie Brej [Sat, 28 Nov 2009 20:08:09 +0000 (20:08 +0000)]
[list] Add a stable sort
Stable sort sorts but does not change the order of elements which are equal.
This is important in the sprite based plugins where if the level of the sprites
is equal because it may be unimportant which is on top, changing the order
between frames looks bad.
Charlie Brej [Sat, 28 Nov 2009 19:10:53 +0000 (19:10 +0000)]
[region] Allow rectangles to be sorted before being fed back
The renderers commit the rectangles derived from the region in a random order.
This gives some tearing as the screen is displayed with a random regions in
their new state. The change sorts the list of rectangles according to their Y
value to commit them from top to bottom. This gives fewer tear lines.
Ray Strode [Sat, 28 Nov 2009 04:44:21 +0000 (23:44 -0500)]
[branch-merge] Improve plymouth -> X hand off
This merges the "no-fbcon" branch to master.
Previously, the way to get a transition between
plymouth and X was for plymouth to quit,
leaving the tty in KD_GRAPHICS mode, and hope
X starts and picks up the peices. In this
limbo state where plymouth isn't running but X
isn't started yet the user is unable to
switch VTs or really do anything at all.
If X doesn't start then the user is hosed; they
have to reboot.
Now, instead of quitting plymouth before starting
X we "deactivate" it. This gets plymouth into a
state where X can take over the display, but
plymouth stays running. Once X has fully started
up or failed to start the display manager can
tell plymouth to quit (with --retain-splash if
X started successfully and without if X started
unsucessfully)
Ray Strode [Sat, 28 Nov 2009 04:29:30 +0000 (23:29 -0500)]
[daemon] deactivate daemon for X transition
In order for plymouth to be able to stay around until
after X is started, we need to put the daemon into a
"deactivated" state where it makes the splash becomes idle
and relinquishes control of the scan out hardware and keyboard
for X to seize.
This commit listens for deactivation requests in the daemon and
performs the deactivation.
A future commit will implement the client bits needed.