In some cases we want to show a logo other than the U-Boot one. Add a
field for this, so it can be used by layouts which need it.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is sometimes useful to be able to click on an image (sometimes called
an icon). Allow this within expo and return new click action.
Signed-off-by: Simon Glass <sjg@chromium.org>
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>
When the object pointer is already available we don't want to have to
look it up. Provide a new is_within() function which takes an object
pointer instead of an ID.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new 'cedit dump' command which dumps the contents of an expo for
debugging.
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>
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")
It is possible that there is already a mouse click available, so
mouse_get_click() should check that first, before reading any further
events.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 90e109789e ("mouse: Move click detection into mouse_get_event()")
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>
If a display is provided to the mouse uclass, use it to scale the coords
returned by the absolute-pointer protocol.
Series-to: concept
Series-cc: heinrich
Cover-letter:
expo: Complete mouse operation in the EFI app
This series includes various improvements which allow the mouse to be
used when running as an EFI app.
In particular:
- support for the absolute-pointer protocol, since this provides better
integration when running under QEMU
- input tweaks to improve performance under QEMU
It also includes some x86-specific fixes for i8042 and MTRRs.
Finally, a new --bootcmd option is added to the build-qemu script to
allow passing a boot command to U-Boot.
This series is part F
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:48
Series-version: 2
The absolute-pointer protocol is useful particularly with QEMU since it
allows the position to be consistent between the host and the guest.
Add support for this new protocol and use it in preference to the simple
one, when both are available.
Signed-off-by: Simon Glass <sjg@chromium.org>
Create a function which handles getting the pointer position using the
simple-pointer protocol. Call this from efi_mouse_get_event()
Return immediately if there is a button event. Otherwise return a motion
event if motion is detected.
Signed-off-by: Simon Glass <sjg@chromium.org>
Split out the code that handles button presses into its own function,
since efi_mouse_get_event() is already quite long.
Signed-off-by: Simon Glass <sjg@chromium.org>
In preparation for supporting an absolute pointer, move the setup of
the simple pointer into its own function. Rename 'pointer' to simple
and last_state to simple_last. Take this opportunity to add comments
for struct efi_mouse_priv since it will be less obvious once the new
support is added.
Clean up some unnecessary cruft in the remove() path.
Signed-off-by: Simon Glass <sjg@chromium.org>
This driver can operate in various modes, e.g. with VIDEO_COPY and with
different colour depths or in blit mode. Add some debugging to help
debug problems on particular boards. Fix an errant blank line while we
are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
The serial driver is currently quite slow since it sets an event and
waits for at least 1ms for a keypress, which may never come.
On real hardware, the keyboard does not work correctly wihout waiting
for events. Reduce the time to 10us which should be enough to provide an
opportunity for event processing.
QEMU does not actually have this problem, so detect that and skip the
processing altogether.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
When the app is running under QEMU we may wish to do some things
differently. Add a flag for this and use the SMBIOS tables to detect it.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Check for both GUIDs when looking for the SMBIOS tables. This allows
both table versions to be detected when running from OVMF.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
We should not try to directly access the keyboard when running as an EFI
app. Disable CONFIG_I8042_KEYB option to prevent that.
Signed-off-by: Simon Glass <sjg@chromium.org>
The MTRRs have already been set by the previous phase so we should not
set them when the U-Boot app starts. Add a condition to prevent it.
Signed-off-by: Simon Glass <sjg@chromium.org>
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>
Currently mouse_get_click() processes events by calling
mouse_get_event() and tracking the press->release transition. But if
other code calls mouse_get_event() directly, those button events are
consumed and mouse_get_click() never sees them.
Fix this by moving the click detection logic into mouse_get_event()
itself. Add a click_pending flag to track when a click has been
detected, and simplify mouse_get_click() to just check and clear this
flag.
This ensures clicks are properly registered regardless of whether callers
use mouse_get_event() or mouse_get_click().
Series-changes: 2
- Add new patch to move click detection into mouse_get_event()
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>
Replace the mouse_press_state_t enum with a simpler bool left_pressed
field in mouse_uc_priv. Convert BUTTON_PRESSED/BUTTON_RELEASED to defines
since they're still used in the mouse_event button structure.
This simplifies the code by directly tracking whether the left button
is pressed rather than using an enum to represent a binary state.
Clarify the comment to struct mouse_uc_priv while here.
Series-changes: 2
- Add new patch to replace mouse_press_state_t enum with bool
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a --bootcmd option to the build-qemu script that allows passing a
boot command to QEMU via fw_cfg. The bootcmd is written to the
"opt/u-boot/bootcmd" fw_cfg entry, which can be read by U-Boot's
EVT_BOOTCMD handler.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Implement an EVT_BOOTCMD event handler that reads the bootcmd from
QEMU's fw_cfg interface using the "opt/u-boot/bootcmd" file. This
allows QEMU to provide a custom boot command to U-Boot at runtime.
Uses the newly exported qfw_locate_file() function to locate and
read the bootcmd file.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new event that is triggered in main_loop() before
autoboot_command(). This allows platform code to provide a custom
bootcmd string via the event system.
The event uses struct event_bootcmd which provides a buffer for the
bootcmd string and its size. Platform event handlers can write their
custom bootcmd to this buffer.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Export the qfw_locate_file() function to allow other modules to locate
files in the QEMU firmware config without loading them into memory.
Co-developed-by: Claude <noreply@anthropic.com>
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>
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>
Keep track of the frame count, i.e. the number of times that
expo_render() has been called since expo_enter_mode() was invoked.
Allow test mode to be enabled (if compiled in) by setting the 'expotest'
environment variable to 1.
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 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 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>
Add a new set_ptr_visible() method to the mouse uclass to allow hiding
and showing the system mouse pointer. This is useful with sandbox when
rendering a custom mouse pointer, such as in expo mode.
The method is optional and returns -ENOSYS if not supported by the
driver.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Document the mouse_get_event() function to explain what it does and its
return values.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The timer is used in a different function from that where it is set up.
Move setup into video_sync() so that the code is all together.
Signed-off-by: Simon Glass <sjg@chromium.org>