[Concept,00/14] video: Add per-client context to vidconsole

Message ID 20260116171424.398597-1-sjg@u-boot.org
Headers
Series video: Add per-client context to vidconsole |

Message

Simon Glass Jan. 16, 2026, 5:14 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

This series refactors the vidconsole interface to support multiple
clients with their own context. This will enables features like expo to
maintain separate text-entry state without interfering with each other.

The approach is to create a new struct vidconsole_ctx that holds
per-client state, initially embedded in vidconsole_priv for the default
context. Helper functions vidconsole_ctx() and vidconsole_ctx_from_priv()
provide access to the context.

Fields moved into vidconsole_ctx:
- rows, cols, x_charsize, y_charsize (display metrics)
- xcur_frac, ycur (cursor position)
- last_ch (for kerning)
- cli_index, xmark_frac, ymark (CLI entry state)
- ansi, utf8_buf (parsing state)

The series also adds ctx_new() and ctx_dispose() operations for drivers
to allocate and free per-client context, with implementations for both
the normal and truetype console drivers.


Simon Glass (14):
  video: Add empty vidconsole_ctx struct
  video: Add vidconsole context creation and disposal
  video: truetype: Restore pos_start in entry_restore()
  video: truetype: Move per-client context into ctx struct
  video: Add a helper to obtain the vidconsole context
  video: Move rows and cols into vidconsole_ctx
  video: Move x_charsize and y_charsize into vidconsole_ctx
  video: Create struct vidconsole_ansi for ANSI state
  video: Move xcur_frac into vidconsole_ctx
  video: Move ycur into vidconsole_ctx
  video: Move last_ch into vidconsole_ctx
  video: Move cli_index into vidconsole_ctx
  video: Move xmark_frac and ymark into vidconsole_ctx
  video: Move ansi and utf8_buf into vidconsole_ctx

 board/atmel/common/video_display.c |   3 +-
 boot/expo_test.c                   |  10 +-
 common/console.c                   |   6 +-
 drivers/video/console_core.c       |   3 +-
 drivers/video/console_normal.c     |  66 +++++++--
 drivers/video/console_rotate.c     |   9 +-
 drivers/video/console_truetype.c   | 186 +++++++++++++++----------
 drivers/video/vidconsole-uclass.c  | 214 ++++++++++++++++++-----------
 drivers/video/video-uclass.c       |   4 +-
 include/video_console.h            | 167 ++++++++++++++++------
 lib/efi_loader/efi_console.c       |  10 +-
 test/dm/video.c                    |  22 +++
 12 files changed, 473 insertions(+), 227 deletions(-)