Give more screen control to vboot_draw_screen
authorDaisuke Nojiri <dnojiri@chromium.org>
Mon, 16 Nov 2015 19:47:28 +0000 (11:47 -0800)
committerchrome-bot <chrome-bot@chromium.org>
Tue, 17 Nov 2015 22:40:23 +0000 (14:40 -0800)
New devices have Depthcharge render vboot screens by calling
vboot_draw_screen. Thus, display initialization and backlight control should
not be duplicated. This patch prevents VbDisplayScreen from initializing
display and controlling backlight when vboot is rendering screens using GBB.

BUG=chrome-os-partner:43706,chromium:502066
BRANCH=tot
TEST=Tested on Glados

Change-Id: I50cd2decb7065af96779601b12f0fbf2554ff6ed
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/312749
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
firmware/lib/vboot_display.c

index f8417b9..8dbf2f2 100644 (file)
@@ -311,10 +311,15 @@ VbError_t VbDisplayScreenFromGBB(VbCommonParams *cparams, uint32_t screen,
        return retval;
 }
 
-VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
-                         int force, VbNvContext *vncptr)
+/*
+ * This is the deprecated display screen function. This should be called only
+ * if bmpblk.bin is found in GBB. New devices store graphics data in cbfs
+ * and screens are rendered by Depthcharge (chromium:502066).
+ */
+static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen,
+                                      int force, VbNvContext *vncptr,
+                                      uint32_t locale)
 {
-       uint32_t locale;
        VbError_t retval;
 
        /* Initialize display if necessary */
@@ -334,9 +339,6 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
        /* Request the screen */
        disp_current_screen = screen;
 
-       /* Read the locale last saved */
-       VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale);
-
        /* Look in the GBB first */
        if (VBERROR_SUCCESS == VbDisplayScreenFromGBB(cparams, screen,
                                                      vncptr, locale))
@@ -346,6 +348,21 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
        return VbExDisplayScreen(screen, locale);
 }
 
+VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
+                         int force, VbNvContext *vncptr)
+{
+       uint32_t locale;
+       GoogleBinaryBlockHeader *gbb = cparams->gbb;
+
+       /* Read the locale last saved */
+       VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale);
+
+       if (gbb->bmpfv_size == 0)
+               return VbExDisplayScreen(screen, locale);
+
+       return VbDisplayScreenLegacy(cparams, screen, force, vncptr, locale);
+}
+
 static void Uint8ToString(char *buf, uint8_t val)
 {
        const char *trans = "0123456789abcdef";