diff options
author | Tom Rini <trini@konsulko.com> | 2023-01-17 08:55:40 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-17 08:55:40 -0500 |
commit | 5b958dea5c678dbdb2aeb6ac3c0c8cc8dfea065c (patch) | |
tree | 172424111d1a39640cf5245eefd080fae3b5fb27 /include/video_console.h | |
parent | 6d03688e75041a7bae4d33815de28da781c37dd6 (diff) | |
parent | b5c8fea7b830c0304051237ad1501431a958b0e6 (diff) |
Merge branch '2022-01-16-bootstd-updates'
To quote the author:
So far standard boot lacks a boot menu, although it is possible to create
a rudimentary one using the existing 'bootmenu' command.
Even then, this text-based menu offer only basic functionality and does
not take full advantage of the displays which are common on many devices.
This series provides a 'bootflow menu' command which allows the user to
select from the available bootflows. An attempt is made to show the name
of the available operating systems, by reading more information into the
bootflow. A logo can be read also, where supported, so that this can be
presented to the user when an option is highlighted.
Full use is made of TrueType fonts, if enabled. For cases where only a
serial console is available, it falls back to a simple text-based menu.
All of this is implementing using a new 'expo' construct, a collection of
scenes (like menu screens) which can be navigated by the user to view
information and select options. This is fairly general and should be able
to cope with a wider array of use cases, with less hacking of the menu
code, such as is currently needed for CMD_BOOTEFI_BOOTMGR.
Of course it would be possible to enhance the existing menu rather than
creating a new setup. Instead it seems better to make the existing menu
use expo, if code space permits. It avoids the event-loop problem and
should be more extensible, given its loosely coupled components and use of
IDs instead of pointers. Further motivation is provided in the
documentation.
For now the CLI keypress-decoding code is split out to be used by the new
menu. The key codes defined by menu.h are reused also.
This is of course just a starting point. Some ideas for future work are
included in the documentation.
Diffstat (limited to 'include/video_console.h')
-rw-r--r-- | include/video_console.h | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/include/video_console.h b/include/video_console.h index d755eb73cf..9d2c0f210e 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -63,6 +63,15 @@ struct vidconsole_priv { }; /** + * struct vidfont_info - information about a font + * + * @name: Font name, e.g. nimbus_sans_l_regular + */ +struct vidfont_info { + const char *name; +}; + +/** * struct vidconsole_ops - Video console operations * * These operations work on either an absolute console position (measured @@ -111,6 +120,9 @@ struct vidconsole_ops { /** * entry_start() - Indicate that text entry is starting afresh * + * @dev: Device to adjust + * Returns: 0 on success, -ve on error + * * Consoles which use proportional fonts need to track the position of * each character output so that backspace will return to the correct * place. This method signals to the console driver that a new entry @@ -123,6 +135,9 @@ struct vidconsole_ops { /** * backspace() - Handle erasing the last character * + * @dev: Device to adjust + * Returns: 0 on success, -ve on error + * * With proportional fonts the vidconsole uclass cannot itself erase * the previous character. This optional method will be called when * a backspace is needed. The driver should erase the previous @@ -133,12 +148,54 @@ struct vidconsole_ops { * characters. */ int (*backspace)(struct udevice *dev); + + /** + * get_font() - Obtain information about a font (optional) + * + * @dev: Device to check + * @seq: Font number to query (0=first, 1=second, etc.) + * @info: Returns font information on success + * Returns: 0 on success, -ENOENT if no such font + */ + int (*get_font)(struct udevice *dev, int seq, + struct vidfont_info *info); + + /** + * select_font() - Select a particular font by name / size + * + * @dev: Device to adjust + * @name: Font name to use (NULL to use default) + * @size: Font size to use (0 to use default) + * Returns: 0 on success, -ENOENT if no such font + */ + int (*select_font)(struct udevice *dev, const char *name, uint size); }; /* Get a pointer to the driver operations for a video console device */ #define vidconsole_get_ops(dev) ((struct vidconsole_ops *)(dev)->driver->ops) /** + * vidconsole_get_font() - Obtain information about a font + * + * @dev: Device to check + * @seq: Font number to query (0=first, 1=second, etc.) + * @info: Returns font information on success + * Returns: 0 on success, -ENOENT if no such font, -ENOSYS if there is no such + * method + */ +int vidconsole_get_font(struct udevice *dev, int seq, + struct vidfont_info *info); + +/** + * vidconsole_select_font() - Select a particular font by name / size + * + * @dev: Device to adjust + * @name: Font name to use (NULL to use default) + * @size: Font size to use (0 to use default) + */ +int vidconsole_select_font(struct udevice *dev, const char *name, uint size); + +/** * vidconsole_putc_xy() - write a single character to a position * * @dev: Device to write to @@ -234,27 +291,21 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y); /** * vidconsole_list_fonts() - List the available fonts * - * This shows a list on the console - */ -void vidconsole_list_fonts(void); - -/** - * vidconsole_select_font() - Select a font to use + * @dev: vidconsole device to check * - * @dev: vidconsole device - * @name: Font name - * @size: Size of the font (norminal pixel height) or 0 for default + * This shows a list of fonts known by this vidconsole. The list is displayed on + * the console (not necessarily @dev but probably) */ -int vidconsole_select_font(struct udevice *dev, const char *name, uint size); +void vidconsole_list_fonts(struct udevice *dev); /** - * vidconsole_get_font() - get the current font name and size + * vidconsole_get_font_size() - get the current font name and size * * @dev: vidconsole device * @sizep: Place to put the font size (nominal height in pixels) * Returns: Current font name */ -const char *vidconsole_get_font(struct udevice *dev, uint *sizep); +const char *vidconsole_get_font_size(struct udevice *dev, uint *sizep); #ifdef CONFIG_VIDEO_COPY /** |