[PATCH 03/19] expo: Create a function to arrange the current scene

Simon Glass sjg at chromium.org
Mon May 5 17:42:41 CEST 2025


Provide a convenient function which arranges the current scene in an
expo. Make use of this in bootflow_menu

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 boot/bootflow_menu.c | 12 +-----------
 boot/expo.c          | 19 +++++++++++++++++++
 include/expo.h       | 11 +++++++++++
 3 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 5d77a0eaea8..934165d2855 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -249,9 +249,7 @@ int bootflow_menu_setup(struct bootstd_priv *std, bool text_mode,
 int bootflow_menu_start(struct bootstd_priv *std, bool text_mode,
 			struct expo **expp)
 {
-	struct scene *scn;
 	struct expo *exp;
-	uint scene_id;
 	int ret;
 
 	ret = bootflow_menu_setup(std, text_mode, &exp);
@@ -272,15 +270,7 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode,
 	if (ret)
 		return log_msg_ret("bmd", ret);
 
-	ret = expo_first_scene_id(exp);
-	if (ret < 0)
-		return log_msg_ret("scn", ret);
-	scene_id = ret;
-	scn = expo_lookup_scene_id(exp, scene_id);
-
-	scene_set_highlight_id(scn, OBJ_MENU);
-
-	ret = scene_arrange(scn);
+	ret = expo_arrange(exp);
 	if (ret)
 		return log_msg_ret("arr", ret);
 
diff --git a/boot/expo.c b/boot/expo.c
index 94413acd381..3e79cbca04b 100644
--- a/boot/expo.c
+++ b/boot/expo.c
@@ -211,6 +211,25 @@ int expo_first_scene_id(struct expo *exp)
 	return scn->id;
 }
 
+int expo_arrange(struct expo *exp)
+{
+	struct scene *scn;
+	int ret;
+
+	if (!exp->scene_id)
+		return 0;
+
+	scn = expo_lookup_scene_id(exp, exp->scene_id);
+	if (!scn)
+		return log_msg_ret("scn", -ENOENT);
+
+	ret = scene_arrange(scn);
+	if (ret)
+		return log_msg_ret("ear", ret);
+
+	return 0;
+}
+
 int expo_render(struct expo *exp)
 {
 	struct udevice *dev = exp->display;
diff --git a/include/expo.h b/include/expo.h
index 6b191815ded..75ff1df3cfc 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -620,6 +620,17 @@ int expo_first_scene_id(struct expo *exp);
  */
 int expo_render(struct expo *exp);
 
+/**
+ * expo_arrange() - Arrange the current scene to deal with object sizes
+ *
+ * Updates any menus in the current scene so that their objects are in the right
+ * place. Does nothing if there is no scene
+ *
+ * @exp: Expo to arrange
+ * Returns: 0 if OK, -ve on error
+ */
+int expo_arrange(struct expo *exp);
+
 /**
  * expo_set_text_mode() - Controls whether the expo renders in text mode
  *
-- 
2.43.0



More information about the U-Boot mailing list