Since the ask-for-password or ask-question dialog and the firmware background
may intersect so far we've been clearing the screen to black when showing a
dialog and using the firmware background.
This is not always desirable, this commit adds a new
"DialogClearsFirmwareBackground" option to the two-step based theme config
file, which enables this behavior when set.
The new default is to keep using the initial (firmware) background when
showing a dialog, which matches the non firmware-background paths.
Also update the bgrt theme to use the "DialogClearsFirmwareBackground"
option, keeping the current behavior for that theme.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add DialogHorizontalAlignment and DialogVerticalAlignment options which
allow placing the (diskcrypt) dialog aligned at another place then the
center of the screen.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Rename the UseBGRT theme configfile option to UseFirmwareBackground,
to make it clear what this does using language which most users will be
able to understand, rather then using the cryptic BGRT ACPI table reference.
While at it also switch to using the new ply_key_file_get_bool function, so
that users can edit an existing configfile with "UseFirmwareBackground=true"
in there and change it to "=false" and actually have that work as expected.
The switch to ply_key_file_get_bool also fixes a memleak as
ply_key_file_get_value returns a strdup-ed value which we were not free-ing.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add a function to read a boolean value from a ply-key-file.
This function will return true if the key exists and it has a value of "1",
"y", "yes" or "true" (case-insensitive). In all other cases it returns
false.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Use the locale agnostic plymouth_strtod helper which always uses a "."
as decimal seperator. This fixes the various Alignment options not working
with some locales.
While at it also add a ply_trace to log the size and chosen centering for
the watermark image.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add a ply_strtod helper which always uses "." as decimal separator
independent of the locale.
Using this fixes e.g. HorizontalAlignment in the two-step plugin
not working with some locales.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Fix: "warning: enumeration value ‘PLY_KEYBOARD_PROVIDER_TYPE_TERMINAL’
not handled in switch [-Wswitch-enum]" compiler warning.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
When a renderer goes away on a udev remove event, free keyboards associated with the renderer, before freeing the renderer. This avoids a null pointer dereference when ply_device_manager_deactivate_keyboards gets called later on:
https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/1794292
See merge request plymouth/plymouth!10
So far we've been relying on the kernel fbcon code to set up all outputs,
now that distros have started using deferred fbcon takeover for flickerfree
booting, we can no longer rely on this and in some cases we must pick
our own controllers.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This avoids the need to call ply_renderer_connector_get_rotation_and_tiled
twice and thus also the need to call drmModeGetProperty twice for all
properties.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Refactor create_heads_for_active_connectors to prepare it for adding a
step where we assign controllers to connected outputs which do not have
a controller assigned yet.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
The only way we use mode_index is to get the mode, so its easier to
directly store the mode when we create a head.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Upside-down LCD panels are fixed up in HW by the GOP, so the bgrt image is
not rotated in this case and we should not rotate it to compensate.
While at it also fixup the wrong indentation of the
ply_pixel_buffer_set_device_scale() call.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add support for using the firmware splash as background for the two-step splash plugin using the ACPI BGRT extension
See merge request plymouth/plymouth!14
Add a new BGRT theme, this is a copy of the spinner theme, using the ACPI
BGRT graphics (firmware boot splash) as logo when available.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
On laptops / tablets the LCD panel is typically brought up in
its native resolution, so we can trust the x- and y-offset values
provided by the firmware to be correct for a screen with the panels
resolution.
Moreover some laptop / tablet firmwares to do all kind of hacks wrt
the y-offset. This happens especially on devices where the panel is
mounted 90 degrees rotated, but also on other devices.
So on devices with an internal LCD panel, we prefer to use the firmware
provided offsets, to make sure we match its quirky behavior.
We check that the x-offset matches what we expect for the panel's
native resolution to make sure that the values are indeed for the
panel's native resolution and then we correct for any difference
between the (external) screen's and the panel's resolution.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add support to (optionally) use the firmware splash screen logo
from the ACPI BGRT extension as background.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Before this commit background drawing on HiDPI screens is quite slow
and CPU intensive, because we do the interpolating scale, which does
a whole bunch of double-precision float operations for *each* pixel
for every frame we draw.
When using two-step with a background-tile on a Cherry Trail machine with
a HiDPI screen this results in the diskcrypt password entry being visible
laggy, I can type the password much faster then the bullets show up.
This also means we are pegging the CPU during boot, significantly slowing
down the boot.
This commit fixes this by creating the background_buffer at the screen's
device_scale and rotation, only doing the scaling once.
This commit further speeds things up by also doing the solid/gradient fill
of the background + the alpha blend of the tiled background-image once,
creating a solid background which allows us to hit the
ply_pixel_buffer_fill_with_buffer memcpy fast-path and avoids the need to
re-do the solid/gradient fill + alpha-blend each frame we render.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Use a pixel-buffer instead of an image, this gives us more flexibility.
This is a preparation patch for adding support to (optionally) use
the firmware splash screen logo (from the ACPI BGRT extension) as
background.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
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.
Until now our device-rotation support was limited to using rotated
pixel_buffer-s as destination / canvas only.
This commit adds a ply_pixel_buffer_rotate_upright helper to rotate
a nop-upright source buffer upright so that we can use it as source-buffer
to other functions which expect source-buffers to always be upright.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
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>