[Concept,13/14] video: Move xmark_frac and ymark into vidconsole_ctx

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

Commit Message

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

Move the xmark_frac and ymark fields from vidconsole_priv into
vidconsole_ctx as part of the per-client context refactoring. These
fields track the start position of CLI text entry, allowing each client
to have its own entry point.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 drivers/video/console_normal.c    | 4 ++--
 drivers/video/vidconsole-uclass.c | 4 ++--
 include/video_console.h           | 8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)
  

Patch

diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 283bbdff681..73bf3a7ebe8 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -105,8 +105,8 @@  static __maybe_unused int console_get_cursor_info(struct udevice *dev)
 	if (!IS_ENABLED(CONFIG_EXPO))
 		return -ENOSYS;
 
-	x = VID_TO_PIXEL(vc_priv->xmark_frac);
-	y = vc_priv->ymark;
+	x = VID_TO_PIXEL(ctx->xmark_frac);
+	y = ctx->ymark;
 	index = ctx->cli_index;
 
 	/* rounded up character position in this line */
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 4570c9fe60d..182505d1056 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -839,8 +839,8 @@  int vidconsole_mark_start(struct udevice *dev)
 	struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv);
 	struct vidconsole_ops *ops = vidconsole_get_ops(dev);
 
-	priv->xmark_frac = ctx->xcur_frac;
-	priv->ymark = ctx->ycur;
+	ctx->xmark_frac = ctx->xcur_frac;
+	ctx->ymark = ctx->ycur;
 	ctx->cli_index = 0;
 	if (ops->mark_start) {
 		int ret;
diff --git a/include/video_console.h b/include/video_console.h
index 559263e214b..73c4f54f62c 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -87,6 +87,8 @@  struct vidconsole_cursor {
  * @ycur:		Current Y position in pixels (0=top)
  * @last_ch:		Last character written to the text console on this line
  * @cli_index:		Character index into the CLI text (0=start)
+ * @xmark_frac:		X position of start of CLI text entry, in fractional units
+ * @ymark:		Y position of start of CLI text
  */
 struct vidconsole_ctx {
 	int rows;
@@ -97,6 +99,8 @@  struct vidconsole_ctx {
 	int ycur;
 	int last_ch;
 	int cli_index;
+	int xmark_frac;
+	int ymark;
 };
 
 /**
@@ -139,8 +143,6 @@  struct vidconsole_ansi {
  * @tab_width_frac:	Tab width in fractional units
  * @xsize_frac:		Width of the display in fractional units
  * @xstart_frac:	Left margin for the text console in fractional units
- * @xmark_frac:		X position of start of CLI text entry, in fractional units
- * @ymark:		Y position of start of CLI text
  * @ansi:		ANSI escape-sequence state
  * @utf8_buf:		Buffer to accumulate UTF-8 byte sequence
  * @quiet:		Suppress all output from stdio
@@ -152,8 +154,6 @@  struct vidconsole_priv {
 	int tab_width_frac;
 	int xsize_frac;
 	int xstart_frac;
-	int xmark_frac;
-	int ymark;
 	struct vidconsole_ansi ansi;
 	char utf8_buf[5];
 	bool quiet;