]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
SeaVGABios/cbvga: Fix bpp for coreboot framebuffer
authorMatt DeVillier <matt.devillier@puri.sm>
Tue, 11 Sep 2018 21:54:53 +0000 (16:54 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 18 Sep 2018 17:35:30 +0000 (13:35 -0400)
Commit 4b42cc4 [SeaVGABios/cbvga: Advertise correct pixel format] neglected
to wrap the cbfb mask size components in GET_FARVAR(), which resulted in a
bogus value for bpp, breaking output on most/all devices.  Fix this by
adding GET_FARVAR() as appropriate.

Additionally, some newer ChromeOS devices still fail even with this fix,
so fall back to using the coreboot reported bit depth if the calculated
valid is invalid.

TEST: build/boot a variety of devices (google/[reef,eve], purism/librem_skl)
using coreboot framebuffer init, verify SeaBIOS boot menu prompt visible.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
vgasrc/cbvga.c

index 859524cb2362338f2e46d28174de89d59138c127..438d8fda6c6e598ea10b0fafce10f06bc94c74c0 100644 (file)
@@ -312,11 +312,17 @@ cbvga_setup(void)
     }
 
     u64 addr = GET_FARVAR(0, cbfb->physical_address);
-    u8 bpp = cbfb->blue_mask_size + cbfb->green_mask_size
-             + cbfb->red_mask_size + cbfb->reserved_mask_size;
+    u8 bpp = GET_FARVAR(0, cbfb->blue_mask_size)
+             + GET_FARVAR(0, cbfb->green_mask_size)
+             + GET_FARVAR(0, cbfb->red_mask_size)
+             + GET_FARVAR(0, cbfb->reserved_mask_size);
     u32 xlines = GET_FARVAR(0, cbfb->x_resolution);
     u32 ylines = GET_FARVAR(0, cbfb->y_resolution);
     u32 linelength = GET_FARVAR(0, cbfb->bytes_per_line);
+    //fall back to coreboot reported bpp if calculated value invalid
+    if (bpp != 15 && bpp != 16 && bpp != 24 && bpp != 32)
+        bpp = GET_FARVAR(0, cbfb->bits_per_pixel);
+
     dprintf(1, "Found FB @ %llx %dx%d with %d bpp (%d stride)\n"
             , addr, xlines, ylines, bpp, linelength);