Ray Strode [Fri, 1 Jun 2018 18:41:32 +0000 (14:41 -0400)]
drm: ensure drm_fd is closed if open fails
At the moment we open the drm fd right away, then proceed to
check the terminal. If the terminal doesn't meet specs, we
fail the open call but neglect to close the drm_fd.
This commit fixes the code such that we don't leave the drm
fd open inadvertently.
Ray Strode [Thu, 31 May 2018 17:22:54 +0000 (13:22 -0400)]
renderer: nullify device if open fails
Since commit e4f86e3c we query the renderer device straight from
the renderer plugin. Unfortunately, we continue to use that
device name even after the renderer fails to open and the plugin
gets unloaded.
This commit changes the code to go back to using the original
device name in that scenario.
Ray Strode [Thu, 26 Apr 2018 14:15:14 +0000 (10:15 -0400)]
wip! plymouth: stub out drm escrow program
Right now plymouthd forces itself to stay alive for the duration of
shutdown, so the splash screen can stay up until the power is killed.
This causes unclean mounts in some situations following system updates.
Rather than keep plymouthd around, all we really need to do is keep
the drm fd around. That can be down with a separate program executed
just in time from the initramfs.
As a first step toward acheiving that goal, this commit creates a
simple new program "plymouth-drm-escrow" that doesn't do anything
at all but try to stay alive.
A future commit will change plymouthd to run plymouth-drm-escrow,
and pass it the drm fd.
Hans de Goede [Tue, 10 Apr 2018 15:33:31 +0000 (11:33 -0400)]
branch-merge: support device rotation
On some devices the LCD panel is mounted in the casing in such a way
that the up/top side of the panel does not match with the top side of
the device.
Examples of this are:
-Tablets where the LCD panel is mounted upside-down (various models)
-Clamshell design devices use portrait tablet screens in a landscape fashion /
a landscape case, e.g. the GPD pocket, GPD win, Asus T100HA and the VIOS LTH17
(so the didplay is mounted rotated 90 degrees clock-wise or counter-clock-wise).
Starting with kernel 4.16 there is code in the kernel to:
-Detect affected devices
-Automatically rotate the fbconsole to compensate
-Let userspace know about this with a new "panel orientation" property on the drm connector of the panel
The patch series I'm attaching to this bug adds support for this to
plymouth, so that the boot-splash and diskcrypt-ask-password are shown
with the correct orientation / the right way up on these devices.
Hans de Goede [Sat, 20 Jan 2018 11:20:29 +0000 (12:20 +0100)]
drm: Reset primary plane rotation to DRM_MODE_ROTATE_0
On devices where the (LCD) panel is mounted upside-down in the case
the kernel's drm_fb_helper code may have set up rotation on the primary
plane to make the text-console (and other fbdev using apps) show the right
way up.
We inherit this rotation from the text-mode and since we do our own rotation
where necessary we end up rotating twice and showing the boot-splash
upside-down again.
Dealing with hardware rotation may require using a specific framebuffer
tiling which we do not support, so we should just disable the hardware
rotation and keep using our own software rotation.
This commit adds code to find the primary plane and its rotation property
and if it is not DRM_MODE_ROTATE_0 then sets it to DRM_MODE_ROTATE_0. fixing
the double rotation issue.
Hans de Goede [Tue, 12 Dec 2017 18:47:26 +0000 (19:47 +0100)]
drm: Check for "panel orientation" connector property
On some devices the LCD panel is mounted in the casing in such a way
that the up/top side of the panel does not match with the top side of
the device (e.g. it is mounted upside-down).
Kernel 4.16 introduces a new "panel-orientation" property on the drm
connector which allows modesetting applications / code to check for
such LCD panels.
This commit adds support for this new property and passes this to the
pixel_buffer code using the new ply_pixel_buffer_new_with_device_rotation
method, so that the pixel_buffer code will automatically rotate the
image to correct for the panel orientation.
Hans de Goede [Wed, 6 Dec 2017 16:37:12 +0000 (17:37 +0100)]
pixel-buffer: Add the concept of device rotation
On some devices the LCD panel is mounted in the casing in such a way
that the up/top side of the panel does not match with the top side of
the device (e.g. it is mounted upside-down).
This commit adds support to the ply-pixel-buffer code to create
buffers which take device rotation into account and which will rotate
the picture to compensate.
Hans de Goede [Sun, 21 Jan 2018 13:07:39 +0000 (14:07 +0100)]
main: Do not update the display on backspace when there is no input to remove
On machines with a slow CPU (Atom) and a highres screen drawing the
diskcrypt dialog may take longer then the keyrepeat speed, this leads to
a long delay before showing keypresses when doing the following:
1) Type long password
2) Realize it is wrong, press + hold backspace
the key-repeat will now generate backspace key presses faster then we
process them as main.c does an update_display for each press
3) Users releases backspace when we've processed input-length backspace
key-presses, but since we were drawing slower then key-presses were
coming in many more backspace keypresses are in the keyboard buffer
4) User types first character of the right password, this shows up up to
a couple of seconds later because first we are still processing all
the queued up backspace presses and doing a redraw for each.
This commit fixes this by skipping the redraws in on_backspace when there
is no more input left in the input buffer.
Ray Strode [Wed, 20 Dec 2017 15:49:19 +0000 (10:49 -0500)]
device-manager: drop superfluous create_pixel_displays_for_renderer call
commit 29e27637694eefc962d53333c729e6cac1c66518 tried to move
create_pixel_displays_for_renderer down a couple of lines, but it
inadvertently copied it instead of moved it.
Ray Strode [Mon, 11 Dec 2017 15:39:13 +0000 (10:39 -0500)]
x11: don't call gdk_display_get_name before gtk_init
The x11 plugin calls gdk_display_get_name at load time
to set the device name state. This no longer works, since
gtk_init_check() happens later at open_device time, and
GTK+ no longer allows gdk_display_get_name before gtk_init.
This commit moves the gtk_init call earlier, to
create_backend, so gdk_display_get_name works again.
Not all distros use the upstream plymouth-populate-initrd
script to populate their initramfs. As a consequence,
some themes have been developed that use subdirectories,
(which is not supported by plymouth-populate-initrd).
This commit adds support for that feature, so that
preexisting themes get properly installed.
Ray Strode [Tue, 7 Nov 2017 18:49:30 +0000 (13:49 -0500)]
device-manager: fall back to text mode if graphical devices fail
Right now we assume if we find a /dev/dri/card0 that it will work.
That may not be true. The proprietary nvidia driver, for instance,
provides /dev/dri/card0 but disables modesetting by default.
This commit makes sure we fall back to text mode if /dev/dri/card0
is insufficient for our needs.
This makes possible to support shipping a self-contained initrd which
completely overrides the plymouth theme. The configuration and theme are
copied to /run by a custom service before plymouth starts, so plymouth
can load the correct config from /run both during bootup and shutdown.
This commit changes the routine which resolves plymouth.defaults' path,
to have it look first in plymouth's runtime directory.
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
When a theme is shipped exclusively in the initrd, plymouth will not be
able to load is if it starts the boot splash after the bootup process
already switched from the initrd. One way to make it work is to copy the
theme to plymouth's runtime directory in /run, which is preserved during
switch root.
This commit changes the routine which resolves a theme's path to have it
look first in themes/ under plymouth's runtime directory.
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Michael Kuhn [Mon, 22 Aug 2016 19:54:18 +0000 (21:54 +0200)]
libply, main: Add device scale setting
This adds a DeviceScale setting to plymouthd.conf. It can be used to
override the device scale detection when setting the
PLYMOUTH_FORCE_SCALE environment variable is too complicated.
Ray Strode [Mon, 20 Jun 2016 15:06:49 +0000 (11:06 -0400)]
drm: don't pick up drm master implicitly
If a client opens the drm device, they're given drm master
implicitly. We already explicitly take DRM master when we need it,
so that featuer is unneeded.
Furthermore, it's actively harmful, since fbdev won't let you change
the color palette of the terminal if drm master is held.
This commit makes sure to drop master as soon as we get it from
open().
Daniel Drake [Thu, 16 Jun 2016 22:25:05 +0000 (15:25 -0700)]
device-manager: probe existing DRM devices at startup
A regression introduced in 7e37d58be3e9acff36c53c420b399c18d08bd8f8
means that we only look for DRM devices that appear while we're waiting,
we don't consider any that are already present before we started.
shutdown splash was not appearing because of this.
Solve this by explicitly searching for already-initialized DRM devices as
we start up.
Ray Strode [Tue, 14 Jun 2016 18:31:40 +0000 (14:31 -0400)]
main: call show_messages after the splash is assigned
The show_messages function shows any queued messages sent to the
daemon on the active boot splash. It's currently only ever called
in a place in the code where the splash hasn't yet been assigned,
so it's effectively always a noop.
This commit moves the call a little later so it won't bail immediately.
Ray Strode [Tue, 14 Jun 2016 18:23:18 +0000 (14:23 -0400)]
text: add view for new text displays
commit 74346ec268f609 tried to fix a case where views are
added after the text splash is shown. That commit inadvertently
removed the code that adds a view for a new text display.
This commit adds back the accidentaly excised line.
Ray Strode [Tue, 7 Jun 2016 12:28:03 +0000 (08:28 -0400)]
device-manager: fix use after free
If a renderer fails to open, then we need to make sure we nullify,
the renderer variable after freeing it, since subsequent code checks
if the renderer is null to know whether or not to proceed with
fallback.
Ray Strode [Thu, 24 Sep 2015 13:21:18 +0000 (09:21 -0400)]
device-manager: activate new renderers after adding to renderers list
When a new renderer gets created, we should activate it, if the device
manager is already active.
At the moment we call create_pixel_displays_for_renderer which would
implicitly activate it (from a callback), except we call it one line
too early, so the renderer isn't in the list of known renderers yet.
This commit swaps the two lines and also adds an explicit renderer
activation for clarity. For symmetry it makes the same change to
keyboards that it makes to renderers.
Will Woods [Wed, 20 May 2015 16:03:58 +0000 (12:03 -0400)]
plymouth-populate-initrd: fix THEME_OVERRIDE with empty conf
If you set PLYMOUTH_THEME_NAME to override the theme in an initrd
(as e.g. lorax does when building upgrade.img), plymouth-populate-initrd
tries to edit plymouthd.conf to enable that theme.
Unfortunately, the existing `sed` line doesn't work if your
plymouthd.conf is empty or all commented out - which is how we currently
ship it.
So before modifying the config, make sure it has a [Daemon] section
header, and a Theme=[placeholder] line for us to modify.
Daniel Drake [Wed, 11 May 2016 17:21:16 +0000 (11:21 -0600)]
device-manager: use device timeout instead of udev coldplug monitor
https://lists.freedesktop.org/archives/systemd-devel/2015-March/029184.html
As explained there, plymouth watching for coldplug events is not the
behaviour we're looking for.
Replace this with a configurable timeout. We claim DRM devices as soon as
we're aware of them (displaying the splash still subject to ShowDelay),
but legacy framebuffer and text console devices are only claimed after
this new DeviceTimeout.
This avoids an issue where the initramfs finishes (generating a coldplug
event) before udev has informed plymouth of the DRM devices. This was
causing plymouth to activate text mode and ignore the DRM devices appearing
a moment later.
Apply the same heuristics as the DRM code, and set a device
scale on the pixel buffer. An environment variable is introduced
to force a scale different than the native one.
The background image is tiled to cover the entire screen, so
we must pass a fill area that covers the screen or sampling
will be wrong. But we must also pass a clip area or we will
have expensive overdraw.
The device scale is a scale transformation that is applied to
the pixel buffer contents, but is transparent to the user of
the buffer (all pixel values are in logical pixels, not device
pixels).
The concept is modeled after the cairo API, and it is useful
to implement HiDPI monitor support.
on i386. The conversion from double to int in functions
ply_pixel_buffer_resize and ply_pixel_buffer_interpolate happens
through an intermediate float. This sometimes results in a truncated
value being larger than the original value.
This commit changes the code to use an intermediate double to
work around the bug.
Ray Strode [Mon, 10 Aug 2015 14:11:32 +0000 (10:11 -0400)]
boot-splash: don't crash in free if module not loaded
ply_boot_splash_free currently calls some code that depends
on a module being loaded. We call ply_boot_splash_free to
clean up the boot splash object if a module can't be loaded,
leading to crash.
This commit addresses that issue by only calling the module
specific destruction code in ply_boot_splash_free in the case
where a module is loaded.
Ray Strode [Fri, 24 Jul 2015 18:12:40 +0000 (14:12 -0400)]
device-manager: decouple local console from output device
The code currently does a faulty heuristic to figure out which
drm device is associated with the tty. We shouldn't actually
even need an accurate association, so this commit just makes
sure the terminal gets used for the first device.
Ray Strode [Thu, 23 Jul 2015 18:16:48 +0000 (14:16 -0400)]
device-manager: drop seat abstraction
The seat abstraction isn't really right, since it forces creating a
link between terminal and video output device, which isn't really
necessary (and other reasons).
This commit drops the abstraction, and moves all the code that was
in ply-seat.c directly to ply-device-manager.c.
Ray Strode [Tue, 28 Jul 2015 14:00:25 +0000 (10:00 -0400)]
animation,throbber: allow calling stop after animation is stopped
Right now if a user calls ply_throbber_stop or ply_animation_stop
after the animation is stopped things malfunction. In the case
of the throbber we end up never calling the stop completion handler
passed in, and in the case of the animation, we end up setting
some state that shouldn't be set.
This commit checks if the animation and throbber objects are stopped,
and if so does the necessary steps to process the late stop request.
Sjoerd Simons [Mon, 8 Dec 2014 10:50:47 +0000 (11:50 +0100)]
script: Don't draw backgrounds if they're obscured
When drawing sprites it's a waste to draw the background if the target
area will be obscured by the sprit to draw. Optimize for the common case
where only one sprite is being drawn by peeking at the first item in the
sprite list to check if it is opaque and fills the area.
Sjoerd Simons [Mon, 8 Dec 2014 10:47:12 +0000 (11:47 +0100)]
ply-image: Don't do alpha pre-multiplication for opaque pixels
When transforming the output of libpng to ARG32 with pre-multiplied
alpha, only do the multiplications if the pixel isn't opaque. Otherwise
plymouth is just applying a very complicated identity function.
Sjoerd Simons [Mon, 8 Dec 2014 10:42:26 +0000 (11:42 +0100)]
pixel-buffer: Optimize filling with opaque buffers
If the source buffer is known to be fully opaque and the fill is done at
full opacity, simply memcpy the data row-by-row instead of iterating over
every pixel and blending it with the target buffer.
This could be optimized more, in the future, in some cases, by memcpy of
the entire block instead of row-by-row.
Sjoerd Simons [Mon, 8 Dec 2014 10:39:39 +0000 (11:39 +0100)]
pixel-buffer: add ability track opaqueness
Pixel buffers contain ARGB32 data. Add functionality to mark a buffer as
containing only fully opaque pixels. This functionality can be used by
rendering functions to be able to optimize drawing of such buffers.