From patchwork Sun Jan 18 20:42: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: 1607 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=1768769072; bh=0RtA6oyvWoNfVE3TFkkMMe+lLQfQiK0Erua7VyBmC/4=; 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=b9XstD/CeKXD37TXtCKclBVH0EJscCdaM495EgAYiFntbqR+fT2qd/DzK/wsskDCb 2YzITGCZ1IpwzQSPxFmgut7/Fq0qn0vUTGqFpOv1xqk3EmR135osTWuFdVJmoGCgEO /mddB2hTfHG3SgT9DTy92zFM8oqle2WFMissApVx4nB/Uw4t3vfNm6o+8ITLhq1x1e 8LKev/GI+FGED2kyZuko1kW/O+LnpwyXkViYPCHuUEnYuAkGAXBXG+qzEGEUVlD9xb SFr7SxinLKYVRAwKoEsMmV/Iouwu7EKlLHJb8QUgAfnRLe7OAKyzu7gyDv0FwFU1RO 7jSMtF2Od5sAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 310396949E for ; Sun, 18 Jan 2026 13:44: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 xW6MNR31TSE3 for ; Sun, 18 Jan 2026 13:44:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769072; bh=0RtA6oyvWoNfVE3TFkkMMe+lLQfQiK0Erua7VyBmC/4=; 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=b9XstD/CeKXD37TXtCKclBVH0EJscCdaM495EgAYiFntbqR+fT2qd/DzK/wsskDCb 2YzITGCZ1IpwzQSPxFmgut7/Fq0qn0vUTGqFpOv1xqk3EmR135osTWuFdVJmoGCgEO /mddB2hTfHG3SgT9DTy92zFM8oqle2WFMissApVx4nB/Uw4t3vfNm6o+8ITLhq1x1e 8LKev/GI+FGED2kyZuko1kW/O+LnpwyXkViYPCHuUEnYuAkGAXBXG+qzEGEUVlD9xb SFr7SxinLKYVRAwKoEsMmV/Iouwu7EKlLHJb8QUgAfnRLe7OAKyzu7gyDv0FwFU1RO 7jSMtF2Od5sAw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1FA9569491 for ; Sun, 18 Jan 2026 13:44:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769070; bh=MR+CnSrbbOUrvY94yPnRTHUvCDUuuNRLl2jJaDdbn2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q++wMM35QqZAjOJasq5j0kY+Hn34h9Y/fq0p2q+Ew+gF7MzvcrTWGWvl5I/0A0GqF KHa9pdkdOIwD4AIKBbopGk0m48RHijp8DHpMLXSHYrIUGld3gnJ0Br5kgePyBrmRJL x388+e89BnepkRC68ws8Z9PpRk1W+lAMQ32fOmoZBXidGSdvMM6vRHDP600XWyB3rl Dz717XyD+5gcJzxaJNeUvlWfa3zMGzNXa8D0yjKgb66GExgOruQgmX+LLdfpsuuqYz r3SGDLu936SIuCnco0Pd422zXB1WgsMMVE6p6bSU2igLxj+KP9fv787a2i/aXrK5vA VQliTQhb7Uoiw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 196B06948C; Sun, 18 Jan 2026 13:44: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 MetWsW36SpfI; Sun, 18 Jan 2026 13:44:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769066; bh=yvOT3KruU+UiknjPjOw/fB0LSCK/lB8f7ZWUpoLNG/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nmqT18DxDhB7lJnXewrGuOOxi/+a7VfujuxkUbEOx1CoRhqnhH1gyshtD1D1NY+b3 Bo/RzZ636TpGonDLJgp/L0jLrYqnJMooNtdBLGwCL9xP9s6DrxycxLKPlBfAzAq5DQ x/ngeuc5P1ox6G+orQk46mHTni142EZ6SsVLWEnpyqata8XcIhGq3CA9sIOQMtOCBD xQSY/sM2zHpsyz2fQCcQtr1+okO1s5+XKLO0wcfNxJIN9Iws8YJZpMnH56r6hB8Pfr yaR3WJomkc9RMqgKPt1As7ybhFV+8PraMh4jr1qq+6sEKQF/QccIGJAu81UomSCz7k RlG+m9Odl9E3w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BE7036946A; Sun, 18 Jan 2026 13:44:25 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:42:55 -0700 Message-ID: <20260118204303.1982533-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118204303.1982533-1-sjg@u-boot.org> References: <20260118204303.1982533-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OKNQCRTLVFGGXJHKX5XAJNF23FPVROQP X-Message-ID-Hash: OKNQCRTLVFGGXJHKX5XAJNF23FPVROQP 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/16] expo: Enable textedit dimension calculation for word-wrap 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 textedit support to scene_calc_dims() by calling scene_txted_calc_dims(), thus enabling proper dimension-calculation for textedit objects. This is needed for word-wrapping. Update expo_render_textedit() with the new expected value, now that word-wrapping is working. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene.c | 24 ++++++++++++++++-------- boot/scene_internal.h | 39 +++++++++++++++++++++++++-------------- test/boot/expo.c | 2 +- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 5691cbce847..3565bfd77de 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -773,7 +773,6 @@ int scene_calc_arrange(struct scene *scn, struct expo_arrange_info *arr) case SCENEOBJT_IMAGE: case SCENEOBJT_TEXT: case SCENEOBJT_BOX: - case SCENEOBJT_TEXTEDIT: break; case SCENEOBJT_MENU: { struct scene_obj_menu *menu; @@ -782,14 +781,11 @@ int scene_calc_arrange(struct scene *scn, struct expo_arrange_info *arr) label_id = menu->title_id; break; } - case SCENEOBJT_TEXTLINE: { - struct scene_obj_textline *tline; - - tline = (struct scene_obj_textline *)obj, - label_id = tline->tin.label_id; + case SCENEOBJT_TEXTLINE: + case SCENEOBJT_TEXTEDIT: + label_id = scene_obj_txtin(obj)->label_id; break; } - } if (label_id) { int ret; @@ -1517,7 +1513,6 @@ int scene_calc_dims(struct scene *scn) case SCENEOBJT_NONE: case SCENEOBJT_TEXT: case SCENEOBJT_BOX: - case SCENEOBJT_TEXTEDIT: case SCENEOBJT_IMAGE: { int width; @@ -1533,6 +1528,19 @@ int scene_calc_dims(struct scene *scn) } case SCENEOBJT_MENU: break; + case SCENEOBJT_TEXTEDIT: { + struct scene_obj_txtedit *ted; + + ted = (struct scene_obj_txtedit *)obj; + if (!scn->expo->cons || do_menus) + continue; + + ret = scene_txted_calc_dims(ted, scn->expo->cons); + if (ret) + return log_msg_ret("ted", ret); + + break; + } case SCENEOBJT_TEXTLINE: { struct scene_obj_textline *tline; diff --git a/boot/scene_internal.h b/boot/scene_internal.h index 8c2196a7b11..db11f9c0f60 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -29,20 +29,6 @@ enum scene_obj_t; typedef int (*expo_scene_obj_iterator)(struct scene_obj *obj, void *priv); -/** - * scene_obj_txtin() - Get text-input info from a scene object - * - * This works for both textline and textedit objects since they have - * struct scene_txtin at the same offset (immediately after struct scene_obj). - * - * @obj: Object to get text-input info from - * Return: pointer to the text-input info - */ -static inline struct scene_txtin *scene_obj_txtin(struct scene_obj *obj) -{ - return (struct scene_txtin *)(obj + 1); -} - /** * enum scene_bbox_t - Parts of an object which can have a bounding box * @@ -64,6 +50,20 @@ enum scene_bbox_t { SCENEBB_count, }; +/** + * scene_obj_txtin() - Get text-input info from a scene object + * + * This works for both textline and textedit objects since they have + * struct scene_txtin at the same offset (immediately after struct scene_obj). + * + * @obj: Object to get text-input info from + * Return: pointer to the text-input info + */ +static inline struct scene_txtin *scene_obj_txtin(struct scene_obj *obj) +{ + return (struct scene_txtin *)(obj + 1); +} + /** * expo_lookup_scene_id() - Look up a scene ID * @@ -501,6 +501,17 @@ int scene_dims_union(struct scene *scn, uint id, struct scene_obj_dims *dims); int scene_textline_calc_dims(struct scene_obj_textline *tline, struct udevice *cons); +/** + * scene_txted_calc_dims() - Calculate the dimensions of a textedit + * + * Updates the width and height of the textedit based on its contents + * + * @ted: Textedit to update + * @cons: UCLASS_VIDEO_CONSOLE device (cannot be NULL) + * Returns 0 if OK, -ve on error + */ +int scene_txted_calc_dims(struct scene_obj_txtedit *ted, struct udevice *cons); + /** * scene_menu_calc_bbox() - Calculate bounding boxes for the menu * diff --git a/test/boot/expo.c b/test/boot/expo.c index 95b029568d0..97b9bf82bb7 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1533,7 +1533,7 @@ static int expo_render_textedit(struct unit_test_state *uts) expo_set_scene_id(exp, SCENE1); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(19493, video_compress_fb(uts, dev, false)); + ut_asserteq(19860, video_compress_fb(uts, dev, false)); abuf_uninit(&buf); abuf_uninit(&logo_copy);