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.
nerdopolis [Fri, 8 Dec 2023 15:30:37 +0000 (10:30 -0500)]
main: Restore terminal line discipline on hide splash
At the moment if a program calls `plymouth hide-splash`
plymouth keeps the terminal in raw mode. That is wrong,
because programs call `plymouth hide-splash` specifically
so they can use the terminal.
This commit makes plymouth restore the terminal to cooked
mode so it's ready for the next program.
nerdopolis [Wed, 6 Dec 2023 02:12:37 +0000 (21:12 -0500)]
ply-terminal-emulator: Require a fixed upfront column count
Some commands really do need to know how wide the terminal is to operate correctly. Without
it long lines don't wrap right and other badness can happen.
This commit addresses the problem by changing the terminal to take both a `number_of_rows`
and `number_of_columns` argument at construct time instead of just a `maximum_line_count`.
In order to properly implement that change, this commit also adds new api to `ply_rich_text_t`
to specify which parts of a run of rich text is read-only and which parts of the run can be
modified.
Changes in this commit were made with assistance from Ray Strode
Ray Strode [Mon, 4 Dec 2023 12:54:41 +0000 (07:54 -0500)]
ply-input-device: Handle SYN events
If the kernel falls behind a stream of input events, we currently
drop them on the floor.
It seems unlikely that this could ever happen theorhetically since we only
process keyboard events (versus, say, a high frequency stream of pointer
events, or a complex stylus device with inter-related events coming in,
in batches). Nonetheless, there is a report that suggests key events
may be getting dropped.
This commit adds support for handling the backlogged event case, and
hopefully address the bug report.
Hans de Goede [Tue, 15 Aug 2023 17:25:21 +0000 (19:25 +0200)]
drm: Guess device-scale when using simpledrm
When displaying on a simpledrm kms device the physical dimensions
of the screen are unknown. Use the heuristics from ply_get_device_scale ()
to guess the device scale to avoid rendering things too small
on 4K screens.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Tue, 15 Aug 2023 16:41:29 +0000 (18:41 +0200)]
drm: Add check if the driver used is simpledrm
Add a check to see if the driver used is simpledrm,
this is a preparation patch for adding support to set
device_scale based on heuristics when using simpledrm.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Tue, 15 Aug 2023 16:42:46 +0000 (18:42 +0200)]
drm: Initialize rotation local variable
Initialize rotation local variable to fix the following
false positive compiler warning:
src/plugins/renderers/drm/plugin.c: In function ‘get_primary_plane_rotation’:
src/plugins/renderers/drm/plugin.c:485:31: warning: ‘rotation’ may be used uninitialized [-Wmaybe-uninitialized]
485 | *rotation_ret = rotation;
| ~~~~~~~~~~~~~~^~~~~~~~~~
src/plugins/renderers/drm/plugin.c:419:18: note: ‘rotation’ was declared here
419 | uint64_t rotation;
| ^~~~~~~~
Signed-off-by: Hans de Goede <hdegoede@redhat.com>