vboot: Save last screen ID
authorDaisuke Nojiri <dnojiri@chromium.org>
Thu, 21 Apr 2016 21:54:45 +0000 (14:54 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Mon, 25 Apr 2016 19:56:42 +0000 (12:56 -0700)
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 <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340264
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
firmware/lib/vboot_display.c

index f2978fb..b178f2c 100644 (file)
@@ -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)