[Concept,10/14] expo: Track the number of render calls
Commit Message
From: Simon Glass <sjg@chromium.org>
Keep track of the frame count, i.e. the number of times that
expo_render() has been called since expo_enter_mode() was invoked.
Allow test mode to be enabled (if compiled in) by setting the 'expotest'
environment variable to 1.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
boot/expo_test.c | 21 +++++++++++++++++++++
include/expo.h | 4 ++++
include/expo_test.h | 11 +++++++++++
3 files changed, 36 insertions(+)
@@ -8,18 +8,39 @@
#define LOG_CATEGORY LOGC_EXPO
+#include <env.h>
+#include <errno.h>
#include <expo.h>
#include <expo_test.h>
+#include <log.h>
+#include <malloc.h>
int expo_test_init(struct expo *exp)
{
+ struct expo_test_mode *test;
+
+ test = calloc(1, sizeof(struct expo_test_mode));
+ if (!test)
+ return log_msg_ret("test", -ENOMEM);
+
+ test->enabled = env_get_yesno("expotest") == 1;
+ exp->test = test;
+
return 0;
}
void expo_test_uninit(struct expo *exp)
{
+ free(exp->test);
+ exp->test = NULL;
}
void expo_test_update(struct expo *exp)
{
+ struct expo_test_mode *test = exp->test;
+
+ if (!test)
+ return;
+
+ test->render_count++;
}
@@ -90,6 +90,8 @@ struct expo_action {
};
};
+struct expo_test_mode;
+
/**
* struct expo_theme - theme for the expo
*
@@ -139,6 +141,7 @@ struct expo_theme {
* @priv: Private data for the controller
* @done: Indicates that a cedit session is complete and the user has quit
* @save: Indicates that cedit data should be saved, rather than discarded
+ * @test: Pointer to test mode information, NULL if not allocated
* @theme: Information about fonts styles, etc.
* @scene_head: List of scenes
* @str_head: list of strings
@@ -165,6 +168,7 @@ struct expo {
void *priv;
bool done;
bool save;
+ struct expo_test_mode *test;
struct expo_theme theme;
struct list_head scene_head;
struct list_head str_head;
@@ -9,6 +9,17 @@
struct expo;
+/**
+ * struct expo_test_mode - Test mode information for expo
+ *
+ * @enabled: true if test mode is enabled
+ * @render_count: Number of calls to expo_render() since expo_enter_mode()
+ */
+struct expo_test_mode {
+ bool enabled;
+ int render_count;
+};
+
#if CONFIG_IS_ENABLED(EXPO_TEST)
/**