summaryrefslogtreecommitdiff
path: root/firmware/2lib
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2020-09-23 14:55:24 +0800
committerCommit Bot <commit-bot@chromium.org>2020-11-12 12:40:03 +0000
commit58894ec1de7fa63948a04f72434931081f0458e4 (patch)
tree279443064ae7c06da339f14c656721e1be97a98e /firmware/2lib
parent7991ecdb219a5290e2e5a9663b19fce8e5b15145 (diff)
downloadvboot-58894ec1de7fa63948a04f72434931081f0458e4.tar.gz
vboot/ui: Remove extra delay for long iteration time
If an iteration takes longer than KEY_DELAY_MS, no extra delay. Otherwise, delay until the iteration time reaches KEY_DELAY_MS. BUG=b:168776970 BRANCH=none TEST=Build locally Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ia78dbe1cc87d08c02f99f4fc9269929c12c18b77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2424373
Diffstat (limited to 'firmware/2lib')
-rw-r--r--firmware/2lib/2ui.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/firmware/2lib/2ui.c b/firmware/2lib/2ui.c
index 24f74736..10de1760 100644
--- a/firmware/2lib/2ui.c
+++ b/firmware/2lib/2ui.c
@@ -300,6 +300,7 @@ vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id,
const struct vb2_menu *menu;
const struct vb2_screen_info *root_info;
uint32_t key_flags;
+ uint32_t start_time_ms, elapsed_ms;
vb2_error_t rv;
memset(&ui, 0, sizeof(ui));
@@ -316,6 +317,8 @@ vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id,
prev_error_code = VB2_UI_ERROR_NONE;
while (1) {
+ start_time_ms = vb2ex_mtime();
+
/* Draw if there are state changes. */
if (memcmp(&prev_state, ui.state, sizeof(*ui.state)) ||
/* Redraw when timer is disabled. */
@@ -392,7 +395,9 @@ vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id,
}
/* Delay. */
- vb2ex_msleep(KEY_DELAY_MS);
+ elapsed_ms = vb2ex_mtime() - start_time_ms;
+ if (elapsed_ms < KEY_DELAY_MS)
+ vb2ex_msleep(KEY_DELAY_MS - elapsed_ms);
}
return VB2_SUCCESS;