From patchwork Tue Jan 20 23:17:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1689 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=1768951189; bh=+biS6qAv/rcLtSDnnpNrRNKDwdLPvDx1oMjKMMD+hS0=; 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=gWN5o4OhcDvIWEskDKNt+re3ZxrIg6UVcTxwKYhtNZuwpkI67fHW+7mEYznQCdZUN T157eAHU6dZKtxO0souTJSq7l6djHt1POgp5HaH8k1kG5kqUfnuLrj7/UuF9x97tus K8HIynXL5jIK29t3dFap9xWWABy291+tKvliTGprsCHEspjxIQvAI85/56TrCuIJ1T PnD/7XgIm6i8FWKerqXddWRBvHCn9wjZYTSLawFCFxt0pAniaE/0FMVQMbJCFSzXEL lUX29iDfDnaDWtO1DylUKxmiBi9CkIfBzVvrTrsYwP8YVWq9HbQXtzxEN7wlS+SWCy U4KOc0KaAXX1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0ED2569572 for ; Tue, 20 Jan 2026 16:19:49 -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 VmiWEycKBBqM for ; Tue, 20 Jan 2026 16:19:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951188; bh=+biS6qAv/rcLtSDnnpNrRNKDwdLPvDx1oMjKMMD+hS0=; 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=qv7PnbIapvMSXRivXB3Rf8Uy0zL94k+KrSfiOSqJ7p18Sk+HRseoV/by+Cbhote7q qFHxNdZhtv+w9Nf81IhP8aDUNkKVJVu0fru4DKNbJ99G4BMWi25zDxY2esPqvde9j4 hLX6hAh4H1Se7HoegX74bPOPHgvi+DkMlvasrhzA012zJfYnKG8J6d7n5CLpDD7x1v UffXW3AzqoldLXl62xnKDKvmyDaCwxa4i/dqwaeE8BJY4BOP8jaGYCs+Ljm3MqrBxe WrMilZMLohpwHZhgU//csqqs2e6RCRx+ijURVe0SGE0Z9Fsh7sov12TWFT7WHqTjcy +aWiB9uIeL4aQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F27CB6957E for ; Tue, 20 Jan 2026 16:19:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951187; bh=f0tMsyNIUmHuBDSBSaZtK0kihyxPwybH0xv7uAySZZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cnCN50p3U8UX2XFGDTjZ59BpnupaC/nbVODKY3hRfBAWCbjIhmHGHuPzGmdJV5Muz 3zdo0mq+J66vvHiANDIhPqHEgGsFZTkUdA60diEEOHm6uALdN5teiUtKGoZHYSeMFG UAqfRxxU0+BJfete1w7VzIVAXjKHTaLNa3eP6+8rIKeKlZUnhcJ9Ic6JTUvzPVw754 UbMo7eh8awuvhx97OoTcptuaxe1AhUOM5PP3tUSkOU9tFi1zu3xMcwVzdcLx9fGbD0 CSPksS+6pm98YenOffYxW+vYqpVMgwDRJNhtFcGoPIihBlITSySyhfpYNnpXtfUV/g YpsV+Hf9OWWZA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9F02969572; Tue, 20 Jan 2026 16:19:47 -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 3Fqa9H9sf_TE; Tue, 20 Jan 2026 16:19:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951183; bh=1as3RP0CLwZW4pa+QyGkwueR9AvwgISB07Nlkt2sONI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFpaVHGqTPzmmOMejcnIi362u0eVJQ2344VwwY9yoieAa0ktuaIzYB5ljkTcvwVRR eEW2VR0k1ZriNSiGEDvycIqv3wkyAKGxUYkfd3VgOTAHl9Vg1e42EyuE8QFkgoOEqQ 3wx4D+qMcsXbcIjAMqiXOJ1pxpTO6P/Ewf9kx+g7dyhW6ytJhTpY77AwaIDITZwKw3 QB9oLbbNpiTssYjbleUhNNt7CXrpB9gzhDoe0DAuE6G6dXQ1lsBgJMTj1oEXMsCZ4d Pi7Alrhmys4tm5jJP+1cJfKGU+RJ+ZvHeMD3Lc2ARFJEN1lnO0oqUWDMEfxyF3GpDb lPzv1H0xjVkhA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 55B086913F; Tue, 20 Jan 2026 16:19:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:17:43 -0700 Message-ID: <20260120231814.2033069-17-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: XYRJLMY5XSYLSF3GZASSABYZT65AAEUG X-Message-ID-Hash: XYRJLMY5XSYLSF3GZASSABYZT65AAEUG 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 16/36] video: Pass context to get_cursor_info() 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 get_cursor_info() driver method currently uses the default context. Update it to accept a context parameter so callers can specify which context to use for obtaining cursor position info. 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_normal.c | 6 +++--- drivers/video/console_truetype.c | 4 ++-- drivers/video/vidconsole-uclass.c | 2 +- include/video_console.h | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 5f84896699d..5f57b3403f1 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -87,10 +87,10 @@ int console_normal_putc_xy(struct udevice *dev, void *vctx, uint x_frac, return console_fixed_putc_xy(dev, vctx, x_frac, y, cp, priv->fontdata); } -static __maybe_unused int console_get_cursor_info(struct udevice *dev) +static __maybe_unused int console_get_cursor_info(struct udevice *dev, + void *vctx) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *ctx = vctx; struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; struct vidconsole_cursor *curs = &ctx->curs; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index a72e2342010..5453e5d9776 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1192,9 +1192,9 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) return 0; } -static int truetype_get_cursor_info(struct udevice *dev) +static int truetype_get_cursor_info(struct udevice *dev, void *vctx) { - struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct console_tt_ctx *ctx = vctx; struct vidconsole_ctx *com = &ctx->com; struct vidconsole_cursor *curs = &com->curs; int x, y, index; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 51db3200e86..6258513b07e 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -779,7 +779,7 @@ int vidconsole_show_cursor(struct udevice *dev) if (!ops->get_cursor_info) return -ENOSYS; - ret = ops->get_cursor_info(dev); + ret = ops->get_cursor_info(dev, ctx); if (ret) return ret; diff --git a/include/video_console.h b/include/video_console.h index 9627d645189..2b299661e1b 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -431,9 +431,10 @@ struct vidconsole_ops { * @xmark_frac, @ymark and @index * * @dev: Console device to use + * @ctx: Vidconsole context to use (cannot be NULL) * Return: 0 if OK, -ve on error */ - int (*get_cursor_info)(struct udevice *dev); + int (*get_cursor_info)(struct udevice *dev, void *ctx); /** * mark_start() - Mark the current position as the state of CLI entry