[Concept,14/14] expo: Support drawing only the dirty portion of an expo

Message ID 20251006165452.1675349-15-sjg@u-boot.org
State New
Headers
Series expo: Continue development of expo with mouse |

Commit Message

Simon Glass Oct. 6, 2025, 4:54 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

To optimise drawing on the display, provide a new function which draws
only the part of the display which is marked as dirty.

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

 boot/expo.c    | 14 ++++++++++++--
 include/expo.h | 12 ++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
  

Patch

diff --git a/boot/expo.c b/boot/expo.c
index 8423a304eb0..8ec301d4dcf 100644
--- a/boot/expo.c
+++ b/boot/expo.c
@@ -300,7 +300,7 @@  static int render_mouse_pointer(struct expo *exp)
 	return 0;
 }
 
-int expo_render(struct expo *exp)
+static int expo_render_(struct expo *exp, bool dirty_only)
 {
 	struct udevice *dev = exp->display;
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev);
@@ -320,7 +320,7 @@  int expo_render(struct expo *exp)
 		if (!scn)
 			return log_msg_ret("scn", -ENOENT);
 
-		ret = scene_render(scn, false);
+		ret = scene_render(scn, dirty_only);
 		if (ret)
 			return log_msg_ret("ren", ret);
 	}
@@ -335,6 +335,16 @@  int expo_render(struct expo *exp)
 	return scn ? 0 : -ECHILD;
 }
 
+int expo_render(struct expo *exp)
+{
+	return expo_render_(exp, false);
+}
+
+int expo_render_dirty(struct expo *exp)
+{
+	return expo_render_(exp, true);
+}
+
 int expo_send_key(struct expo *exp, int key)
 {
 	struct scene *scn = NULL;
diff --git a/include/expo.h b/include/expo.h
index fcc090d54f1..8ad7415b5a4 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -668,6 +668,18 @@  int expo_first_scene_id(struct expo *exp);
  */
 int expo_render(struct expo *exp);
 
+/**
+ * expo_render_dirty() - render the dirty portion of expo on the display
+ *
+ * Only the objects within the damage bbox are rendered. The others are
+ * assumed to be up-to-date.
+ *
+ * @exp: Expo to render
+ * Return: 0 if OK, -ECHILD if there is no current scene, -ENOENT if the
+ * current scene is not found, other error if something else goes wrong
+ */
+int expo_render_dirty(struct expo *exp);
+
 /**
  * expo_arrange() - Arrange the current scene to deal with object sizes
  *