From patchwork Sat Jan 17 00:56: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: 1543 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=1768611442; bh=UefettQEaIf20fE6+SKhQr8AJBTseaWnn5jiGxnWZeg=; 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=rCgBeLtCDNaqxVEbP40gocUNtI/9tg1ndSnb34ohx6ZOkI19/ZZ5iT+Aq/KkhWa8O KHYms8XPRJBMph8uzWDkY1hurKpeLyAwlwrY905cLrJ1U8R/dcX1QLqQV8hi2ABccs t9PpwKV0ztwOBBsuNgaJDDkgN01RYr6xd5OG/IHmJ9aLvSSFYM2Vrd6m7z/V8e1U9L 4phkupXRwQO37HUYcesdNCkpjkvUyHQa/6HZlXozyQTEwod4XcTYv1RMY9EyfpZNwe dgxbT/+H7yJqE8r7acNQLvrwaGSTQSx6ohKcMs4pCxzqrhCG0i2yWAI2SFKKHyJaGv 4YYW4cL17B0gA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 87BE6693B1 for ; Fri, 16 Jan 2026 17:57:22 -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 o_Fs0Ya1UcUp for ; Fri, 16 Jan 2026 17:57:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611442; bh=UefettQEaIf20fE6+SKhQr8AJBTseaWnn5jiGxnWZeg=; 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=rCgBeLtCDNaqxVEbP40gocUNtI/9tg1ndSnb34ohx6ZOkI19/ZZ5iT+Aq/KkhWa8O KHYms8XPRJBMph8uzWDkY1hurKpeLyAwlwrY905cLrJ1U8R/dcX1QLqQV8hi2ABccs t9PpwKV0ztwOBBsuNgaJDDkgN01RYr6xd5OG/IHmJ9aLvSSFYM2Vrd6m7z/V8e1U9L 4phkupXRwQO37HUYcesdNCkpjkvUyHQa/6HZlXozyQTEwod4XcTYv1RMY9EyfpZNwe dgxbT/+H7yJqE8r7acNQLvrwaGSTQSx6ohKcMs4pCxzqrhCG0i2yWAI2SFKKHyJaGv 4YYW4cL17B0gA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 77CB8693E0 for ; Fri, 16 Jan 2026 17:57:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611440; bh=xNnDOFSxGPKV3PCNHzgPlyQMfQuUAj7jEIpcXhCn/xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i3rydnEtURf5Ob7WmrKQpQM+hmMgVYZiYzOoc2cQRql90a8r0Lz9G9V/KkI9B+glX kVFCtIwVNAPiXf9iJrj259UxgrtlH/sITn+pLr8If3MuZYv9QeWqEXQa9F1anU3p6A cGIwHzLi/8mHi6W8dex9tPVAz3GvML8vFAnwr43dVuuOW+Ue+AMezb7DM5c8mPtfcr Yeg45jjhDNxbVqQVYc6WL/Yo0uat00uXu8Q7UdxPzUomLf1BbtF6R5hyVK83tOc8Gi xiLh2CsA56xE9BKTMqxb/QJmfdUsI7HStnY9aPQkaA3wM6J/AGS/3F4ujfPr7DwwUX WK60aNrc3JfaQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C257D693B1; Fri, 16 Jan 2026 17:57:20 -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 otHkcwoKdVfY; Fri, 16 Jan 2026 17:57:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611436; bh=Bp51EJzmYMSAXd3BMstNOlg41XKV/RY/LT2nGYBbhiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRhEp9DUXJpPLGkrL8plRQkOEywa/Yee5jyxF6mFtcOy19Bz9qJmplqLaf1LmAZos qMc5uzeYlRhCSRXQ1yJD9i/zVytgKzk1XJoPiuGkvZC6ADFG+FKOP4nHQmEn0u5DXG 8oBgIQ0HFwwFYVBeqHOj9kzlkOaFBRT8Czd1w8NMXuZ4fl3HVQ95KL2MWRk5C0ur7/ uzbMRXr/cvkRYVhlfaD1aO4I+ybqLqwuhWxAmI7fetNy3ZKCkmIEpuJ1klGZbV3aom bDXwkEMv7wI4mrtg75QjdjqXY80WqE0j3KSdFfmgvb0wKGXA05eA11Z3NIFv6bcenh Ms5ExEfKDSDxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 67C66693ED; Fri, 16 Jan 2026 17:57:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:39 -0700 Message-ID: <20260117005702.1684841-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NAO7NTTNDP6ZXLVJNWGHI64XKJJAXJE5 X-Message-ID-Hash: NAO7NTTNDP6ZXLVJNWGHI64XKJJAXJE5 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 01/18] video: truetype: Rename vc_ctx to com 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 Rename the common vidconsole_ctx pointer from 'vc_ctx' to 'com' for consistency with other drivers. The truetype-specific console_tt_ctx is accessed via '&priv->ctx' where needed. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 84 ++++++++++++++++---------------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index e607dff0aea..37cc1f0fc5d 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -266,7 +266,7 @@ struct console_tt_store { static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = vidconsole_ctx(dev); struct console_tt_priv *priv = dev_get_priv(dev); void *end, *line; int font_height; @@ -314,9 +314,9 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) video_damage(dev->parent, 0, - vc_ctx->y_charsize * row, + com->y_charsize * row, vid_priv->xsize, - vc_ctx->y_charsize); + com->y_charsize); return 0; } @@ -325,7 +325,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = vidconsole_ctx(dev); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; void *dst; @@ -349,9 +349,9 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, video_damage(dev->parent, 0, - vc_ctx->y_charsize * rowdst, + com->y_charsize * rowdst, vid_priv->xsize, - vc_ctx->y_charsize * count); + com->y_charsize * count); return 0; } @@ -368,12 +368,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, */ static void clear_from(struct udevice *dev, int index) { + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; struct udevice *vid_dev = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); struct pos_info *start_pos, *end_pos; int xstart, xend; int ystart, yend; @@ -392,22 +392,22 @@ static void clear_from(struct udevice *dev, int index) /* If on the same line, just erase from start to end position */ if (ystart == yend) { video_fill_part(vid_dev, xstart, ystart, xend, - ystart + vc_ctx->y_charsize, + ystart + com->y_charsize, vid_priv->colour_bg); } else { /* Different lines - erase to end of first line */ video_fill_part(vid_dev, xstart, ystart, vid_priv->xsize, - ystart + vc_ctx->y_charsize, vid_priv->colour_bg); + ystart + com->y_charsize, vid_priv->colour_bg); /* Erase any complete lines in between */ - if (yend > ystart + vc_ctx->y_charsize) { - video_fill_part(vid_dev, 0, ystart + vc_ctx->y_charsize, + if (yend > ystart + com->y_charsize) { + video_fill_part(vid_dev, 0, ystart + com->y_charsize, vid_priv->xsize, yend, vid_priv->colour_bg); } /* Erase from start of final line to end of last character */ video_fill_part(vid_dev, 0, yend, xend, - yend + vc_ctx->y_charsize, + yend + com->y_charsize, vid_priv->colour_bg); } } @@ -416,9 +416,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, int cp) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); - struct udevice *vid = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid); + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; struct console_tt_metrics *met = priv->cur_met; @@ -452,8 +451,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, pos = ctx->pos_ptr < ctx->pos_count ? &ctx->pos[ctx->pos_ptr] : NULL; xpos = frac(VID_TO_PIXEL((double)x)); kern = 0; - if (vc_ctx->last_ch) { - int last_cp = vc_ctx->last_ch; + if (com->last_ch) { + int last_cp = com->last_ch; if (pos) last_cp = pos->cp; @@ -496,8 +495,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, } pos = &ctx->pos[ctx->pos_ptr]; - pos->xpos_frac = vc_ctx->xcur_frac; - pos->ypos = vc_ctx->ycur; + pos->xpos_frac = com->xcur_frac; + pos->ypos = com->ycur; pos->width = (width_frac + VID_FRAC_DIV - 1) / VID_FRAC_DIV; pos->cp = cp; ctx->pos_ptr++; @@ -684,11 +683,10 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, static int console_truetype_backspace(struct udevice *dev) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; - struct udevice *vid_dev = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); struct pos_info *pos; int xend; @@ -707,14 +705,14 @@ static int console_truetype_backspace(struct udevice *dev) * cursor position, but if we are clearing a character on the previous * line, we clear from the end of the line. */ - if (pos->ypos == vc_ctx->ycur) - xend = VID_TO_PIXEL(vc_ctx->xcur_frac); + if (pos->ypos == com->ycur) + xend = VID_TO_PIXEL(com->xcur_frac); else xend = vid_priv->xsize; /* Move the cursor back to where it was when we pushed this record */ - vc_ctx->xcur_frac = pos->xpos_frac; - vc_ctx->ycur = pos->ypos; + com->xcur_frac = pos->xpos_frac; + com->ycur = pos->ypos; return 0; } @@ -722,14 +720,14 @@ static int console_truetype_backspace(struct udevice *dev) static int console_truetype_entry_start(struct udevice *dev) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; /* A new input line has start, so clear our history */ ctx->pos_ptr = 0; ctx->pos_count = 0; - vc_ctx->last_ch = 0; + com->last_ch = 0; return 0; } @@ -938,17 +936,17 @@ static void set_bitmap_font(struct udevice *dev, static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct udevice *vid_dev = dev_get_parent(dev); struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); priv->cur_met = met; - ctx->x_charsize = met->font_size; - ctx->y_charsize = met->font_size; + com->x_charsize = met->font_size; + com->y_charsize = met->font_size; vc_priv->xstart_frac = VID_TO_POS(2); - ctx->cols = vid_priv->xsize / met->font_size; - ctx->rows = vid_priv->ysize / met->font_size; + com->cols = vid_priv->xsize / met->font_size; + com->rows = vid_priv->ysize / met->font_size; vc_priv->tab_width_frac = VID_TO_POS(met->font_size) * 8 / 2; } @@ -1186,7 +1184,7 @@ static int truetype_ctx_dispose(struct udevice *dev, void *ctx) static int truetype_entry_save(struct udevice *dev, struct abuf *buf) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_store store; const uint size = sizeof(store); @@ -1202,8 +1200,8 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) return log_msg_ret("sav", -ENOMEM); store.priv = *priv; - store.cur.xpos_frac = vc_ctx->xcur_frac; - store.cur.ypos = vc_ctx->ycur; + store.cur.xpos_frac = com->xcur_frac; + store.cur.ypos = com->ycur; memcpy(abuf_data(buf), &store, size); return 0; @@ -1212,7 +1210,7 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; struct console_tt_store store; @@ -1222,8 +1220,8 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) memcpy(&store, abuf_data(buf), sizeof(store)); - vc_ctx->xcur_frac = store.cur.xpos_frac; - vc_ctx->ycur = store.cur.ypos; + com->xcur_frac = store.cur.xpos_frac; + com->ycur = store.cur.ypos; *ctx = store.priv.ctx; return 0; @@ -1232,7 +1230,7 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) static int truetype_get_cursor_info(struct udevice *dev) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *vc_ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; struct vidconsole_cursor *curs = &vc_priv->curs; @@ -1255,8 +1253,8 @@ static int truetype_get_cursor_info(struct udevice *dev) if (0 && index < ctx->pos_count) x = VID_TO_PIXEL(ctx->pos[index].xpos_frac); else - x = VID_TO_PIXEL(vc_ctx->xcur_frac); - y = vc_ctx->ycur; + x = VID_TO_PIXEL(com->xcur_frac); + y = com->ycur; /* Get font height from current font type */ if (priv->cur_fontdata) From patchwork Sat Jan 17 00:56:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1544 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=1768611448; bh=TwAHtf8ACmHOkV+iQJ9s+IG74TIqMQCy292izkal6xg=; 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=o1mO8XaKpqrL5lOV0QvZDRp1w9PvHbhL5tbgjJOkDkhOScpcM5j7WAwleWVoend40 pLZg7+jA9+7VIrJLgc5NzThXKwJuJr0sm0HF2U7kxSsRsdtUSDle9xPovPuFBTsOwx db6R+3cBzX58/RVqal8xljqiN+8udldJPSC+DJxs8wp7PagwLabseOc4ewDvlNZ+b4 fIY0Aw+B3+z4C7hwaSJSfysdrmCmvRQTNyDiOEzgzdLDkoEhLBXfysZc0J7YSXBsHd ZnLq2QokhJuuU3vUW5EygOwzj7bkZJy+1opCfdFL6e7V55ABT8B1k8nugnM6iGZIGh yww73VTVauFbQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4A239693E7 for ; Fri, 16 Jan 2026 17:57: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 10024) with ESMTP id r6FlEDUif6vK for ; Fri, 16 Jan 2026 17:57:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611448; bh=TwAHtf8ACmHOkV+iQJ9s+IG74TIqMQCy292izkal6xg=; 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=o1mO8XaKpqrL5lOV0QvZDRp1w9PvHbhL5tbgjJOkDkhOScpcM5j7WAwleWVoend40 pLZg7+jA9+7VIrJLgc5NzThXKwJuJr0sm0HF2U7kxSsRsdtUSDle9xPovPuFBTsOwx db6R+3cBzX58/RVqal8xljqiN+8udldJPSC+DJxs8wp7PagwLabseOc4ewDvlNZ+b4 fIY0Aw+B3+z4C7hwaSJSfysdrmCmvRQTNyDiOEzgzdLDkoEhLBXfysZc0J7YSXBsHd ZnLq2QokhJuuU3vUW5EygOwzj7bkZJy+1opCfdFL6e7V55ABT8B1k8nugnM6iGZIGh yww73VTVauFbQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A41F693E6 for ; Fri, 16 Jan 2026 17:57:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611445; bh=VBLa5sNzTPlLLEAZWJz//t2np9dDIDth3dYe/peNVEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lPHn9BUnBqzuzPUxJD/PQ0+WWM1/xooUF4GeoTEHQXqzXNZiqiIpoKa0VCVrAe6zf 8ZCn900M5mOGgGo8ZzCeC+EPJqI7xnZ7Dv1VO8Y2GMV+/o+lRt6sCkjsYzZdGRXyJz f5sUCjUthua3XTW60SL5lSxVnBBWZpClBQF2OetsMZJlO/ZEyQSoDrTjIi04PahVfX QK5LDQ8XFGgq8mXrSvp6m0+ObsrINil/pOawrhZZncU2TO0x8ZT+zgJLnT+NCyO5NM l4G9njM9W7JYl32o3mrNpMjfSCzFscj1zJ8aDs/x3dy/LiU0jbI7G2C9NnoeJn7M88 9otSm7dDjAZbA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 63E9D693B1; Fri, 16 Jan 2026 17:57: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 10026) with ESMTP id o_ZSsxyR7bEr; Fri, 16 Jan 2026 17:57:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611441; bh=xUc01BwAARn0py0vAye68RIeQQi/fQVDHhJW3Md/yXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5hyZKUhx2/WOdgOIYuy2mW69O9TcKoBc4kED5muXRDhK4h+YMALDek2+vyjnGmtH VYAMMyPE19KSQOxHSPHFKEYPdApCgop+ReFsVb6ZTOnRpXrNSIl/ytO3RfY3umcWbx Eluh19FEv9HzL7307+ekXFIbCrXP1nTTNZ16tdlgjsyaJUzTM/i+pThunSqXE0mab7 bBnynVOc1dAp2yAefzBpLE9Q44oEuLw/j3fgj5+Vvy51vUD8INFDSV7Jk2mUike4af Mye8Ry+S8olKEJErIpW8QBpLyDiK9zneQ08q57eVxr2+Ub3kuEzgVI9mze/Q2wFXV2 hExHcdkT+yHUw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 10C79693D7; Fri, 16 Jan 2026 17:57:21 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:40 -0700 Message-ID: <20260117005702.1684841-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NO5QVYGTISWRQMV7FN6OEQ3XK5FUASWX X-Message-ID-Hash: NO5QVYGTISWRQMV7FN6OEQ3XK5FUASWX 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 02/18] video: Move curs 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 The cursor state should be per-context so that different clients can maintain their own cursor information. Move the curs field from vidconsole_priv into vidconsole_ctx. Update all access to use the vidconsole_ctx() or vidconsole_ctx_from_priv() helpers for consistency. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_core.c | 6 +++--- drivers/video/console_normal.c | 2 +- drivers/video/console_truetype.c | 2 +- drivers/video/vidconsole-uclass.c | 24 +++++++++++++----------- include/video_console.h | 4 ++-- test/dm/video.c | 3 ++- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 9cf5831b562..50f67ffcf83 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -280,7 +280,7 @@ int cursor_hide(struct vidconsole_cursor *curs, struct video_priv *vid_priv, int console_alloc_cursor(struct udevice *dev) { - struct vidconsole_priv *vc_priv; + struct vidconsole_ctx *ctx; struct vidconsole_cursor *curs; struct video_priv *vid_priv; struct udevice *vid; @@ -289,10 +289,10 @@ int console_alloc_cursor(struct udevice *dev) if (!CONFIG_IS_ENABLED(CURSOR) || xpl_phase() < PHASE_BOARD_R) return 0; - vc_priv = dev_get_uclass_priv(dev); + ctx = vidconsole_ctx(dev); vid = dev_get_parent(dev); vid_priv = dev_get_uclass_priv(vid); - curs = &vc_priv->curs; + curs = &ctx->curs; /* Allocate cursor save buffer for maximum possible cursor height */ save_count = vid_priv->ysize * VIDCONSOLE_CURSOR_WIDTH; diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 73bf3a7ebe8..4854e953e58 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -98,7 +98,7 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(vc_priv); struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; - struct vidconsole_cursor *curs = &vc_priv->curs; + struct vidconsole_cursor *curs = &ctx->curs; int x, y, index, xspace, xpos; /* for now, this is not used outside expo */ diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 37cc1f0fc5d..978e81a9350 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1233,7 +1233,7 @@ static int truetype_get_cursor_info(struct udevice *dev) struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = &priv->ctx; - struct vidconsole_cursor *curs = &vc_priv->curs; + struct vidconsole_cursor *curs = &com->curs; int x, y, index; uint height; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 2136253b15e..71bcb0d9c91 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -767,8 +767,9 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf) int vidconsole_show_cursor(struct udevice *dev) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); struct vidconsole_ops *ops = vidconsole_get_ops(dev); - struct vidconsole_cursor *curs = &priv->curs; + struct vidconsole_cursor *curs = &ctx->curs; int ret; /* find out where the cursor should be drawn */ @@ -807,7 +808,8 @@ int vidconsole_show_cursor(struct udevice *dev) int vidconsole_hide_cursor(struct udevice *dev) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); - struct vidconsole_cursor *curs = &priv->curs; + struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); + struct vidconsole_cursor *curs = &ctx->curs; int ret; if (!curs->visible) @@ -912,9 +914,9 @@ static int vidconsole_post_probe(struct udevice *dev) static int vidconsole_pre_remove(struct udevice *dev) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx *ctx = vidconsole_ctx(dev); - free(vc_priv->curs.save_data); + free(ctx->curs.save_data); return 0; } @@ -987,8 +989,8 @@ void vidconsole_set_bitmap_font(struct udevice *dev, void vidconsole_idle(struct udevice *dev) { - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); - struct vidconsole_cursor *curs = &priv->curs; + struct vidconsole_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_cursor *curs = &ctx->curs; /* Only handle cursor if it's enabled */ if (curs->enabled && !curs->visible) { @@ -1008,10 +1010,10 @@ void vidconsole_readline_start(bool indent) struct udevice *dev; uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) { - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx *ctx = vidconsole_ctx(dev); - priv->curs.indent = indent; - priv->curs.enabled = true; + ctx->curs.indent = indent; + ctx->curs.enabled = true; vidconsole_mark_start(dev); } } @@ -1022,9 +1024,9 @@ void vidconsole_readline_end(void) struct udevice *dev; uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) { - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx *ctx = vidconsole_ctx(dev); - priv->curs.enabled = false; + ctx->curs.enabled = false; } } #endif /* CURSOR */ diff --git a/include/video_console.h b/include/video_console.h index bc468d753d4..5b90a5cf160 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -112,6 +112,7 @@ struct vidconsole_ansi { * @ymark: Y position of start of CLI text * @ansi: ANSI escape-sequence state * @utf8_buf: Buffer to accumulate UTF-8 byte sequence + * @curs: Cursor state and management */ struct vidconsole_ctx { int rows; @@ -126,6 +127,7 @@ struct vidconsole_ctx { int ymark; struct vidconsole_ansi ansi; char utf8_buf[5]; + struct vidconsole_cursor curs; }; /** @@ -148,7 +150,6 @@ struct vidconsole_ctx { * @xsize_frac: Width of the display in fractional units * @xstart_frac: Left margin for the text console in fractional units * @quiet: Suppress all output from stdio - * @curs: Cursor state and management */ struct vidconsole_priv { struct stdio_dev sdev; @@ -157,7 +158,6 @@ struct vidconsole_priv { int xsize_frac; int xstart_frac; bool quiet; - struct vidconsole_cursor curs; }; /** diff --git a/test/dm/video.c b/test/dm/video.c index d802a5cc24d..d3978f4b00c 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1185,7 +1185,8 @@ static int check_cursor_backspace(struct unit_test_state *uts, { int with_a, with_cursor, after_backspace, after_idle, after_hide; struct vidconsole_priv *vc_priv = dev_get_uclass_priv(con); - struct vidconsole_cursor *curs = &vc_priv->curs; + struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(vc_priv); + struct vidconsole_cursor *curs = &ctx->curs; /* Output chars without cursor */ ut_assert(!curs->visible); From patchwork Sat Jan 17 00:56:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1545 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=1768611451; bh=s6NaAmw4OF/4vyu+TCD1Y2hGnqUqA9+IPtGRAVfz5jc=; 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=fu4r0Ev/cUuw+AGl+MTU7QoJdbNd7gJgydUlUC5Ia/o96iiRA60w2LsUQb46fBp2G KgqZEOIGYaVmTuUyMCrroAiXgeRuvSYvdorTkB/D2bZp/cUy4eGakaCxnCUGRNzlmS 4wOUSZkJyrpc8e8+LjsCcHgCtTkqwTwTkPRHdr+YL24SJDi2qql/2vQNTmnuAihSo8 Lwyl8O2HcMOni7jjrouHKjYxjs5nyhmGZyY8yLF0uwfgM0MGYGFZCgUW1zbknmmSA4 BnpE402qfwjo9VfZzQM1X4TH7d6dWaRaSZ3yDfTLYLUT3/AEbfo1eLecjAdQMDICNr zpeVSUjEwNwsw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B2730693E7 for ; Fri, 16 Jan 2026 17:57: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 0OT-lXGPEtdz for ; Fri, 16 Jan 2026 17:57:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611451; bh=s6NaAmw4OF/4vyu+TCD1Y2hGnqUqA9+IPtGRAVfz5jc=; 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=fu4r0Ev/cUuw+AGl+MTU7QoJdbNd7gJgydUlUC5Ia/o96iiRA60w2LsUQb46fBp2G KgqZEOIGYaVmTuUyMCrroAiXgeRuvSYvdorTkB/D2bZp/cUy4eGakaCxnCUGRNzlmS 4wOUSZkJyrpc8e8+LjsCcHgCtTkqwTwTkPRHdr+YL24SJDi2qql/2vQNTmnuAihSo8 Lwyl8O2HcMOni7jjrouHKjYxjs5nyhmGZyY8yLF0uwfgM0MGYGFZCgUW1zbknmmSA4 BnpE402qfwjo9VfZzQM1X4TH7d6dWaRaSZ3yDfTLYLUT3/AEbfo1eLecjAdQMDICNr zpeVSUjEwNwsw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A0D57693E0 for ; Fri, 16 Jan 2026 17:57:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611450; bh=/YcrEjqX33D9j1YfSgLv5m5OoQwBVK5XcGVBIOS6rsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oC9UagIq9CgPhZM06w9SYim+CMqDjG+fHWc+PDQryoZMNGhTXWrOE7oAjfpDn+KE4 Ro4aQEwLwBF6gTD31bLwWpPCFC4sNW/o4G4H6/IxNMAQInMfpsF4xchbQPwC6AHp6M ZYXEDuRWU7lQQEqvA23OUrepEqNf/8c1qQusXu0RJY4JhlxDPPU6pc1CwxAwI9E3c2 n2nsoxgErvFlW07ajyBRh2SJILXegWhOMlRujd4sIq9bjVgwwlGWuGOtc3Tqd0+Shu Xkx9ix+q6Cdi4oqWu865brF3snKs8KGdhIR0/BD2idbInWFnsVs2o/EJXkF+tQ+qF3 kqryuASeFVDyA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A542C693E0; Fri, 16 Jan 2026 17:57:30 -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 Z1_IJF83H3di; Fri, 16 Jan 2026 17:57:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611445; bh=FGALoFXkQ6oFNyzohPF7pfVHCo/NReoabvrorsCCxFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXnTvjDc2XfyKZ2UvXb2rqYYi29869o1w/IUXaDdAQGymuoDiLSyvATDEWcwUjfjS C+Dy65cqLdskgcly4unATn5tSJt0t2ewVqOPNk465ZHM1uwi0RtnKo8Ew+6iSxxj9f 0rQhXQPj0TVLIsKHe/ytscFDorqD2YDAO/donhSxNriEra1NKNuq2ub6ABC2QVfCxd UvS0pK5rRDrEm6VP2Uv/fk7U4ebUmzLdJ3jDY68EAhryaaJ84+6DiLk/9Vc9Hxl+GV UOh9QH1vmMtew7SdhHLYNQnTn4CjLXtCw2eiQWacnC1B53eL6MJsNTANBk+z4XhXDu Y0bO7/wmoOKEA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A2DD3693D7; Fri, 16 Jan 2026 17:57:25 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:41 -0700 Message-ID: <20260117005702.1684841-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NV6HMKQC76AYUPZF67X2P4UYQUDASD42 X-Message-ID-Hash: NV6HMKQC76AYUPZF67X2P4UYQUDASD42 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 03/18] video: Move xstart_frac 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 The left margin should be per-context so that different clients can maintain their own margin settings. Move the xstart_frac field from vidconsole_priv into vidconsole_ctx. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 2 +- drivers/video/vidconsole-uclass.c | 14 +++++++------- include/video_console.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 978e81a9350..36a2c33eb70 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -944,7 +944,7 @@ static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) priv->cur_met = met; com->x_charsize = met->font_size; com->y_charsize = met->font_size; - vc_priv->xstart_frac = VID_TO_POS(2); + com->xstart_frac = VID_TO_POS(2); com->cols = vid_priv->xsize / met->font_size; com->rows = vid_priv->ysize / met->font_size; vc_priv->tab_width_frac = VID_TO_POS(met->font_size) * 8 / 2; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 71bcb0d9c91..bc2b3943fc8 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -77,7 +77,7 @@ static int vidconsole_back(struct udevice *dev) vidconsole_hide_cursor(dev); ctx->xcur_frac -= VID_TO_POS(ctx->x_charsize); - if (ctx->xcur_frac < priv->xstart_frac) { + if (ctx->xcur_frac < ctx->xstart_frac) { ctx->xcur_frac = (ctx->cols - 1) * VID_TO_POS(ctx->x_charsize); ctx->ycur -= ctx->y_charsize; @@ -100,7 +100,7 @@ static void vidconsole_newline(struct udevice *dev) const int rows = CONFIG_VAL(CONSOLE_SCROLL_LINES); int i, ret; - ctx->xcur_frac = priv->xstart_frac; + ctx->xcur_frac = ctx->xstart_frac; ctx->ycur += ctx->y_charsize; /* Check if we need to scroll the terminal */ @@ -139,7 +139,7 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y) vidconsole_hide_cursor(dev); ctx->xcur_frac = VID_TO_POS(x); - priv->xstart_frac = ctx->xcur_frac; + ctx->xstart_frac = ctx->xcur_frac; ctx->ycur = y; /* make sure not to kern against the previous character */ @@ -182,7 +182,7 @@ static void get_cursor_position(struct vidconsole_priv *priv, struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); *row = ctx->ycur / ctx->y_charsize; - *col = VID_TO_PIXEL(ctx->xcur_frac - priv->xstart_frac) / + *col = VID_TO_PIXEL(ctx->xcur_frac - ctx->xstart_frac) / ctx->x_charsize; } @@ -333,7 +333,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch) #endif } ctx->ycur = 0; - ctx->xcur_frac = priv->xstart_frac; + ctx->xcur_frac = ctx->xstart_frac; } else { debug("unsupported clear mode: %d\n", mode); } @@ -507,7 +507,7 @@ int vidconsole_put_char(struct udevice *dev, char ch) /* beep */ break; case '\r': - ctx->xcur_frac = priv->xstart_frac; + ctx->xcur_frac = ctx->xstart_frac; break; case '\n': vidconsole_newline(dev); @@ -984,7 +984,7 @@ void vidconsole_set_bitmap_font(struct udevice *dev, ctx->rows = vid_priv->ysize / fontdata->height; /* xsize_frac is set in vidconsole_pre_probe() */ } - vc_priv->xstart_frac = 0; + ctx->xstart_frac = 0; } void vidconsole_idle(struct udevice *dev) diff --git a/include/video_console.h b/include/video_console.h index 5b90a5cf160..cedc94a83cf 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -113,6 +113,7 @@ struct vidconsole_ansi { * @ansi: ANSI escape-sequence state * @utf8_buf: Buffer to accumulate UTF-8 byte sequence * @curs: Cursor state and management + * @xstart_frac: Left margin for the text console in fractional units */ struct vidconsole_ctx { int rows; @@ -128,13 +129,14 @@ struct vidconsole_ctx { struct vidconsole_ansi ansi; char utf8_buf[5]; struct vidconsole_cursor curs; + int xstart_frac; }; /** * struct vidconsole_priv - uclass-private data about a console device * * Drivers must set up @ctx.rows, @ctx.cols, @ctx.x_charsize, @ctx.y_charsize - * in their probe() method. Drivers may set up @xstart_frac if desired. + * in their probe() method. Drivers may set up @ctx.xstart_frac if desired. * * Note that these values relate to the rotated console, so that an 80x25 * console which is rotated 90 degrees will have rows=80 and cols=25 @@ -148,7 +150,6 @@ struct vidconsole_ctx { * @ctx: Per-client context * @tab_width_frac: Tab width in fractional units * @xsize_frac: Width of the display in fractional units - * @xstart_frac: Left margin for the text console in fractional units * @quiet: Suppress all output from stdio */ struct vidconsole_priv { @@ -156,7 +157,6 @@ struct vidconsole_priv { struct vidconsole_ctx ctx; int tab_width_frac; int xsize_frac; - int xstart_frac; bool quiet; }; From patchwork Sat Jan 17 00:56:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1546 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=1768611456; bh=Wcj9+CoKenYWYurbatIMUlHkgKLUMBuyOO4jhlwp6RE=; 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=gcl19vKRVZzK4yZL8pZwzTEY0M97THalAp8v77EhgpdaSHK253ffOPfv5hUp2PTtn Ynj4vfpnpTrQDt2ArwqyEZ0Ma3ZACLkkdFdq7Rxk2cAXJewjEUIS+mJwFa50T2fnLE jB1rTcWZ8NtasYYaRbWkR/t3goqMu8NDhJi8d2PnlL9N8dtg9v7pDr75iqmOzryiQ+ JzsrZzGJTnkFEWw/bAuSscqVzg9urXnqygzzcQn0/Y+yYGyFSMylu5ROANACkRbNk9 NM+RxZ2qofrueuhSQwXzLvazOeBYmF/6I0GwOiiiXLPbgmZfI7sqWOh34zBTJ6oOX7 MHVOsJBJDs1xw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 25D25693E7 for ; Fri, 16 Jan 2026 17:57:36 -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 LtnnIQSurRHg for ; Fri, 16 Jan 2026 17:57:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611456; bh=Wcj9+CoKenYWYurbatIMUlHkgKLUMBuyOO4jhlwp6RE=; 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=gcl19vKRVZzK4yZL8pZwzTEY0M97THalAp8v77EhgpdaSHK253ffOPfv5hUp2PTtn Ynj4vfpnpTrQDt2ArwqyEZ0Ma3ZACLkkdFdq7Rxk2cAXJewjEUIS+mJwFa50T2fnLE jB1rTcWZ8NtasYYaRbWkR/t3goqMu8NDhJi8d2PnlL9N8dtg9v7pDr75iqmOzryiQ+ JzsrZzGJTnkFEWw/bAuSscqVzg9urXnqygzzcQn0/Y+yYGyFSMylu5ROANACkRbNk9 NM+RxZ2qofrueuhSQwXzLvazOeBYmF/6I0GwOiiiXLPbgmZfI7sqWOh34zBTJ6oOX7 MHVOsJBJDs1xw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 151F9693E0 for ; Fri, 16 Jan 2026 17:57:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611454; bh=EoQyIwlTzM6nHEoHIHX6AK2bqV5huDMvbH+89sdfjRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRK9Uy6tzvJWboBKTGf/Zqr7uyzm6XxgDS6yn/wchi4+tlwYawcrUxqIbAclx9QRo pCNKY7YSZG01+iZvPL9bmaY0Ww+BD+93XrffiNl3b6NMxLUkW+kkHKeSyozu4iOaWw 9XYDNuXqGxsFqe0nnQyGJaFbAYgPEbPNuj2gFCNIcrxuFpRBfvkbkARsp46EOf8hOB KtcJsBRzdO5wcWVchASalvwsab4WNqNXYfTDzqwXWs2UdtZd0YpRQBE6T/Hl5it3iI JxPmqsLHHZ+seSj5wsl6tuWAOgksObvHUBPkPAE/QLGPASp5BlNKOyREJuExQSjbF6 3qkC6v7ivYsrw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 92E6B693D7; Fri, 16 Jan 2026 17:57:34 -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 EN00K_GwIVMo; Fri, 16 Jan 2026 17:57:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611450; bh=bLTAfFVxMWYIEN00lPEME8YGBiieMo0GuNTY8fpPTcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=luuwEs+LgjzIg4ZhQCgIFVitOc0r7mah91ryQ0ROGHOS8/vgx5zUj9Ag7UcwCgFBC rSR1Wlm58DYweqCttIDJjkVzSph4EGyGlFr+lzDVkHGJuNRhnG5Mw3GXa3euW6IKvh coPcp/nrEe8ExQxD9GK77cX1zUBwnNekJv2o66yKTFg60+7vVZPai44gQ+RfWthn8W E0TJbWqpmetfa2NrUPtEWp19N6orWNlNsyba92mhc92XT9Q+U5dWcG/rHn9heNmr+3 4fvwnapUpvxjj4alD2EF3PzBOvy6B3r8tb+hCwcdk5V6VjHi7NC0fJYPYsogZAU+cB i2Xi6b0DRYLPA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 47FE2693B1; Fri, 16 Jan 2026 17:57:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:42 -0700 Message-ID: <20260117005702.1684841-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BNZ2XCIPLVHVQFJKPEBSQNNYZIXOMTWB X-Message-ID-Hash: BNZ2XCIPLVHVQFJKPEBSQNNYZIXOMTWB 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 04/18] video: Move tab_width_frac 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 The tab width should be per-context so that different clients can maintain their own tab settings. Move the tab_width_frac field from vidconsole_priv into vidconsole_ctx. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 5 +++-- drivers/video/vidconsole-uclass.c | 8 ++++---- include/video_console.h | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 36a2c33eb70..9c7c116809b 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -923,6 +923,7 @@ static void set_bitmap_font(struct udevice *dev, 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 console_tt_priv *priv = dev_get_priv(dev); priv->cur_fontdata = fontdata; @@ -930,7 +931,7 @@ static void set_bitmap_font(struct udevice *dev, vidconsole_set_bitmap_font(dev, fontdata); - vc_priv->tab_width_frac = VID_TO_POS(fontdata->width) * 8 / 2; + ctx->tab_width_frac = VID_TO_POS(fontdata->width) * 8 / 2; } static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) @@ -947,7 +948,7 @@ static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) com->xstart_frac = VID_TO_POS(2); com->cols = vid_priv->xsize / met->font_size; com->rows = vid_priv->ysize / met->font_size; - vc_priv->tab_width_frac = VID_TO_POS(met->font_size) * 8 / 2; + com->tab_width_frac = VID_TO_POS(met->font_size) * 8 / 2; } static int get_metrics(struct udevice *dev, const char *name, uint size, diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index bc2b3943fc8..414a33f7bf7 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -514,8 +514,8 @@ int vidconsole_put_char(struct udevice *dev, char ch) vidconsole_entry_start(dev); break; case '\t': /* Tab (8 chars alignment) */ - ctx->xcur_frac = ((ctx->xcur_frac / priv->tab_width_frac) - + 1) * priv->tab_width_frac; + ctx->xcur_frac = ((ctx->xcur_frac / ctx->tab_width_frac) + + 1) * ctx->tab_width_frac; if (ctx->xcur_frac >= priv->xsize_frac) vidconsole_newline(dev); @@ -894,8 +894,8 @@ static int vidconsole_post_probe(struct udevice *dev) struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); struct stdio_dev *sdev = &priv->sdev; - if (!priv->tab_width_frac) - priv->tab_width_frac = VID_TO_POS(ctx->x_charsize) * 8; + if (!ctx->tab_width_frac) + ctx->tab_width_frac = VID_TO_POS(ctx->x_charsize) * 8; if (dev_seq(dev)) { snprintf(sdev->name, sizeof(sdev->name), "vidconsole%d", diff --git a/include/video_console.h b/include/video_console.h index cedc94a83cf..ebba1ac7572 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -114,6 +114,7 @@ struct vidconsole_ansi { * @utf8_buf: Buffer to accumulate UTF-8 byte sequence * @curs: Cursor state and management * @xstart_frac: Left margin for the text console in fractional units + * @tab_width_frac: Tab width in fractional units */ struct vidconsole_ctx { int rows; @@ -130,6 +131,7 @@ struct vidconsole_ctx { char utf8_buf[5]; struct vidconsole_cursor curs; int xstart_frac; + int tab_width_frac; }; /** @@ -148,14 +150,12 @@ struct vidconsole_ctx { * * @sdev: stdio device, acting as an output sink * @ctx: Per-client context - * @tab_width_frac: Tab width in fractional units * @xsize_frac: Width of the display in fractional units * @quiet: Suppress all output from stdio */ struct vidconsole_priv { struct stdio_dev sdev; struct vidconsole_ctx ctx; - int tab_width_frac; int xsize_frac; bool quiet; }; From patchwork Sat Jan 17 00:56: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: 1547 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=1768611460; bh=scIEiMYdfOMBzGSV2kHN0rAYUHBfjqP9fnq7TEkNukM=; 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=D2OfF7zQiOEFPyAfnvVOueuabYcyYjz+qpXfIIw6sQ2ped+tvV5yZTM1ipj2q/pkq vgesayAqf4JkVBBOdvtxPElgBjwn79pqdH9FA8F01lJAbYGCeWhhKG7Qe/BuXEf458 zYquBwgXb28w32Pzz9Kq+Czdk4gAICQBWfCUIFT+8bK+697SdXLASmh0GSKAjsquKI 6tWde9D8UUr4deMkorSg1TG8t10iWFIMVSD2tKn2JZZBU70P2Q0PesUENtG2u35ofH +wSuyreIqMuKu3gVtqZZN7lKHaTFdK5wf4pa1jhfZ4q0yZrKGelZVQrbABOaI2wtl3 3SVhXHRkvt0IA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D45C3693E6 for ; Fri, 16 Jan 2026 17:57:40 -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 c-hrykTuSPko for ; Fri, 16 Jan 2026 17:57:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611460; bh=scIEiMYdfOMBzGSV2kHN0rAYUHBfjqP9fnq7TEkNukM=; 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=D2OfF7zQiOEFPyAfnvVOueuabYcyYjz+qpXfIIw6sQ2ped+tvV5yZTM1ipj2q/pkq vgesayAqf4JkVBBOdvtxPElgBjwn79pqdH9FA8F01lJAbYGCeWhhKG7Qe/BuXEf458 zYquBwgXb28w32Pzz9Kq+Czdk4gAICQBWfCUIFT+8bK+697SdXLASmh0GSKAjsquKI 6tWde9D8UUr4deMkorSg1TG8t10iWFIMVSD2tKn2JZZBU70P2Q0PesUENtG2u35ofH +wSuyreIqMuKu3gVtqZZN7lKHaTFdK5wf4pa1jhfZ4q0yZrKGelZVQrbABOaI2wtl3 3SVhXHRkvt0IA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C0CE6693D7 for ; Fri, 16 Jan 2026 17:57:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611459; bh=8VTHlsCkHiBYJXw5y0Ec4Ka9LUfMVyAQFuz1q1AmYOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qc0AyaYxjnpWmu2hsRxt6Wh7UUTa4l8W86/KvVA+c2I9vVcDzxwFIMUVyod0SHZl+ dRU3OAuveWvdoyBoZVw3jWqqQA5Zjd5HTIdA/8GQjJ/6LYKjox9TwxYVK1bxILnkzz 8IrUeOfvSPmqOMzIthbhMZf8NdC+TeQ55Lcu8F66ujI3rCX/d35jx7LmI6sk14FlVH leyILjy64lRz1dlkk6m/PVw75IzEu3IRyZOnkVMJR5Klep8INoB/OULqnFSaSEprSc 3RISuIh8QK6knIVcfpf5hCzJoov8JE1gi6kvy4Xg5ck3V1qktC+rYfc6GHM+w9toLe Om8RDMsy7jnmA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 34EED693D7; Fri, 16 Jan 2026 17:57:39 -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 Uca3LDxaLzhI; Fri, 16 Jan 2026 17:57:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611455; bh=YtLHzqkQrkSKSy0hVZn6gjaCrgB81YjZoI3Ah6Wecao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mu99OuGqAeZd1YkxKA11gkbHa1Ko1tZiuFn7HwfiaztVIh0OYHzil77/52QKyrgFB Cs+tHM0z2g6wd2I3tO46Ba2LJLaicM9A1dlYiY8cvxa7ZY3Xkew2qXDfTo+spEVqmA Nytb3HbsRLj/fh2EG04n6tz3wh1+DRdbuXGdaqb0NW1lTIQL+jWwjHZuk6BDYm/7lP dSlai33s3iEJ+kvROJBl/tA3Ze2SO6iF468ggl/dTM/w6sdgJ0mlpSl+zH3W52/8mI 4DqIxe4lGAc7WpzJ0h5I4RCCtu2zGMerY9DenNXgJBMLxKWz1bmPwBQCoD2j0Kxasq gWxbefVOSNsAw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D5562693B1; Fri, 16 Jan 2026 17:57:34 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:43 -0700 Message-ID: <20260117005702.1684841-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QP45HR2WNXDIHANLBTODJ3C2DCRVQU4A X-Message-ID-Hash: QP45HR2WNXDIHANLBTODJ3C2DCRVQU4A 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 05/18] video: Move xsize_frac 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 The display width should be per-context so that different clients can maintain their own display settings. Move the xsize_frac field from vidconsole_priv into vidconsole_ctx. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_core.c | 2 +- drivers/video/console_rotate.c | 6 +++--- drivers/video/console_truetype.c | 2 +- drivers/video/vidconsole-uclass.c | 10 +++++----- include/video_console.h | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 50f67ffcf83..18edc14bcd7 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -350,7 +350,7 @@ int console_fixed_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp, uchar *pfont = fontdata->video_fontdata + ch * fontdata->char_pixel_bytes; - if (x_frac + VID_TO_POS(ctx->x_charsize) > vc_priv->xsize_frac) + if (x_frac + VID_TO_POS(ctx->x_charsize) > ctx->xsize_frac) return -EAGAIN; linenum = y; x = VID_TO_PIXEL(x_frac); diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index 85c571accd4..378c7ec6fc7 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -87,7 +87,7 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) uchar *pfont = fontdata->video_fontdata + ch * fontdata->char_pixel_bytes; - if (x_frac + VID_TO_POS(ctx->x_charsize) > vc_priv->xsize_frac) + if (x_frac + VID_TO_POS(ctx->x_charsize) > ctx->xsize_frac) return -EAGAIN; linenum = VID_TO_PIXEL(x_frac) + 1; x = y + 1; @@ -176,7 +176,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) uchar *pfont = fontdata->video_fontdata + ch * fontdata->char_pixel_bytes; - if (x_frac + VID_TO_POS(ctx->x_charsize) > vc_priv->xsize_frac) + if (x_frac + VID_TO_POS(ctx->x_charsize) > ctx->xsize_frac) return -EAGAIN; linenum = vid_priv->ysize - y - 1; x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - 1; @@ -267,7 +267,7 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) uchar *pfont = fontdata->video_fontdata + ch * fontdata->char_pixel_bytes; - if (x_frac + VID_TO_POS(ctx->x_charsize) > vc_priv->xsize_frac) + if (x_frac + VID_TO_POS(ctx->x_charsize) > ctx->xsize_frac) return -EAGAIN; x = y; linenum = vid_priv->ysize - VID_TO_PIXEL(x_frac) - 1; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 9c7c116809b..a9553cc9a53 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -477,7 +477,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, x_shift = xpos - (double)tt_floor(xpos); xpos += advance * met->scale; width_frac = (int)VID_TO_POS((kern + advance) * met->scale); - if (x + width_frac >= vc_priv->xsize_frac) + if (x + width_frac >= vc_ctx->xsize_frac) return -EAGAIN; /* Write the current cursor position into history */ diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 414a33f7bf7..eda55fcf04e 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -476,7 +476,7 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) return ret; ctx->xcur_frac += ret; ctx->last_ch = ch; - if (ctx->xcur_frac >= priv->xsize_frac) + if (ctx->xcur_frac >= ctx->xsize_frac) vidconsole_newline(dev); cli_index_adjust(priv, 1); @@ -517,7 +517,7 @@ int vidconsole_put_char(struct udevice *dev, char ch) ctx->xcur_frac = ((ctx->xcur_frac / ctx->tab_width_frac) + 1) * ctx->tab_width_frac; - if (ctx->xcur_frac >= priv->xsize_frac) + if (ctx->xcur_frac >= ctx->xsize_frac) vidconsole_newline(dev); break; case '\b': @@ -878,11 +878,11 @@ void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old) /* Set up the number of rows and colours (rotated drivers override this) */ static int vidconsole_pre_probe(struct udevice *dev) { - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx *ctx = vidconsole_ctx(dev); struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); - priv->xsize_frac = VID_TO_POS(vid_priv->xsize); + ctx->xsize_frac = VID_TO_POS(vid_priv->xsize); return 0; } @@ -978,7 +978,7 @@ void vidconsole_set_bitmap_font(struct udevice *dev, if (vid_priv->rot % 2) { ctx->cols = vid_priv->ysize / fontdata->width; ctx->rows = vid_priv->xsize / fontdata->height; - vc_priv->xsize_frac = VID_TO_POS(vid_priv->ysize); + ctx->xsize_frac = VID_TO_POS(vid_priv->ysize); } else { ctx->cols = vid_priv->xsize / fontdata->width; ctx->rows = vid_priv->ysize / fontdata->height; diff --git a/include/video_console.h b/include/video_console.h index ebba1ac7572..43b894048ed 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -115,6 +115,7 @@ struct vidconsole_ansi { * @curs: Cursor state and management * @xstart_frac: Left margin for the text console in fractional units * @tab_width_frac: Tab width in fractional units + * @xsize_frac: Width of the display in fractional units */ struct vidconsole_ctx { int rows; @@ -132,6 +133,7 @@ struct vidconsole_ctx { struct vidconsole_cursor curs; int xstart_frac; int tab_width_frac; + int xsize_frac; }; /** @@ -150,13 +152,11 @@ struct vidconsole_ctx { * * @sdev: stdio device, acting as an output sink * @ctx: Per-client context - * @xsize_frac: Width of the display in fractional units * @quiet: Suppress all output from stdio */ struct vidconsole_priv { struct stdio_dev sdev; struct vidconsole_ctx ctx; - int xsize_frac; bool quiet; }; From patchwork Sat Jan 17 00:56:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1548 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=1768611465; bh=QKrsOz6blJuX4UO+NvJhjse2t5WeC+pfoDKB3NCahaY=; 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=T5hgSIu+/j/RjRk6hf4OMkQ8UABuldM6CLhAFhOM68hpRmVYGeXcYVc2Q/+RC4fg9 vs57H7paQv5GTURY8isJCGiCKXwf1wmPFAlZPascAuIHdVcH+J2An5BNTZ3G6uJOYF /A/RqgkutGwjhiID7OxKlvfyqWTWwVX9Hs3TurFr57eyNnafJ6LTBZTfHDfkthS3Rt 8So39M3WmPJI56H3beBf+I64gY9i+vF1T7dXJwNA7SCrVaAicZ5j4mmCNu0+OP6vPp iwFvL6HsSNpq8i7HDfkwoaJaRe8AhZQqlya6ea4OrF032UM8tDw0qgJBtEWK13cpjM +iJtcLkW4+Yag== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 69F89693E7 for ; Fri, 16 Jan 2026 17:57:45 -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 nO9wDCaI1ryQ for ; Fri, 16 Jan 2026 17:57:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611465; bh=QKrsOz6blJuX4UO+NvJhjse2t5WeC+pfoDKB3NCahaY=; 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=T5hgSIu+/j/RjRk6hf4OMkQ8UABuldM6CLhAFhOM68hpRmVYGeXcYVc2Q/+RC4fg9 vs57H7paQv5GTURY8isJCGiCKXwf1wmPFAlZPascAuIHdVcH+J2An5BNTZ3G6uJOYF /A/RqgkutGwjhiID7OxKlvfyqWTWwVX9Hs3TurFr57eyNnafJ6LTBZTfHDfkthS3Rt 8So39M3WmPJI56H3beBf+I64gY9i+vF1T7dXJwNA7SCrVaAicZ5j4mmCNu0+OP6vPp iwFvL6HsSNpq8i7HDfkwoaJaRe8AhZQqlya6ea4OrF032UM8tDw0qgJBtEWK13cpjM +iJtcLkW4+Yag== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5875D693E0 for ; Fri, 16 Jan 2026 17:57:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611463; bh=blW+o0aALJRDTQInmMzmo1Qzu+ZmTKlaz5F1tTajq2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMkbMdNsRc3z9wchZzQyE8c+uwJvvMyEQLrnox45cmeQsM3X+K9LIL1cxl7frHlSp 0E6BCqakCCbkwljhKq7VOXm40WGJhAhkwdqn3fA4o7A197cM7gZRbXdc2ynKNzkZCL bcN3xJ+eiWefDw3zFjT4loOPhZuyeG4rGatS0fLhWYT1HCe3buRdpMbm/J8nYQMkWQ 8joiktkXUFisqnGJ+3xVU1R7mQYjcwDhQ49Hx/9tHPVT9ueUuBO34uoa5KtC+ua/NP mJjWSYsNZgjyp2gvnHmusFhAZnPdIY35ztPeiQLeTq7eiwj/K46IPq32eVEVjyCSrw gBcDy7T2OpBbA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C7DA1693D7; Fri, 16 Jan 2026 17:57:43 -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 PzUImXXzRSJV; Fri, 16 Jan 2026 17:57:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611459; bh=h3/1yaCQGNjQlAyzmwL124sv7IiVmRmG0oNx/zV216w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxJDWp5j++HK8pIjSjbbYIa3AKDLOWL6d7wSiY/90Z1CttBdvC5vnAzdbt9gtYCTI 7s6U3aZhDqN0ehKNBldywhyGxeM96eKmq5PG1QpynN1vRw7bHHMUqLQJ6FoZbzhi2o YfndfKERTs/QSiezq/nGft5ni635TuYWR6VQXPAfWfmE5+qAYIa09acWWRAAW3xtTH E6X2ZqzStUk+yCZbXdJfthmIt/oXy3snrqmDa6w5NXsLkMHwAuwHEfHS895LsYcFIV wzFP7rEpT/2Fyesm3wosKYHes6UWlwkRBInXTX365uF265Piw56pYclrUQ2Zz2tLnA 5CeDVGNhmM1kg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7AAD6693B1; Fri, 16 Jan 2026 17:57:39 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:44 -0700 Message-ID: <20260117005702.1684841-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 46WJJ53SD7AZWTMGLGXNCFFHZOAPVTCM X-Message-ID-Hash: 46WJJ53SD7AZWTMGLGXNCFFHZOAPVTCM 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 06/18] video: Use vidconsole_ctx_from_priv() in expo_test 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 Update expo_test_render() to use the vidconsole_ctx_from_priv() helper function instead of accessing the ctx field directly. This is more consistent with the rest of the codebase. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/expo_test.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/boot/expo_test.c b/boot/expo_test.c index a905b144745..a5ad571eedb 100644 --- a/boot/expo_test.c +++ b/boot/expo_test.c @@ -120,6 +120,7 @@ int expo_test_render(struct expo *exp) struct expo_test_mode *test = exp->test; struct vidconsole_priv *cons_priv; struct udevice *dev = exp->display; + struct vidconsole_ctx *ctx; struct video_priv *vid_priv; char buf[30]; ulong now; @@ -140,6 +141,7 @@ int expo_test_render(struct expo *exp) vid_priv = dev_get_uclass_priv(dev); cons_priv = dev_get_uclass_priv(exp->cons); + ctx = vidconsole_ctx_from_priv(cons_priv); /* Accumulate delta times for averaging */ test->render_total_us += test->render_delta_us; @@ -176,7 +178,7 @@ int expo_test_render(struct expo *exp) /* Display frame count */ snprintf(buf, sizeof(buf), "frame %6d", test->render_count); - x = vid_priv->xsize - 18 * cons_priv->ctx.x_charsize; + x = vid_priv->xsize - 18 * ctx->x_charsize; y = 10; vidconsole_set_cursor_pos(exp->cons, x, y); vidconsole_put_string(exp->cons, buf); @@ -184,7 +186,7 @@ int expo_test_render(struct expo *exp) /* Display FPS on next line (only if non-zero) */ if (test->fps_last > 0) { snprintf(buf, sizeof(buf), "fps %6d", test->fps_last); - y += cons_priv->ctx.y_charsize; + y += ctx->y_charsize; vidconsole_set_cursor_pos(exp->cons, x, y); vidconsole_put_string(exp->cons, buf); } @@ -193,7 +195,7 @@ int expo_test_render(struct expo *exp) snprintf(buf, sizeof(buf), "render %6lu.%01lums", test->render_avg_us / 1000, (test->render_avg_us % 1000) / 100); - y += cons_priv->ctx.y_charsize; + y += ctx->y_charsize; vidconsole_set_cursor_pos(exp->cons, x, y); vidconsole_put_string(exp->cons, buf); @@ -201,7 +203,7 @@ int expo_test_render(struct expo *exp) snprintf(buf, sizeof(buf), "sync %6lu.%01lums", test->sync_avg_us / 1000, (test->sync_avg_us % 1000) / 100); - y += cons_priv->ctx.y_charsize; + y += ctx->y_charsize; vidconsole_set_cursor_pos(exp->cons, x, y); vidconsole_put_string(exp->cons, buf); @@ -209,7 +211,7 @@ int expo_test_render(struct expo *exp) snprintf(buf, sizeof(buf), "poll %6lu.%01lums", test->poll_avg_us / 1000, (test->poll_avg_us % 1000) / 100); - y += cons_priv->ctx.y_charsize; + y += ctx->y_charsize; vidconsole_set_cursor_pos(exp->cons, x, y); vidconsole_put_string(exp->cons, buf); From patchwork Sat Jan 17 00:56:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1549 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=1768611469; bh=hi+5n9YGMxkC1o1UgbOJJVvIyS+koBzk1p7y2D/nYuk=; 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=Q5A1rg09WMSSZ5Q3mc02tvXBuFCTFZahaZMnJnDOsPkZjBTbQyaZS6AAJr3O9gNv/ dCblHL0Opgj4bB/biZsA2wCERPu48tKjJmHyQqKudRQXUkyKcCdaKPWTSo8RBORW2w kohJH9mIquCLzarafc+knh5Ju+hb3/A8/7uF6BZ90HBDZBi9Hw0xaV208iSsaK5iVr IiWczu9vBVBeqfAGf+3ernKFV+nArdp1yXqGOdIMnuxmz4PIiigTqb2pMOUy6fRHyy 43/HJKrQwtAReqK1Fh3saWs7JlEY87Ruu76GgbLYVhnaYZUbN2/k5sEsD/KY0YLik+ 5z3VxOLJLBk6Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E114F693E7 for ; Fri, 16 Jan 2026 17:57: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 04GlQ4fDBfbA for ; Fri, 16 Jan 2026 17:57:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611469; bh=hi+5n9YGMxkC1o1UgbOJJVvIyS+koBzk1p7y2D/nYuk=; 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=Q5A1rg09WMSSZ5Q3mc02tvXBuFCTFZahaZMnJnDOsPkZjBTbQyaZS6AAJr3O9gNv/ dCblHL0Opgj4bB/biZsA2wCERPu48tKjJmHyQqKudRQXUkyKcCdaKPWTSo8RBORW2w kohJH9mIquCLzarafc+knh5Ju+hb3/A8/7uF6BZ90HBDZBi9Hw0xaV208iSsaK5iVr IiWczu9vBVBeqfAGf+3ernKFV+nArdp1yXqGOdIMnuxmz4PIiigTqb2pMOUy6fRHyy 43/HJKrQwtAReqK1Fh3saWs7JlEY87Ruu76GgbLYVhnaYZUbN2/k5sEsD/KY0YLik+ 5z3VxOLJLBk6Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D0700693E0 for ; Fri, 16 Jan 2026 17:57:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611468; bh=n72gbOOoip+eZAZIGfjLdcp96/vBOlRq/rLJKoR+3P8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VqNj8ICm9fMw/mnxEaP/RSTzz0q2fZv3thdpxU7RZ7tz4mdS2rGWMqz93tSiHPYF2 iMxPdvDN/vjEBRPlTJUSUyjdpYqSF+XrMh/YkK0MiIBS506hlLo7g/cUhXNkyltgKf AAm7LGYZqpPc95dmSF2CyX3vDZCM1LrcFZPiQPwEvDuWzCXQL6KKjAZe/oPQn5/i8i 0d/KfCPocWSDgJMXc3m8mBmoVf8TN6wuo+uSDT/E9zXEDQFZ31z2HJSnC1y60qF897 BBm7Mk6Kuc0co/gyYPPc2wzGZZPdt0MQ+TO2gwA9d87f63lOHk7JLfGPBY87jfl5Ua vhMkv5vKVThdQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 62ECE693D7; Fri, 16 Jan 2026 17:57:48 -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 n5YVprEMydQS; Fri, 16 Jan 2026 17:57:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611464; bh=gZNMQPIRqI6rpb12jTeziUbUDI0uSxsVrJojCIg9mow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLHe0f6DhFa+YZX8gobfKsv+BG1MA7W9VmUuqRF8S27WGm2dX2PEOMxXAj1K5Zavd p6N3ZBGN8q4zpoVuHGqyCFmR2AUAKAX52VQEu+8oDihY951+6U8HPFynahKAHjh4q/ PTNLyCj9FKRfm7e1PuKsdTrPnbo0RvZ9w6NPR2jSHTeOzp2I+MzpU/ysc0Sngb+77b frqfytM07jDwknY3p955xOSbfMtJHFn018TJxb29eVnmvlCWd29/S+U3LNXt9ema+2 fIGRa7srVQEuuY3hKNaaCK4FUozmBY/dWpedQ1kVm+LOcpzh6ECRA7bj5OAExCeX57 hT12jv+Y1Kh+A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 179A6693B1; Fri, 16 Jan 2026 17:57:44 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:45 -0700 Message-ID: <20260117005702.1684841-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SEVHT43WMPBK6JQP6K63EQ2JQLI7R5PG X-Message-ID-Hash: SEVHT43WMPBK6JQP6K63EQ2JQLI7R5PG 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 07/18] video: Update cli_index_adjust() to use 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 Change cli_index_adjust() to take a struct vidconsole_ctx pointer instead of struct vidconsole_priv, since cli_index is now part of the context structure. Update all callers accordingly. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 4 ++-- include/video_console.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index eda55fcf04e..ed9311bd05e 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -85,7 +85,7 @@ static int vidconsole_back(struct udevice *dev) ctx->ycur = 0; } assert(ctx->cli_index); - cli_index_adjust(priv, -1); + cli_index_adjust(ctx, -1); return video_sync(dev->parent, false); } @@ -478,7 +478,7 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) ctx->last_ch = ch; if (ctx->xcur_frac >= ctx->xsize_frac) vidconsole_newline(dev); - cli_index_adjust(priv, 1); + cli_index_adjust(ctx, 1); return 0; } diff --git a/include/video_console.h b/include/video_console.h index 43b894048ed..d3e8b3f3c9f 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -612,10 +612,10 @@ static inline void vidconsole_readline_end(void) } #endif /* CONFIG_CURSOR */ -static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) +static inline void cli_index_adjust(struct vidconsole_ctx *ctx, int by) { if (CONFIG_IS_ENABLED(CURSOR)) - priv->ctx.cli_index += by; + ctx->cli_index += by; } /** From patchwork Sat Jan 17 00:56:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1550 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=1768611474; bh=e4/XdvKX4+qgiSVT2I4FsKxmAPNaHm9bCQuJbTC7wmA=; 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=lEr94TBE3ZLgw1UrL58sEaegiJOCGsFfNIyT8yrco9pYjIrG0lrI7RwWf9ZhUDwdT vLofKZZnmdGNzH7kgXNrQ8i7NroqxlwlqlcFyPZs17GMvf1Hv3hBt01b+o/o/cJIgP 9Qc+KVGNBbWVMGnKxANbBw9b9ID8tXO3nzrylRuHB33NSjOyPonKAjFgIe7RZ6j9fu CYzrB7jwZGbi6mkwiQvFwWIV6IDuF5acfnu8kLUr0/lY/9LQxhwf6kI0NYHftVpgRi VJsGam/28WHQ/gNhN95V9ayynY9zvSo9734Ry8DfKMeisdWgpn7maqmgjfanQQVpch v0S3eLdrTKY2A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9F656693D7 for ; Fri, 16 Jan 2026 17:57:54 -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 BWnlxKjV-ORr for ; Fri, 16 Jan 2026 17:57:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611474; bh=e4/XdvKX4+qgiSVT2I4FsKxmAPNaHm9bCQuJbTC7wmA=; 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=lEr94TBE3ZLgw1UrL58sEaegiJOCGsFfNIyT8yrco9pYjIrG0lrI7RwWf9ZhUDwdT vLofKZZnmdGNzH7kgXNrQ8i7NroqxlwlqlcFyPZs17GMvf1Hv3hBt01b+o/o/cJIgP 9Qc+KVGNBbWVMGnKxANbBw9b9ID8tXO3nzrylRuHB33NSjOyPonKAjFgIe7RZ6j9fu CYzrB7jwZGbi6mkwiQvFwWIV6IDuF5acfnu8kLUr0/lY/9LQxhwf6kI0NYHftVpgRi VJsGam/28WHQ/gNhN95V9ayynY9zvSo9734Ry8DfKMeisdWgpn7maqmgjfanQQVpch v0S3eLdrTKY2A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E159693E0 for ; Fri, 16 Jan 2026 17:57:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611472; bh=4u+7/NJNAQUpQFM+nSoAYBgs/hJkSaY9Jdqkc/2UShA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEJV+lfc3QcgJa0GJPTd4hUQnmcGOAAl1+E52T5N6ixBCTqq/24OG8eMFRNEkgjwJ IR1Z6ftPGeiOJ0I8pWIjW8cVRO1GHmUKWv35hipTh1TwYmIpenHJIT+GG4VuJfxrb9 uwpLC5OFWoKCoB0KF+C1DX9ltRVP0Cp1GFF9ufjvEjmJFzwHmtm+vsw1jlBcHtPzZX AhgY1HT8FeC/PjOknkK+J2/JNsOb+J8hWcBw167RDN3VHMC0aXpYJNN+bIWdi/wLhJ JPZEaRF4QEhEckd+AGOoF4mmabNGqaDNVd4//U4U0VSl3y1FVMuoV32/8LYEJ1MZV7 4qH/O/yL+Cnaw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F00E0693D7; Fri, 16 Jan 2026 17:57:52 -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 rCW8_VvLa06v; Fri, 16 Jan 2026 17:57:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611468; bh=FQuuo5cf6//l9iw0ND51cgWeBIcsP1RskhIDINc+M6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bia96WfAFRqzp/1F1J5KI0+nYqtk0HbNlTzO5mzgpRtShow8BZMu2kgXWX7BlCIDI wVzUF/lzrrFKopx+ZSFbles0lAXhXlIUJt4IVkj7qVTzvYtIoVfNFpLP59vgsanGPp hXSdoa3ySCaSLnt3bQsoMcKxpRekIi9kf1qdSeWs5LrDeVImMZsZ3HFnfOXHd36FvX HGtshq+/o6B+68I+KAfh0sY7g2+0c8mby1wsJdnnBmEcjjLGHvdToHAtxT/KUS+lnW CNdthI3zHCepuT5je+d5Tz/IOQjGxMQ6iEBtS711wAoauB1dvC7ZNBtCCtcFlRLtyn Qw8EhyQp8Seow== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A5162693B1; Fri, 16 Jan 2026 17:57:48 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:46 -0700 Message-ID: <20260117005702.1684841-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PSBWEGXA5U3HEKWQSAWUR56VPZ4ODEBA X-Message-ID-Hash: PSBWEGXA5U3HEKWQSAWUR56VPZ4ODEBA 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 08/18] video: Add vidconsole_uc_plat for per-device platform data 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 new struct vidconsole_uc_plat to hold uclass platform data for vidconsole devices. This includes ctx_size which allows drivers to specify the size of context data they need. This prepares for dynamic context allocation where drivers can have different sized contexts. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 1 + include/video_console.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index ed9311bd05e..1ac8e2ddf3c 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -928,6 +928,7 @@ UCLASS_DRIVER(vidconsole) = { .post_probe = vidconsole_post_probe, .pre_remove = vidconsole_pre_remove, .per_device_auto = sizeof(struct vidconsole_priv), + .per_device_plat_auto = sizeof(struct vidconsole_uc_plat), }; int vidconsole_clear_and_reset(struct udevice *dev) diff --git a/include/video_console.h b/include/video_console.h index d3e8b3f3c9f..72bc0e5b0db 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -136,6 +136,19 @@ struct vidconsole_ctx { int xsize_frac; }; +/** + * struct vidconsole_uc_plat - uclass platform data for a vidconsole device + * + * This holds information that the uclass needs to know about each device. It + * is accessed using dev_get_uclass_plat(dev). + * + * @ctx_size: Size of context data needed by the driver, or 0 to use the + * default (sizeof(struct vidconsole_ctx)) + */ +struct vidconsole_uc_plat { + uint ctx_size; +}; + /** * struct vidconsole_priv - uclass-private data about a console device * From patchwork Sat Jan 17 00:56: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: 1551 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=1768611479; bh=7uwmX3evXo9trKwlJ5gweOefBa9bUZdrzKcpxAn5GyE=; 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=IMLY6wOuW9wQGr4V8m8WIkMuD3+X/DGx7ChkBwyKObUH8bQTemNQADZYgg1rwGQMC D+PB4vypowIHAuncPwsApyEzps8FDQnjXPxfoLoPE3II79s5s1JQWBe59WR5ERKfJO gqXNFjKInEPDgeUvRRnQy9VqKAfrlzVZfGF/qHD87TMFh94jojcTWkHsENeJYl2pCb 3Ym2apmbwCEmKQkvXc7TP5UqwlIMgvouiuuhx2rfQWvR9osGDWTrMPga+rpTuqvvRI g1vf+rrJEnuQymNXCuhZ1IENh0pD5bW5gVguosqZkitWsU2YJ09t8LjBV4x8/WYVfS hKhWIJmJgFJEQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 31AA2693EA for ; Fri, 16 Jan 2026 17:57:59 -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 XY77P9EcUOt4 for ; Fri, 16 Jan 2026 17:57:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611479; bh=7uwmX3evXo9trKwlJ5gweOefBa9bUZdrzKcpxAn5GyE=; 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=IMLY6wOuW9wQGr4V8m8WIkMuD3+X/DGx7ChkBwyKObUH8bQTemNQADZYgg1rwGQMC D+PB4vypowIHAuncPwsApyEzps8FDQnjXPxfoLoPE3II79s5s1JQWBe59WR5ERKfJO gqXNFjKInEPDgeUvRRnQy9VqKAfrlzVZfGF/qHD87TMFh94jojcTWkHsENeJYl2pCb 3Ym2apmbwCEmKQkvXc7TP5UqwlIMgvouiuuhx2rfQWvR9osGDWTrMPga+rpTuqvvRI g1vf+rrJEnuQymNXCuhZ1IENh0pD5bW5gVguosqZkitWsU2YJ09t8LjBV4x8/WYVfS hKhWIJmJgFJEQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2195C693E0 for ; Fri, 16 Jan 2026 17:57:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611477; bh=Ncbo+Uua6noZ8DNzlIxCpSKYs/T9Uy0v9a5XOTLb/Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJ+Sxzqnf+RrL3HrkRXKFRiAttxcqjDVG27sQmbdJQJkzliuZhlZxyzH7mqLcOSpD T/BNlTVq3zOZyscUEPfYbaayC/JzBU9BRBpJcDzNVqhx7TRQwN3ljd9xXYZ54+F5UF kyAlAvFtAY26JUfsnMEKDimpzB9DVXmT08aMKcifYlY1aAyhDI1sActhDHC3NvpFjt QNZexI3QQtrpy5ABG9Ht9jUTt1IBT4gUFKrzeKZhWPHWCJSRjo8frHIDEGCSk8jCN+ mqniKQnwIIKv2ZR+0dw9pcNn1q/+IGkHWXsOSsWUmYgs0SF3YcJjXN3wGd5MJt67Dn qzER8+90q17TQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 89750693D7; Fri, 16 Jan 2026 17:57:57 -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 uzVhSTq_0EsL; Fri, 16 Jan 2026 17:57:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611473; bh=x0yv+SwhDhvHlcFEKh50w2yr/5xB6T/UTnlszzS0SJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fl7UQ14E8a4s+IPfKnGgbI6gOUFxksLmLLoqaW19ZKdsVXmsNMP4LUuvtZSsPLU85 ZJR6MoUgRLrB+r78Bu+qXoFtttxogBhJ/wh7ht9hJVgXBFa4S/vMKvQ8dq8aNs6ic2 MUzhOxpqUnVIxoLic4LMLw1x3n5PQztzGRRUnwAtsZQTsP0FgJD5YJRYyOkK5LihTh VlAyp/bh+FEEq77z+omVobVsQD7o9ezhlKpJt8jsNUgjlov38j1vTgz9g6XGYzDXVe wGST5NId4U37XEoRIKbJYmsXcZGAQ8S/OFG34gJzlyvrHtEMy0tSvcHrZ2vL0oGbFb oX+v5i8V/ISMA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 425CB693B1; Fri, 16 Jan 2026 17:57:53 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:47 -0700 Message-ID: <20260117005702.1684841-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7LJSHWABZOFPBDI7UIA4OISM7PJNUBOF X-Message-ID-Hash: 7LJSHWABZOFPBDI7UIA4OISM7PJNUBOF 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 09/18] video: Set ctx_size in console_truetype driver 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 bind function to the truetype console driver that sets the ctx_size to sizeof(struct console_tt_ctx). This tells the uclass to allocate enough space for the driver's extended context structure, which includes the base vidconsole_ctx plus driver-specific fields for cursor position history. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index a9553cc9a53..faf10f2730b 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1375,10 +1375,20 @@ struct vidconsole_ops console_truetype_ops = { .mark_start = truetype_mark_start, }; +static int console_truetype_bind(struct udevice *dev) +{ + struct vidconsole_uc_plat *plat = dev_get_uclass_plat(dev); + + plat->ctx_size = sizeof(struct console_tt_ctx); + + return 0; +} + U_BOOT_DRIVER(vidconsole_truetype) = { .name = "vidconsole_tt", .id = UCLASS_VIDEO_CONSOLE, .ops = &console_truetype_ops, + .bind = console_truetype_bind, .probe = console_truetype_probe, .remove = console_truetype_remove, .priv_auto = sizeof(struct console_tt_priv), From patchwork Sat Jan 17 00:56:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1552 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=1768611484; bh=300RAiaePuuVQp+IEiXZTCpXVE/nTrkIuD6EliiU4JU=; 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=VGpd/9ftDwwHAawL5KocAd9QmD4xBxm8VzZwe/ITvxjPvfrxwQgisBkXIM0yDflF9 jTnqyWK8Rt0fJe+ZNoPob+au3z/r4dBUWZ1ol4H/GbEYQMpWCgVClsgCYFW5oPmpYD sdXj0E0CidEVoJPZtSEpkru4cgm2HHuxtDuPfHlKV8VTbOCruz1aNwwO668t84JHL0 jQp7bDDsL1/XKs14rd+x7oR1ODhxDG83/Zveh30FjGzV1ov+ebdqoRQhmmGe0X9Ypo UP+hBHSsA7jrDASGUkZT48Iv4yozXJR5ObpXEqXMojX7q0JddZwdz0cmyDucmV7tR4 rNLI84c0c1Gqg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A9ADC693E9 for ; Fri, 16 Jan 2026 17:58:04 -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 0IPysS9rlNmZ for ; Fri, 16 Jan 2026 17:58:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611484; bh=300RAiaePuuVQp+IEiXZTCpXVE/nTrkIuD6EliiU4JU=; 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=VGpd/9ftDwwHAawL5KocAd9QmD4xBxm8VzZwe/ITvxjPvfrxwQgisBkXIM0yDflF9 jTnqyWK8Rt0fJe+ZNoPob+au3z/r4dBUWZ1ol4H/GbEYQMpWCgVClsgCYFW5oPmpYD sdXj0E0CidEVoJPZtSEpkru4cgm2HHuxtDuPfHlKV8VTbOCruz1aNwwO668t84JHL0 jQp7bDDsL1/XKs14rd+x7oR1ODhxDG83/Zveh30FjGzV1ov+ebdqoRQhmmGe0X9Ypo UP+hBHSsA7jrDASGUkZT48Iv4yozXJR5ObpXEqXMojX7q0JddZwdz0cmyDucmV7tR4 rNLI84c0c1Gqg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 978D2693E6 for ; Fri, 16 Jan 2026 17:58:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611482; bh=qSWY/4czXIebmVhAo+dPCu31IYlkaGnT/BySBNGfp/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M9x/wGnZtHOna3ntRU915KYZKaHlc44rTo2/vvYnSymyWhcRTfAn+Yenp3anTI0fk 26NJkvkBaJ8BzeEcJNv1QqL++k8MANpUers23IHQhzs7uB4jDZt36wvH8GWOBljvu0 fQoYSvGzvC9D9f1Wo4dbRFieLHrL0vig3pfmcMa1Mz5vHOMpiM5+oqiLebAsmzCysv RrKppTe35S8AVO7Tt2ClhhFuO8GKSN6A5zNCsAp5zSt9L31fSwR61/h/7+wV485C0/ 9qGjE0JJiZeFd2RU2IfgZkZae69fes9Lxru9IyuRkmXrojD2uD1fn66Syp991gSzlb su67qCTdVqrSQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 287A2693D7; Fri, 16 Jan 2026 17:58:02 -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 TQT726S5S-ig; Fri, 16 Jan 2026 17:58:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611478; bh=tptlXywm8JNIB10ZObDXgFRP0wBjui0yMmElVtZvmMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+azO14VfeR51A+wgAF0Eqwlna0ecA/UyevPmUhTVC9UWGqhGALMMudZmn3j1dxmT FW3f6C2eNXfjKGM5eReAM8eGr1AXqdiIxQslhcBIh6FCbhJGpNFdZe8TD8bbJNhXGV rhPFkrqE2akxg8icT18CrkKhE+IMPq3CZQ941FZuFQsoZ9qv1Cd+o6CSjgMqycA6LQ Lo1GO9CihsOq34CSSJxi6M82yBglIQl5n8m/J7vuEGfyfmDkxVUb+Y3rWho6roUUQ9 mT0wkzp4WXzmuWA9Pf5E1x2bGNO57iXKdxq+RijGuHlEezJoQ2W+iyyEkpDPCOuOp8 Jn79ybgTRH+Eg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C9411693B1; Fri, 16 Jan 2026 17:57:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:48 -0700 Message-ID: <20260117005702.1684841-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5X3T2MHBGPTR2SC7LTSANKAVFXLNPQRQ X-Message-ID-Hash: 5X3T2MHBGPTR2SC7LTSANKAVFXLNPQRQ 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 10/18] video: Allocate vidconsole_ctx dynamically using ctx_size 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 Change the ctx field in vidconsole_priv from an embedded struct to a pointer, and allocate it dynamically in vidconsole_pre_probe(). The size is taken from the ctx_size field in vidconsole_uc_plat, falling back to sizeof(struct vidconsole_ctx) if ctx_size is 0 This allows drivers to specify a larger context size if they need to store additional per-context data beyond the base vidconsole_ctx. The context is freed in vidconsole_pre_remove() along with the cursor save data. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- board/atmel/common/video_display.c | 4 ++-- drivers/video/vidconsole-uclass.c | 18 +++++++++++++++--- include/video_console.h | 17 +++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/board/atmel/common/video_display.c b/board/atmel/common/video_display.c index 4d6ac3a740e..55a49b45f16 100644 --- a/board/atmel/common/video_display.c +++ b/board/atmel/common/video_display.c @@ -68,8 +68,8 @@ int at91_video_show_board_info(void) priv = dev_get_uclass_priv(con); vidconsole_position_cursor(con, 0, (logo_info.logo_height + - priv->ctx.y_charsize - 1) / - priv->ctx.y_charsize); + priv->ctx->y_charsize - 1) / + priv->ctx->y_charsize); for (s = buf, i = 0; i < len; s++, i++) vidconsole_put_char(con, *s); diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 1ac8e2ddf3c..05426138b09 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -878,9 +878,18 @@ void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old) /* Set up the number of rows and colours (rotated drivers override this) */ static int vidconsole_pre_probe(struct udevice *dev) { - struct vidconsole_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_uc_plat *plat = dev_get_uclass_plat(dev); + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); + struct vidconsole_ctx *ctx; + uint size; + + size = plat->ctx_size ?: sizeof(struct vidconsole_ctx); + ctx = calloc(1, size); + if (!ctx) + return -ENOMEM; + priv->ctx = ctx; ctx->xsize_frac = VID_TO_POS(vid_priv->xsize); @@ -914,9 +923,12 @@ static int vidconsole_post_probe(struct udevice *dev) static int vidconsole_pre_remove(struct udevice *dev) { - struct vidconsole_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx *ctx = priv->ctx; free(ctx->curs.save_data); + free(ctx); + priv->ctx = NULL; return 0; } @@ -1036,5 +1048,5 @@ void *vidconsole_ctx(struct udevice *dev) { struct vidconsole_priv *uc_priv = dev_get_uclass_priv(dev); - return &uc_priv->ctx; + return uc_priv->ctx; } diff --git a/include/video_console.h b/include/video_console.h index 72bc0e5b0db..0e9784c8e3c 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -152,24 +152,25 @@ struct vidconsole_uc_plat { /** * struct vidconsole_priv - uclass-private data about a console device * - * Drivers must set up @ctx.rows, @ctx.cols, @ctx.x_charsize, @ctx.y_charsize - * in their probe() method. Drivers may set up @ctx.xstart_frac if desired. + * Drivers must set up @ctx->rows, @ctx->cols, @ctx->x_charsize, + * @ctx->y_charsize in their probe() method. Drivers may set up + * @ctx->xstart_frac if desired. * * Note that these values relate to the rotated console, so that an 80x25 * console which is rotated 90 degrees will have rows=80 and cols=25 * - * The ctx.xcur_frac and ctx.ycur values refer to the unrotated coordinates, - * that is ctx.xcur_frac always advances with each character, even if its limit - * might be vid_priv->ysize instead of vid_priv->xsize if the console is + * The ctx->xcur_frac and ctx->ycur values refer to the unrotated coordinates, + * that is ctx->xcur_frac always advances with each character, even if its + * limit might be vid_priv->ysize instead of vid_priv->xsize if the console is * rotated 90 or 270 degrees. * * @sdev: stdio device, acting as an output sink - * @ctx: Per-client context + * @ctx: Per-client context (allocated by the uclass) * @quiet: Suppress all output from stdio */ struct vidconsole_priv { struct stdio_dev sdev; - struct vidconsole_ctx ctx; + struct vidconsole_ctx *ctx; bool quiet; }; @@ -461,7 +462,7 @@ void *vidconsole_ctx(struct udevice *dev); */ static inline void *vidconsole_ctx_from_priv(struct vidconsole_priv *uc_priv) { - return &uc_priv->ctx; + return uc_priv->ctx; } /** From patchwork Sat Jan 17 00:56:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1553 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=1768611488; bh=rSTTMUAyo0qQNzgf1jgKWLTb2EkGOHROnFJIoiYjn+U=; 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=t0fu0Ft4RW+2QN4HS6a3B2DBSfwS0JXlVLkYrV1myvBghzBL47/jSJq1CaNP1G4j8 yI2BPY88Trsif7k2OSb6j119K7t4XLF6GLcyfEAF8upRi9yxPmvTVNvylG2R0Ya1mj p99rRWTTmBu6jO0KmJmABnzJgyuXZ5QNSNytNfRQma3SmKPntz81UwyQx3eS7+uAq4 djtpuV/rGevUYedFhhVwywubXK8qdLusMNvW10gAHDVv7FoJL3wnM6UC7TsLxDtXG9 hZE7V1GFBgjtfCNDN6QUL2/NnlPLwIgku7J/bvDHx81cI97dAaK7ekPkvGlauUP8ue 51QyI/ockVpYg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 80A7F693F3 for ; Fri, 16 Jan 2026 17:58: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 B0nN7gvxKS4r for ; Fri, 16 Jan 2026 17:58:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611488; bh=rSTTMUAyo0qQNzgf1jgKWLTb2EkGOHROnFJIoiYjn+U=; 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=t0fu0Ft4RW+2QN4HS6a3B2DBSfwS0JXlVLkYrV1myvBghzBL47/jSJq1CaNP1G4j8 yI2BPY88Trsif7k2OSb6j119K7t4XLF6GLcyfEAF8upRi9yxPmvTVNvylG2R0Ya1mj p99rRWTTmBu6jO0KmJmABnzJgyuXZ5QNSNytNfRQma3SmKPntz81UwyQx3eS7+uAq4 djtpuV/rGevUYedFhhVwywubXK8qdLusMNvW10gAHDVv7FoJL3wnM6UC7TsLxDtXG9 hZE7V1GFBgjtfCNDN6QUL2/NnlPLwIgku7J/bvDHx81cI97dAaK7ekPkvGlauUP8ue 51QyI/ockVpYg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 67F39693E6 for ; Fri, 16 Jan 2026 17:58:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611486; bh=1m2eSWaMd5qaVdt1jdY7QVeCn+UMLmvFKkyAnSxOR1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GL34yLVOXOJuqPmVRAFHhth7iGkPdOas+MR96melW/oOepMir4vfbRZdkzKxVhCKp uAwrEVx1cSNbvX1YrNzPRx9P/JVQGzniJvKqdAQy8TYeEJXv5pCjeySImWRcjXksFG JcF4B+ImeHZSa3go7mk80QPHM8WgG07UQpdX+ndEGRrZROYnJ/XZNOFIJbo8luDtTN rPMBdnaj/4/VGFOQhDT+Nn39CA7od5mfP+SNG+c1Xmh6riLLyDR3ovreasM5cQgqrf Mvj+Ou4m0mfBb8Csxs6iHdWlT3g0c990d0RM+osmfy2x36DD5z/A1hozL1HdrJmTaj Fu0PUTaXckLUg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EFC2B693E0; Fri, 16 Jan 2026 17:58: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 10jNsjiFlmmi; Fri, 16 Jan 2026 17:58:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611482; bh=80YUuaXUTej6n2O/OC5wRpXcI0YOWdoIyeJ/9WkrahE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YxYA2a/9Ol1B5DZvoX2j1Kg4w1lUGCqMO/0PeI4RMy3i3UsQC3uxv6C4vL+xzLEnm weoT13WVOpP3JMUgA88P65Vts8/dDFgaSjr0+COwtvUuedrr9U6w+7rEEFo4xFBppK Y6AVgf1NaKbO54cxfCgdPHKF8i8YjYgmvUHFuEbu0GHUzCTVdrLFLdv1JtjNqLq5ep iw5MRAlz1+0IMwqgQ64Gw8/jjTtOJEEzyQcKZgy0zYa8NYEOymjgKiAvKruFRR5+DM TbiYcryHJ/efVtwDLJ38ayyJposNaTHDeMSq75qbuVeWIxIf/i8EMKIthI4/12zJ0V NJYPz4sAuNFyA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6A1D9693B1; Fri, 16 Jan 2026 17:58:02 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:49 -0700 Message-ID: <20260117005702.1684841-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FUGSW7PAAPQIHOVAQORFW6AKI4FQSGVK X-Message-ID-Hash: FUGSW7PAAPQIHOVAQORFW6AKI4FQSGVK 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/18] video: truetype: Remove ctx from console_tt_priv 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 Now that vidconsole context is dynamically allocated and accessed via vidconsole_ctx(), remove the embedded ctx from console_tt_priv. Update console_tt_store to store console_tt_ctx directly instead of the entire priv structure. Also clean up functions to use vidconsole_ctx(dev) consistently and remove unused variable declarations. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 54 +++++++++++--------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index faf10f2730b..bafd35c2370 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -232,7 +232,6 @@ struct console_tt_ctx { * @metrics: List metrics that can be used * @num_metrics: Number of available metrics * @cur_fontdata: Current fixed font data (NULL if using TrueType) - * @ctx: Per-client context * @glyph_buf: Pre-allocated buffer for rendering glyphs. If a glyph fits, * this avoids malloc/free per character. Allocated lazily after * relocation to avoid using early malloc space. @@ -245,7 +244,6 @@ struct console_tt_priv { struct console_tt_metrics metrics[CONFIG_CONSOLE_TRUETYPE_MAX_METRICS]; int num_metrics; struct video_fontdata *cur_fontdata; - struct console_tt_ctx ctx; u8 *glyph_buf; int glyph_buf_size; struct stbtt_scratch scratch; @@ -255,11 +253,11 @@ struct console_tt_priv { /** * struct console_tt_store - Format used for save/restore of entry information * - * @priv: Private data + * @ctx: Per-client context * @cur: Current cursor position */ struct console_tt_store { - struct console_tt_priv priv; + struct console_tt_ctx ctx; struct pos_info cur; }; @@ -327,7 +325,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct vidconsole_ctx *com = vidconsole_ctx(dev); struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); void *dst; void *src; int i, diff, font_height; @@ -369,10 +367,8 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, static void clear_from(struct udevice *dev, int index) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct udevice *vid_dev = dev->parent; struct pos_info *start_pos, *end_pos; int xstart, xend; @@ -419,7 +415,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct console_tt_metrics *met = priv->cur_met; stbtt_fontinfo *font; int width, height, xoff, yoff; @@ -477,7 +473,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, x_shift = xpos - (double)tt_floor(xpos); xpos += advance * met->scale; width_frac = (int)VID_TO_POS((kern + advance) * met->scale); - if (x + width_frac >= vc_ctx->xsize_frac) + if (x + width_frac >= com->xsize_frac) return -EAGAIN; /* Write the current cursor position into history */ @@ -682,11 +678,9 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, */ static int console_truetype_backspace(struct udevice *dev) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct pos_info *pos; int xend; @@ -719,10 +713,8 @@ static int console_truetype_backspace(struct udevice *dev) static int console_truetype_entry_start(struct udevice *dev) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; /* A new input line has start, so clear our history */ ctx->pos_ptr = 0; @@ -1184,23 +1176,18 @@ static int truetype_ctx_dispose(struct udevice *dev, void *ctx) static int truetype_entry_save(struct udevice *dev, struct abuf *buf) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct console_tt_store store; const uint size = sizeof(store); if (xpl_phase() <= PHASE_SPL) return -ENOSYS; - /* - * store the whole priv structure as it is simpler that picking out - * what we need - */ if (!abuf_realloc(buf, size)) return log_msg_ret("sav", -ENOMEM); - store.priv = *priv; + store.ctx = *ctx; store.cur.xpos_frac = com->xcur_frac; store.cur.ypos = com->ycur; memcpy(abuf_data(buf), &store, size); @@ -1210,10 +1197,8 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct console_tt_store store; if (xpl_phase() <= PHASE_SPL) @@ -1223,7 +1208,7 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) com->xcur_frac = store.cur.xpos_frac; com->ycur = store.cur.ypos; - *ctx = store.priv.ctx; + *ctx = store.ctx; return 0; } @@ -1233,7 +1218,7 @@ static int truetype_get_cursor_info(struct udevice *dev) struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_cursor *curs = &com->curs; int x, y, index; uint height; @@ -1291,8 +1276,7 @@ const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) static int truetype_mark_start(struct udevice *dev) { - struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_ctx *ctx = &priv->ctx; + struct console_tt_ctx *ctx = vidconsole_ctx(dev); ctx->pos_start = ctx->pos_ptr; From patchwork Sat Jan 17 00:56:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1554 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=1768611493; bh=HWK4SN2+4+NCRzXvOleU3wEXCDRIAYUfFzmaQcjWGxM=; 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=a1C/oJo2HYFidqVpzWZ3hlVQMYCttyH/HmFaNTJViXxC447hwHCUd4crdx0Y5E0F3 lAJqmHTR8SD/EgWZtOFW5zbyL87Onc3swkw+ddHSxnYecatmN5Fs1/h7+lmU51B7jE l7I/9qoKHWYZyMe1FascA6PZTnDMyqPF4/aFHzNnn1/GeWm2/z5ptvJwOKcnJKmCpy Vz4P553lSWASBPYkZNSehW+i+vkMGDUuVR7d4ZjV2RwhALwh7l0eXmp/M/fkTKCSdK /Xx0kZMRn42aHz6y31npKMI0679yBebMtYD69MsXODu7Kp7QbRQINhxxgOXXZuiD5p Cd3QGVRUwkjTg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E9D04693E9 for ; Fri, 16 Jan 2026 17:58:13 -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 qSa1bJiTWgt4 for ; Fri, 16 Jan 2026 17:58:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611493; bh=HWK4SN2+4+NCRzXvOleU3wEXCDRIAYUfFzmaQcjWGxM=; 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=a1C/oJo2HYFidqVpzWZ3hlVQMYCttyH/HmFaNTJViXxC447hwHCUd4crdx0Y5E0F3 lAJqmHTR8SD/EgWZtOFW5zbyL87Onc3swkw+ddHSxnYecatmN5Fs1/h7+lmU51B7jE l7I/9qoKHWYZyMe1FascA6PZTnDMyqPF4/aFHzNnn1/GeWm2/z5ptvJwOKcnJKmCpy Vz4P553lSWASBPYkZNSehW+i+vkMGDUuVR7d4ZjV2RwhALwh7l0eXmp/M/fkTKCSdK /Xx0kZMRn42aHz6y31npKMI0679yBebMtYD69MsXODu7Kp7QbRQINhxxgOXXZuiD5p Cd3QGVRUwkjTg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D9A19693E0 for ; Fri, 16 Jan 2026 17:58:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611491; bh=D+nRfyjbTyXLAFQ/zHYhDWIXYDGqNYT+I/M4lpTdZ+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uV0z7TqhBpX0hXKntmfcySI9ccVWVXYOIm75+usLwSfRpmDYO4HmrPlEPo72WtW9K UcmW4TneAFSuAjO7o2DvgzQLhaIcl/XymPTQERAri1kfX4BWIshdnvUDSO7OYEemZL 4fnJZTczyIYJMsEQrOvGmMBT2BwOSGx9mHWq5dUpHTXKrBUTxKhWtbH4op/8cnsFuA pvxfUwYhs7WCvgTlQTUUnNMg/bWYn3/swwdzf/v7OV9y2U4f7PD29vLq5StHiHfh6V YekbPq1EqwUUO0UU1fIUgDNrriM5ewF7VQHNRGnd1TMqAICVILX/RYUOcFwVLd6wOL siNKHjwsiMYVg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 60215693D7; Fri, 16 Jan 2026 17:58:11 -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 00ozfmmPrNw7; Fri, 16 Jan 2026 17:58:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611487; bh=uRNEAUsHGlHCezx1BL03CnlmNqVOzCrWZ0Fsi+X0uc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aE/MngERYaK4swAr/srrTM7VFwOOTPsXmKfjGO9m7dpsfWCxngKgMtnfFfqnPeXZH EOy9nXq4rmduJXKO+kctFzU27aMVqA3TYcmNtqLdEfVoiyLtON7j96IOEJnnNVI5Pc qBJsi2NzhqExx4sBclpTU97dfxkLNng7WWYz5/y1lk13p8CCLk5cmmdTZqdDTAN0GV k04KiRz+zf89hlxnPdLDr47aSOfBgRnq+5xjrK2HXTqvwU+pkxzII0FUxdQ7g2EWQX Dv4TI+Js6RQTLd5eczzwpq8UCEZt+egKCe3fPKP8ul0m+WQSlFZfokJyss2VuvAWrj D4fcAPknIpdmg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 12E5A693B1; Fri, 16 Jan 2026 17:58:07 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:50 -0700 Message-ID: <20260117005702.1684841-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UY7NA4XGOPLFSFXP4VMGQFTNFK2XGT7Z X-Message-ID-Hash: UY7NA4XGOPLFSFXP4VMGQFTNFK2XGT7Z 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/18] video: truetype: Use consistent ctx/com pattern 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 Update functions to use a consistent pattern for accessing vidconsole context: - Use vidconsole_ctx(dev) to get console_tt_ctx pointer - Get vidconsole_ctx via &ctx->com This removes usage of vidconsole_ctx_from_priv() and the intermediate vc_priv variable, simplifying the code. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index bafd35c2370..db9f89797bf 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -264,7 +264,8 @@ struct console_tt_store { static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_ctx *com = vidconsole_ctx(dev); + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct console_tt_priv *priv = dev_get_priv(dev); void *end, *line; int font_height; @@ -411,11 +412,10 @@ static void clear_from(struct udevice *dev, int index) static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, int cp) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; + struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; stbtt_fontinfo *font; int width, height, xoff, yoff; @@ -914,8 +914,8 @@ static struct console_tt_metrics *find_metrics(struct udevice *dev, static void set_bitmap_font(struct udevice *dev, 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 console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct console_tt_priv *priv = dev_get_priv(dev); priv->cur_fontdata = fontdata; @@ -923,13 +923,13 @@ static void set_bitmap_font(struct udevice *dev, vidconsole_set_bitmap_font(dev, fontdata); - ctx->tab_width_frac = VID_TO_POS(fontdata->width) * 8 / 2; + com->tab_width_frac = VID_TO_POS(fontdata->width) * 8 / 2; } static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); + struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; struct console_tt_priv *priv = dev_get_priv(dev); struct udevice *vid_dev = dev_get_parent(dev); struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); @@ -1215,10 +1215,9 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) static int truetype_get_cursor_info(struct udevice *dev) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *com = vidconsole_ctx_from_priv(vc_priv); - struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; + struct console_tt_priv *priv = dev_get_priv(dev); struct vidconsole_cursor *curs = &com->curs; int x, y, index; uint height; From patchwork Sat Jan 17 00:56:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1555 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=1768611498; bh=PzzZhxj9inFQVVx9fyjhM1o7tkFWrqjL8QyHsoTv0vo=; 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=KAP5FCWO6xEpjXUwhTmZv7e89EmQr3W2632D/Jkzv9+Qxs1nmozxS5F+3T68n1XNJ R/9Iy3cIIVKtnbqen4TBveKYjMw5VCHmU68RBMiDPjC79P88RBqcy2Fp6UEWW8+E1i dwnLaFb9J0nfcgJsoljo43NPP1gRzQloNUVXj9ePwRZjycuA8CCNbHfgoT2IpqK3P7 ++Ckxk334Gwe97lFhXMlcvG1HEAt3c+iZHoiKio6BI6e7ce4pqSOLZ2xTYob8kOQQs WI4sOG8Oylg29vrrxGCHojz10u1P0dwvpHrJx/JqwuteEsN76EUOS2zox/kRxY3FKD RVbo4cRuFqF3w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 621F9693B1 for ; Fri, 16 Jan 2026 17:58:18 -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 xV7MM8HiW-Db for ; Fri, 16 Jan 2026 17:58:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611498; bh=PzzZhxj9inFQVVx9fyjhM1o7tkFWrqjL8QyHsoTv0vo=; 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=KAP5FCWO6xEpjXUwhTmZv7e89EmQr3W2632D/Jkzv9+Qxs1nmozxS5F+3T68n1XNJ R/9Iy3cIIVKtnbqen4TBveKYjMw5VCHmU68RBMiDPjC79P88RBqcy2Fp6UEWW8+E1i dwnLaFb9J0nfcgJsoljo43NPP1gRzQloNUVXj9ePwRZjycuA8CCNbHfgoT2IpqK3P7 ++Ckxk334Gwe97lFhXMlcvG1HEAt3c+iZHoiKio6BI6e7ce4pqSOLZ2xTYob8kOQQs WI4sOG8Oylg29vrrxGCHojz10u1P0dwvpHrJx/JqwuteEsN76EUOS2zox/kRxY3FKD RVbo4cRuFqF3w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 504E7693E0 for ; Fri, 16 Jan 2026 17:58:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611496; bh=XQ5IEBvnB1x+8jHGLJ0FoTOQxYC+3jgpbvCrkiwrsJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=suOr8/2MXB+6L2Q3vGn7ezjBDw6N/RwxxZaVH8ejyDhUu7+CGEJHz9lxNY2t6Mwgp 9IP4C1oxACZTrGTZYvfDyZqzPsTnvUOVYcFk60lS0g1PAntF40m7BMDBHKc6BoT1ws z6jOQ/Cyx4gMn1bqjzbgsToQRhltiBBXmGdeTd+o9E55MVkk0f+raczHCU0mF5ywBb rCu2yDezuWVnGHXP1CNwqMAkZkeujSM1+F8pqqvNfLgbRCzDU0lREOuAsVDIerFcEk hsz+3q23M8R4r+oqKgHDZpjnudUesilGheNxKQ00/jZ2/7tao+GqLdHArQsSueldQs kIWXKsLDMcrrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 560C3693E0; Fri, 16 Jan 2026 17:58:16 -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 Gnbi58fef4Ae; Fri, 16 Jan 2026 17:58:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611491; bh=UxTp6wSV0B3KY0xm2/M72jvbP2PWeop3H2aUBdypEcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SGGYr6y0vYFFaj99YVXXY/qV94KMsGpRiKZkYy8PTkQm8F7RGNRS/LJqm/5EMKail UUhCtfmp+ZpfimiVGNDH916mS9bStwuBjHwoE2xu6XJc48tZivewAbbqVO7wtQDogV HY1fIEMJ/ZTMc0N0g7fJRSUt5J7eS6ay9e8nyPicoVrYvGpEnxM4GUMW4stGqe0gXA 4dwTH7MoZlJjVid/q7RlVcEPZ8d9Dmifv8473h5mG4gsm4yZz0FCpfGd4Pdp7ylmD9 uKwaynVF/lum03GKLUWs7f/gLfuof8cwjpX09HNUS3/jYuXSQ7BjZXzlMWAcNzIawL RazPdt7DW56fA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A3657693B1; Fri, 16 Jan 2026 17:58:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:51 -0700 Message-ID: <20260117005702.1684841-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PXE4Q527QYHYZECIRCGKDXKWJ6RJS7ER X-Message-ID-Hash: PXE4Q527QYHYZECIRCGKDXKWJ6RJS7ER 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 13/18] video: Move cur_met to console_tt_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 cur_met pointer from console_tt_priv to console_tt_ctx so that it can be tracked per-context rather than per-device. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index db9f89797bf..32d31b6d8cc 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -207,6 +207,7 @@ struct console_tt_metrics { * struct console_tt_ctx - Per-client context for this driver * * @com: Common fields from the vidconsole uclass + * @cur_met: Current metrics being used * @pos_ptr: Current position in the position history * @pos_start: Value of pos_ptr when the cursor is at the start of the text * being entered by the user @@ -219,6 +220,7 @@ struct console_tt_metrics { */ struct console_tt_ctx { struct vidconsole_ctx com; + struct console_tt_metrics *cur_met; int pos_ptr; int pos_start; int pos_count; @@ -228,7 +230,6 @@ struct console_tt_ctx { /** * struct console_tt_priv - Private data for this driver * - * @cur_met: Current metrics being used * @metrics: List metrics that can be used * @num_metrics: Number of available metrics * @cur_fontdata: Current fixed font data (NULL if using TrueType) @@ -240,7 +241,6 @@ struct console_tt_ctx { * @scratch_buf: Memory for scratch buffer */ struct console_tt_priv { - struct console_tt_metrics *cur_met; struct console_tt_metrics metrics[CONFIG_CONSOLE_TRUETYPE_MAX_METRICS]; int num_metrics; struct video_fontdata *cur_fontdata; @@ -274,7 +274,7 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) if (priv->cur_fontdata) font_height = priv->cur_fontdata->height; else - font_height = priv->cur_met->font_size; + font_height = ctx->cur_met->font_size; line = vid_priv->fb + row * font_height * vid_priv->line_length; end = line + font_height * vid_priv->line_length; @@ -335,7 +335,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, if (priv->cur_fontdata) font_height = priv->cur_fontdata->height; else - font_height = priv->cur_met->font_size; + font_height = ctx->cur_met->font_size; dst = vid_priv->fb + rowdst * font_height * vid_priv->line_length; src = vid_priv->fb + rowsrc * font_height * vid_priv->line_length; @@ -416,7 +416,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_ctx *com = &ctx->com; struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_metrics *met = priv->cur_met; + struct console_tt_metrics *met = ctx->cur_met; stbtt_fontinfo *font; int width, height, xoff, yoff; double xpos, x_shift; @@ -919,7 +919,7 @@ static void set_bitmap_font(struct udevice *dev, struct console_tt_priv *priv = dev_get_priv(dev); priv->cur_fontdata = fontdata; - priv->cur_met = NULL; + ctx->cur_met = NULL; vidconsole_set_bitmap_font(dev, fontdata); @@ -930,11 +930,10 @@ static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_ctx *com = &ctx->com; - struct console_tt_priv *priv = dev_get_priv(dev); struct udevice *vid_dev = dev_get_parent(dev); struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); - priv->cur_met = met; + ctx->cur_met = met; com->x_charsize = met->font_size; com->y_charsize = met->font_size; com->xstart_frac = VID_TO_POS(2); @@ -1245,7 +1244,7 @@ static int truetype_get_cursor_info(struct udevice *dev) if (priv->cur_fontdata) height = priv->cur_fontdata->height; else - height = priv->cur_met->font_size; + height = ctx->cur_met->font_size; /* Store line pointer and height in cursor struct */ curs->x = x; @@ -1258,6 +1257,7 @@ static int truetype_get_cursor_info(struct udevice *dev) const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) { + struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct console_tt_priv *priv = dev_get_priv(dev); if (priv->cur_fontdata) { @@ -1266,7 +1266,7 @@ const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) return priv->cur_fontdata->name; } else { /* Using TrueType font */ - struct console_tt_metrics *met = priv->cur_met; + struct console_tt_metrics *met = ctx->cur_met; *sizep = met->font_size; return met->font_name; @@ -1284,6 +1284,7 @@ static int truetype_mark_start(struct udevice *dev) static int console_truetype_probe(struct udevice *dev) { + struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct console_tt_priv *priv = dev_get_priv(dev); struct udevice *vid_dev = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); @@ -1316,7 +1317,7 @@ static int console_truetype_probe(struct udevice *dev) ret = truetype_add_metrics(dev, tab->name, font_size, tab->begin); if (ret < 0) return log_msg_ret("add", ret); - priv->cur_met = &priv->metrics[ret]; + ctx->cur_met = &priv->metrics[ret]; select_metrics(dev, &priv->metrics[ret]); From patchwork Sat Jan 17 00:56:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1556 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=1768611500; bh=R1I4aWsCO65ni8waCIJ+vDM7HOed1EZxzgdwUyChi5I=; 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=svNUHir2cOoZBvGvRUaKfyEN0Vonc5mw85sWZmPcViAAOt3w3tKCdWxEhXn6VeQmB LuhRqfN7psV80krRjlpdKqMFad3UJ7v9W3utiJgMi+fCmb7htQWrEQDMBKHT4EBZ5F ur1/ck4vLffxdmbI/j1Ho+Cn2MnVnIa18zlB3XyNkmWRIAVaFKbDp7N4iIvZLN1Qp0 FVuU/9R/9xfnzo0NGJzYID9F+5oFo/I0l6JrXVXDaxWr3q5d3O51pCV3rdmjfwrpuT ObfiO3M+HRt93eekmQsvrPMYG0AINPC8gf9vxVfO0uaDZZniVXT4zofitQwEWD/i8b aJaKkRQ+I3dAg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D3A76693E6 for ; Fri, 16 Jan 2026 17:58:20 -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 hczMvnmpWcLz for ; Fri, 16 Jan 2026 17:58:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611499; bh=R1I4aWsCO65ni8waCIJ+vDM7HOed1EZxzgdwUyChi5I=; 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=kvyEEsDGQIlhAH9Ir/nFSpl5PfEVDgHdBLv8CDB9p7FcGVm47lqwIaL7dSUkoycMv UewhL864GuZT7MSuGKzIj0neJNB4Us6m9q0085MAKQmu5v0/r0XXKnPzRep/UePIXb gXBd7PW7LaNc0kFWxXQTwGWRhWkNNNFMPd2LiRVhdGo5j7eRjjYGRws7GMMCz+0tGf U7VJ26s6ldnidhhXGLxjUyjxTNC156NUtPYRYI+0zsD/FoRRQv+58N1szNUN/K/n2R yXt+N+dxMs1F4BqP9R62csHSMm1J4CM8/YN1rdZv4yhD24IlmTXEovcUDfQcl3xaYI GXXdVoWjYyhcQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A7E1693B1 for ; Fri, 16 Jan 2026 17:58:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611496; bh=aV5QlZ0GLchTE9WJR850uYRK36GuoXaKGTfhLKtjKlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BNd9S9OpXTbNyi8mcJWwxqHgrac4ZEu1xa80V2kOfA+DNgNukMZZ5+gQw5EQZXNPF ZNzESVRbI/W3wE6u89NJB6XZHPZwD++qiqAceIrrgfcQUtyKI+a7D6oTtK+91FGcAl pIyH/UiL3UdZdSClJMWkSOmmHpxhe4yC8bUIzoZHmeLe19PHK6tEAVj33qeCtpjOQH PPgxgfgeWERHMrLGD6vwkvtl1LJgb5R7U3iPw5axTwm1ESY40a3YgZ3KLv2rceXnur UVH/yoIrA8nXI/fMJugm2FY1BHweGXfk0IWJS8fbs2xDboaCuUMXTcHuBLMAblw906 YiCiTt0zmGa8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E9D19693B1; Fri, 16 Jan 2026 17:58:16 -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 JlMAqjUWlVjB; Fri, 16 Jan 2026 17:58:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611496; bh=2bOZOZCcwVR1UcXFFs6uagZF6136BojMD6Vf9YXwZ7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHpz50hlc/6QIbfkTQnIQIEWnUxd5D394KJRZ4EdEYrtZLZAa4zfeBcSM9WRWh1O+ gLhlwShcHQ6iA4ag6oFZXWVzFcCaPvMF1hY3D2g+sQuNd8sqvmEh0rEBU9KFC8TVic QjGaNMDLLrtLoTAyC8kC8wPPqICZx3iTVfvJVDI5IoXXnmJoq9n5VWsP9ZELsKbAUc bdJTtYc8QSLfeEOaVMkwzcJlHFz94Lvbyt0e5nko4gSZW+h88OT+z6BheZyLHM+Zsn qDCgpYZ5SLTRqPZsSBodtkAyg0GH5fsUXU/IaBJikZxMzZ9sZM90xkilAtpHKTFT7C mhcRkGe3fl5Vw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4AEBD693D7; Fri, 16 Jan 2026 17:58:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:52 -0700 Message-ID: <20260117005702.1684841-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: P2LCBGCPAPWODMIYFEHY62HA46OFS7X7 X-Message-ID-Hash: P2LCBGCPAPWODMIYFEHY62HA46OFS7X7 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 14/18] video: Move cur_fontdata to console_tt_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 cur_fontdata pointer from console_tt_priv to console_tt_ctx so that it can be tracked per-context rather than per-device. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 38 ++++++++++++++------------------ 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 32d31b6d8cc..2ab4f7dcb25 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -221,6 +221,7 @@ struct console_tt_metrics { struct console_tt_ctx { struct vidconsole_ctx com; struct console_tt_metrics *cur_met; + struct video_fontdata *cur_fontdata; int pos_ptr; int pos_start; int pos_count; @@ -232,7 +233,6 @@ struct console_tt_ctx { * * @metrics: List metrics that can be used * @num_metrics: Number of available metrics - * @cur_fontdata: Current fixed font data (NULL if using TrueType) * @glyph_buf: Pre-allocated buffer for rendering glyphs. If a glyph fits, * this avoids malloc/free per character. Allocated lazily after * relocation to avoid using early malloc space. @@ -243,7 +243,6 @@ struct console_tt_ctx { struct console_tt_priv { struct console_tt_metrics metrics[CONFIG_CONSOLE_TRUETYPE_MAX_METRICS]; int num_metrics; - struct video_fontdata *cur_fontdata; u8 *glyph_buf; int glyph_buf_size; struct stbtt_scratch scratch; @@ -266,13 +265,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_ctx *com = &ctx->com; - struct console_tt_priv *priv = dev_get_priv(dev); void *end, *line; int font_height; /* Get font height from current font type */ - if (priv->cur_fontdata) - font_height = priv->cur_fontdata->height; + if (ctx->cur_fontdata) + font_height = ctx->cur_fontdata->height; else font_height = ctx->cur_met->font_size; @@ -324,16 +322,15 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct vidconsole_ctx *com = vidconsole_ctx(dev); - struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *com = &ctx->com; void *dst; void *src; int i, diff, font_height; /* Get font height from current font type */ - if (priv->cur_fontdata) - font_height = priv->cur_fontdata->height; + if (ctx->cur_fontdata) + font_height = ctx->cur_fontdata->height; else font_height = ctx->cur_met->font_size; @@ -430,8 +427,8 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, bool use_buf; /* Use fixed font if selected */ - if (priv->cur_fontdata) - return console_fixed_putc_xy(dev, x, y, cp, priv->cur_fontdata); + if (ctx->cur_fontdata) + return console_fixed_putc_xy(dev, x, y, cp, ctx->cur_fontdata); /* Reset scratch buffer for this character */ stbtt_scratch_reset(&priv->scratch); @@ -916,9 +913,8 @@ static void set_bitmap_font(struct udevice *dev, { struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_ctx *com = &ctx->com; - struct console_tt_priv *priv = dev_get_priv(dev); - priv->cur_fontdata = fontdata; + ctx->cur_fontdata = fontdata; ctx->cur_met = NULL; vidconsole_set_bitmap_font(dev, fontdata); @@ -989,7 +985,7 @@ static int get_metrics(struct udevice *dev, const char *name, uint size, static int truetype_select_font(struct udevice *dev, const char *name, uint size) { - struct console_tt_priv *priv = dev_get_priv(dev); + struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct console_tt_metrics *met; struct video_fontdata *fontdata; int ret; @@ -1006,7 +1002,7 @@ static int truetype_select_font(struct udevice *dev, const char *name, } /* Continue with TrueType font selection */ - priv->cur_fontdata = NULL; + ctx->cur_fontdata = NULL; ret = get_metrics(dev, name, size, &met); if (ret) return log_msg_ret("sel", ret); @@ -1216,7 +1212,6 @@ static int truetype_get_cursor_info(struct udevice *dev) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_ctx *com = &ctx->com; - struct console_tt_priv *priv = dev_get_priv(dev); struct vidconsole_cursor *curs = &com->curs; int x, y, index; uint height; @@ -1241,8 +1236,8 @@ static int truetype_get_cursor_info(struct udevice *dev) y = com->ycur; /* Get font height from current font type */ - if (priv->cur_fontdata) - height = priv->cur_fontdata->height; + if (ctx->cur_fontdata) + height = ctx->cur_fontdata->height; else height = ctx->cur_met->font_size; @@ -1258,12 +1253,11 @@ static int truetype_get_cursor_info(struct udevice *dev) const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); - struct console_tt_priv *priv = dev_get_priv(dev); - if (priv->cur_fontdata) { + if (ctx->cur_fontdata) { /* Using fixed font */ - *sizep = priv->cur_fontdata->height; - return priv->cur_fontdata->name; + *sizep = ctx->cur_fontdata->height; + return ctx->cur_fontdata->name; } else { /* Using TrueType font */ struct console_tt_metrics *met = ctx->cur_met; From patchwork Sat Jan 17 00:56:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1557 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=1768611504; bh=iWJQyVAxDEBF3op59HdeupOoeF4Ip2iU0hAEiIo0JZU=; 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=ZEjSqvzpXkTctK7JhrEjvWRZLQbnswinJX1HjIRuKkx4oOHrOfjV88lGvvUEQ1Yob foUC+iDyT+gtN1E+pUOLwIfiKT88XtLESgOPXXt91LxSQriPxzuUpBK2dt27xEzKDq qyx7mlZsMY/rvraMjJBjyRyduITLWaciMHGM/FnFwxbC+0hjsg7wDpgqFKzPc0F+tZ nn3Jq871DlRMDZkg6uiFgn1ksKPIxwWTJyyVz5Cag9ycVf2sinTHOLtwTiqsZbT6u3 W8ah8Emvewkm7nvr/I5+A6V71VCQjV/Do2j9LferJrxxpuWJJ/OvInZC3CnFDbwGA+ 2CF2hfT0IshxA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BB140693E9 for ; Fri, 16 Jan 2026 17:58:24 -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 XC7OX_P3n-T6 for ; Fri, 16 Jan 2026 17:58:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611504; bh=iWJQyVAxDEBF3op59HdeupOoeF4Ip2iU0hAEiIo0JZU=; 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=ZEjSqvzpXkTctK7JhrEjvWRZLQbnswinJX1HjIRuKkx4oOHrOfjV88lGvvUEQ1Yob foUC+iDyT+gtN1E+pUOLwIfiKT88XtLESgOPXXt91LxSQriPxzuUpBK2dt27xEzKDq qyx7mlZsMY/rvraMjJBjyRyduITLWaciMHGM/FnFwxbC+0hjsg7wDpgqFKzPc0F+tZ nn3Jq871DlRMDZkg6uiFgn1ksKPIxwWTJyyVz5Cag9ycVf2sinTHOLtwTiqsZbT6u3 W8ah8Emvewkm7nvr/I5+A6V71VCQjV/Do2j9LferJrxxpuWJJ/OvInZC3CnFDbwGA+ 2CF2hfT0IshxA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A9A5E693E0 for ; Fri, 16 Jan 2026 17:58:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611503; bh=YbhVgcOJ/hgxEkuxD6tI9NVuFvxoR67zf+ZwK/Crkww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ryW0yrHSnacq08H64zb6fo2WyCGSJCb/ehHHmcwXHrbdW/DiwsCC9gsxGe3Kjp+WD cQtc+2vHWAjW8PhwpFA6Amzn3yW9SqFNxaumfY/5AXtdcPpdiMQZ0Me1pP7HKPcKM9 gcSFmuB7Mtw0ziiTE1OLM2M+ivk0j7qZJxizT0jnrsYGLTubEsC/9yZfneAwr6hmkm v0zV6k8DF02+rF0rXhotnN5iYURLeMKBASSLUlIp7NYoG1SCnHaWIA/epjWJDyVUP+ mnD+Jms5kT9GYmnjcQxLaTnEu91DuL8ioav858BgRa/s180wkg85YgRkJV2DYSs8fr JvRFTCzN6w/1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1DB1C693E0; Fri, 16 Jan 2026 17:58: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 ee7g6l1Sclza; Fri, 16 Jan 2026 17:58:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611497; bh=raKb6aa7iVz5BCotmvIDOiC2kzcDk2r1nC95wygwZaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2zi8SjW2y8PvjJrpe/M0ea4LWLOxp+0tlxC1OrjrFdiz9JxvFpTEQtsNxnN7avRa 3rTNe60N5i4+4YIVAD5W7IjObpbihJbklTZn3NkXolkBKHPvskJ/IXP5Ka0zDO8FG2 6gBNlbOEzUHxs4pQ5dryM4ggk7Lf7HjShd93oysnoCB9HSYYRAYuNuAdCJZLVSmJc5 NRRPWuXtUyDCkiGGxqAorl2Ryu0rqQd3iPdEs2O9sPGh8b7GiPQiwNS42ccmwD+tPi eXWGmxkBcfrApcGuR0+TYutkcgtMBtUPccwcAxwXwKAbY4UFkCx9bRsuuaeEkT/AIu ZMgGTUmHyQhhw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 36635693D7; Fri, 16 Jan 2026 17:58:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:53 -0700 Message-ID: <20260117005702.1684841-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GNU5KMFA2QYIHGKWXX3BPRJ7EAXNTBGY X-Message-ID-Hash: GNU5KMFA2QYIHGKWXX3BPRJ7EAXNTBGY 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 15/18] video: truetype: Remove redundant store.cur field 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 store.cur field is used to separately save xcur_frac and ycur, but these are already saved as part of store.ctx since console_tt_ctx contains vidconsole_ctx which has these fields. Additionally, the restore code is buggy - it sets com->xcur_frac and com->ycur, then immediately overwrites them with *ctx = store.ctx. Remove the redundant field and simplify the save/restore functions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 2ab4f7dcb25..7b1540b6c40 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -253,11 +253,9 @@ struct console_tt_priv { * struct console_tt_store - Format used for save/restore of entry information * * @ctx: Per-client context - * @cur: Current cursor position */ struct console_tt_store { struct console_tt_ctx ctx; - struct pos_info cur; }; static int console_truetype_set_row(struct udevice *dev, uint row, int clr) @@ -1172,7 +1170,6 @@ static int truetype_ctx_dispose(struct udevice *dev, void *ctx) static int truetype_entry_save(struct udevice *dev, struct abuf *buf) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); - struct vidconsole_ctx *com = &ctx->com; struct console_tt_store store; const uint size = sizeof(store); @@ -1183,8 +1180,6 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) return log_msg_ret("sav", -ENOMEM); store.ctx = *ctx; - store.cur.xpos_frac = com->xcur_frac; - store.cur.ypos = com->ycur; memcpy(abuf_data(buf), &store, size); return 0; @@ -1193,16 +1188,12 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); - struct vidconsole_ctx *com = &ctx->com; struct console_tt_store store; if (xpl_phase() <= PHASE_SPL) return -ENOSYS; memcpy(&store, abuf_data(buf), sizeof(store)); - - com->xcur_frac = store.cur.xpos_frac; - com->ycur = store.cur.ypos; *ctx = store.ctx; return 0; From patchwork Sat Jan 17 00:56:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1558 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=1768611508; bh=/pXSfjHsm+LY/YbsxxojJYVWO48+wlwZknojriv98/I=; 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=R6GLnYgFvi+QRovcSrD1cTZpcY9lUw88VTK7hkiNarnw/jMgTeJ72/ueu/cLJHS/3 YalZxK0SGHesrrQMJR91QY87giJSwPdkCKyC8FOB83Qry+NZUy6k3iwg4zyLJdkBO8 Mqn4k3s8jlQ9MN5bWwib7wBJ7zP6Z5nKOoZ2UK7a337XNLgOl+atMUME1KfIoRXFvI mNhgFZitm5Zzdj6woO2di3/1MUnnPS+oLy5gvnspPj/vaxGBg7HvsigApBJ86emCnC LIcP0xV2kY8izhsJEamQANftBVP+aHkwqCT/uEEuCZNBsCE8+UrqprILJBIrcT9tKW hTp11JJYyBw9w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 28587693E9 for ; Fri, 16 Jan 2026 17:58: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 10024) with ESMTP id REeP2q5_8sH4 for ; Fri, 16 Jan 2026 17:58:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611508; bh=/pXSfjHsm+LY/YbsxxojJYVWO48+wlwZknojriv98/I=; 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=R6GLnYgFvi+QRovcSrD1cTZpcY9lUw88VTK7hkiNarnw/jMgTeJ72/ueu/cLJHS/3 YalZxK0SGHesrrQMJR91QY87giJSwPdkCKyC8FOB83Qry+NZUy6k3iwg4zyLJdkBO8 Mqn4k3s8jlQ9MN5bWwib7wBJ7zP6Z5nKOoZ2UK7a337XNLgOl+atMUME1KfIoRXFvI mNhgFZitm5Zzdj6woO2di3/1MUnnPS+oLy5gvnspPj/vaxGBg7HvsigApBJ86emCnC LIcP0xV2kY8izhsJEamQANftBVP+aHkwqCT/uEEuCZNBsCE8+UrqprILJBIrcT9tKW hTp11JJYyBw9w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 17E41693E0 for ; Fri, 16 Jan 2026 17:58:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611506; bh=qWSEgXBRGekQ+eLKchauh4dSyEfmI5c4KOjC9w6bnjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBd4t5x1XTxeS6VKZlTWipJRbBAIhJbKPwUQFVDjy0uceycEeImVk8lWUXX1h527j rYEQBT9XeAmsiGxJmPqSEAcHdSmmc7yhq4x5OPumeeU/Zm6VpjpWLaAIgJqzJD/MFl +Z2QndMwelRMTU8IuXFWzgZfK4eDhACFfquZ7B4tT9amkw3e16k5uxDvYQ/xMDnCVS u5NxKDUYTOQZiglwdgWkX6cmy/yUGPQIz2hEG9xWTfvPGeBX++jVs2kS7qAJDwCXz0 adYcP9oTm/54+k9pCw986oNVatsw7ipBDDuZ9k13uBmmgqpHiaayO2g+M9d1F9ypVT qyFgpnEYcARpg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1FA49693D7; Fri, 16 Jan 2026 17:58:26 -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 1HE0Rt86ThkQ; Fri, 16 Jan 2026 17:58:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611502; bh=KJmFl1uQyFYKofcvcgyOHvmWOb8+4tA3dyqlcFhoZqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L/PtOBcYZSVrwoy/LYLDCNBEXtbCiDtspSSOmpFFm6mdZy923T1HrjHebH6RanlUg DMhyAkazvpeQ1dZkZCY6mAbvVQ0YgqiHm6Ltozi4SdbJ8d1cqzF4fTIDhWRrgCC/x2 m+Gk0ef0xXtyBD/BdyqlGUo2TrZiFwtTiXP0ubDOq6B1vK6/oMPwfceNtJIkZrM7fg fqN3ePQ7fiqoP6Xoo/Na5KLeyBLAI3/DZ5FwZC0HHjRP3a5NAVvzzKS4xIluKKRnEE fPxeOQuCdf5OSSyUHVXLlkpGTi/ffhKsRtwHCWDjJj89acKAdl2XpPfJ3+LnEHmEFR kvOeCO0v3bKXg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C6907693B1; Fri, 16 Jan 2026 17:58:21 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:54 -0700 Message-ID: <20260117005702.1684841-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RTOTB4YW6STU2Q6X3P3SKJNOSSCFDZDQ X-Message-ID-Hash: RTOTB4YW6STU2Q6X3P3SKJNOSSCFDZDQ 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/18] video: truetype: Remove console_tt_store struct 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 Now that console_tt_store only contains console_tt_ctx, remove the wrapper struct and save/restore console_tt_ctx directly. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 7b1540b6c40..f73fb3e6595 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -249,15 +249,6 @@ struct console_tt_priv { char *scratch_buf; }; -/** - * struct console_tt_store - Format used for save/restore of entry information - * - * @ctx: Per-client context - */ -struct console_tt_store { - struct console_tt_ctx ctx; -}; - static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1170,8 +1161,7 @@ static int truetype_ctx_dispose(struct udevice *dev, void *ctx) static int truetype_entry_save(struct udevice *dev, struct abuf *buf) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); - struct console_tt_store store; - const uint size = sizeof(store); + const uint size = sizeof(*ctx); if (xpl_phase() <= PHASE_SPL) return -ENOSYS; @@ -1179,8 +1169,7 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) if (!abuf_realloc(buf, size)) return log_msg_ret("sav", -ENOMEM); - store.ctx = *ctx; - memcpy(abuf_data(buf), &store, size); + memcpy(abuf_data(buf), ctx, size); return 0; } @@ -1188,13 +1177,11 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf) static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) { struct console_tt_ctx *ctx = vidconsole_ctx(dev); - struct console_tt_store store; if (xpl_phase() <= PHASE_SPL) return -ENOSYS; - memcpy(&store, abuf_data(buf), sizeof(store)); - *ctx = store.ctx; + memcpy(ctx, abuf_data(buf), sizeof(*ctx)); return 0; } From patchwork Sat Jan 17 00:56:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1559 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=1768611512; bh=gM0MimxwUaUYQTEnJbWD7/hcIGC/6upl2ses7GqTX3Y=; 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=kwyaLzQuDFBj3kToqBF3JUDl0el/gAlf0qpLAb1WmUWi8ZtoNOqmMvF9+MfAnEulj afRIY8e3M0FnnTE0Ns3MHOZFHgnJTOHaGmMVgkVmv0dxAzWjqBn75k4aTuYIpi7sNB 1pUd8QbJbVBbGWwbWKcJCo5GsCUBR9xn8jHJdpu1+NNrVB/49OPZai4Afcz5BCB3Wc mI5NHXkEHbvF0ZHyJZ33EJLMBqbmaVnoYcMeBHeyMncZyIDTK2r/QoXtoAt+zkC88w GWHD6Gjnfn38fcWX3bvBp4zM0Fxsmlcem/s5ka5TBiqBp3DVIbjSo+C/RV61Fn9pre +OAmJ0pl8pmew== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A2560693E9 for ; Fri, 16 Jan 2026 17:58:32 -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 yYyKvaz_6lBN for ; Fri, 16 Jan 2026 17:58:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611512; bh=gM0MimxwUaUYQTEnJbWD7/hcIGC/6upl2ses7GqTX3Y=; 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=kwyaLzQuDFBj3kToqBF3JUDl0el/gAlf0qpLAb1WmUWi8ZtoNOqmMvF9+MfAnEulj afRIY8e3M0FnnTE0Ns3MHOZFHgnJTOHaGmMVgkVmv0dxAzWjqBn75k4aTuYIpi7sNB 1pUd8QbJbVBbGWwbWKcJCo5GsCUBR9xn8jHJdpu1+NNrVB/49OPZai4Afcz5BCB3Wc mI5NHXkEHbvF0ZHyJZ33EJLMBqbmaVnoYcMeBHeyMncZyIDTK2r/QoXtoAt+zkC88w GWHD6Gjnfn38fcWX3bvBp4zM0Fxsmlcem/s5ka5TBiqBp3DVIbjSo+C/RV61Fn9pre +OAmJ0pl8pmew== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8F005693E0 for ; Fri, 16 Jan 2026 17:58:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611510; bh=WIARj7uR8j0nzQbTocXKiuxGV/mnvFs8PE6BrZE8MzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cI869zwcugtBWw4fergELGvOLHJm3k2RPo5hdVr8mZMIhjfLpBnKtyyJZktYOBRWD jhzse3CcgbuBHlOgP9CZ/+Ubq+aMxNEnhI/BUxjshYHISP51754tWsfuyXXWOgdj+1 Krrjma+S9pCRcEJ1/MnKhTpTtK410jnofTKnee3pw2ZWUncoKNzF0/lg+7JPTHNBR/ mpxg96mYZLsa6nUj7PSsGc9zqlSXB7YG5+sqeUJ1IfTJHmQ1Z8AXS2EoYy1wpRkqRW RWBTBo6TpUwuvDpfF73Dfu5b9+yjS5vSLpuf8gxgUMsjyGEjgaQai/lS8gRoDUyVuV PHIW5CjvnAc7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B07A1693D7; Fri, 16 Jan 2026 17:58:30 -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 CLTh0l2G9l0K; Fri, 16 Jan 2026 17:58:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611506; bh=h7vFWhBEKc6esA2L+e8d1Q4xf4uZ5MHxhyRnxZ6xK8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VRxXzuUuBgXRkwsBP5RCfjahTW3yvoQ1sj5Hf6EEVe42W66SQ8llWCm9wTCvyIq/D 0an7MIyLkuuFAfQRLumL4gJFzxtc1gSvBWHnOd1CGfrTQV+a+ReVht62n1M6om24qd GwAgJWrKk4ZVdtOHhUSSql57AQabfhI2LJGVsFANjmgpPhAj5nmt0Jr0Vc2co89scE saHhTSwPlDP+k69eO6WKzlkmEwEllLfnVqPbA7o/qDN3xGp8NClFU9pxLEDO+gLlZz FtoMVO5cL6hhSlFzrRxjtR9Dt5SaI8vt6/DCmpQg1Ra68CiiC81yHiJeJQq8JGU5VB INQtAo5aq/ong== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 642A7693B1; Fri, 16 Jan 2026 17:58:26 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:55 -0700 Message-ID: <20260117005702.1684841-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5JGY4WXJNM3LHLEVZD2F6WWC5YW5MAT5 X-Message-ID-Hash: 5JGY4WXJNM3LHLEVZD2F6WWC5YW5MAT5 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 17/18] video: normal: Remove console_store struct 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 console_store struct only saved a few fields from vidconsole_ctx. Since console_ctx contains vidconsole_ctx, save/restore the entire console_ctx directly instead. This is simpler and consistent with the truetype driver approach. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 4854e953e58..fa9d496ef86 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -24,12 +24,6 @@ struct console_ctx { struct vidconsole_ctx com; }; -struct console_store { - int xpos_frac; - int ypos; - int cli_index; -}; - static int console_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -149,10 +143,8 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) static __maybe_unused int normal_entry_save(struct udevice *dev, struct abuf *buf) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(vc_priv); - struct console_store store; - const uint size = sizeof(store); + struct console_ctx *ctx = vidconsole_ctx(dev); + const uint size = sizeof(*ctx); if (xpl_phase() <= PHASE_SPL) return -ENOSYS; @@ -160,10 +152,7 @@ static __maybe_unused int normal_entry_save(struct udevice *dev, if (!abuf_realloc(buf, size)) return log_msg_ret("sav", -ENOMEM); - store.xpos_frac = ctx->xcur_frac; - store.ypos = ctx->ycur; - store.cli_index = ctx->cli_index; - memcpy(abuf_data(buf), &store, size); + memcpy(abuf_data(buf), ctx, size); return 0; } @@ -171,18 +160,12 @@ static __maybe_unused int normal_entry_save(struct udevice *dev, static __maybe_unused int normal_entry_restore(struct udevice *dev, struct abuf *buf) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(vc_priv); - struct console_store store; + struct console_ctx *ctx = vidconsole_ctx(dev); if (xpl_phase() <= PHASE_SPL) return -ENOSYS; - memcpy(&store, abuf_data(buf), sizeof(store)); - - ctx->xcur_frac = store.xpos_frac; - ctx->ycur = store.ypos; - ctx->cli_index = store.cli_index; + memcpy(ctx, abuf_data(buf), sizeof(*ctx)); return 0; } From patchwork Sat Jan 17 00:56:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1560 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=1768611517; bh=CgRDcT74QYaDTlqE613tftQ7Vwf7wXPUl8k6KjJiVqU=; 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=B003qdfMTqrzid430sgQwWyAHj0sGEnIXOP1RTyv9Q/A0pofDJU3nrQvWVAgntBDz I/LkokzWnfZLiC3q/k9DpJ9qjzGYfuIpvXUzybdSzmneOopidj9hQUoFq31j1wJrqE irCFltLScgVOUDk/SXlOR/gsjQc1f/wyvpvOZx10WpEshgXt3z2CC28uVyV3OAmC84 rwEd05kL4U2ti533NVuAFvygR72s0P/ZG8pCWcJXhOsl5LyqpBIcoyYprsDJgOUQFg TYvhoofHzPdkg+mQHbms6v8ELpYFL1KhiRNR4ZcB5oiegf5boRfiVhCRzawlPolMqi V0/1Phg31Cy0w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5F775693E9 for ; Fri, 16 Jan 2026 17:58: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 mR2fw6m4Sxzp for ; Fri, 16 Jan 2026 17:58:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611517; bh=CgRDcT74QYaDTlqE613tftQ7Vwf7wXPUl8k6KjJiVqU=; 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=B003qdfMTqrzid430sgQwWyAHj0sGEnIXOP1RTyv9Q/A0pofDJU3nrQvWVAgntBDz I/LkokzWnfZLiC3q/k9DpJ9qjzGYfuIpvXUzybdSzmneOopidj9hQUoFq31j1wJrqE irCFltLScgVOUDk/SXlOR/gsjQc1f/wyvpvOZx10WpEshgXt3z2CC28uVyV3OAmC84 rwEd05kL4U2ti533NVuAFvygR72s0P/ZG8pCWcJXhOsl5LyqpBIcoyYprsDJgOUQFg TYvhoofHzPdkg+mQHbms6v8ELpYFL1KhiRNR4ZcB5oiegf5boRfiVhCRzawlPolMqi V0/1Phg31Cy0w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4F340693D7 for ; Fri, 16 Jan 2026 17:58:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611515; bh=pxviyNhzuuR8spvraPWARtWMnJr7Fi+quJXKpbCCmX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+tyHG0dUyCQ2FvJoyB5Vw2qVlEWW7XCg5bZ7zICeDRa6aKswkG3CTX+Tn8R3kxmy FPX7k80gNk8/WJYz7DyjW0CHNarniCKFf+2j6zD98FnSV9CDbC9Jj51pVsjBDiqpyi 0nRn07zxZDbdlLj6Nwrf99/rHrCUebIyvday6JavmfgNSxwl7GD4kBG/O/w6v5ko7A udU3RpL9WV1FAZ8jAjHiLza8UOQsb9E5I0gu3L3wcKhEGiV6Fjve3cxMvaZOJ5bfse 6RZhBXiZQ1uyGo7BDOhV+fzjq25QK0fUeLC8TobgzYCreJTI6KnsxkYoikzn4rYbZs TgN40Wh2PxrGQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5162D693D7; Fri, 16 Jan 2026 17:58: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 6ikxdRkSFB9j; Fri, 16 Jan 2026 17:58:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768611511; bh=8M8wtqWuAke80OToOUojJRKzT8LltwxyZoHLmo05IyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSleWQxYGr+Z3yBMyszQJjNZdswEGblzWFabM5CPrOD6l4PPc0mZeHKIQPTo4KqV2 oxRnqCrmPe57D0KwB8WaDW1WR+ONOkXezqcIccEswS4V/YW+jf+TJRpOIKSsfHE4QG E+i0aOTpJY9hBmRZLg6RzW6eWyDfh3MpGn1UcvsiM5uFupCm0l4n04nZg7HTGIqt6b eGzKDYc3mS0Prlk9pHMKXW740lIIsfoVTleQ927ws97VLFHPWqTeWK029KIuwasKCn 62hJL4FZNczGPIzOFNRqrG0On1Y2nHTbbaYSV3xM28kLMivQZ6YMkxulCPcGboE8vs hBjhRyF43eQvQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0198F693B1; Fri, 16 Jan 2026 17:58:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 17:56:56 -0700 Message-ID: <20260117005702.1684841-19-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117005702.1684841-1-sjg@u-boot.org> References: <20260117005702.1684841-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NFDHZQMZTHSL4PBPWEAPACQAOREEN77B X-Message-ID-Hash: NFDHZQMZTHSL4PBPWEAPACQAOREEN77B 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 18/18] video: Add test for entry save/restore 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 dm_test_video_entry_save() and dm_test_video_entry_save_tt() to directly test vidconsole_entry_save() and vidconsole_entry_restore() for both bitmap and truetype fonts. The tests verify that cursor position is correctly saved and restored. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/dm/video.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c index d3978f4b00c..97778a70559 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1516,3 +1516,70 @@ static int dm_test_video_context_alloc(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_context_alloc, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test vidconsole entry save/restore */ +static int check_entry_save(struct unit_test_state *uts, struct udevice *con) +{ + struct vidconsole_priv *priv; + struct vidconsole_ctx *ctx; + int xcur_frac, ycur; + struct abuf buf; + + priv = dev_get_uclass_priv(con); + ctx = priv->ctx; + + /* Move cursor to a known position */ + vidconsole_position_cursor(con, 5, 3); + xcur_frac = ctx->xcur_frac; + ycur = ctx->ycur; + + /* Save the state */ + abuf_init(&buf); + ut_assertok(vidconsole_entry_save(con, &buf)); + + /* Move cursor to a different position */ + vidconsole_position_cursor(con, 10, 7); + ut_assert(ctx->xcur_frac != xcur_frac || ctx->ycur != ycur); + + /* Restore the state */ + ut_assertok(vidconsole_entry_restore(con, &buf)); + + /* Verify cursor is back at saved position */ + ut_asserteq(xcur_frac, ctx->xcur_frac); + ut_asserteq(ycur, ctx->ycur); + + abuf_uninit(&buf); + + return 0; +} + +/* Test entry save/restore with bitmap font */ +static int dm_test_video_entry_save(struct unit_test_state *uts) +{ + struct udevice *dev, *con; + + ut_assertok(select_vidconsole(uts, "vidconsole0")); + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + + ut_assertok(check_entry_save(uts, con)); + + return 0; +} +DM_TEST(dm_test_video_entry_save, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test entry save/restore with truetype font */ +static int dm_test_video_entry_save_tt(struct unit_test_state *uts) +{ + struct udevice *dev, *con; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, NULL, 30)); + + ut_assertok(check_entry_save(uts, con)); + + return 0; +} +DM_TEST(dm_test_video_entry_save_tt, UTF_SCAN_PDATA | UTF_SCAN_FDT);