From patchwork Tue Jan 20 23:17:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1693 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=1768951208; bh=lvcBPuTwIylGMYXp0IssrGGK3yl6IrXyGSwrD4oRDFU=; 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=vBUqZuCKLPnP70p9Oeqe6xiNNktoYfLk1aZThOeHWX/htyKyvsxuyF9+bwRmM/pPd 5ZD7BJbnXwvw46GtgEYDUd/Hfg1FeOGrj/CSEtPCQd4ntYRlpKPQXzljiUgz5cECXZ yhZaw7Fn7aBrg+6EXhxPWEaxrBGX8XAVIXc1mfw5ufsB27G0/Frv1DOY9sMVLDBGw8 5OovZ0SXOxSavg++MuVba0TqFmbQIL1Ork73EsLk2VmtpQ4JZVk8Qpq+l+AicqpT0Z 1xuKQnWb3+j8orAQycm+7X9V1EQIE7DDy2nNAjxwjnOGwZIVZew198zlERZssipy16 YAGmrH1vGhxvg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 89DB669594 for ; Tue, 20 Jan 2026 16:20:08 -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 0DgntpQ0_hkb for ; Tue, 20 Jan 2026 16:20:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951208; bh=lvcBPuTwIylGMYXp0IssrGGK3yl6IrXyGSwrD4oRDFU=; 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=vBUqZuCKLPnP70p9Oeqe6xiNNktoYfLk1aZThOeHWX/htyKyvsxuyF9+bwRmM/pPd 5ZD7BJbnXwvw46GtgEYDUd/Hfg1FeOGrj/CSEtPCQd4ntYRlpKPQXzljiUgz5cECXZ yhZaw7Fn7aBrg+6EXhxPWEaxrBGX8XAVIXc1mfw5ufsB27G0/Frv1DOY9sMVLDBGw8 5OovZ0SXOxSavg++MuVba0TqFmbQIL1Ork73EsLk2VmtpQ4JZVk8Qpq+l+AicqpT0Z 1xuKQnWb3+j8orAQycm+7X9V1EQIE7DDy2nNAjxwjnOGwZIVZew198zlERZssipy16 YAGmrH1vGhxvg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 794706957E for ; Tue, 20 Jan 2026 16:20:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951206; bh=Rskj7jKSNlXlsLazelQiIjfTo/0MVObTqXlXaJAnOxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGN3aPra1njEv0cEVhgSH/bta3N5jPhajxtofyGZPMhnUGmaphoqb19VLXobyYXXA p+FJ893YuMJKPJ2fBEVebRMkPpL5Jmkzd+GzFWclgz5qqb8F2wj2wxaFvfgcqItyM2 xXKS0u34wU7h39sOa/jhiK8heFdoTdxY5AAVVrGqCLfQdEStaX68PIdAY75KkM4Y/2 d0LeF/L+9g3CCYsRWryLOdSeL5o3OmfnJfptl+fPJ1JGBGgot7nHfAHykUWPfZSqp6 zuYJgvYvcctlKrOK9U31c2s6k9QExyt3lNyDsOHpa/5omPHebJ4n1s+YnA8HN0M1SV /tWSqdXIxjEIg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E8EF469591; Tue, 20 Jan 2026 16:20:06 -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 5Z4BWMaalja2; Tue, 20 Jan 2026 16:20:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951202; bh=M5chgMIRajBcChqVyuhs/8V4bD3LXEL9eiQtms4IP/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jM6/Zi8QAiWM+VH5FKSVifwdgbe/YK6BLhkMCf+VUijNNAnPAsRmQQqqY5AgZFELy Jf0cqfxthuJu/3Rf8flEozVeJsv8MoTrIL6pLCxKgZ4xwmW1lCV2q6WJ8YwOS1o9Bn l4sbuBkB/FJvwyuWvuw+6dZAaOeWkgJ2iVfD855vBfbkMEQc6rqYcKE+upvzFgGQ4y X6YVA6GAn/o8enSPSKfvlEipoOIS2Obg59xnvE8vFinvvOV49zrgvVJ+5lU244POE9 CNK6gIIBAt/6dFYbrgRODxkWYT1tAEaJixQSPVrezxq+tSsSNS72QvIrFmcwwoWv7z 2QfodbISnG8bg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 95A446913F; Tue, 20 Jan 2026 16:20:02 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:17:47 -0700 Message-ID: <20260120231814.2033069-21-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: TYR4P7VKNO3XFYDKNQM4XC2G4Q7XE6TB X-Message-ID-Hash: TYR4P7VKNO3XFYDKNQM4XC2G4Q7XE6TB 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 20/36] video: Pass context to mark_start() method 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 The mark_start() driver method currently uses the default context. Update it to accept a context parameter so callers can specify which context to use for marking the start position. This is needed for text-input objects which have their own vidconsole context. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 4 ++-- drivers/video/vidconsole-uclass.c | 8 ++++---- include/video_console.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 5453e5d9776..b3884bddd72 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1251,9 +1251,9 @@ const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) } } -static int truetype_mark_start(struct udevice *dev) +static int truetype_mark_start(struct udevice *dev, void *vctx) { - struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct console_tt_ctx *ctx = vctx; ctx->pos_start = ctx->pos_ptr; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 9b29b742740..6ef86abc4ce 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -839,10 +839,10 @@ int vidconsole_hide_cursor(struct udevice *dev, void *vctx) } #endif /* CONFIG_CURSOR */ -int vidconsole_mark_start(struct udevice *dev) +int vidconsole_mark_start(struct udevice *dev, void *vctx) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); + struct vidconsole_ctx *ctx = vctx ?: vidconsole_ctx_from_priv(priv); struct vidconsole_ops *ops = vidconsole_get_ops(dev); ctx->xmark_frac = ctx->xcur_frac; @@ -851,7 +851,7 @@ int vidconsole_mark_start(struct udevice *dev) if (ops->mark_start) { int ret; - ret = ops->mark_start(dev); + ret = ops->mark_start(dev, ctx); if (ret != -ENOSYS) return ret; } @@ -1027,7 +1027,7 @@ void vidconsole_readline_start(struct udevice *dev, void *vctx, bool indent) ctx->curs.indent = indent; ctx->curs.enabled = true; - vidconsole_mark_start(dev); + vidconsole_mark_start(dev, ctx); } void vidconsole_readline_end(struct udevice *dev, void *vctx) diff --git a/include/video_console.h b/include/video_console.h index 4bb6974edcc..297049cb851 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -444,8 +444,9 @@ struct vidconsole_ops { * the beginning point for the cursor. * * @dev: Console device to use + * @ctx: Vidconsole context to use (cannot be NULL) */ - int (*mark_start)(struct udevice *dev); + int (*mark_start)(struct udevice *dev, void *ctx); }; /* Get a pointer to the driver operations for a video console device */