From ff9c2b2e8b49a948ecc6ca640a0400450fd16f4f Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Thu, 21 Apr 2016 14:54:45 -0700 Subject: [PATCH] vboot: Save last screen ID This patch makes VbDisplayScreen remember the last successfully displayed screen and skip rendering if the same screen is requested. When locale is changed, VbCheckDisplayKey calls VbDisplayScreen with force=1, which makes VbDisplayScreen render the requested screen regardless of the saved screen ID. BUG=chromium:602793 BRANCH=tot TEST=emerge-veyron_jerry vboot_reference chromeos-bootimage Change-Id: I31c4dde4ff060081f14224a93d57e9b76fcac1db Signed-off-by: Daisuke Nojiri Reviewed-on: https://chromium-review.googlesource.com/340264 Reviewed-by: Randall Spangler Reviewed-by: Vadim Bendebury --- firmware/lib/vboot_display.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c index f2978fb002..b178f2cdde 100644 --- a/firmware/lib/vboot_display.c +++ b/firmware/lib/vboot_display.c @@ -329,16 +329,9 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen, return retval; } - /* If requested screen is the same as the current one, we're done. */ - if (disp_current_screen == screen && 0 == force) - return VBERROR_SUCCESS; - /* If the screen is blank, turn off the backlight; else turn it on. */ VbExDisplayBacklight(VB_SCREEN_BLANK == screen ? 0 : 1); - /* Request the screen */ - disp_current_screen = screen; - /* Look in the GBB first */ if (VBERROR_SUCCESS == VbDisplayScreenFromGBB(cparams, screen, vncptr, locale)) @@ -353,20 +346,26 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen, { uint32_t locale; GoogleBinaryBlockHeader *gbb = cparams->gbb; + VbError_t rv; + + /* If requested screen is the same as the current one, we're done. */ + if (disp_current_screen == screen && !force) + return VBERROR_SUCCESS; /* Read the locale last saved */ VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale); - if (gbb->bmpfv_size == 0) { - VbError_t ret = VbExDisplayScreen(screen, locale); + if (gbb->bmpfv_size == 0) + rv = VbExDisplayScreen(screen, locale); + else + rv = VbDisplayScreenLegacy(cparams, screen, force, vncptr, + locale); + if (rv == VBERROR_SUCCESS) /* Keep track of the currently displayed screen */ - if (ret == VBERROR_SUCCESS) - disp_current_screen = screen; - return ret; - } + disp_current_screen = screen; - return VbDisplayScreenLegacy(cparams, screen, force, vncptr, locale); + return rv; } static void Uint8ToString(char *buf, uint8_t val)