soc/intel/tigerlake: Utilize vbt data size Kconfig option
[coreboot.git] / src / lib / bootsplash.c
blob050d713154948dea69982987a5bdb1f879dba2b1
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <cbfs.h>
4 #include <vbe.h>
5 #include <console/console.h>
6 #include <endian.h>
7 #include <bootsplash.h>
8 #include <stdlib.h>
10 #include "jpeg.h"
13 void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
14 unsigned int y_resolution, unsigned int fb_resolution)
16 printk(BIOS_INFO, "Setting up bootsplash in %dx%d@%d\n", x_resolution, y_resolution,
17 fb_resolution);
18 struct jpeg_decdata *decdata;
19 unsigned char *jpeg =
20 cbfs_boot_map_with_leak("bootsplash.jpg", CBFS_TYPE_BOOTSPLASH, NULL);
21 if (!jpeg) {
22 printk(BIOS_ERR, "Could not find bootsplash.jpg\n");
23 return;
26 int image_width, image_height;
27 jpeg_fetch_size(jpeg, &image_width, &image_height);
29 printk(BIOS_DEBUG, "Bootsplash image resolution: %dx%d\n", image_width, image_height);
31 decdata = malloc(sizeof(*decdata));
32 int ret = jpeg_decode(jpeg, framebuffer, x_resolution, y_resolution, fb_resolution,
33 decdata);
34 if (ret != 0) {
35 printk(BIOS_ERR, "Bootsplash could not be decoded. jpeg_decode returned %d.\n",
36 ret);
37 return;
39 printk(BIOS_INFO, "Bootsplash loaded\n");