aboutsummaryrefslogtreecommitdiff
path: root/include/video_console.h
AgeCommit message (Collapse)Author
2024-03-21video: console: Parse UTF-8 character sequencesJanne Grunau
efi_console / UEFI applications (grub2, sd-boot, ...) pass UTF-8 character sequences to vidconsole which results in wrong glyphs for code points outside of ASCII. The truetype console expects Unicode code points and bitmap font based consoles expect code page 437 code points. To support both convert UTF-8 to UTF-32 and pass Unicode code points in vidconsole_ops.putc_xy(). These can be used directly in console_truetype and after conversion to code page 437 in console_{normal,rotate}. This fixes rendering of international, symbol and box drawing characters used by UEFI applications. Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-11video: Support showing a cursorSimon Glass
Add rudimentary support for displaying a cursor on a vidconsole. This helps the user to see where text is being entered. The implementation so far is very simple: the cursor is just a vertical bar of fixed width and cannot be erased. To erase the cursor, the text must be redrawn over it. This is good enough for expo but will need enhancement to be useful for the command-line console. For example, it could save and restore the area behind the cursor. For now, enable this only for expo, to reduce code size. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11video: Export vidconsole_entry_start()Simon Glass
At present this is called only when a newline is detected, since this indicates the start of a line of text being entered. Export this function so it can be used by expo, which may start a new text line itself, without first writing out a newline. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11video: Allow saving and restoring text-entry stateSimon Glass
Text entry operates within a context which includes quite a bit of information. For example, with Truetype fonts, each character in the text string has a position stored, so that it is possible to backspace to that character. This information is built up as strings are drawn on the display. For the command line, there is just a single context. It is created when command-line entry starts and it is destroyed (or at least not needed anymore) when the user presses <enter> to enter the command. By contrast, expo needs to be able to switch in and out of a text-entry context, since it is also displaying other objects in the scene. Add a way to save and restore the entry context for a vidconsole. This is only needed for the truetype vidconsole, so add a method for that, storing the information in an abuf struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11video: Allow obtaining the nominal size of a string sizeSimon Glass
At present there is a method for measuring text, but if the actual text string is not known, it cannot be used. For text editor we want to set the size of the entry box to cover the expected text size. Add the concept of a 'norminal' size with a method to calculate that for the vidconsole. If the method is not implemented, fall back to using the font size, which is sufficient for fixed-width fonts. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14console: Allow measuring the bounding box of textSimon Glass
For laying out text accurately it is necessary to know the width and height of the text. Add a measure() method to the console API, so this can be supported. Add an implementation for truetype and a base implementation for the normal console. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14video: Allow temporary colour changesSimon Glass
It is sometimes necessary to highlight some text in a different colour. Add an easy way to do this and then restore the original console colours. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-13video: Clear the vidconsole rather than the videoSimon Glass
It is better to clear the console device rather than the video device, since the console has the text display. We also need to reset the cursor position with the console, but not with the video device. Add a new function to handle this and update the 'cls' command to use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-07video console: move vidconsole_get_font_size() logic to driver opsDzmitry Sankouski
Since multiple vidconsole drivers exists, vidconsole_get_font_size() implementation cannot longer live in vidconsole_uclass.c file. Move current vidconsole_get_font_size logic to truetype driver ops. Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-07video console: refactoring and optimizationDzmitry Sankouski
- move common code to vidconsole_internal.h and console_core.c - unite probe functions - get rid of code duplications in switch across bpp values - extract common pixel fill logic in two functions one per horizontal and vertical filling - rearrange statements in put_xy* methods in unified way - replace types - uint*_t to u* Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-16video: Add font functions to the vidconsole APISimon Glass
Support for fonts currently depends on the type of vidconsole in use. Add two new methods to enumerate fonts and to set the font. Fix a few other method comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30video: Add commands to list and change fontsSimon Glass
Add a new 'font' command which allows the fonts to be listed as well as selecting a different font and size. Allow the test to run on sandbox, where multiple font/size combinations are supported, as well as sandbox_flattree, where they are not. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30video: Add a way to change the font name and sizeSimon Glass
It is useful to be able to support multiple fonts. Add a function to handle this as well as one to list the available fonts. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30video: Provide a function to set the cursor positionSimon Glass
Add an exported function which allows the cursor position to be set to pixel granularity. Make use of this in the existing code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30video: Move console colours to the video uclassSimon Glass
At present these are attached to vidconsole which means that the video uclass requires that a console is enabled. This is not the intention. The colours are a reasonable way of indexing common colours in any case, so move them to the video uclass instead. Rename vid_console_color() to video_index_to_colour() now that it is more generic. Also fix the inconsistent spelling in these functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2020-07-09video: Add helpers for vidconsole for the copy framebufferSimon Glass
Add a convenience function to call video_sync_copy() for a vidconsole. Also add a memmove() helper, which does the memmove() as well as the sync. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2020-07-09video: Drop unnecessary #ifdef around vid_console_color()Simon Glass
All of the functions in this file only apply if DM_VIDEO is enabled. Drop the #ifdef as it just clutters things up. Add the needed forward declaration. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-05-20video: Factor out vidconsole_put_string()Marek Vasut
Pull the vidconsole_put_string() function from DM tests, make it available to e.g. boards that want to display information on the LCD on boot. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Anatolij Gustschin <agust@denx.de> Reviewed-by: Anatolij Gustschin <agust@denx.de>
2018-09-28dm: video: support more escape sequencesHeinrich Schuchardt
The EFI subsystems needs to know the size of the terminal. If the environment variable stdout = serial,vidconsole this size cannot be read from the video console. So the EFI subsystem sends escape sequences to read the size. With this patch we get support for the following escape sequences: ESC "7" Save cursor position ESC "8" Restore cursor position Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-09-28dm: video: adjust struct vidconsole_priv descriptionHeinrich Schuchardt
The third component of struct vidconsole_priv is ycur. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-03-06dm: video: support increased intensity (bold)Heinrich Schuchardt
Support special rendition code 0 - reset attributes. Support special rendition code 1 - increased intensity (bold). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-03-06dm: video: use constants to refer to colorsHeinrich Schuchardt
Use constants to refer to colors. Adjust initialization of foreground and background color to avoid setting reserved bits. Consistently u32 instead of unsigned for color bit mask. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-29dm: video: Add basic ANSI escape sequence supportRob Clark
Really just the subset that is needed by efi_console. Perhaps more will be added later, for example color support would be useful to implement efi_cout_set_attribute(). Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-01-30video: Provide a backspace methodSimon Glass
With proportional fonts the vidconsole uclass cannot itself erase the previous character. Provide an optional method so that the driver can handle this operation. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30video: Provide a signal when a new console line is startedSimon Glass
When we start a new line (due to the user pressing return), signal this to the driver so that it can flush its buffer of character positions. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30video: Provide a left margin for the text consoleSimon Glass
Allow the left margin to be set so that text does not have to be right up against the left side. On some panels this makes it hard to read. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30video: Use fractional units for X coordinatesSimon Glass
With anti-aliased fonts we need a more fine-grained horizontal position than a single pixel. Characters can be positioned to start part-way through a pixel, with anti-aliasing (greyscale edges) taking care of the visual effect. To cope with this, use fractional units (1/256 pixel) for horizontal positions in the text console. Signed-off-by: Simon Glass <sjg@chromium.org> [agust: rebased] Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-20dm: video: Add a uclass for the text consoleSimon Glass
The existing LCD/video interface suffers from conflating the bitmap display with text output on that display. As a result the implementation is more complex than it needs to me. We can support multiple text console drivers. Create a separate uclass to support this, with its own API. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de>