summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2020-09-22 15:49:29 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-17 23:57:08 +0000
commit4a800a9a061bd4c536e897daf3439456b6cb73ed (patch)
tree94f1a838bc57228995c59c0bbd82017f07ac301a
parent909b68344754c1cb50bad539f9d0523bd3fe5688 (diff)
downloadvboot-4a800a9a061bd4c536e897daf3439456b6cb73ed.tar.gz
minidiag/ui: Prevent calling update action if memory test is finished
Skip calling diagnostics_memory_update_screen() action if memory test is finished to reduce delays in memory diagnostics screens. BUG=b:168776970, b:171852478 BRANCH=none TEST=Build locally, boot recovery, select 'run diagnostics', enter memory test (quick) screen, wait until test is finished, and observe that the delay reduces while pressing keyboard Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4f8dbadc68989112bce418119ff7405ec150a7df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2423089 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2565050 Tested-by: Chung-Sheng Wu <chungsheng@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
-rw-r--r--firmware/2lib/2ui_screens.c6
-rw-r--r--firmware/2lib/include/2ui.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index a2f642ff..8dd6e6bc 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -1128,6 +1128,11 @@ static vb2_error_t diagnostics_memory_update_screen(struct vb2_ui_context *ui,
int reset)
{
const char *log_string = NULL;
+
+ /* Early return if the memory test is done. */
+ if (ui->state->test_finished)
+ return VB2_REQUEST_UI_CONTINUE;
+
vb2_error_t rv = op(reset, &log_string);
if ((rv && rv != VB2_ERROR_EX_DIAG_TEST_RUNNING) || !log_string) {
VB2_DEBUG("ERROR: Failed to retrieve memory test status\n");
@@ -1164,6 +1169,7 @@ static vb2_error_t diagnostics_memory_update_screen(struct vb2_ui_context *ui,
DIAGNOSTICS_MEMORY_ITEM_CANCEL);
if (ui->state->selected_item == DIAGNOSTICS_MEMORY_ITEM_CANCEL)
ui->state->selected_item = DIAGNOSTICS_MEMORY_ITEM_BACK;
+ ui->state->test_finished = 1;
}
return VB2_REQUEST_UI_CONTINUE;
diff --git a/firmware/2lib/include/2ui.h b/firmware/2lib/include/2ui.h
index 44e24fdd..77c5acf4 100644
--- a/firmware/2lib/include/2ui.h
+++ b/firmware/2lib/include/2ui.h
@@ -78,6 +78,9 @@ struct vb2_screen_state {
uint32_t page_count;
uint32_t current_page;
+ /* For memory check screen. */
+ int test_finished; /* Do not update screen if the content is done */
+
struct vb2_screen_state *prev;
};