[Concept,20/27] expo: Add per-line measurement logging

Message ID 20260119204130.3972647-21-sjg@u-boot.org
State New
Headers
Series Expo debugging and textedit improvements (part E) |

Commit Message

Simon Glass Jan. 19, 2026, 8:41 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add detailed per-line measurement logging using log_content(), showing
each line's bounding box and text content after measurement.

Use scene_chklog() to filter which objects produce log output.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 boot/scene.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
  

Patch

diff --git a/boot/scene.c b/boot/scene.c
index 9cade9aad41..b64ddf51630 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -535,13 +535,27 @@  int scene_obj_get_hw(struct scene *scn, uint id, int *widthp)
 
 		limit = obj->flags & SCENEOF_SIZE_VALID ?
 			obj->req_bbox.x1 - obj->req_bbox.x0 : -1;
-		log_debug("obj %s limit %d\n", obj->name, limit);
 
 		ret = vidconsole_measure(scn->expo->cons, gen->font_name,
 					 gen->font_size, str, limit, &bbox,
 					 &gen->lines);
 		if (ret)
 			return log_msg_ret("mea", ret);
+		if (scene_chklog(obj->name)) {
+			log_debug("obj %s limit %d: %d lines, width %d height %d\n",
+				  obj->name, limit, gen->lines.count,
+				  bbox.x1, bbox.y1);
+			for (int i = 0; i < gen->lines.count; i++) {
+				const struct vidconsole_mline *mline;
+
+				mline = alist_get(&gen->lines, i,
+						  struct vidconsole_mline);
+				log_content("line %d: %d,%d %d,%d '%.*s'\n", i,
+					    mline->bbox.x0, mline->bbox.y0,
+					    mline->bbox.x1, mline->bbox.y1,
+					    mline->len, str + mline->start);
+			}
+		}
 		if (widthp)
 			*widthp = bbox.x1;