55 Commits

Author SHA1 Message Date
Simon Glass
dffd7b41a5 expo: Ensure that cyclic tasks can run
Since expo now runs with no delays it can trigger the watchdog on
sandbox. Add a call to schedule() to avoid this.

Series-to: concept
Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: 0b1b9f90177b7b2e682d57f3df20cf3cdb453517
Series-links: 1:60
2025-11-12 10:20:02 -07:00
Simon Glass
2575f78957 expo: Allow applying the theme to just the display
In some cases it is useful to apply the display-related theme elements
without touching the objects. Add an argument to expo_apply_theme() to
support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
e46bbc445a expo: Check the mouse once the video device is known
For expos which are designed to use the mouse, the mouse is normally
enabled when the expo is created.

Setting the display comes later, so move the display-related mouse to
expo_set_display()

Also get the current mouse position if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:30 +01:00
Simon Glass
6b1c188336 expo: Correct key-polling timeout
When a character is received it should reset the timeout, even if the
character does not result in output from cli_ch_process()

Fix this, so that keypresses which consist of escape codes are correctly
interpreted.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a5c5b3b2fb ("expo: Speed up polling the keyboard")
2025-10-10 02:24:07 +01:00
Simon Glass
a5c5b3b2fb expo: Speed up polling the keyboard
The current algorithm spends 10ms or more looking for keyboard input.
Since we expect the frame rate to be 50 or more, it should be OK to only
check once.

Handle the timeout by recording the timestamp of the last key and timing
out the CLI entry after 10ms. This allows an 'Escape' key to work,
rather than it just waiting forever for a terminal sequence that starts
with escape.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 09:55:12 -06:00
Simon Glass
f5ccdc7ac0 expo: Use manual-sync mode
Make use of the manual-sync mode provided by the video subsystem. This
removes uncertainty about whether the display will actually be updated.

Series-to: concept
Series-cc: heinrich
Cover-letter:
expo: More mouse development for expo
This series adds support for hiding the system pointer, if one is
available, since it is confusing to have an expo pointer separate from
the system one.

It also introduces a simple test mode for expo, to check the frame rate,
etc.

Some minor tweaks in the video uclass are also included, as well as
improvements to the video documentation.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
aa83cf00ce expo: Expand timing to include render and poll
Provide more timing information for expo operation, including the time
taken to:

- render the scene
- sync the framebuffer to the display
- poll for keyboard / mouse input

These are averages calculated over the past second.

Update the documentation to mention these features.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
6825579c41 expo: Add test mode to display frame count
When expo-test is enabled, show the frame count in the top right of the
display. This allows an easy visual check that expo is working correctly,
and provides an indication of performance.

Add a test for this also.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
ea95076ac6 expo: Introduce a test mode
Add a test mode for expo which will display useful debugging
information.

Put this feature behind a CONFIG_EXPO_TEST option to avoid code-size
growth. Create a separate C file and a header. Use static inlines to
avoid lots of CONFIG checking in expo.c

Enable this feature for sandbox and the EFI app for now.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
6af145ea6b expo: Hide system pointer when entering expo mode
When entering expo mode, hide the system mouse pointer so that only the
custom expo pointer is visible. Restore it when exiting expo mode.

This uses the new set_ptr_visible() method if a mouse is enabled.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
e99d2dc8ec mouse: Add support for scaling of video-device coordinates
Add a mouse_set_video() function to set up the video device associated
with the mouse. This allows mouse drivers to scale coordinates to match
the display resolution.

The video device information is stored in mouse_uc_priv rather than
being driver-specific, providing a common place for all mouse drivers to
access display dimensions for coordinate scaling.

Update expo_set_mouse_enable() to call mouse_set_video() to configure
the mouse with the display device.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
10f0e9f4ca expo: Support drawing only the dirty portion of an expo
To optimise drawing on the display, provide a new function which draws
only the part of the display which is marked as dirty.

Series-to: concept
Cover-letter:
expo: Continue development of expo with mouse
This series integrates mouse support into expo and starts to build the
infrastructure for drawing the mouse pointer more efficiently (i.e.
without re-rendering the entire scene).

It also adds a few more structs to video_defs.h for position and size.

This is part D.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-06 10:11:05 -06:00
Simon Glass
56f7bf5ed8 expo: Add selective rendering for dirty objects in scene
Support rendering only the dirty objects in a scene.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-06 10:11:05 -06:00
Simon Glass
cec177e67b expo: Add damage tracking
As a few step towards making rendering more efficient, add support for
tracking video damage within an expo.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-06 10:04:36 -06:00
Simon Glass
c4e7c60e97 expo: Show the mouse when enabled
When the mouse is enabled, show it at its new position each time the
expo is rendered.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-06 10:04:35 -06:00
Simon Glass
ef117db9c3 expo: Store mouse pointer and size in expo
Store the mouse pointer image and its dimensions in the expo structure
when mouse support is enabled. This avoids repeatedly looking up the
image and calculating its size.

Use struct vid_size to store the mouse pointer dimensions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-06 10:03:29 -06:00
Simon Glass
ff8905943b expo: Update poll_mouse() to use struct vid_pos
Simplify the function to use struct vid_pos instead of separate x/y
pointers.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-03 06:42:10 -06:00
Simon Glass
00692afa1c mouse: Update mouse_get_click() to use struct vid_pos
Change the API to use struct vid_pos instead of separate x/y pointers.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-03 06:41:11 -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
Simon Glass
6cdc1c906a expo: Refactor expo_poll() to separate out key handling
In preparation for supporting mouse clicks, split the key-handling part
of this function into a separate poll_keys() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
a6fd275924 expo: Support sending a click to an expo
Implement clicking on an expo, which simply passes it onto the scene.
For now, there are no callers for this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
d738ddf73f expo: Provide a way to enable the mouse
In some cases it is useful to use expo with a mouse (or touchpad). Add
a way to tell expo to find and record a mouse device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
872733ec11 expo: Allow the nominal display-size to be selected
At present all coordinates are absolute and must fit within the display.
This makes it hard to create an expo which can work on any size of
display, a key goal of expo.

Add the concept of a nominal size, to which all coordinates conform. Once
the real display-size is known, expo can in principle (i.e. with later
work) scale the coordinates and objects according.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-05 13:59:50 -06:00
Simon Glass
e27b36c015 expo: Tidy up insets and improve tests
Insets are handled inconsistently at present, since menus use them to
offset the label text, whereas textlines don't. This is done because
menus need the margin to be visible when opened. However this causes an
alignment issue when menus and textlines appear in the same cedit.

Remove the offsets from menus and compensate by adjusting the bounding
boxes used for highlighting and the opened menu.

Line up menu items and textlines vertically and add a style option for
textlines to control how much padding is added.

Add a test to check the positions of objects in a cedit, since this is
more direct than the rendering tests. Add style information so that the
impact can be seen.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:02 +01:00
Simon Glass
04110615e0 expo: Separate out reading the theme from applying it
Rename the existing expo_apply_theme() to expo_setup_theme() and adjust
the former so that it applies a theme which has already been read into
the struct. This will make it easier for tests to check theme
adjustments, since they won't have to put them in a node.

Add the white-on-black property into the theme struct while we are.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
3434950961 expo: Drop the extra parameter to scene_calc_dims()
We always call this with false first, then true. Drop the parameter and
handle this within the function itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
817db7d12d expo: Avoid arranging the scene willy nilly
Moving from one scene to another should not result in the scene being
re-arranged. Drop this, so that tests can have more control of when
scenes are arranged.

Also drop the scene_arrange() call when applying a theme, for the same
reason.

Add the now-required scene_arrange() to cedit and bootmenu

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
f20a1818cf expo: Create a function to arrange the current scene
Provide a convenient function which arranges the current scene in an
expo. Make use of this in bootflow_menu

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
e42503b8d2 expo: Drop the render from expo_poll()
Within tests it is useful to be able to control rendering of the expo.
Drop the automatic call to expo_render() within expo_poll() and adjust
its callers to handle this instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
01f6f88977 expo: Adjust expo_poll() to avoid looping forever
If the user does not quickly provide some input, exit so that other
things can be done, such as searching for the next OS.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
f870111aee expo: Support white-on-black in the theme
Allow this setting to be controlled from the theme.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
44e2655363 expo: Allow strings to be editable
In some cases dynamic text is needed, e.g. for a menu countdown. Add a
function which handles this, allowing the caller to take control of the
text that is shown on each render.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
bc6c19c87b expo: Use an abuf to hold strings
It is more convenient to put strings in an abuf so they can easily be
resized. Adjust the struct accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
a781c37746 expo: Add a function to poll for input
Both bootflow_menu and cedit use similar logic to poll an expo. Move
this into the expo library so the code can be shared.

Update bootflow_menu_run() to return -EPIPE when the user quits without
choosing anything, since -EAGAIN is ambiguous and elsewhere means that
there is no input yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
280b9bf36f expo: Add CLI context to the expo
An expo generally needs to keep track of the keyboard state while it is
running, so move the context into struct expo

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
f72c40ff0f video: Make white-on-black a video-device property
The CONFIG_WHITE_ON_BLACK setting is hard-coded at build-time. It is
useful to be able to control this when showing menus.

Create a property to hold this information, using the CONFIG as the
initial value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-01 17:31:39 -06:00
Simon Glass
d8ff97ce91 expo: Use standard numbering for save and discard
Set aside some expo IDs for 'save' and 'discard' buttons. This avoids
needing to store the IDs for these. Adjust the documentation and expo
tool for the new EXPOID_BASE_ID value.

Ignore these objects when saving and loading the cedit, since they do
not contain real data.

Adjust 'cedit run' to return failure when the user exits the expo
without saving. Update the test for this change as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Simon Glass
89f4f33c44 expo: Set the initial next_id to 1
If expo_set_dynamic_start() is never called, the first scene created
will have an ID of 0, which is invalid. Correct this by setting a
default value.

Add a test to check this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Simon Glass
54eca1d39b expo: Place menu items to the right of all labels
At present a fixed position is used for menu items, 200 pixels to the
right of the left side of the labels. This means that a menu item with
a very long label may overlap the items.

It seems better to calculate the maximum label width and then place the
items to the right of all of them.

To implement this, add a new struct to containing arrangement
information. Calculate it before doing the actual arrangement. Add a
new style item which sets the amount of space from the right side of
the labels to left side of the items.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Tom Rini
03de305ec4 Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"
As part of bringing the master branch back in to next, we need to allow
for all of these changes to exist here.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-20 13:35:03 -06:00
Tom Rini
d678a59d2d Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d, reversing
changes made to 2ee6f3a5f7.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19 08:16:36 -06:00
Tom Rini
c4b646d436 boot: Remove <common.h> and add needed includes
Remove <common.h> from all "boot/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06 15:05:04 -06:00
Simon Glass
cac91b0b72 expo: Correct background colour
Use the correct background colour when using white-on-black.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-11-14 20:04:00 -07:00
Simon Glass
f2eb6ad50a expo: Provide a way to iterate through all scene objects
For some operations it is necessary to process all objects in an expo.
Provide an iterator to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
82cafee133 expo: Support building an expo from a description file
The only way to create an expo at present is by calling the functions to
create each object. It is useful to have more data-driven approach, where
the objects can be specified in a suitable file format and created from
that. This makes testing easier as well.

Add support for describing an expo in a devicetree node. This allows more
complex tests to be set up, as well as providing an easier format for
users. It also provides a better basis for the upcoming configuration
editor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
7230fdb383 expo: Add spacing around menus and items
It looks better if menus have a bit of an inset, rather than be drawn hard
up against the background. Also, menu items look better if they have a bit
of spacing between them.

Add theme options for these and implement the required changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
4c87e073a4 expo: Draw the current opened menu on top
When a menu is opened, it must be displayed over all other objects in
the scene, so that all its items are visible.

Handle this by drawing the menu object a second time, after all other
objects have been drawn. Draw all of the objects which are dependent
on the menu object.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
2e59389704 expo: Support simple themes
It is a pain to manually set the fonts of all objects to be consistent.
Some spacing settings are also better set globally than by manually
positioning each object.

Add a 'theme' to the expo, to hold this information. For now it includes
only the font size.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
699b0acb52 expo: Set up the width and height of objects
Provide a way to set the full dimensions of objects, i.e. including the
width and height.

For menus, calculate the bounding box of all objects in the menu. Set all
labels to be the same size, so that highlighting works correct, once
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
9af341502c expo: Allow setting the start of the dynamic-ID range
Provide a way to set this value so that it is easy to separate the
statically allocated IDs (generated by the caller) from those
generated dynamically by expo itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00