From 7a6f888e8c4d8069e32fded8397edca2768b38fb Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 4 Aug 2023 21:31:05 +0530 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76927 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- src/drivers/intel/fsp2_0/Kconfig | 33 +++++++++++++++++++++++++++++++-- src/drivers/intel/fsp2_0/Makefile.inc | 4 ++++ 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'src/drivers/intel/fsp2_0') diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index 378f4fb330..f5399ea92c 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -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" diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc index a1855dd71b..ce0ad695b9 100644 --- a/src/drivers/intel/fsp2_0/Makefile.inc +++ b/src/drivers/intel/fsp2_0/Makefile.inc @@ -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) -- cgit v1.2.3