[Concept,06/19] bootctl: Allow switching between logos

Message ID 20251208023229.3929910-7-sjg@u-boot.org
State New
Headers
Series bootctl: Continue development with TKey functionality |

Commit Message

Simon Glass Dec. 8, 2025, 2:32 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The bootctl tests are currently disabled due to some image
incompatibilities: the multi UI uses one image and the simple UI uses a
different one.

Update the logic to switch between these logos when the layout changes.
For now, use the U-Boot logo in both cases.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 boot/bootctl/multi_ui.c     |  4 ++++
 boot/bootctl/simple_ui.c    |  7 +++++--
 boot/bootflow_menu.c        | 11 ++++++++++-
 include/bootctl.dtsi        |  3 +++
 test/boot/bootctl/bootctl.c |  4 ++--
 5 files changed, 24 insertions(+), 5 deletions(-)
  

Patch

diff --git a/boot/bootctl/multi_ui.c b/boot/bootctl/multi_ui.c
index 975f9a1b91c..f663bcdac61 100644
--- a/boot/bootctl/multi_ui.c
+++ b/boot/bootctl/multi_ui.c
@@ -215,6 +215,10 @@  static int multiboot_ui_set_props(struct udevice *dev, struct scene *scn,
 	scene_obj_set_hide(scn, OBJ_AUTOBOOT, !lpriv->opt_autoboot);
 
 	if (upriv->logo) {
+		ret = scene_img_set_data(scn, OBJ_U_BOOT_LOGO, upriv->logo,
+					 upriv->logo_size);
+		if (ret)
+			return log_msg_ret("log", ret);
 		ret = scene_obj_set_pos(scn, OBJ_U_BOOT_LOGO, 1045, 10);
 		if (ret)
 			return log_msg_ret("lop", ret);
diff --git a/boot/bootctl/simple_ui.c b/boot/bootctl/simple_ui.c
index 58860138a33..34f46f04838 100644
--- a/boot/bootctl/simple_ui.c
+++ b/boot/bootctl/simple_ui.c
@@ -92,8 +92,11 @@  static int simple_ui_show(struct udevice *dev)
 	abuf_printf(buf, "Boot control");
 
 	if (upriv->logo) {
-		ret = scene_img_set_data(scn, OBJ_U_BOOT_LOGO,
-					       upriv->logo, upriv->logo_size);
+		const void *logo;
+		int size;
+
+		logo = video_get_u_boot_logo(&size);
+		ret = scene_img_set_data(scn, OBJ_U_BOOT_LOGO, logo, size);
 		if (ret)
 			return log_msg_ret("log", ret);
 		ret = scene_obj_set_pos(scn, OBJ_U_BOOT_LOGO, 1135, 10);
diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 1b740c8d16b..909694f6e7b 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -80,9 +80,18 @@  int bootflow_menu_set_props(struct expo *exp, struct scene *scn, bool has_logo,
 				  1366, 60);
 	ret |= scene_obj_set_halign(scn, OBJ_MENU_TITLE, SCENEOA_CENTRE);
 
-	if (has_logo)
+	if (has_logo) {
+		const void *logo;
+		int size;
+
 		ret |= scene_obj_set_pos(scn, OBJ_U_BOOT_LOGO, 1165, 100);
 
+		logo = video_get_u_boot_logo(&size);
+		ret |= scene_img_set_data(scn, OBJ_U_BOOT_LOGO, logo, size);
+		if (ret)
+			return log_msg_ret("log", ret);
+	}
+
 	ret |= scene_obj_set_bbox(scn, OBJ_PROMPT1A, 0, 590,
 				  1366, 590 + 40);
 	ret |= scene_obj_set_bbox(scn, OBJ_PROMPT1B, 0, 620,
diff --git a/include/bootctl.dtsi b/include/bootctl.dtsi
index 05032a924e1..4070fa32c5f 100644
--- a/include/bootctl.dtsi
+++ b/include/bootctl.dtsi
@@ -120,6 +120,9 @@ 
 			"bootctl,ui";
 		graphical = "if-available";
 		textual = "if-available";
+#ifdef CANONICAL_LOGO
+		logo = /incbin/("/home/sglass/u/boot/bootctl/canonical.bmp");
+#endif
 	};
 
 	ui-simple {
diff --git a/test/boot/bootctl/bootctl.c b/test/boot/bootctl/bootctl.c
index ab9aa28a668..532a73d6336 100644
--- a/test/boot/bootctl/bootctl.c
+++ b/test/boot/bootctl/bootctl.c
@@ -396,7 +396,7 @@  static int check_multiboot_ui(struct unit_test_state *uts,
 	ut_assertok(bc_ui_add(ui_dev, &info[0]));
 	ut_assertok(bc_ui_add(ui_dev, &info[1]));
 	ut_assertok(bc_ui_render(ui_dev));
-	ut_asserteq(16645, video_compress_fb(uts, vid_dev, false));
+	ut_asserteq(13702, video_compress_fb(uts, vid_dev, false));
 
 	/* dump after render - buf2 is golden for multiboot_ui */
 	uc_priv = dev_get_uclass_priv(ui_dev);
@@ -435,7 +435,7 @@  static int check_multiboot_ui(struct unit_test_state *uts,
 	/* switch back to multiboot UI style and check against buf2 */
 	ut_assertok(bc_ui_switch_layout(ui_dev));
 	ut_assertok(bc_ui_render(ui_dev));
-	ut_asserteq(16645, video_compress_fb(uts, vid_dev, false));
+	ut_asserteq(13702, video_compress_fb(uts, vid_dev, false));
 
 	/* dump after switch back to multiboot - buf4 should match buf2 */
 	ut_assertok(membuf_new(&buf4, 4096));