Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
lib/coreboot_table: Show splashscreen in lb_table_init

Every vga init implementation needs to cache the framebuffer state
to be able to fill the lb_framebuffer struct later on in the
fill_lb_framebuffer call. Showing the bootsplash afterwards
guarantees to have the same interface into all the vga drivers.

This is by far from ideal, as it only allows for a single driver at
compile-time and should be adapted in the future.

It was tested on the wip razer blade stealth using vgabios @ 1280x1024
and also in Qemu @ 1280x1024.
By default the qemu framebuffer will be initialized in 800x600@32.
This can be overwriten by configuration by setting
CONFIG_DRIVERS_EMULATION_QEMU_BOCHS_{X,Y}RES .

Change-Id: I4bec06d22423627e8f429c4b47e0dc9920f1464e
Signed-off-by: Johanna Schander <coreboot@mimoja.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34599
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M src/device/Kconfig
M src/device/pci_device.c
M src/include/bootsplash.h
M src/lib/bootsplash.c
M src/lib/coreboot_table.c
5 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/src/device/Kconfig b/src/device/Kconfig
index e605bc2..0b90833 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -392,18 +392,6 @@
default 0x11A if FRAMEBUFFER_VESA_MODE_11A
default 0x11B if FRAMEBUFFER_VESA_MODE_11B
default 0x118 if FRAMEBUFFER_VESA_MODE_USER
-
-config BOOTSPLASH
- prompt "Show graphical bootsplash"
- bool
- help
- This option shows a graphical bootsplash screen. The graphics are
- loaded from the CBFS file bootsplash.jpg.
-
- You can either specify the location and file name of the
- image in the 'General' section or add it manually to CBFS, using,
- for example, cbfstool.
-
endif # FRAMEBUFFER_SET_VESA_MODE

choice
@@ -447,6 +435,18 @@
def_bool y
depends on VBE_LINEAR_FRAMEBUFFER || GENERIC_LINEAR_FRAMEBUFFER

+config BOOTSPLASH
+ prompt "Show graphical bootsplash"
+ bool
+ depends on LINEAR_FRAMEBUFFER
+ help
+ This option shows a graphical bootsplash screen. The graphics are
+ loaded from the CBFS file bootsplash.jpg.
+
+ You can either specify the location and file name of the
+ image in the 'General' section or add it manually to CBFS, using,
+ for example, cbfstool.
+
config LINEAR_FRAMEBUFFER_MAX_WIDTH
int "Maximum width in pixels"
depends on LINEAR_FRAMEBUFFER && MAINBOARD_USE_LIBGFXINIT
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index 5765529..84fc82c 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -34,7 +34,6 @@
#include <arch/acpi.h>
#include <device/pci_ops.h>
#include <bootmode.h>
-#include <bootsplash.h>
#include <console/console.h>
#include <stdlib.h>
#include <stdint.h>
@@ -766,9 +765,6 @@
gfx_set_init_done(1);
printk(BIOS_DEBUG, "VGA Option ROM was run\n");
timestamp_add_now(TS_OPROM_END);
-
- if (CONFIG(BOOTSPLASH))
- set_vesa_bootsplash();
}

/** Default device operation for PCI devices */
diff --git a/src/include/bootsplash.h b/src/include/bootsplash.h
index 84ba34c..af09922 100644
--- a/src/include/bootsplash.h
+++ b/src/include/bootsplash.h
@@ -19,12 +19,6 @@
#include <types.h>

/**
- * Wraps bootsplash setup for vesa
- */
-void set_vesa_bootsplash(void);
-
-
-/**
* Sets up the framebuffer with the bootsplash.jpg from cbfs.
* Returns 0 on success
* CB_ERR on cbfs errors
diff --git a/src/lib/bootsplash.c b/src/lib/bootsplash.c
index ee14b92..812a3b7 100644
--- a/src/lib/bootsplash.c
+++ b/src/lib/bootsplash.c
@@ -21,22 +21,6 @@

#include "jpeg.h"

-void set_vesa_bootsplash(void)
-{
- const vbe_mode_info_t *mode_info = vbe_mode_info();
- if (mode_info != NULL) {
- unsigned int x_resolution = le16_to_cpu(mode_info->vesa.x_resolution);
- unsigned int y_resolution = le16_to_cpu(mode_info->vesa.y_resolution);
- unsigned int fb_resolution = mode_info->vesa.bits_per_pixel;
- unsigned char *framebuffer =
- (unsigned char *)le32_to_cpu(mode_info->vesa.phys_base_ptr);
-
- set_bootsplash(framebuffer, x_resolution, y_resolution, fb_resolution);
- } else {
- printk(BIOS_ERR, "VBE modeinfo invalid\n");
- }
-}
-

void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
unsigned int y_resolution, unsigned int fb_resolution)
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 95c2ae6..66afcf3 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -31,6 +31,7 @@
#include <cbfs.h>
#include <cbmem.h>
#include <bootmem.h>
+#include <bootsplash.h>
#include <spi_flash.h>
#include <security/vboot/misc.h>
#include <security/vboot/vbnv_layout.h>
@@ -144,6 +145,14 @@
memcpy(framebuffer, &fb, sizeof(*framebuffer));
framebuffer->tag = LB_TAG_FRAMEBUFFER;
framebuffer->size = sizeof(*framebuffer);
+
+ if (CONFIG(BOOTSPLASH)) {
+ uint8_t *fb_ptr = (uint8_t *)(uintptr_t)framebuffer->physical_address;
+ unsigned int width = framebuffer->x_resolution;
+ unsigned int height = framebuffer->y_resolution;
+ unsigned int depth = framebuffer->bits_per_pixel;
+ set_bootsplash(fb_ptr, width, height, depth);
+ }
}

void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table,

To view, visit change 34599. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4bec06d22423627e8f429c4b47e0dc9920f1464e
Gerrit-Change-Number: 34599
Gerrit-PatchSet: 13
Gerrit-Owner: Mimoja <coreboot@mimoja.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-Reviewer: Mimoja <coreboot@mimoja.de>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Gerd Hoffmann <kraxel@redhat.com>
Gerrit-CC: Patrick Rudolph
Gerrit-CC: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-MessageType: merged