[Concept,00/36] video: Add multiple-context support to vidconsole (part F)

Message ID 20260120231814.2033069-1-sjg@u-boot.org
Headers
Series video: Add multiple-context support to vidconsole (part F) |

Message

Simon Glass Jan. 20, 2026, 11:17 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

At present expo textline objects are handled in a rather ad-hoc manner.
When a textline is 'opened', the text is written out using vidconsole and
the state is saved in the scene. When the user types a character, the
state is restored, the character is written to the vidconsole, then the
state is saved again. It is basically using the command-editor code.

If the user press Ctrl-A, a suitable number of backspaces are written to
move the cursor to the start. If the user then inserts a character, the
entire string is written out (which is probably undesirable) and then
backspaces are written again. Typing into a lineedit shows the same
characters on the text console.

This approach was designed for the text console and extended into the
vidconsole. It was further extended into expo as it is fairly simple and
saves code space.

However it is not really suitable for a textedit, which may have many
lines of text and needs to support moving up and down through these
lines. Ideally we would separate expo a little from the CLI editor.

As a start towards resolving these problems, this series adds support
for multiple, independent vidconsole contexts. This enables expo
text-input objects to each have their own cursor position, font settings
and CLI line state, allowing multiple text fields to operate
independently on the same display.

This series:
- Adds a context parameter to vidconsole functions throughout the stack
- Moves CLI line state into text-input objects for expo
- Maintains a list of contexts in the vidconsole uclass
- Centralises context allocation and freeing in the uclass

This is preparation for supporting multiple text-input fields in the
expo menu system, where each field needs independent cursor tracking.

Size growth is approximately 300 bytes on Thumb2, for boards which
enable command-line editing and expo.

This series also includes a fix for LUKS in CI.


Simon Glass (36):
  test: Fix LUKS device-name collision in CI environments
  video: Pass context to vidconsole_set_cursor_pos()
  video: Pass context to vidconsole_entry_start()
  cli: Split initial-text output from cli_cread_init()
  video: Add per-device vidconsole_readline_start/end()
  video: Pass context to vidconsole_readline_start/end()
  expo: Move and generalise scene_textline_send_key()
  expo: Add CLI line state to text-input objects
  expo: Use text-input CLI line state instead of scene's
  video: Pass context to backspace() method
  video: Pass context to vidconsole_newline/back()
  video: Pass context to console_fixed_putc_xy()
  video: Pass context to vidconsole_putc_xy()
  video: Pass context to vidconsole_output_glyph()
  video: Pass context to vidconsole_escape_char()
  video: Pass context to get_cursor_info() method
  video: Pass context to vidconsole_show/hide_cursor()
  video: Pass context to vidconsole_put_char()
  video: Pass context to vidconsole_put_string() et al
  video: Pass context to mark_start() method
  video: Pass context to select_font() method
  video: Pass context to select_metrics()
  video: Pass context to console_alloc_cursor()
  video: Pass context to vidconsole_set_bitmap_font()
  video: Pass context to set_bitmap_font()
  video: Pass context to console_set_font()
  video: Pass context to get_font_size()
  expo: Pass context to draw_string()
  expo: Pass context to scene_txt_render()
  expo: Pass context to scene_obj_render()
  expo: Pass context to scene_render_obj()
  video: Maintain a list of contexts in vidconsole
  video: Allocate the cursor in the uclass
  video: Pass a cursor pointer to console_alloc_cursor()
  video: Move context freeing to uclass
  video: Move context allocation from drivers to uclass

 board/atmel/common/video_display.c  |   2 +-
 board/kosagi/novena/novena.c        |   2 +-
 boot/expo_test.c                    |  22 +--
 boot/scene.c                        |  83 +++++----
 boot/scene_internal.h               |  13 +-
 boot/scene_textline.c               |  47 -----
 boot/scene_txtin.c                  |  80 ++++++--
 cmd/font.c                          |   6 +-
 cmd/video.c                         |   6 +-
 common/cli_readline.c               |  16 +-
 common/splash.c                     |   2 +-
 drivers/video/console_core.c        |  46 +++--
 drivers/video/console_normal.c      |  47 +----
 drivers/video/console_rotate.c      |  24 +--
 drivers/video/console_truetype.c    |  80 ++++----
 drivers/video/vidconsole-uclass.c   | 276 ++++++++++++++++++----------
 drivers/video/vidconsole_internal.h |  49 ++++-
 include/cli.h                       |  12 ++
 include/expo.h                      |   2 +
 include/video_console.h             | 120 ++++++++----
 test/boot/expo.c                    |  12 +-
 test/cmd/font.c                     |   6 +-
 test/dm/video.c                     | 114 ++++++------
 test/py/tests/fs_helper.py          |   7 +-
 24 files changed, 621 insertions(+), 453 deletions(-)