Mimoja has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34537 )
Change subject: Fix bootsplash display code for optionroms ......................................................................
Fix bootsplash display code for optionroms
So far the bootsplash is only correctly rendered if the framebuffer were setup as 1027x768@16. This commit removes this limit by using the actual resolutions and combines the code for x86 and yabel. For the moment the bootsplash is still limited to VGA-OptionROM framebuffer init.
Change-Id: I5ab7b8a0f28badaa16e25dbe807158870d06e26a Signed-off-by: Johanna Schander coreboot@mimoja.de --- M src/device/oprom/Makefile.inc A src/device/oprom/bootsplash.c A src/device/oprom/bootsplash.h M src/device/oprom/realmode/x86.c M src/device/oprom/yabel/vbe.c 5 files changed, 83 insertions(+), 41 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/34537/1
diff --git a/src/device/oprom/Makefile.inc b/src/device/oprom/Makefile.inc index 61970ae..9d49796 100644 --- a/src/device/oprom/Makefile.inc +++ b/src/device/oprom/Makefile.inc @@ -16,3 +16,5 @@ subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_YABEL) += x86emu subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_YABEL) += yabel subdirs-$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) += realmode + +ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c \ No newline at end of file diff --git a/src/device/oprom/bootsplash.c b/src/device/oprom/bootsplash.c new file mode 100644 index 0000000..a1b804c --- /dev/null +++ b/src/device/oprom/bootsplash.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 Johanna Schander coreboot@mimoja.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <lib/jpeg.h> +#include <cbfs.h> + +#include "bootsplash.h" + +int oprom_set_bootsplash(unsigned char *framebuffer, u16 x_resolution, u16 y_resolution, + u16 fb_resolution) +{ + struct jpeg_decdata *decdata; + unsigned char *jpeg = + cbfs_boot_map_with_leak("bootsplash.jpg", CBFS_TYPE_BOOTSPLASH, NULL); + if (!jpeg) { + return -1; + } + decdata = malloc(sizeof(*decdata)); + return jpeg_decode(jpeg, framebuffer, x_resolution, y_resolution, fb_resolution, + decdata); +} \ No newline at end of file diff --git a/src/device/oprom/bootsplash.h b/src/device/oprom/bootsplash.h new file mode 100644 index 0000000..0bf7f26 --- /dev/null +++ b/src/device/oprom/bootsplash.h @@ -0,0 +1,18 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 Johanna Schander coreboot@mimoja.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <stdint.h> + +int oprom_set_bootsplash(unsigned char *framebuffer, u16 x_resolution, u16 y_resolution, u16 fb_resolution); diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index 67e550c..79586a5 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -18,19 +18,21 @@ #include <arch/interrupt.h> #include <arch/registers.h> #include <boot/coreboot_tables.h> -#include <cbfs.h> #include <console/console.h> #include <cpu/amd/lxdef.h> #include <cpu/amd/vr.h> #include <delay.h> #include <device/pci.h> #include <device/pci_ids.h> -#include <lib/jpeg.h> #include <pc80/i8259.h> #include <pc80/i8254.h> #include <string.h> #include <vbe.h>
+#if CONFIG(BOOTSPLASH) +#include "../bootsplash.h" +#endif + /* we use x86emu's register file representation */ #include <x86emu/regs.h>
@@ -347,12 +349,17 @@ { mode_info.video_mode = (1 << 14) | CONFIG_FRAMEBUFFER_VESA_MODE; vbe_get_mode_info(&mode_info); + + u16 x_resolution = le16_to_cpu(mode_info.vesa.x_resolution); + u16 y_resolution = le16_to_cpu(mode_info.vesa.y_resolution); + u16 fb_resolution = mode_info.vesa.bits_per_pixel; + unsigned char *framebuffer = (unsigned char *)mode_info.vesa.phys_base_ptr; printk(BIOS_DEBUG, "VBE: resolution: %dx%d@%d\n", - le16_to_cpu(mode_info.vesa.x_resolution), - le16_to_cpu(mode_info.vesa.y_resolution), - mode_info.vesa.bits_per_pixel); + x_resolution, + y_resolution, + fb_resolution); printk(BIOS_DEBUG, "VBE: framebuffer: %p\n", framebuffer); if (!framebuffer) { printk(BIOS_DEBUG, "VBE: Mode does not support linear " @@ -362,17 +369,15 @@
vbe_set_mode(&mode_info); #if CONFIG(BOOTSPLASH) - struct jpeg_decdata *decdata; - unsigned char *jpeg = cbfs_boot_map_with_leak("bootsplash.jpg", - CBFS_TYPE_BOOTSPLASH, - NULL); - if (!jpeg) { - printk(BIOS_DEBUG, "VBE: No bootsplash found.\n"); - return; + printk(BIOS_INFO, "VBE: Setting up Bootsplash\n"); + int ret = oprom_set_bootsplash(framebuffer, x_resolution, y_resolution, fb_resolution); + if (ret == -1) { + printk(BIOS_WARNING, "VBE: No bootsplash found.\n"); + } else if (ret > 0) { + printk(BIOS_WARNING, "VBE: Bootsplash could not be decoded. jpeg_decode returned %d.\n", ret); + } else { + printk(BIOS_INFO, "VBE: Bootsplash loaded\n"); } - decdata = malloc(sizeof(*decdata)); - int ret = 0; - ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata); #endif }
diff --git a/src/device/oprom/yabel/vbe.c b/src/device/oprom/yabel/vbe.c index 8116c6b..5ab6c68 100644 --- a/src/device/oprom/yabel/vbe.c +++ b/src/device/oprom/yabel/vbe.c @@ -52,12 +52,12 @@ #include "interrupt.h" #include "device.h"
-#include <cbfs.h> - #include <delay.h> -#include "../../src/lib/jpeg.h"
#include <vbe.h> +#if CONFIG(BOOTSPLASH) +#include "../bootsplash.h" +#endif
// these structs only store a subset of the VBE defined fields // only those needed. @@ -747,31 +747,15 @@ vbe_set_mode(&mode_info);
#if CONFIG(BOOTSPLASH) - unsigned char *framebuffer = - (unsigned char *) le32_to_cpu(mode_info.vesa.phys_base_ptr); - DEBUG_PRINTF_VBE("FRAMEBUFFER: 0x%p\n", framebuffer); - - struct jpeg_decdata *decdata; - - /* Switching Intel IGD to 1MB video memory will break this. Who - * cares. */ - // int imagesize = 1024*768*2; - - unsigned char *jpeg = cbfs_boot_map_with_leak("bootsplash.jpg", - CBFS_TYPE_BOOTSPLASH, - NULL); - if (!jpeg) { + printk(BIOS_INFO, "VBE: Setting up Bootsplash\n"); + int ret = oprom_set_bootsplash(framebuffer, x_resolution, y_resolution, fb_resolution) + if (ret == -1) { DEBUG_PRINTF_VBE("Could not find bootsplash.jpg\n"); - return; + } else if (ret > 0){ + DEBUG_PRINTF_VBE("VBE: Bootsplash could not be decoded. jpeg_decode returned %d.\n", ret); + } else { + DEBUG_PRINTF_VBE("VBE: Bootsplash loaded\n"); } - DEBUG_PRINTF_VBE("Splash at %p ...\n", jpeg); - dump(jpeg, 64); - - decdata = malloc(sizeof(*decdata)); - int ret = 0; - DEBUG_PRINTF_VBE("Decompressing boot splash screen...\n"); - ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata); - DEBUG_PRINTF_VBE("returns %x\n", ret); #endif }