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
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>
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>
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")
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>