Ray Strode [Wed, 3 Jan 2024 20:37:08 +0000 (15:37 -0500)]
label-freetype: Rework font loading
There's currently this function, set_font_with_fallback, that
almost always gets called with a NULL first argument in the
initramfs, forcing the _with_fallback part of the function to
run.
It's a little strange to have a function with a chunk of code that
hardly ever runs. Furthermore there's a bug where the error variable
is left uninitialized in this case leading to the freetype plugin
sporadically failing to load the fallback font.
This commit reworks things to drop set_font_with_fallback, and just
call FT_New_Face directly in the caller. Fallbacks are handled
at the point where the font path is determined
(previously called query_fc_match, now called find_default_font_path.
Ray Strode [Tue, 2 Jan 2024 22:04:26 +0000 (17:04 -0500)]
label-pango: Try to fix up remove_hexboxes_from_pango_layout
There are a few issues with the remove_hexboxes_from_pango_layout
function, where it's getting offsets wrong and things like that.
This commit changes the approach entirely. Rather than modifying
the text to remove characters without font converage, it just
changes out the glyphs for those characters to be white boxes.
Ray Strode [Tue, 2 Jan 2024 03:04:21 +0000 (22:04 -0500)]
ply-terminal: Only set keyboard mode when changing it
Setting the console keyboard mode is not entirely idempotent.
The kernel may flush the input buffer leading to lost
key strokes. We currently set the mode explicitly on graphics
updates as part of our more general "fix things up in case
something during boot screws with the terminal settings" code.
That leads to keystrokes getting eaten.
This commit makes the terminal more careful about setting the
keyboard mode. It now only changes it when plymouth thinks its
necessary to do so.
In the future we could query the keyboard mode and reset it
when it's wrong, but I think we should hold off on doing that
until shown we need to.
Ray Strode [Mon, 1 Jan 2024 19:40:08 +0000 (14:40 -0500)]
ply-keyboard: Add new plymouth.debug-key-events option
We're currently facing a bug where keys have to be hit several
times to register for a user.
In order to make traction on that problem, this commit adds a
new plymouth.debug-key-events kernel command line option
to report in more detail the keyboard events coming in from the
terminal.
Ray Strode [Wed, 27 Dec 2023 19:46:31 +0000 (14:46 -0500)]
ply-terminal-emulator: Add way to see escape sequences
This commit adds a new kernel command line option
plymouth.debug-escape-sequences that makes escape sequences stay
unparsed and instead get printed on the screen.
Ray Strode [Thu, 28 Dec 2023 18:28:46 +0000 (13:28 -0500)]
label-freetype: Ensure font metrics are up to date when querying dimensions
If code calls ply_label_get_width without ply_label_show or some other
call that forces the dimensions to be computed first, then the returned
width will be wrong.
This commit makes the freetype plugin look more like the pango plugin
where the size will computed on demand when querying the width, if
necessary.
Ray Strode [Wed, 27 Dec 2023 21:30:15 +0000 (16:30 -0500)]
main: Print backtrace on crash
Since plymouth can crash before the root filesystem is mounted,
and since plymouth can prevent boot from proceeding, coredumpctl
isn't always a viable option for getting backtraces.
This commit changes the crash handler to output backtrace
information to assist when coredumpctl can't.
Adam Williamson [Mon, 25 Dec 2023 22:48:27 +0000 (14:48 -0800)]
Fix checks for existence of vars set by fc-match
The first line here checked for the wrong variable and is a dupe
from two lines earlier anyway, and the second line isn't guarded
at all, which seems to cause the weird failure we've been seeing
in openQA testing.
Also add a couple more existence checks for the same variables
later.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
Ray Strode [Sun, 24 Dec 2023 20:27:49 +0000 (15:27 -0500)]
ply-input-device: Fix crasher
If we have an error during early input device initialization we
can blow assertion because we may try to cleave it from the event
loop it is not yet attached to.
Ray Strode [Mon, 18 Dec 2023 18:48:42 +0000 (13:48 -0500)]
label-freetype: Revamp to work better
Recent changes to the freetype plugin made it quite buggy. There
was an infinite loop bug, and also a failure in metrics handling.
There's also a number of outstanding issues:
1. Kerning is not properly applied
2. hidpi displays don't render correctly
Rather than try to tackle all of these problems in a peicemeal way,
this commit substantially reworks the code.
It introduces a ply_freetype_unit_t type for more clearly managing
the fixed point math freetype requires. This type relies on less
than well defined compiler behavior, however, so it may cause issues
down the road.
It consolidates measuring and drawing code to one function, since in
both cases, the same computation needs to happen, and they had
slightly divergent implementations before.
It consolidates font loading code, so we don't end up with two
different font face loading routines, with different dpi values.
It also changes the names of some variables to be clearer in my
mind (like changing the loaded glyph to the name "glyph" instead
of the name "slot")
Ray Strode [Sun, 17 Dec 2023 12:50:19 +0000 (07:50 -0500)]
ply-boot-splash: Flush display updates at fixed framerate
At the moment the splash plugins have a lot of leeway when
updates can go to the screen. They can pause and unpause
updates by themselves, and draw at any point.
This rope has a little too much slack, it's actually kind
of complicated for the splash plugins to manage drawing
when they have more than one moving part.
For instance, a spinner animation may be drawing autonomously
from the splash plugin itself. To avoid flicker, everything
needs to be synchronized.
This commit adds that synchronization a layer higher than
the plugins themselves, in ply-boot-splash. It accumulates
drawing updates continuously without doing any drawing, until
a given deadline, then flushes the updates out all at once.
This idea of pausing and unpausing updates at a given framerate is good,
but doing it at the ply-pixel-display level causes a proble with
monitor hotplug.
Ray Strode [Mon, 11 Dec 2023 15:29:20 +0000 (10:29 -0500)]
ply-buffer: Nullify bytes outside scope block
ply_buffer_borrow_bytes is a new macro to make it possible to
temporarily alter the allocation of the underlying bytes of
a `ply_buffer_t` outside of `ply_buffer_t` specific methods.
This macro works by forcing the caller to use a scope block
to clearly delineate where the allocation modification is
occurring. This macro was inspired by the python `with` feature.
Unfortunately, the macro leaves the bytes initialized outside
the scope block, so there is some temptation to continue messing
with the allocation when it's not allowed.
This commit improves the macro to address that problem by nullifying
the passed in variables at the conclusion of the borrowing scope
block.
Ray Strode [Sun, 10 Dec 2023 15:18:30 +0000 (10:18 -0500)]
utils: Rework UTF-8 handling
ply_utf8_character_get_size currently has this odd argument at
the end that is often just set to PLY_UTF8_MAX_CHARACTER_SIZE
and also the function returns magic values for cases where it
can't figure out the size because the byte isn't a leading
byte or is otherwise not valid UTF-8.
That means that API has a nuance to it that makes the code hard
to follow at a light read.
This commit attempts to improve the situation by dropping the
extra argument, and adds a way to get the type separate from the
size for clarity.
At the same time, this commit updates all the callers to use the
new API. There are two cases where the callers are trying to
remove the last character from a UTF-8 string, so this commit
adds a new function to consolidate that logic as well.