Commit Graph

99206 Commits

Author SHA1 Message Date
GitLab CI
238eb7c102 chore: Bump version for release candidate 2025.10-rc3 c2025.10-rc3 2025-09-22 09:40:05 +00:00
Simon Glass
3a2d787d68 Merge branch 'curs' into 'master'
video: Support a cursor more generally

See merge request u-boot/u-boot!184
2025-09-19 20:42:30 +00:00
Simon Glass
1fd04ae30a console: Add some cursor tests
Add a few tests of cursor operation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

Series-to: concept
Series-cc: heinrich
Cover-letter:
video: Support a cursor more generally
At present U-Boot does not support displaying a cursor on the console,
except with expo.

It is quite useful to have a cursor, particularly when using the
command-line editor.

This series adds tracking of the cursor position for both truetype and
normal consoles. The cursor is shown when U-Boot is idle and is removed
before writing characters to the display. A save-buffer ensures that the
old display contents are provided.

Some related improvements in this series include:
- expo lineedit support with normal console
- arrow keys now render correctly when editing commands with truetype
- truetype console now also supports bitmap fonts

The cursor is not currently supported for rotated consoles.

A README for claude is provided, although so far I have not had too much
success with it.

A fix for an intermittent build is added as well, along with silencing
some build messages noticed from Rust ulib.
END
2025-09-19 13:21:02 -06:00
Simon Glass
cea8b622b6 video: Add some notes about the cursor
Provide a few notes about how the cursor works in the video console.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
d9d653b08b video: truetype: Avoid clearing on backspace
Now that the truetype console properly handles clearing text from the
display during editing, we don't need to clear the character when
processing a backspace.

This allows arrow keys to work as expected on the truetype console.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
81675eff4a video: truetype: Clear after the current char on insert
Within the CLI, inserting a character works by writing out the new char
and then all the ones after it.

With the truetype console this results in gibberish since the new
chars are written on top of the old. To resolve this, clear the rest of
the input when a character is inserted. Consider that the end of the
input, at least until furture characters are written.

As an optimisation, don't clear if the new character is the same as the
old.

This cleans up a dot above the 'g' of greatness which should not be
there, so update the dm_test_video_truetype() test.

It also clean up the part of the 't' of 'not be' which should not be
there, so update dm_test_video_truetype_bs() too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
e38a1ae08e video: Show the cursor when idle
When the console is idle and at the CLI, ensure the cursor is visible.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
8962a5fbe2 video: Save overwritten pixels when drawing the cursor
Save the pixels overwritten by the cursor into the save area.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
d59d05dede video: Support reading the framebuffer when writing
Create a variant of fill_pixel_and_goto_next() function which returns
the old pixel value. This will make it easy to save the framebuffer
pixels as they are overwritten by drawing the cursor.

Leave the current function alone, since it increases code size about
16 bytes and may slow down blitting.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
aebedeac44 video: Provide a buffer to hold pixels behind the cursor
Drawing the cursor is a destructive operation, so we must save the
previous contents of the affected part of the framebuffer, so it can be
restored afterwards.

Add this to the cursor info and set it up when probing the console
device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
f7b1a67327 video: Drop extra parameters from vidconsole_show_cursor()
Now that both console drivers use the CLI index, we don't need the extra
parameters for this. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
082bed3807 video: Support a cursor in multi-line text
For expo, lineedit only supports a single line.

For the CLI, the text can extend across multiple lines. Add support for
this in the normal console, calculating the x and y offset of the cursor
position based on the display width and font size.

The truetype console already works, since it has had this tracking for a
while.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
ea3440a535 video: Drop extra parameters from get_cursor_info()
Now that the console tracks the CLI index, remove the unnecessary
parameters. Both the normal and truetype consoles use the information
provided by the console.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
4e5c96fbcf video: Add save and restore drivers for normal console
Provide these two methods so that we can use expo lineedits with the
normal console (i.e. no truetype). This allows the cursor to be
positioned correctly when editing the lineedit and rendering the expo.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
0ab8584e3c video: Update normal console to use tracking information
The console supports keeping track of the index and the start position
of the CLI entry. Use this instead of the passed-in values.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
54f7d358cd video: Drop vidconsole_set_cursor_visible()
There is only one user of this function. Update it to use the new
vidconsole_show_cursor() instead.

Remove the now-unused vidconsole_set_cursor_visible()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
b59efb56f6 video: Track whether the cursor is enabled
The cursor should only be enabled if the user is entering something.
This can be at the CLI or in an expo. Provide a flag to track it, which
we can (later) use to determine whether or not to draw the cursor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
bd8303cf43 expo: Enable the cursor when editing a textline
Call the appropriate vidconsole functions to ensure that the cursor
will be enabled while a textline is open.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:02 -06:00
Simon Glass
8724cf302c video: truetype: Track characters and their widths
The Truetype driver maintains a list of x and y positions for every
character in the line being entered by the user. This allows it to
backspace reliably without having to re-measure lots of text.

For kerning, the video console maintains a last_ch variable which holds
the last character written to the console. This allows accurate kerning
between one character and the next. At present lash_ch is cleared on
backspace, since we cannot know what the character before last_ch is.

The slightly strange part is that the truetype console currently has no
knowledge about what the characters were, only their x and y positions,
with the x position being fractional. It also has no idea of the width
of each character, since it doesn't need to: the CLI will always write
out a new character in order to move forward during command-editing,
since there is no actual concept of 'move the cursor to the right'.

Part of the reason this works is that truetype implements backspace by
actually clearing the character from the display. So if you type some
text and then press the left arrow, it looks like it is doing a
backspace. This has been a known limitation for some time.

The correct way to implement left-arrow is to leave the display alone,
only clearing it if characters are later added. This is necessary since
Truetype fonts are OR'd onto the screen, which is assumed to be
initially cleared to the background colour.

We cannot do this clearing without knowing the width of the characters
we need to clear, so add a 'width' to the struct pos_info for that.

For kerning we must know the previous character to kern against, but we
cannot yet make that change, since we don't want to kern against
characters that were there before an erase. So that will be dealt with
later, in 'Clear after the current char on insert'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
384e6156c5 video: truetype: Record the position where CLI entry starts
Implement the mark_start() method for the truetype console by recording
which pos[] record corresponds to this event. We can be sure that the
user will not be able to backspace past this point.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
86655de2bd console: Add debugging for kerning
Add some debugging which can be used to manually check that truetype is
kerning against the expected character. This is tested by the
image-based tests but they are sometimes hard to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
691e10ead3 video: Provide a way to indicate the start of CLI entry
Add a new mark_start() method for the console, which indicates that the
CLI prompt has been written to the display and any following characters
will be user input.

There are two cases to consider, tracked by an indent flag in
struct vidconsole_cursor:

- normal CLI entry where new lines start at the left of the console
- expo entry where new lines start at the same position as the previous
  line (indent=true)

Record this position in the uclass info, so it is available to console
drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
fdfdb84dcc video: Track the current CLI index
Keep track of the current character index in the current CLI entry. This
corresponds to the cursor position and is numbered from zero.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
6147153e56 video: Move cursor drawing into the uclass
Rather than having the truetype driver draw the cursor, make it just
return the information needed to draw the cursor. This will make it
possible for the normal console to support a cursor too.

Add a check for the cursor being entirely within the framebuffer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
5e0625e3a0 video: Update cursor_show() to take a simple pointer
We don't need to pass a pointer to a pointer, so just pass a normal
pointer. This is simpler to understand.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
4a1aff1212 video: Rename draw_cursor_vertically() to cursor_show()
For now the cursor is always vertical, so part of this name is
redundant. Rename it to cursor_show(), which is what it does. We will
eventually have a cursor_hide() to match it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
25dfba4a57 video: Provide state for the cursor
We need to keep track of various things with the cursor, so create a
separate struct within the console. Add some

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
4f5c8dcf7b video: Provide an idle function for the console
Add a way to tell the console that the machine is idle. This will be
used (later) to show the cursor.

Call the video console sync after that, so that any updates are shown.

Keep the video_sync_all() for the case where CONFIG_CURSOR is not
enabled, to reduce code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
2ce18b5a14 video: Convert to use uclass_id_foreach_dev()
Convert a few functions in the video uclass to use the new
uclass_id_foreach_dev() macro.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
7c17756634 video: Correct cursor handling when the the left side
There is normally a prompt which prevents the cursor ever being on the
far left. However we should check for this to avoid a potential crash.

Add a check for x being at least 0 in console_set_cursor_visible()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
f5afdafb77 video: truetype: Use common cursor-drawing code
Update truetype_set_cursor_visible() to use the existing shared
draw_cursor_vertically() function instead of duplicating cursor-drawing
itself.

This corrects a problem where met is accessed for fixed-width fonts, for
which it doesn't exist.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
cca7523800 video: truetype: Handle rendering of bitmap fonts
Complete the support for this feature by dealing with rendering, the
moving to a particular row/column and scrolling.

Provide a simple test to check that things look right.

Allow omitting the font name to request the default font.

Fix an errant tab nearby.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
1fe8824fb9 video: Allow selection of bitmap fonts in truetype
It is sometimes useful to use a bitmap font for the console even when
truetype fonts are available. As a starting point, pull in the
font table and provide information about font sizes. Allow selection of
a bitmap font by name, as well as listing available bitmap fonts.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
5c2b0938f1 video: Move setting of the bitmap font into uclass
Most of this function deals with uclass data, so move it into the
uclass. This will allow truetype to use it too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
cda1957d43 video: truetype: Rename the FONT_ENTRY() macro
Rename this macro in preparation for allowing truetype to use bitmap
fonts. This avoids a conflict with FONT_ENTRY() in video_font.h

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:56:01 -06:00
Simon Glass
70c30bce62 video: console: Put fixed-font rendering into a shared file
Move fixed-font, character-rendering from console_normal.c into a shared
function in console_core.c. This will allow truetype to use the fixed
fonts as well as its own.

Co-developed-by: Claude <noreply@anthropic.com>
2025-09-19 12:56:01 -06:00
Simon Glass
87c89fe434 snow: link: Disable the cursor
These boards enable EXPO. Disable the cursor so we can get build
coverage on this combination.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:55:57 -06:00
Simon Glass
2986bf7bcb video: Provide an option to enable the cursor
The video cursor is always enabled at present, but it is only used for
expo. Put it behind an option, to reduce code size for platforms which
do use video but don't want a cursor.

Move the existing set_cursor_visible() method behind this option, for
the normal console. For the truetype console, the fonts and extra
rendering dwarf the code-size saving, so include the cursor there
always.

Once the cursor is enabled for the CLI, this will produce code-size
savings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 11:42:51 -06:00
Simon Glass
1ecfbbcbad test: video: Split long strings
Some strings in this file are quite long and it is a pain to look at
them within an 80-column editor. Split them.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 11:42:51 -06:00
Simon Glass
0e944b89ab scripts: Fix conditional syntax for capsule ESL generation
The ifeq/else/endif conditional for capsule_esl_file generation was
incorrectly placed inside the recipe, causing malformed Makefile syntax
that prevented proper dependency resolution. This resulted in build
failures when CONFIG_EFI_CAPSULE_AUTHENTICATE was enabled because the
capsule_esl_file target could not be created from the certificate file.

Move the conditional to properly wrap the rule definitions, allowing
Make to correctly parse and execute the capsule ESL generation rules.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Claude <noreply@anthropic.com>
2025-09-19 11:42:34 -06:00
Simon Glass
08fbd3a911 Makefile: Silence the example Rust build
We don't need messages printed when building. Remove them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 11:42:33 -06:00
Simon Glass
551b30c659 video: Correct ops check for nominal, entry save/restore
All of these helper functions check the wrong member. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 9e55d09596 ("video: Allow obtaining the nominal size of a...")
Fixes: 9899eef2cb ("video: Allow saving and restoring text-entry...")
2025-09-18 15:41:37 -06:00
Simon Glass
5e5eed7ded cyclic: Avoid showing messages when debugging
When using a debugger it is common to single step through functions. If
one of those functions happens to be called from a cyclic function, then
a warning messages is shown. When debugging the console itself, this can
mess up the session.

Add a Kconfig to control whether the message is shown. Disable it by
default if CONFIG_CC_OPTIMIZE_FOR_DEBUG is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-18 15:41:37 -06:00
Simon Glass
f2385b7bea Provide a README for Claude
Add the beginnings of a readme to help Claude do the right thing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-18 06:41:34 -06:00
Simon Glass
0c2531998e Merge branch 'apf' into 'master'
expo: Support interactions with a mouse or touchpad

See merge request u-boot/u-boot!183
2025-09-15 20:06:03 +00:00
Simon Glass
3b3ec58450 expo: Provide a test of expo mouse behaviour
Check the behaviour of non-popup menus with a mouse.

Series-to: concept
Series-cc: heinrich
Cover-letter:
expo: Support interactions with a mouse or touchpad
So far expo only supports user interaction with a keyboard. This is the
common case, but for PC devices it is typical to have a mouse or
touchpad available as well.

Particularly for the configuration editor, these devices are often more
convenient for selecting options than moving up and down with with the
keyboard.

This series adds mouse support to expo, providing a function to process
a click similar to processing of a keypress. The core of this is a new
expo_send_click() function. Within scenes, the logic to search for
objects by and x and y position is provided.

As with keypresses, expo provides clear separation between the
processing of a click (which may or may not produce an action) and the
handling of that action. This allows expo to be used within an existing
event loop.

Expo uses a mouse by default if available.

This series also includes a few other minor improvements, including some
code tidy-ups and support for filled boxes.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:34
2025-09-15 13:23:13 -06:00
Simon Glass
f44080081c expo: Provide a test of cedit mouse behaviour
Add a test which checks the various expected features of a cedit when
used with a mouse. This includes clicking on menu items and textlines.

For now, textedit is not supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
c4544d59f0 expo: Add a test helper for clicking on objects
Provide a way to click on an object and check that the expected action
resulted. Put it in a common file so it can be used by cedit and expo
tests.

Tidy up the include-order in both cedit and expo.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
4eb8f8319a expo: Enable the mouse when available
When creating a new bootflow menu or cedit, enable the mouse, so the
user can interact with the expo more easily.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
bcf7b403e8 expo: Check the mouse when polling
If no key is pressed, check for a mouse click and process that, if
available.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00