At present only highlightable objects can be clicked on, i.e. menus and
textlines. Update scene_find_obj_within() so that it can find any type
of object, if requested. Update all the callers to false, so things work
the same.
Since the scene is drawn by iterating through the list of objects, when
the user clicks somewhere we should look at the top-most object under
the mouse first. So reverse the direction of the object search.
Update the tests to cover this new feature.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Since the scene is drawn by iterating through the list of objects, when
the user clicks somewhere we should look at the top-most object under
the mouse first.
This is not true when a menu is popped up, since we only care about the
menu in that case.
Add a way to reverse the direction of the object search. For now there
are no new test cases, since OBJ_OVERLAP is a text object and cannot
currently be clicked on.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
It is easier to test this function directly than via click_check(). Set up
a test expo with an extra overlapping object and add some tests.
Update the existing render test to take account of the new object.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
For debugging it is sometimes helpful to dump an expo. Add an
implementation of this, writing to a membuf.
Add a MAINTAINERS entry for expo, including this next file.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a few functions which can convert a flag and an object type to
strings.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a membuf_printf() function which supports writing a formatted string
into a membuf.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The video_write_bmp() function was writing 16bpp framebuffer data
directly to BMP files without proper format conversion. The framebuffer
uses RGB565 format (5 red, 6 green, 5 blue), but standard Windows BMP
16bpp format uses RGB555 (5 red, 5 green, 5 blue).
Convert pixels from RGB565 to RGB555 by:
- Extracting the 5-bit red, 6-bit green, and 5-bit blue components
- Dropping the LSB of the green channel to convert from 6 to 5 bits
- Reconstructing as RGB555 with the same R/B order
This fixes incorrect colors in BMP output files (e.g., orange appearing
as blue).
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Change the mouse_button structure to use a bool pressed field instead
of an unsigned char press_state. This simplifies the API by using a
natural boolean type for a binary state.
Remove the BUTTON_PRESSED/BUTTON_RELEASED defines as they're no longer
needed.
Update all mouse drivers, tests, and the mouse command to use the new
field name and type.
Series-changes: 2
- Add new patch to replace press_state with bool pressed
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
In test mode, show the FPS (frames per second) below the frame count.
This is helpful for performance monitoring during development.
The FPS calculation averages over the last 5 seconds to provide a
stable reading.
Add a test for the FPS calculation logic as well.
Mention expo's test mode in the documentation.
Co-developed-by: Claude <noreply@anthropic.com>
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 for the mouse set_ptr_visible() method. This uses a back-door
function to read the visibility state from the sandbox mouse driver.
Also add documentation for struct sandbox_mouse_priv.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a flag to indicate that am object must be redrawn. Set this flag
when an object's bounding box changes.
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>
Add a test that verifies the sandbox SDL driver receives the correct
damage rectangle in its sync() method. The test:
- Clears the display and verifies full-screen damage is passed to sync()
- Writes text at a specific position and verifies smaller damage region
- Draws a box and verifies the damage matches the box dimensions
The damage rectangle is recorded in sandbox_sdl_plat.last_sync_damage
and can be retrieved using sandbox_sdl_get_sync_damage() for testing
purposes.
Series-to: concept
Series-cc: heinrich
Cover-letter:
video: Enhancements to support a pointer
The video subsystem has a video_sync() function which does quite a few
things and is rather hard to predict and control:
- it may or may not actually sync, depending on a timer, etc
- it may be called when U-Boot is idle, so any time delays can cause a
sync
These two problems make it hard to test.
This series introduces a deterministic video_manual_sync() which does
exactly what it is told, using a set of flags:
VIDSYNC_FORCE - the force flag was provided (info for the driver)
VIDSYNC_FLUSH - framebuffer changes should be flushed to hardware
VIDSYNC_COPY - the copy framebuffer (if any) should be updated
The video_sync() method is renamed to sync() and is passed the flags,
so that drivers can find out what to do. This allows the
sandbox-specific code in video_sync() to move to the driver.
These features will (later) be used by expo to provide a better user
experience, e.g. to sync only part of the display, or to sync quickly
when there is mouse movement.
The pointer also needs to be drawn with transparency which is not well
supported by the BMP code. This series adds support for a simple
transparency colour for now, although an alpha channel may be
appropriate in the future.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:45
Series-version: 2
Extract the core sync logic from video_sync() into a new
video_manual_sync() function that accepts flags directly. This allows
callers to perform sync operations with explicit control over the sync
behavior.
The video_sync() function now:
- Determines the appropriate flags (VIDSYNC_FORCE, VIDSYNC_FLUSH,
VIDSYNC_COPY) based on the force parameter and timing
- Calls video_manual_sync() with those flags
The video_manual_sync() function:
- Takes explicit flags as a parameter
- Handles VIDSYNC_COPY flag to control copy framebuffer flush
- Performs the actual sync operations
This separation allows manual-sync mode users (and tests) to call
video_manual_sync() directly with custom flags while video_sync()
continues to work as before for normal scenarios.
Add tests for video_manual_sync() to check the behaviour with
different flag combinations.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
When expo is being used, it should only redraw the display when it has
made changes. Add a new 'manual sync' mode which tells the video
subsystem to ignore video syncs from other sources.
This also disables the idle feature, since it can interfere with tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Replace the anonymous struct in video_priv with struct vid_bbox for
the damage field.
Update all references from xstart/ystart/xend/yend to x0/y0/x1/y1 to
match the video_bbox field names. Add local video_bbox pointers in
functions that access damage fields repeatedly to improve readability.
Series-changes: 2
- Call it vid_bbox instead as it is shorter and less video-centric
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
When the mouse is being used we need a suitable pointer image to draw on
the display. Add the RISC OS pointer, in honour of the first GUI
available on ARM devices.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new --video_frames option to sandbox which accepts a directory path.
When set, every video test assertion writes a BMP file (frame0.bmp,
frame1.bmp, etc.) to the specified directory, allowing visual inspection
of the framebuffer at each test step.
A new video_write_bmp() function writes 16/32bpp framebuffer contents as
Windows BMP files. On startup, any existing frame*.bmp files in the
directory are removed to ensure a clean state.
Usage example:
./u-boot --video_frames /tmp/frames -c "ut dm video_text"
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new -V flag to sandbox which accepts a delay in milliseconds. This
causes video tests to pause after each assertion, allowing the display
output to be visually inspected.
This is useful for debugging video tests and understanding what is being
drawn at each step.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new 'video images' command which lists the graphical images that
are compiled into U-Boot. Generally the only one is the logo.
Series-to: concept
Series-cc: heinrich
Cover-letter:
video: Tidy up embedded graphical images
U-Boot includes a few graphical images which are compiled in, such as
the logo and the BGRT logo used for EFI.
At present these are handled by a Makefile rule which looks for files
ending with '_logo.bmp'.
This series moves these into a new drivers/video/images directory and
puts them in a linker list, so it is possible to see what images are
available.
Adding a new image is simpler, just requiring the addition of the normal
'obj-y += file.bmp' rule.
This series also adds a new 'video' command which provides the existing
'setcurs' and 'lcdputs' as subcommands, along with documentation and
tests.
It also adds a more convenient 'write' subcommand.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 2:44 1:43
Series-version: 3
Add a new 'video' command with 'setcursor' and 'puts' subcommands that
provide an alternative interface to the existing setcurs and lcdputs
commands.
Update the test is updated to test both the legacy commands and the new
'video' command.
Series-changes: 2
- Correct confusing output text which should be 16 instead of 10
- Improve docs for row and col
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a simple test for the setcurs and lcdputs commands.
Series-changes: 2
- Pull out the docs into a separate patch
- Update test result for hex
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
At present the EFI bootmgr scans all devices in the system before
deciding which one to boot. Ideally it would use the bootstd iterator
for this, but in the meantime, give it a lower priority, so it runs
just before the network devices.
Note that if there are no hunted network devices hunted, then it will
run at the end, after all bootdevs are exhausted. In other words, it
will always run.
Series-changes: 2
- Update commit message to indicate the bootmeth will always run
- Document how the priority was chosen
Signed-off-by: Simon Glass <sjg@chromium.org>
At present before scanning global bootmeths, the iterator sets the
method count to the index of the first global bootmeth. Now that we
support scanning the global bootmeths multiple times, we must leave this
count alone.
Check against have_global and first_glob_method instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a bitfield which tracks when bootmeths have been used. This will be
needed when global bootmeths can be used later in the iteration.
Fix a missing bootflow_free() while here.
Signed-off-by: Simon Glass <sjg@chromium.org>
The current 'doing_global' refers to being in the state of processing
global bootmeths. Since global bootmeths are currently used once at the
start, it becomes false once the last global bootmeth has been used.
In preparation for allowing bootmeths to run at other points in the
bootstd interation, add a new 'have_global' flag which tracks whether
there are any global bootmeths in the method_order[] list. It is set up
when iteration starts. Unlike doing_global which resets back to false
after the global bootmeths have been handled, once have_global is set to
true, it remains true for the entire iteration process. This provides a
quick check as to whether global-bootmeth processing is needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
For now we only support dropping non-global bootmeths from the
iteration. Update first_glob_method in that case and add a few checks
that things are correct.
Signed-off-by: Simon Glass <sjg@chromium.org>
These have different behaviour from normal bootmeths and we are about to
enhance it. So add a test and also an extra check in bootflow_iter()
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a few comments about global bootmeths and first_glob_method
Fix a broken line in bootmeth_setup_iter_order() while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Add a way to specify the (fake) Ubuntu release being used, so that we
can (later) add more tests for this case.
Signed-off-by: Simon Glass <sjg@chromium.org>
The flags contain lots of little pieces of information. Print them out
with the bdinfo command, so the user can look them up if needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
The distro test for EFI in the EFI ARM app is currently flaky.
If the test does not send an 'escape' character, then the board may boot
straight into Ubuntu. If it does, but didn't need to, then grub sits at
the command prompt.
Handle this by pressing escape twice (which should always go to the grub
command line), then using the 'normal' command to start the menu.
Series-to: concept
Series-cc: heinrich
Signed-off-by: Simon Glass <sjg@chromium.org>
The EFI-media devices names were recently changed to make it easier to
tell them apart. Update the tests as well, since this change caused them
to fail.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: dea4ea00a7 ("efi: Set the efi_media device name when binding")
Add support for pressing 'Q' to put the pager into bypass mode,disabling
further paging for the current session.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The test.py tests pass -P to sandbox to tell it to bypass the pager.
Tests which change this value must restore it to the old value.
Fix this, so that the -P setting remains in place across test runs.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fix line continuation in generate_schedule() that caused Sphinx to fail
with "Bullet list ends without a blank line; unexpected unindent" error.
Add tests to validate RST formatting of generated documentation.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
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
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>
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>
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>
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>