From patchwork Tue Jan 20 23:17:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1685 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=1768951171; bh=kF/NY4ESyV0rAZ9c+tIVN35V2umzzGzLWPHH8xJVSUo=; 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=q/dstcHDZnIJZIrANejs78HkYw9TAi1ZaTDGozyBh9wW0d2Unm0vAN3owW6GfawI2 HzW8pnmiOk6Y6kJETP1EI8spz00Kp3pwcpk7O0wGModugUEjUZqiT5z7mQtqyn7XDs 6Y07pI+yL8rdxcJ66xb5jc+NscIIeYQ8784cOaRUixafrbL0eAmT01ERZBb6Deo5/k zHN79epO/a7ASoogHwYxTIojAYZ6fuu4wZjz8GOa7LejIVrOJsSgiY+cunQdfujWO8 cUhUod0iocfKEh25AarpQTKbA0kK4M66rG/So6ew2ypBP1rWTxtkthZSX8fs7iOP1j 3HdeqcuAFNprw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9E8E469572 for ; Tue, 20 Jan 2026 16:19:31 -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 cm80KuIZE02D for ; Tue, 20 Jan 2026 16:19:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951171; bh=kF/NY4ESyV0rAZ9c+tIVN35V2umzzGzLWPHH8xJVSUo=; 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=q/dstcHDZnIJZIrANejs78HkYw9TAi1ZaTDGozyBh9wW0d2Unm0vAN3owW6GfawI2 HzW8pnmiOk6Y6kJETP1EI8spz00Kp3pwcpk7O0wGModugUEjUZqiT5z7mQtqyn7XDs 6Y07pI+yL8rdxcJ66xb5jc+NscIIeYQ8784cOaRUixafrbL0eAmT01ERZBb6Deo5/k zHN79epO/a7ASoogHwYxTIojAYZ6fuu4wZjz8GOa7LejIVrOJsSgiY+cunQdfujWO8 cUhUod0iocfKEh25AarpQTKbA0kK4M66rG/So6ew2ypBP1rWTxtkthZSX8fs7iOP1j 3HdeqcuAFNprw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 853896957E for ; Tue, 20 Jan 2026 16:19:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951168; bh=vGBseWRLzZSZ4mxUnVLEPVCgwvQYHWDHxvnTc6NNkQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YORQ7tCOqIDGNv6dpc5XGEVxTrWvt7E1vYS3bV7LOgATbVwiik8i72qWA5VPA5xPf 751UDV/nvsRw8G6qc930Fv1e3itUTrYfbxBsiIVj6v3AniT+1G1mgEfevQsrkAKgkN qnBX2OXL62HBHg/pttliALmd1Of1a/YLTRJ1jIQ+Bf0H5jW4TvDL0/1Fgb3TEsncJB eNWJkAwnZkQ9Ih8zmb5MWPvz+UbUDa2P7pRLO+1s48xN9aZYLDIV/78FeeaoWoQJJA xM7b0/PSnZxl+Av5FNmPOaLJjOKBivPGkYO1/N6IQjntvVjMpKVsS/svI/7G2huQ5q LXtec7i7/1Jug== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 59D4569572; Tue, 20 Jan 2026 16:19:28 -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 txuvaEMVFkwm; Tue, 20 Jan 2026 16:19:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951164; bh=xuGsyqeIjESKfcbwMFG5fCH8gOQfbnBNRXZgiWX8fds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Op5TEgt//Ec5ioSUIs2uVw/RMwgr6hLOC2hYTXy3AiPAzWUPICjDSLzSSmws1MgJV gVoRu8QzvHjeQ3WAeZ7wGFB+G2QlNe3IWGms+ai81w4JZGa/ZdSxPDydhTGPqXfAJw ZQCc0pGTKwr83dR/7GWywn7f+SzADw3xR3Xr3r+x4PLW3bC/YbNx3ZTzHJi0G8/evB 8El+brq8AJZkTyqsaGu2GPxJz0vsqBxgH+xlFMpkT2aa6r8i6bG2HtuQa9yyHhrrOY T8gmG90b+0G/SNuBs9BXxzXk2aI4uOIXwGIr6Ij6LfK2k0U4VNaCv9dMrfN+Zt/GY5 hWGKm4Bw5lz2A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0DF9C6913F; Tue, 20 Jan 2026 16:19:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:17:39 -0700 Message-ID: <20260120231814.2033069-13-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: QGGEDLLLRRFOAFH4DKV5HMFDZP3PWHXS X-Message-ID-Hash: QGGEDLLLRRFOAFH4DKV5HMFDZP3PWHXS 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/36] video: Pass context to console_fixed_putc_xy() 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 vctx parameter to console_fixed_putc_xy() to allow passing in a specific vidconsole context. If NULL, the default context from priv is used. Update all callers accordingly. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_core.c | 7 +++---- drivers/video/console_normal.c | 4 +++- drivers/video/console_truetype.c | 3 ++- drivers/video/vidconsole_internal.h | 5 +++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 18edc14bcd7..ecb0b9dab89 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -336,11 +336,10 @@ int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *i return info->name ? 0 : -ENOENT; } -int console_fixed_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp, - struct video_fontdata *fontdata) +int console_fixed_putc_xy(struct udevice *dev, void *vctx, uint x_frac, uint y, + int cp, struct video_fontdata *fontdata) { - 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 udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); int pbytes = VNBYTES(vid_priv->bpix); diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index fa9d496ef86..5b6f0f0ce86 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -81,9 +81,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) { + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct console_simple_priv *priv = dev_get_priv(dev); - return console_fixed_putc_xy(dev, x_frac, y, cp, priv->fontdata); + return console_fixed_putc_xy(dev, vidconsole_ctx_from_priv(vc_priv), + x_frac, y, cp, priv->fontdata); } static __maybe_unused int console_get_cursor_info(struct udevice *dev) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 519b8f88843..b4b491039ae 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -417,7 +417,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, /* Use fixed font if selected */ if (ctx->cur_fontdata) - return console_fixed_putc_xy(dev, x, y, cp, ctx->cur_fontdata); + return console_fixed_putc_xy(dev, &ctx->com, x, y, cp, + ctx->cur_fontdata); /* Reset scratch buffer for this character */ stbtt_scratch_reset(&priv->scratch); diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index 241be149ac9..ef864a7c858 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -198,14 +198,15 @@ int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp); * Fixed font putc_xy function that can be called with explicit font data * * @param dev console device + * @param vctx vidconsole context to use (cannot be NULL) * @param x_frac fractional X position * @param y Y position in pixels * @param cp Unicode code point * @param fontdata font data to use for rendering * @returns width in fractional pixels, or -ve on error */ -int console_fixed_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp, - struct video_fontdata *fontdata); +int console_fixed_putc_xy(struct udevice *dev, void *vctx, uint x_frac, uint y, + int cp, struct video_fontdata *fontdata); /** * Internal function to convert Unicode code points to code page 437.