From patchwork Tue Jan 20 23:17:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1684 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=1768951165; bh=2SoBBksW7bW9Xi+VyfBaGWDE+C3Z733c2XAXcen0/zU=; 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=QRloLnb0BHYhjjZLE1J4eaDa50c3L9Z1YxUBfCeEsmEM5E7rU/m2k4xFpPyU+7BtF 7hUSnU7h4Op+s2CjHSGN7tObbkVhH0lU8pjqW2BaqxY7YrF3iECjbUMRu/oNADA8NC V3dyKAwP+FWtXSY2Qr9DB5RjnWJpjtzQTssT6pz1nXmjNhQFJIS3HLf0kWL+AMKUGu vb5froJDXNMdy8S0f2aPuz3JhIN8reeWRoZ080O5jAXmv4HLzznawLnC4HhHh0lZxr cmgwN7kP5+S+wBwXbUL3rFJRNAKncSVwLdnrfiWboY1kz7yWKHr9/WIrzmIn0ljLGm aVvbBVEYukneg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D677E69589 for ; Tue, 20 Jan 2026 16:19:25 -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 GsgUX7TOAiag for ; Tue, 20 Jan 2026 16:19:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951165; bh=2SoBBksW7bW9Xi+VyfBaGWDE+C3Z733c2XAXcen0/zU=; 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=QRloLnb0BHYhjjZLE1J4eaDa50c3L9Z1YxUBfCeEsmEM5E7rU/m2k4xFpPyU+7BtF 7hUSnU7h4Op+s2CjHSGN7tObbkVhH0lU8pjqW2BaqxY7YrF3iECjbUMRu/oNADA8NC V3dyKAwP+FWtXSY2Qr9DB5RjnWJpjtzQTssT6pz1nXmjNhQFJIS3HLf0kWL+AMKUGu vb5froJDXNMdy8S0f2aPuz3JhIN8reeWRoZ080O5jAXmv4HLzznawLnC4HhHh0lZxr cmgwN7kP5+S+wBwXbUL3rFJRNAKncSVwLdnrfiWboY1kz7yWKHr9/WIrzmIn0ljLGm aVvbBVEYukneg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C14CF69572 for ; Tue, 20 Jan 2026 16:19:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951163; bh=RgPjryMay7vIYwGG4I3VH5PlYN3OpDCeBUHgS/s8njI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jp0YPioQoiNIZ1Dks/3Qv4jMvqzYZKlNcZnn4YIdiQ2axWpZPtrsnZoN/pgM5KWZe R7M8uOO0Nu9YFdf+8pq3bxJHOzr4LUulH42d4Lu93TdCDeYtBd4lyGuETZzbRPPM6G YWrRSa+8T4B+EVfVJPT+x5kZ8tfzTCqfav9nTJvWSIixGqepY0Cm8+VdeCPh9ClzZE hztiigDnoPtOpukul6RzCjlbq8n64sCxfa4tn1Z3V+5vSKVXCI0WRGjO0mnb0X8FgS hwMGiR/25MBV9Z5gEAeysOdDUypam6O6IfIRYdJa2zYM//tGlqZR31gWvRYtsadg2X o+aDS/RlkvCqQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C11186957E; Tue, 20 Jan 2026 16:19:23 -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 PqoR6Xr1pltL; Tue, 20 Jan 2026 16:19:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951159; bh=WyIUf37/ecF2dqB/srzSLKdFBxaS9sMNOZBf3H1prqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWpPTrcOG6QnS5fdLV+HeQhyCC65qgMwzFRBZrakZYpV0lasmiuLclfprfkqggTlO +IySyg2SvJnwq3IGE5Xtm2WoC+l4ZanZuqi/4SvfoQBdH1qrMq+whJZgCIDNijL9hZ 1DJIFdDFczy7s3ghndPdEzfbuVEfL11W34TWaCDKpSZdL1wOs2cAnMNQrYXRAGXMJ5 ZsFCR+BL5g3OUzN/yo329VCEG2KgsFP8/SsF9CpNNGEyio9rO0ci3/hMY2OK+GBKK9 0VE/CDZGlKEZWt94FQ7mVUfcMEqMhae5t6QsrN4rzpKl0/OjWKmdIZYAKOlkZywSMZ bsF8u4Zdgi5Eg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 742446913F; Tue, 20 Jan 2026 16:19:19 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:17:38 -0700 Message-ID: <20260120231814.2033069-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260120231814.2033069-1-sjg@u-boot.org> References: <20260120231814.2033069-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BQMCF3YERKK2UBKWEC75JY3W7JBDLUZ3 X-Message-ID-Hash: BQMCF3YERKK2UBKWEC75JY3W7JBDLUZ3 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 11/36] video: Pass context to vidconsole_newline/back() 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 Add a ctx parameter to the internal vidconsole_newline() and vidconsole_back() functions to allow passing in a specific vidconsole context. This prepares for supporting per-object contexts in the expo text-input code. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 8590219ae64..29a1accb64c 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -90,11 +90,12 @@ static int vidconsole_back(struct udevice *dev, struct vidconsole_ctx *ctx) return video_sync(dev->parent, false); } -/* Move to a newline, scrolling the display if necessary */ -static void vidconsole_newline(struct udevice *dev) +/* + * Move to a newline, scrolling the display if necessary. + * ctx must be non-NULL + */ +static void vidconsole_newline(struct udevice *dev, struct vidconsole_ctx *ctx) { - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); struct udevice *vid_dev = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); const int rows = CONFIG_VAL(CONSOLE_SCROLL_LINES); @@ -469,7 +470,7 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) */ ret = vidconsole_putc_xy(dev, ctx->xcur_frac, ctx->ycur, ch); if (ret == -EAGAIN) { - vidconsole_newline(dev); + vidconsole_newline(dev, ctx); ret = vidconsole_putc_xy(dev, ctx->xcur_frac, ctx->ycur, ch); } if (ret < 0) @@ -477,7 +478,7 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) ctx->xcur_frac += ret; ctx->last_ch = ch; if (ctx->xcur_frac >= ctx->xsize_frac) - vidconsole_newline(dev); + vidconsole_newline(dev, ctx); cli_index_adjust(ctx, 1); return 0; @@ -510,7 +511,7 @@ int vidconsole_put_char(struct udevice *dev, char ch) ctx->xcur_frac = ctx->xstart_frac; break; case '\n': - vidconsole_newline(dev); + vidconsole_newline(dev, ctx); vidconsole_entry_start(dev, NULL); break; case '\t': /* Tab (8 chars alignment) */ @@ -518,7 +519,7 @@ int vidconsole_put_char(struct udevice *dev, char ch) + 1) * ctx->tab_width_frac; if (ctx->xcur_frac >= ctx->xsize_frac) - vidconsole_newline(dev); + vidconsole_newline(dev, ctx); break; case '\b': vidconsole_back(dev, ctx);