From 34e90fe57efa32774f5a5d6073cbc74a126e676c Mon Sep 17 00:00:00 2001 From: Hsuan Ting Chen Date: Tue, 22 Sep 2020 15:49:29 +0800 Subject: 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 Change-Id: I4f8dbadc68989112bce418119ff7405ec150a7df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2423089 --- firmware/2lib/2ui_screens.c | 6 ++++++ firmware/2lib/include/2ui.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c index 1b4c5e29..878b4ed7 100644 --- a/firmware/2lib/2ui_screens.c +++ b/firmware/2lib/2ui_screens.c @@ -1123,6 +1123,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"); @@ -1158,6 +1163,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; }; -- cgit v1.2.1