drivers/intel/fsp2_0: Add configurable compression for logo cbfs file

This patch adds a new configuration option to allow the compression
algorithm for the logo cbfs file to be specified. By default, the logo
cbfs file is compressed using LZMA. However, enabling LZ4 compression
can save ~2ms of boot time when the BMP_LOGO config is enabled.

This patch verified that the logo cbfs file can be booted using either
LZMA or LZ4 compression.

BUG=b:284799726
TEST=Able to boot google/rex and verified firmware splash screen using
either LZMA or LZ4 compression.

Change-Id: Ib0aa5320632ae3f734004d2b1d495af11c2e1928
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76927
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
Subrata Banik 2023-08-04 21:31:05 +05:30
parent 71b9fbabb7
commit 7a6f888e8c
2 changed files with 35 additions and 2 deletions

View File

@ -206,8 +206,37 @@ config BMP_LOGO
depends on HAVE_FSP_LOGO_SUPPORT
help
Uses the FSP to display the boot logo. This method supports a
BMP file only. The uncompressed size can be up to 1 MB. The logo can be compressed
using LZMA.
BMP file only. The uncompressed size can be up to 1 MB. The logo can
be compressed based on either `BMP_LOGO_COMPRESS_*` configs (default LZMA).
config HAVE_BMP_LOGO_COMPRESS_LZMA
bool
depends on BMP_LOGO
default y
choice
prompt "BMP Logo compression"
depends on BMP_LOGO
default BMP_LOGO_COMPRESS_LZMA if HAVE_BMP_LOGO_COMPRESS_LZMA
default BMP_LOGO_COMPRESS_LZ4
config BMP_LOGO_COMPRESS_LZMA
bool "Use LZMA compression for BMP logo"
help
This option enables the use of LZMA compression for the BMP logo.
LZMA is a lossless compression algorithm that can significantly reduce
the size of the logo, without sacrificing quality.
If this option is not enabled, the BMP logo will be uncompressed.
config BMP_LOGO_COMPRESS_LZ4
bool "Compress BMP logo using LZ4"
help
This option enables compression of the BMP logo using the LZ4 algorithm.
Although the size reduction is not as efficient as LZMA compression, however,
it can also make the boot process slightly faster compared to the LZMA.
endchoice
config FSP2_0_LOGO_FILE_NAME
string "Logo file"

View File

@ -104,7 +104,11 @@ endif
cbfs-files-$(CONFIG_BMP_LOGO) += logo.bmp
logo.bmp-file := $(call strip_quotes,$(CONFIG_FSP2_0_LOGO_FILE_NAME))
logo.bmp-type := raw
ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZMA),y)
logo.bmp-compression := LZMA
else ($(CONFIG_BMP_LOGO_COMPRESS_LZ4),y)
logo.bmp-compression := LZ4
endif
ifneq ($(call strip_quotes,$(CONFIG_FSP_HEADER_PATH)),)
CPPFLAGS_common+=-I$(CONFIG_FSP_HEADER_PATH)