From patchwork Fri Jan 16 17:14:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1540 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583737; bh=NuygM4CRMa0EAzrILgxivuiiRj+JOKk4ftJVqf4JNCE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Q5W7w+3ygMj/MAcoHoQudX4NHoE+OUk1ekfLfmDCn5+qJzWbpLWSf6buvgT6Sh+An OITynYITLR6iqmaXEywfpOAlglbrlNIv1VUwtThGq/KmawG2QlmCmU8xmG4r4iufje KOQkpFF/xOhAwtoyhiQM5905ZBE75zl3JgLEI7bNd3aQe/YAsiuUBUsUqGcSi6FCB2 xpxxtVMCMgzGyjTgtfFkdyzLgPxnaO41EicZpHiV15cCTBvWNbsWlAvOi1NEWweBIF o0agyMEVeSb+/fg7uXlvxULfCUc2j9WA4EjOkaXd7nusOFXNqm09XQeIfLmuvztBld RorK4aJod12Gw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0EB546932E for ; Fri, 16 Jan 2026 10:15:37 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id KxH51PudlKAQ for ; Fri, 16 Jan 2026 10:15:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583736; bh=NuygM4CRMa0EAzrILgxivuiiRj+JOKk4ftJVqf4JNCE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jgwk4THkSagTub0tqd73kM4+L/Jr7JXnrBZ04GYXITQOYwfL2Y6AV02ehrOmkH9AS IiTvnWdpK8kfz27qT931M4vy+juRUaKKd/pLjt9ImVrrzMaa0wahHffbWIwyXTUamJ 8SH0E+Db/EjmJIarOAhzT/82JmTTfEOU6gHOhOZRlkrF99VX9QUM04VPravljEzIlq xjYi7tzT58jQil8lpXRnZVLWfZRVTkxB1FzsMCbrK/4/kVSwNPFeyiTtS8sj2ElDE0 AjxgdkIfSCVutTlhyYslroUYHiOJr7dp2ssz0exgsOj1G7p/K5HHqSyFJKvpVIFPwr cggMUrjWK+h/A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F1C3E693B0 for ; Fri, 16 Jan 2026 10:15:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583735; bh=rlrKHJWaxgDZs5tktaz/ax6SRHpmz4bbs+SCbEOHCYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0mLmO0PVtRpH0b2YVOyigSD8LIfSu+cdKjHstomp3DQEpJyAGW55U8rYyL1faPYw 1YynPyWrWKqNRRJGNVT337yAIkLDLNKLN762atEY+uubMlBwt+sFqTJ3/cKVKXBar7 QsS3fdFDxB+TANlJ5A5/DANrmaJ5q4ABd5BUMEh6I5cf2ZQtorzBVMg9d+sCxPA6ss ufz0Wvh9SP0AoypyxnjkDIwAkq5QqFKqnz/f+O++bmATc4xBlYsAeMOUwd5xclle51 e0uEm4LJBefWQF0V97iRG+VKsw0EZZnzkcHaIKbS1Aqzrj9Ru1Xx8cMvanQHNyB/eg fJi8d2dw4h5KA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E34D6932E; Fri, 16 Jan 2026 10:15:35 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id pH-HiukDajpn; Fri, 16 Jan 2026 10:15:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583731; bh=+cWjD3uJLvJ9YXj3y9WnwMwRYoWiCEvXyd9G9YFV/bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wKzpqEW8GxBr06Pe4NKiSwhDw0b8fftIAdc/g1JtkqdqGsBCKMc7R2eOSo81hrgQj TGWjlizXWgvADsFuN8FpTyTc6suVkS7/eGKoA5aRe2wsp+ZVGuUC2M4vSN1IDH1I63 5bZ0Am+z18ZQdfuSqTSQ5aGW0FUuAcvQk4h0s7kEsCBmaJN7fiWuIga+WXbBABDU9x 8L77Z+M8uLYwr2CgbcIcHSvr4IHPK9xtbUInL4hL/cLV3p3GRpML5QRoVtH3X8GTgO nNYNU52sdWuuKz26OYwO7ve4nNqEd00UJchvU/BwopC4RU1cs8bIq6c2kYqjcXT46z eJFjrc/8BzSkA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DDD806913F; Fri, 16 Jan 2026 10:15:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 10:14:14 -0700 Message-ID: <20260116171424.398597-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260116171424.398597-1-sjg@u-boot.org> References: <20260116171424.398597-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VKK7IVSAYT6VQQALEUZIE6TBM3RN2BGI X-Message-ID-Hash: VKK7IVSAYT6VQQALEUZIE6TBM3RN2BGI X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/14] video: Move cli_index into vidconsole_ctx List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Move the cli_index field from vidconsole_priv into vidconsole_ctx as part of the per-client context refactoring. This field tracks the character position within CLI text entry. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 8 ++++---- drivers/video/vidconsole-uclass.c | 4 ++-- include/video_console.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 95cde3aa709..283bbdff681 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -107,7 +107,7 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) x = VID_TO_PIXEL(vc_priv->xmark_frac); y = vc_priv->ymark; - index = vc_priv->cli_index; + index = ctx->cli_index; /* rounded up character position in this line */ xpos = (x + ctx->x_charsize - 1) / ctx->x_charsize; @@ -141,7 +141,7 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) curs->x = x; curs->y = y; curs->height = ctx->y_charsize; - curs->index = vc_priv->cli_index; + curs->index = ctx->cli_index; return 0; } @@ -162,7 +162,7 @@ static __maybe_unused int normal_entry_save(struct udevice *dev, store.xpos_frac = ctx->xcur_frac; store.ypos = ctx->ycur; - store.cli_index = vc_priv->cli_index; + store.cli_index = ctx->cli_index; memcpy(abuf_data(buf), &store, size); return 0; @@ -182,7 +182,7 @@ static __maybe_unused int normal_entry_restore(struct udevice *dev, ctx->xcur_frac = store.xpos_frac; ctx->ycur = store.ypos; - vc_priv->cli_index = store.cli_index; + ctx->cli_index = store.cli_index; return 0; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 1e9c0b4b730..4570c9fe60d 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -84,7 +84,7 @@ static int vidconsole_back(struct udevice *dev) if (ctx->ycur < 0) ctx->ycur = 0; } - assert(priv->cli_index); + assert(ctx->cli_index); cli_index_adjust(priv, -1); return video_sync(dev->parent, false); @@ -841,7 +841,7 @@ int vidconsole_mark_start(struct udevice *dev) priv->xmark_frac = ctx->xcur_frac; priv->ymark = ctx->ycur; - priv->cli_index = 0; + ctx->cli_index = 0; if (ops->mark_start) { int ret; diff --git a/include/video_console.h b/include/video_console.h index 6dfa2214448..559263e214b 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -86,6 +86,7 @@ struct vidconsole_cursor { * @xcur_frac: Current X position, in fractional units (VID_TO_POS(x)) * @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) */ struct vidconsole_ctx { int rows; @@ -95,6 +96,7 @@ struct vidconsole_ctx { int xcur_frac; int ycur; int last_ch; + int cli_index; }; /** @@ -139,7 +141,6 @@ struct vidconsole_ansi { * @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 - * @cli_index: Character index into the CLI text (0=start) * @ansi: ANSI escape-sequence state * @utf8_buf: Buffer to accumulate UTF-8 byte sequence * @quiet: Suppress all output from stdio @@ -153,7 +154,6 @@ struct vidconsole_priv { int xstart_frac; int xmark_frac; int ymark; - int cli_index; struct vidconsole_ansi ansi; char utf8_buf[5]; bool quiet; @@ -615,7 +615,7 @@ static inline void vidconsole_readline_end(void) static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) { if (CONFIG_IS_ENABLED(CURSOR)) - priv->cli_index += by; + priv->ctx.cli_index += by; } /**