For some themes we want to use the firmware-logo / splash as background,
when the LCD panel of a laptop is mounted non-upright then the image which
we get from the firmware will be pre-rotated to match the LCD panel mount.
This commit adds ply_pixel_buffer_set/get_device_rotation helpers to
help deal with this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Instead of comparing fill_area addresses actually compare the contents
of the ply_rectangles.
This allows us to use the memcpy fastpath in ply_pixel_buffer_with_buffer
more often.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
After calling ply_pixel_buffer_crop_area_to_clip_area cropped_area.x/y
are in device coordinates. So when calculating the x/y offset in the
source-buffer due to device-clip areas possible making cropped_area.x/y
larger then just the xoffset/yoffset (in the canvas) we must multiply
the original xoffset/yoffset by device_scale before subtracting.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
For some themes we want to read the firmware-logo to use as background,
when the LCD panel of a laptop is mounted non-upright and/or if it is
using scaling because of HiDPI then the image which we get from the
firmware will be pre-rotated and scaled to match the LCD panel.
This new function will allow renderers to let themes know about this so
that they can adjust for the logo being pre-rotated and scaled.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add support for loading BMP files. This is needed to be able to read the
the ACPI BGRT graphics (the firmware splash shown at boot by the firmware).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
So far the image loading code has been assuming that all files are PNGs,
this commit makes the code check the file-header before assuming the file
is a PNG.
This is a preparation patch for adding support for also being able to load
BMP files.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Commit 9639ed8953 ("two-step: Fix animation not starting on later
added heads") unconditionally calls view_start_progress_animation() when
adding secondary heads, to fix the animation not running on secondary
heads when not asking for a password.
But we should not start the animation when adding a head after we've
already entered PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY state, otherwise
we end up starting it a second time when the user is done entering his
password, causing plymouth to crash and the boot to hang.
We already have the is_animating bool to indicate whether animations have
been started or not, use this to decide if we should start the animation
when adding a new head, fixing the crash.
Fixes: 9639ed8953 ("two-step: Fix animation not starting on ... added heads")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Fix the animation not starting on heads added after show_splash_screen
has been called. Since the core calls show_splash_screen after adding
the first head / pixel_display in practice this fixes the animation not
starting on all monitors other then the first.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
On systems with working drm/kms devices we still sometimes see:
"Creating non-graphical devices, since there's no suitable graphics hardware"
in the logs (and actually create non-gfx devices).
This is caused by a race where the create_devices_from_udev timeout handler
runs just after the pivot-root, just at the time when the "udev trigger"
from the real root is done.
This causes create_devices_for_subsystem() to hit the "it's not initialized"
code-path for all drm and fb devices, even though before (from the initrd)
drm-devices where already setup successfully.
One way of solving this would be to stop the timer as soon as we successfully
enumerate the first drm device. But we need the timer to enumerate fb devices
so on machines where some outputs only have a fbdev driver (corner case) this
would break support for those outputs.
Instead this commit moves the found_drm_device and found_fb_device to the
global manager state and sets them from create_devices_for_udev_device().
This way they will be set when we check them from the create_devices_from_udev
timeout handler even if create_devices_for_subsystem skips over the devices
because of the udev trigger race.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Since we concatenate boot logs one after the other in /var/log/boot.log
it is hard to tell where the logs from one boot end the next boot starts.
This commit makes plymouth write out a separator including a time + date
of the date, when the log file gets opened to add new boot messages to it.
Note ply_logger_open_file() is only called from ply_terminal_session_open_log()
which in turn is only used for /var/log/boot.log, so this only effects
/var/log/boot.log.
Closes#29
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
When enumerating outputs pick the preferred mode instead of the current
active mode, which may be e.g. a very low res mode.
Sofar we've been relying on fbcon setting up the modes for us, but as
mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=101520#c22
we really should not rely on this.
With the recent flickerfree boot changes we can no longer rely on fbcon
to do the setup for us, hence this commit. For now this commit only
changes the mode-picking logic on UEFI setups as we only have
flickerfree boot there. Once the setup code is more mature we should
probably always use it.
Closes#68
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ply_renderer_connector_get_rotation walks over all properties to add
support for selecting the preferred mode we also want to know if a connector
is part of a tiled output or not, which also requires walking over the props.
This commit refactors ply_renderer_connector_get_rotation into
ply_renderer_connector_get_rotation_and_tiled to prepare for this.
While at also properly use ply_pixel_buffer_rotation_t for the orientation
instead of an int.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
When we takeover the kms master from whatever process came before us the
LUT table may be a mess making the graphics funky. So lets reset it once
before our first drmModeSetCrtc call.
Closes#59
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Move kernel commandline parsing functions to libply/ply-utils to avoid
code duplication between the daemon, the client and the plugins.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
If the stop_trigger is set and we are waiting for the last frame to stop the
animation, make sure we don't accidentally skip the last frame. It could
happen if the machine is busy and can't keep up with the frames or when the
animation has more than 60 frames (30FPS * 2 seconds).
For some reason I made the same api misdesign with ply_key_file_t
that I made when writing GKeyFile...it returns duplicated memory for
no good reason.
This commit sprinkles frees around.
If a device gets added when we're already deactivated, plymouth shouldn't
process the device, since processing it effectively activates plymouth.
This commit pulls the udev monitor fd out of the event loop while
plymouth is deactivated so new events are deferred until reactivation.
Modified by Iain Lane <iain.lane@canonical.com>: Also deactivate the
timer that finds all devices known to udev after an interval, when
paused.
If plymouth doesn't get explicitly "activated" then when
GDM tries to deactivate it, the deactivation request is
a noop.
One aspect of being active, though is having ownership and
control of the terminal. This happens immediately, even
before a splash is shown.
The `deactivate` request needs to relinguish such control,
unconditionally, since some display server is about to use
the tty.
This commit fixes that.
When running in a container with plymouth installed, plymouth is started
unnecessarily and systemd prints warnings:
[ OK ] Reached target Shutdown.
Sending SIGTERM to remaining processes...
Sending SIGKILL to remaining processes...
Process 253 (plymouthd) has been been marked to be excluded from killing. It is running from the root file system, and thus likely to block re-mounting of the root file system to read-only. Please consider moving it into an initrd file system instead.
It makes little sense to start plymouth in contains, so add
'ConditionVirtualization=!container' everywhere where
ConditionKernelCommandLine=!plymouth.enable=0 appears to disable plymouth
in containers.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1337611
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Closes: https://gitlab.freedesktop.org/plymouth/plymouth/issues/27
Fix all compiler warnings (and one type) except for the deprectation warnings
for the gdk_screen_get_monitor_* functions used in the x11 renderer.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
plymouth uses function type casts for callbacks in quite a few places, fixing
these needlessly complicates the code, so lets pass -Wno-cast-function-type.
This fixes 218 warnings like this one:
ply-command-parser.c: In function ‘ply_command_parser_stop_parsing_arguments’:
ply-command-parser.c:680:48: warning: cast between incompatible function types from ‘void (*)(ply_command_parser_t *)’ {aka ‘void (*)(struct _ply_command_parser *)’} to ‘void (*)(void *, int, ply_event_loop_t *)’ {aka ‘void (*)(void *, int, struct _ply_event_loop *)’} [-Wcast-function-type]
(ply_event_loop_exit_handler_t)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This are 3 issues with the detailed logs handling:
1) plymouth attaches to the session directly on a show-splash command
(in on_show_splash()), but it does not tell systemd to start printing
details until the splash is actually shown after the splash_delay.
2) If the splash is actually shown during the initrd (e.g. a diskcript
password is necessary) then we tell the initrd systemd instance to
print details, but we don't tell the regular initrd instance which takes
over as pid 1 after the switch-root to print details.
This leads to rather inconsistent logging/printing behavior, e.g.:
* If a diskcrypt password is asked for, we only log details from
the initrd phase.
* If the boot is shorter then splash_delay no details are logged
* If the user presses ESC during boot during the initrd, only initrd
messages are printed
* If the user presses ESC during boot after the initrd, only normal
messages are printed
This commit fixes both these issues by:
1) Telling systemd to print details as soon as we have attached to the session;
and to stop printing details when we detach from the session (*)
2) Telling systemd to print details after the rootfs has been remounted rw
*) This is necessary to have a smooth transition to e.g. gdm if the splash
has not shown because the boot is shorter then splash_delay
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Start listening for keypresses on the first show_splash() call, so that
pressing ESC while we're delaying show the non-details splash will show
the details splash.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ply_renderer_head_map() gets only called from map_to_device() which
calls activate() directly afterwards which calls
ply_renderer_head_set_scan_out_buffer(), so there is no need for the
reset_scan_out_buffer_if_needed() call.
Not only is it not needed, but it is actually harmful, there are 2 problems
woth it:
1) Normally the drm plugin gets instantiated by ply-renderer.c with
rendered->is_active=true, backend->is_active=false. The
rendered->is_active=true causes the first ply_renderer_activate call
to be a no-op without calling backend->activate(). So when the first
map_to_device() calls happen activate() has not been called yet and we've
not yet claimed master rights, so ply_renderer_head_set_scan_out_buffer()
calls will always fail, resulting in this in a ply-trace:
Mapping buffer for 1920x1080 renderer head
Redrawing 1920x1080 renderer head
Setting scan out buffer of 1920x1080 head to our buffer
Couldn't set scan out buffer for head with controller id 41
This is harmless, but also shows that the reset_scan_out_buffer_if_needed()
is really not needed.
2. If deactivate_renderer() gets called before the first show-splash then
rendered->is_active will become false, so renderer_activate() done before
map_to_device() will now actually call backend->activate() claiming
drm master rights and setting backend->is_active=true.
The map_to_device() -> ply_renderer_head_map() call done after this, calls
ply_renderer_head_redraw() -> flush_head() which under 1. was a no-op
as it exits directly when backend->is_active=false. But now it actually
flushes the buffers by calling reset_scan_out_buffer_if_needed(). This
itself is fine.
But since reset_scan_out_buffer_if_needed() has already happened in
ply_renderer_head_redraw() the reset_scan_out_buffer_if_needed() call this
commit removes would always return false (no reset necessary) causing
ply_renderer_head_map() to destroy the buffer and return an error.
This results in the splash briefly showing, followed by the core soon after
trying another map_to_device(), which again briefly shows the splash, etc.
With the end result being a badly flickering display.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Since commit eb147e52b1 ("renderer: support reactivating renderer without
closing it first"), the show_theme() call done by
toggle_between_splash_and_details() will reactivate the renderers after
switching to details mode, causing the drm renderer to switch the screen
from text to graphics mode hiding the details being logged on the console.
This commit fixes this by only calling ply_device_manager_activate_renderers()
and ply_device_manager_deactivate_renderers if the splash uses pixel-displays.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=107047
hide_splash() should be the counter-part of show_splash(). show_splash()
calls ply_device_manager_activate_renderers() (through show_theme()).
2 of the 3 callers of hide_splash() are already calling
ply_device_manager_deactivate_renderers() directly before calling
hide_splash(). This commit moves the deactivate call into hide_splash()
so that it also gets called from the 3th code-path, which is when
the user hits the escape to key to toggle from the splash to details.
It's important that plymouth deactivates its renderers before going
to details, because those renderers can block the kernel from
initializing fbcon, which the kernel will start doing lazily in the
future:
https://lkml.org/lkml/2018/6/26/489.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=107047
At the moment, ply_renderer_activate() doesn't work immediately following
ply_renderer_deactivate(). This is because the renderer isn't marked
inactive until it's closed.
This commit marks the renderer inactive when it's deactivated.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=107047
If neither "rhgb" nor "splash" is on the kernel cmdline, then
plymouth forces the "details" splash. This splash is merely
a passthrough plugin, where it makes boot looks like plymouth
isn't even running.
In this case, the code sets PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV.
The idea is to not bother waiting for udev events notifying
plymouth when graphics devices show up, since it doesn't need
to use the grpahics devices directly anyway.
Unfortunately, it does still erroneously try to setup graphical
renderers in this case, including the /dev/fb renderer.
Before commit e4f86e3c, these graphical renderers failed because
they were given the wrong device name, but since that fix, they're
suceeding. We definitely don't want the /dev/fb renderer to
load if we're ignoring udev on efi systems, since during very
early boot /dev/fb is backed by efifb, something we never want to
use. efifb is supposed to get replaced during the boot process
by other fb implementations like say radeondrmfb, virtiodrmfb or
bochsdrmfb, and some of those implementations can't handle the
transition if /dev/fb is open at switchover time.
This commit adds a new flag to tell the device manager to
not bother trying to setup graphical renderers when details are
forced.
http://bugzilla.redhat.com/1518464