Changeset based on nitrokey 2.3 release to understand what is attempted here. i915 is still under linux config on 2.3 release. coreboot is on gop, not libgfxinit. This is to open discussion.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
Thierry Laurion 2023-11-20 11:17:38 -05:00
parent 0e42833ada
commit 664603cf8c
No known key found for this signature in database
GPG Key ID: E7B4A71658E36A93
7 changed files with 325 additions and 160 deletions

View File

@ -38,7 +38,7 @@ CONFIG_LINUX_E1000=y
export CONFIG_BOOTSCRIPT=/bin/gui-init
export CONFIG_BOOT_KERNEL_ADD="intel_iommu=igfx_off"
export CONFIG_BOOT_KERNEL_ADD=""
export CONFIG_BOOT_KERNEL_REMOVE="intel_iommu=on intel_iommu=igfx_off"
# TPM2 requirements

View File

@ -35,6 +35,11 @@ CONFIG_TSEG_STAGE_CACHE=y
# CONFIG_UPDATE_IMAGE is not set
CONFIG_BOOTSPLASH_IMAGE=y
CONFIG_BOOTSPLASH_FILE="@BRAND_DIR@/bootsplash.jpg"
CONFIG_BOOTSPLASH_CONVERT=y
CONFIG_BOOTSPLASH_CONVERT_QUALITY=90
CONFIG_BOOTSPLASH_CONVERT_RESIZE=y
CONFIG_BOOTSPLASH_CONVERT_RESOLUTION="1920x1080"
# CONFIG_BOOTSPLASH_CONVERT_COLORSWAP is not set
# CONFIG_FW_CONFIG is not set
# end of General setup

View File

@ -35,6 +35,11 @@ CONFIG_TSEG_STAGE_CACHE=y
# CONFIG_UPDATE_IMAGE is not set
CONFIG_BOOTSPLASH_IMAGE=y
CONFIG_BOOTSPLASH_FILE="@BRAND_DIR@/bootsplash.jpg"
CONFIG_BOOTSPLASH_CONVERT=y
CONFIG_BOOTSPLASH_CONVERT_QUALITY=90
CONFIG_BOOTSPLASH_CONVERT_RESIZE=y
CONFIG_BOOTSPLASH_CONVERT_RESOLUTION="1920x1080"
# CONFIG_BOOTSPLASH_CONVERT_COLORSWAP is not set
# CONFIG_FW_CONFIG is not set
# end of General setup

View File

@ -260,7 +260,7 @@ CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
#
CONFIG_SMP=y
CONFIG_X86_FEATURE_NAMES=y
# CONFIG_X86_MPPARSE is not set
CONFIG_X86_MPPARSE=y
# CONFIG_GOLDFISH is not set
# CONFIG_X86_CPU_RESCTRL is not set
# CONFIG_X86_EXTENDED_PLATFORM is not set
@ -298,7 +298,7 @@ CONFIG_BOOT_VESA_SUPPORT=y
CONFIG_NR_CPUS_RANGE_BEGIN=2
CONFIG_NR_CPUS_RANGE_END=512
CONFIG_NR_CPUS_DEFAULT=64
CONFIG_NR_CPUS=32
CONFIG_NR_CPUS=64
CONFIG_SCHED_CLUSTER=y
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
@ -395,7 +395,6 @@ CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_FAN=y
# CONFIG_ACPI_DOCK is not set
CONFIG_ACPI_CPU_FREQ_PSS=y
@ -642,8 +641,7 @@ CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_ZSTD is not set
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
CONFIG_MODPROBE_PATH="/sbin/modprobe"
CONFIG_TRIM_UNUSED_KSYMS=y
CONFIG_UNUSED_KSYMS_WHITELIST=""
# CONFIG_TRIM_UNUSED_KSYMS is not set
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_BLOCK=y
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
@ -752,7 +750,6 @@ CONFIG_ARCH_HAS_PTE_DEVMAP=y
CONFIG_ARCH_HAS_ZONE_DMA_SET=y
# CONFIG_ZONE_DMA is not set
CONFIG_ZONE_DMA32=y
CONFIG_VMAP_PFN=y
# CONFIG_VM_EVENT_COUNTERS is not set
# CONFIG_PERCPU_STATS is not set
@ -889,10 +886,12 @@ CONFIG_PCI_MSI=y
CONFIG_PCI_MSI_IRQ_DOMAIN=y
CONFIG_PCI_QUIRKS=y
# CONFIG_PCI_DEBUG is not set
# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set
# CONFIG_PCI_STUB is not set
# CONFIG_PCI_PF_STUB is not set
CONFIG_PCI_ATS=y
CONFIG_PCI_LOCKLESS_CONFIG=y
# CONFIG_PCI_IOV is not set
CONFIG_PCI_IOV=y
CONFIG_PCI_PRI=y
CONFIG_PCI_PASID=y
CONFIG_PCI_LABEL=y
@ -947,7 +946,6 @@ CONFIG_VGA_ARB_MAX_GPUS=16
#
# Generic Driver Options
#
CONFIG_AUXILIARY_BUS=y
# CONFIG_UEVENT_HELPER is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
@ -1036,7 +1034,7 @@ CONFIG_EFI_CUSTOM_SSDT_OVERLAYS=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
# CONFIG_PARPORT is not set
CONFIG_PNP=y
# CONFIG_PNP_DEBUG_MESSAGES is not set
CONFIG_PNP_DEBUG_MESSAGES=y
#
# Protocols
@ -1120,9 +1118,6 @@ CONFIG_EEPROM_93CX6=m
CONFIG_INTEL_MEI=m
CONFIG_INTEL_MEI_ME=m
CONFIG_INTEL_MEI_TXE=m
# CONFIG_INTEL_MEI_GSC is not set
# CONFIG_INTEL_MEI_HDCP is not set
# CONFIG_INTEL_MEI_PXP is not set
# CONFIG_VMWARE_VMCI is not set
# CONFIG_GENWQE is not set
# CONFIG_ECHO is not set
@ -1226,7 +1221,7 @@ CONFIG_ISCSI_TCP=y
CONFIG_ATA=y
CONFIG_SATA_HOST=y
CONFIG_PATA_TIMINGS=y
# CONFIG_ATA_VERBOSE_ERROR is not set
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_ATA_FORCE=y
CONFIG_ATA_ACPI=y
CONFIG_SATA_PMP=y
@ -1587,7 +1582,7 @@ CONFIG_TCG_TIS=y
# CONFIG_XILLYBUS is not set
# CONFIG_XILLYUSB is not set
CONFIG_RANDOM_TRUST_CPU=y
CONFIG_RANDOM_TRUST_BOOTLOADER=y
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set
# end of Character devices
#
@ -1869,116 +1864,16 @@ CONFIG_MFD_SYSCON=y
#
CONFIG_APERTURE_HELPERS=y
# CONFIG_AGP is not set
CONFIG_INTEL_GTT=y
# CONFIG_VGA_SWITCHEROO is not set
CONFIG_DRM=y
CONFIG_DRM_MIPI_DSI=y
# CONFIG_DRM_DEBUG_MM is not set
CONFIG_DRM_KMS_HELPER=y
# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set
# CONFIG_DRM is not set
# CONFIG_DRM_DEBUG_MODESET_LOCK is not set
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_FBDEV_OVERALLOC=100
CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM=y
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_DISPLAY_HELPER=y
CONFIG_DRM_DISPLAY_DP_HELPER=y
CONFIG_DRM_DISPLAY_HDCP_HELPER=y
CONFIG_DRM_DISPLAY_HDMI_HELPER=y
# CONFIG_DRM_DP_AUX_CHARDEV is not set
# CONFIG_DRM_DP_CEC is not set
CONFIG_DRM_TTM=y
CONFIG_DRM_BUDDY=y
CONFIG_DRM_VRAM_HELPER=y
CONFIG_DRM_TTM_HELPER=y
#
# I2C encoder or helper chips
#
# CONFIG_DRM_I2C_CH7006 is not set
# CONFIG_DRM_I2C_SIL164 is not set
# CONFIG_DRM_I2C_NXP_TDA998X is not set
# CONFIG_DRM_I2C_NXP_TDA9950 is not set
# end of I2C encoder or helper chips
#
# ARM devices
#
# end of ARM devices
# CONFIG_DRM_RADEON is not set
# CONFIG_DRM_AMDGPU is not set
# CONFIG_DRM_NOUVEAU is not set
CONFIG_DRM_I915=y
CONFIG_DRM_I915_FORCE_PROBE=""
CONFIG_DRM_I915_CAPTURE_ERROR=y
CONFIG_DRM_I915_COMPRESS_ERROR=y
CONFIG_DRM_I915_USERPTR=y
#
# drm/i915 Debugging
#
# CONFIG_DRM_I915_WERROR is not set
# CONFIG_DRM_I915_DEBUG is not set
# CONFIG_DRM_I915_DEBUG_MMIO is not set
# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set
# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set
# CONFIG_DRM_I915_DEBUG_GUC is not set
# CONFIG_DRM_I915_SELFTEST is not set
# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set
# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set
# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set
# end of drm/i915 Debugging
#
# drm/i915 Profile Guided Optimisation
#
CONFIG_DRM_I915_REQUEST_TIMEOUT=20000
CONFIG_DRM_I915_FENCE_TIMEOUT=10000
CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250
CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500
CONFIG_DRM_I915_PREEMPT_TIMEOUT=640
CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000
CONFIG_DRM_I915_STOP_TIMEOUT=100
CONFIG_DRM_I915_TIMESLICE_DURATION=1
# end of drm/i915 Profile Guided Optimisation
# CONFIG_DRM_VGEM is not set
# CONFIG_DRM_VKMS is not set
# CONFIG_DRM_VMWGFX is not set
# CONFIG_DRM_GMA500 is not set
# CONFIG_DRM_UDL is not set
CONFIG_DRM_AST=y
# CONFIG_DRM_MGAG200 is not set
# CONFIG_DRM_QXL is not set
CONFIG_DRM_PANEL=y
#
# Display Panels
#
# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set
# end of Display Panels
CONFIG_DRM_BRIDGE=y
CONFIG_DRM_PANEL_BRIDGE=y
#
# Display Interface Bridges
#
# CONFIG_DRM_ANALOGIX_ANX78XX is not set
# end of Display Interface Bridges
# CONFIG_DRM_ETNAVIV is not set
# CONFIG_DRM_BOCHS is not set
# CONFIG_DRM_CIRRUS_QEMU is not set
# CONFIG_DRM_GM12U320 is not set
# CONFIG_DRM_SIMPLEDRM is not set
# CONFIG_DRM_VBOXVIDEO is not set
# CONFIG_DRM_GUD is not set
# CONFIG_DRM_SSD130X is not set
# CONFIG_DRM_LEGACY is not set
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
CONFIG_DRM_NOMODESET=y
#
# Frame buffer Devices
@ -1990,12 +1885,7 @@ CONFIG_FB=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_DEFERRED_IO=y
# CONFIG_FB_MODE_HELPERS is not set
# CONFIG_FB_TILEBLITTING is not set
@ -2049,20 +1939,9 @@ CONFIG_FB_EFI=y
# Backlight & LCD device support
#
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_APPLE is not set
# CONFIG_BACKLIGHT_QCOM_WLED is not set
# CONFIG_BACKLIGHT_SAHARA is not set
# CONFIG_BACKLIGHT_ADP8860 is not set
# CONFIG_BACKLIGHT_ADP8870 is not set
# CONFIG_BACKLIGHT_LM3639 is not set
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
# CONFIG_BACKLIGHT_ARCXCNN is not set
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
# end of Backlight & LCD device support
CONFIG_HDMI=y
#
# Console display driver support
#
@ -2071,8 +1950,8 @@ CONFIG_DUMMY_CONSOLE=y
CONFIG_DUMMY_CONSOLE_COLUMNS=80
CONFIG_DUMMY_CONSOLE_ROWS=25
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION=y
# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set
# end of Console display driver support
@ -2486,34 +2365,20 @@ CONFIG_SURFACE_PLATFORMS=y
# CONFIG_SURFACE_GPE is not set
# CONFIG_SURFACE_PRO3_BUTTON is not set
CONFIG_X86_PLATFORM_DEVICES=y
CONFIG_ACPI_WMI=y
CONFIG_WMI_BMOF=y
# CONFIG_HUAWEI_WMI is not set
# CONFIG_MXM_WMI is not set
# CONFIG_PEAQ_WMI is not set
# CONFIG_NVIDIA_WMI_EC_BACKLIGHT is not set
# CONFIG_XIAOMI_WMI is not set
# CONFIG_YOGABOOK_WMI is not set
# CONFIG_ACPI_WMI is not set
# CONFIG_ACERHDF is not set
# CONFIG_ACER_WIRELESS is not set
# CONFIG_ACER_WMI is not set
# CONFIG_AMD_PMF is not set
# CONFIG_AMD_PMC is not set
# CONFIG_ADV_SWBUTTON is not set
# CONFIG_APPLE_GMUX is not set
# CONFIG_ASUS_LAPTOP is not set
# CONFIG_ASUS_WIRELESS is not set
# CONFIG_X86_PLATFORM_DRIVERS_DELL is not set
# CONFIG_FUJITSU_LAPTOP is not set
# CONFIG_FUJITSU_TABLET is not set
# CONFIG_GPD_POCKET_FAN is not set
# CONFIG_HP_ACCEL is not set
# CONFIG_WIRELESS_HOTKEY is not set
# CONFIG_HP_WMI is not set
# CONFIG_IBM_RTL is not set
# CONFIG_SENSORS_HDAPS is not set
# CONFIG_THINKPAD_ACPI is not set
# CONFIG_THINKPAD_LMI is not set
# CONFIG_INTEL_SAR_INT1092 is not set
# CONFIG_INTEL_PMC_CORE is not set
@ -2523,9 +2388,6 @@ CONFIG_WMI_BMOF=y
# CONFIG_INTEL_SPEED_SELECT_INTERFACE is not set
# end of Intel Speed Select Technology interface support
# CONFIG_INTEL_WMI_SBL_FW_UPDATE is not set
# CONFIG_INTEL_WMI_THUNDERBOLT is not set
#
# Intel Uncore Frequency Control
#
@ -2539,15 +2401,10 @@ CONFIG_WMI_BMOF=y
# CONFIG_INTEL_SMARTCONNECT is not set
# CONFIG_INTEL_TURBO_MAX_3 is not set
# CONFIG_INTEL_VSEC is not set
# CONFIG_MSI_WMI is not set
# CONFIG_SAMSUNG_LAPTOP is not set
# CONFIG_SAMSUNG_Q10 is not set
# CONFIG_TOSHIBA_BT_RFKILL is not set
# CONFIG_TOSHIBA_HAPS is not set
# CONFIG_TOSHIBA_WMI is not set
# CONFIG_ACPI_CMPC is not set
# CONFIG_LG_LAPTOP is not set
# CONFIG_PANASONIC_LAPTOP is not set
# CONFIG_TOPSTAR_LAPTOP is not set
# CONFIG_MLX_PLATFORM is not set
# CONFIG_INTEL_IPS is not set
@ -2591,7 +2448,7 @@ CONFIG_INTEL_IOMMU=y
CONFIG_INTEL_IOMMU_SVM=y
CONFIG_INTEL_IOMMU_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_FLOPPY_WA=y
CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON=y
# CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON is not set
# CONFIG_IRQ_REMAP is not set
#
@ -3184,7 +3041,7 @@ CONFIG_CRC8=m
CONFIG_842_COMPRESS=m
CONFIG_842_DECOMPRESS=m
CONFIG_ZLIB_INFLATE=m
CONFIG_ZLIB_DEFLATE=y
CONFIG_ZLIB_DEFLATE=m
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_LZ4_COMPRESS=m

View File

@ -0,0 +1,150 @@
From 4fafe82b67dfe6919fe7be93459083549aac9f25 Mon Sep 17 00:00:00 2001
From: Nico Huber <nico.h@gmx.de>
Date: Fri, 14 Jul 2023 00:09:00 +0200
Subject: [PATCH] Center bootsplash on bigger framebuffers
In the JPEG decoder, use `bytes_per_line` instead of `width` for
address calculations, to allow for bigger framebuffers. When
calling jpeg_decode(), add an offset to the framebuffer address
so the picture gets centered.
Change-Id: I0174bdccfaad425e708a5fa50bcb28a1b98a23f7
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
diff --git a/src/include/bootsplash.h b/src/include/bootsplash.h
index 10da5aa..9d1bae3 100644
--- a/src/include/bootsplash.h
+++ b/src/include/bootsplash.h
@@ -12,7 +12,8 @@
* and >0 on jpeg errors.
*/
void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
- unsigned int y_resolution, unsigned int fb_resolution);
+ unsigned int y_resolution, unsigned int bytes_per_line,
+ unsigned int fb_resolution);
void bmp_load_logo(uint32_t *logo_ptr, uint32_t *logo_size);
diff --git a/src/lib/bootsplash.c b/src/lib/bootsplash.c
index 0eb94dc..3ab11ac 100644
--- a/src/lib/bootsplash.c
+++ b/src/lib/bootsplash.c
@@ -11,7 +11,8 @@
void set_bootsplash(unsigned char *framebuffer, unsigned int x_resolution,
- unsigned int y_resolution, unsigned int fb_resolution)
+ unsigned int y_resolution, unsigned int bytes_per_line,
+ unsigned int fb_resolution)
{
printk(BIOS_INFO, "Setting up bootsplash in %dx%d@%d\n", x_resolution, y_resolution,
fb_resolution);
@@ -27,9 +28,20 @@
printk(BIOS_DEBUG, "Bootsplash image resolution: %dx%d\n", image_width, image_height);
+ if (image_width > x_resolution || image_height > y_resolution) {
+ printk(BIOS_NOTICE, "Bootsplash image can't fit framebuffer.\n");
+ cbfs_unmap(jpeg);
+ return;
+ }
+
+ /* center image: */
+ framebuffer += (y_resolution - image_height) / 2 * bytes_per_line +
+ (x_resolution - image_width) / 2 * (fb_resolution / 8);
+
decdata = malloc(sizeof(*decdata));
- int ret = jpeg_decode(jpeg, framebuffer, x_resolution, y_resolution, fb_resolution,
- decdata);
+ int ret = jpeg_decode(jpeg, framebuffer, image_width, image_height,
+ bytes_per_line, fb_resolution, decdata);
+ free(decdata);
cbfs_unmap(jpeg);
if (ret != 0) {
printk(BIOS_ERR, "Bootsplash could not be decoded. jpeg_decode returned %d.\n",
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index bee389d..800d2d4 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -155,8 +155,9 @@
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 bytes_per_line = framebuffer->bytes_per_line;
unsigned int depth = framebuffer->bits_per_pixel;
- set_bootsplash(fb_ptr, width, height, depth);
+ set_bootsplash(fb_ptr, width, height, bytes_per_line, depth);
}
}
diff --git a/src/lib/jpeg.c b/src/lib/jpeg.c
index b3d4c89..ed4377f 100644
--- a/src/lib/jpeg.c
+++ b/src/lib/jpeg.c
@@ -267,7 +267,8 @@
}
int jpeg_decode(unsigned char *buf, unsigned char *pic,
- int width, int height, int depth, struct jpeg_decdata *decdata)
+ int width, int height, int bytes_per_line, int depth,
+ struct jpeg_decdata *decdata)
{
int i, j, m, tac, tdc;
int mcusx, mcusy, mx, my;
@@ -382,19 +383,19 @@
switch (depth) {
case 32:
- col221111_32(decdata->out, pic
- + (my * 16 * mcusx + mx) * 16 * 4,
- mcusx * 16 * 4);
+ col221111_32(decdata->out,
+ pic + my * 16 * bytes_per_line + mx * 16 * 4,
+ bytes_per_line);
break;
case 24:
- col221111(decdata->out, pic
- + (my * 16 * mcusx + mx) * 16 * 3,
- mcusx * 16 * 3);
+ col221111(decdata->out,
+ pic + my * 16 * bytes_per_line + mx * 16 * 3,
+ bytes_per_line);
break;
case 16:
- col221111_16(decdata->out, pic
- + (my * 16 * mcusx + mx) * (16 * 2),
- mcusx * (16 * 2));
+ col221111_16(decdata->out,
+ pic + my * 16 * bytes_per_line + mx * 16 * 2,
+ bytes_per_line);
break;
default:
return ERR_DEPTH_MISMATCH;
diff --git a/src/lib/jpeg.h b/src/lib/jpeg.h
index 237da9f..fdb2def 100644
--- a/src/lib/jpeg.h
+++ b/src/lib/jpeg.h
@@ -31,8 +31,7 @@
int dquant[3][64];
};
-int jpeg_decode(unsigned char *, unsigned char *, int, int, int,
- struct jpeg_decdata *);
+int jpeg_decode(unsigned char *, unsigned char *, int, int, int, int, struct jpeg_decdata *);
void jpeg_fetch_size(unsigned char *buf, int *width, int *height);
int jpeg_check_size(unsigned char *, int, int);
diff --git a/util/fuzz-tests/jpeg-test.c b/util/fuzz-tests/jpeg-test.c
index 69e6c8d..da21824 100644
--- a/util/fuzz-tests/jpeg-test.c
+++ b/util/fuzz-tests/jpeg-test.c
@@ -30,7 +30,7 @@
jpeg_fetch_size(buf, &width, &height);
//printf("width: %d, height: %d\n", width, height);
char *pic = malloc(depth / 8 * width * height);
- int ret = jpeg_decode(buf, pic, width, height, depth, decdata);
+ int ret = jpeg_decode(buf, pic, width, height, width * depth / 8, depth, decdata);
//printf("ret: %x\n", ret);
return ret;
}

View File

@ -0,0 +1,12 @@
diff -u --recursive coreboot-git.org/src/mainboard/clevo/adl-p/ramstage.c coreboot-git/src/mainboard/clevo/adl-p/ramstage.c
--- coreboot-git.org/src/mainboard/clevo/adl-p/ramstage.c 2023-09-25 13:59:42.737397657 +0200
+++ coreboot-git/src/mainboard/clevo/adl-p/ramstage.c 2023-09-25 14:00:19.384660682 +0200
@@ -50,7 +50,7 @@
#define SLEEP_TYPE_OPTION_S0IX 0
#define SLEEP_TYPE_OPTION_S3 1
-#define SLEEP_TYPE_OPTION_DEFAULT SLEEP_TYPE_OPTION_S0IX
+#define SLEEP_TYPE_OPTION_DEFAULT SLEEP_TYPE_OPTION_S3
const char *smbios_system_sku(void)
{

View File

@ -0,0 +1,136 @@
From 0c9e832ea1fe321737b1980588407f283ec92ef2 Mon Sep 17 00:00:00 2001
From: Nico Huber <nico.h@gmx.de>
Date: Sun, 16 Jul 2023 19:24:13 +0200
Subject: [PATCH] bootsplash: Add ImageMagick voodoo
Ta-da!
(commit message tbd)
Change-Id: I564e0d89fb46503ff4c11e095726616700009968
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
diff --git a/Makefile.inc b/Makefile.inc
index 0d38ea3..5e1dcee 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -357,6 +357,24 @@
$(eval DEPENDENCIES += $(2).d)
#######################################################################
+# Convert image to YCC 4:2:0 JPEG
+# arg1: image input file
+# arg2: output jpg
+cbfs-files-processor-jpg420= \
+ $(eval $(2): $(1) $(KCONFIG_AUTOCONFIG); \
+ printf " CONVERT $$<\n"; \
+ convert $$< $(BOOTSPLASH_RESIZE-y) $(BOOTSPLASH_COLORSWAP-y) \
+ -quality $(CONFIG_BOOTSPLASH_CONVERT_QUALITY)% \
+ -interlace none -colorspace YCC -sampling-factor 4:2:0 \
+ jpg:$$@)
+BOOTSPLASH_RESOLUTION = $(shell res=$(CONFIG_BOOTSPLASH_CONVERT_RESOLUTION); \
+ echo $$(($${res%%x*}/16*16))x$$(($${res##*x}/16*16)) 2>/dev/null)
+BOOTSPLASH_RESIZE-$(CONFIG_BOOTSPLASH_CONVERT_RESIZE) = \
+ -resize $(BOOTSPLASH_RESOLUTION) -background black \
+ -gravity center -extent $(BOOTSPLASH_RESOLUTION)
+BOOTSPLASH_COLORSWAP-$(CONFIG_BOOTSPLASH_CONVERT_COLORSWAP) := -channel-fx 'red<=>blue'
+
+#######################################################################
# Add handler for arbitrary files in CBFS
$(call add-special-class,cbfs-files)
cbfs-files-handler= \
@@ -1281,10 +1299,16 @@
build_info-file := $(obj)/build_info
build_info-type := raw
+ifeq ($(CONFIG_BOOTSPLASH_CONVERT),y)
+cbfs-files-$(CONFIG_BOOTSPLASH_IMAGE) += bootsplash.jpg
+bootsplash.jpg-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE)):jpg420
+bootsplash.jpg-type := bootsplash
+else
BOOTSPLASH_SUFFIX=$(suffix $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE)))
cbfs-files-$(CONFIG_BOOTSPLASH_IMAGE) += bootsplash$(BOOTSPLASH_SUFFIX)
bootsplash$(BOOTSPLASH_SUFFIX)-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE))
bootsplash$(BOOTSPLASH_SUFFIX)-type := bootsplash
+endif
# Ensure that no payload segment overlaps with memory regions used by ramstage
# (not for x86 since it can relocate itself in that case)
diff --git a/src/Kconfig b/src/Kconfig
index f5ba4fc..e906130 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -447,7 +447,52 @@
# Default value set at the end of the file
help
The path and filename of the file to use as graphical bootsplash
- screen. The file format has to be jpg.
+ screen. The file format has to be JPEG with YCC 4:2:0 color sampling
+ unless converted with "Pre-process bootsplash file with ImageMagick".
+
+ The image can only be displayed by coreboot if it's smaller or has
+ the same size as the framebuffer resolution. Width and height have
+ to be a multiple of 16 pixels.
+
+ Setting these constraints allows a leaner implementation in coreboot.
+ The minimum necessary ImageMagick command line seems to be:
+ $ convert input.img -colorspace YCC -sampling-factor 4:2:0 bootsplash.jpg
+
+config BOOTSPLASH_CONVERT
+ bool "Pre-process bootsplash file with ImageMagick"
+ depends on BOOTSPLASH_IMAGE
+ # Default value set at the end of the file
+ help
+ Use ImageMagick (`convert` program) to convert a bootsplash image
+ to the supported JPEG format.
+
+config BOOTSPLASH_CONVERT_QUALITY
+ int "Bootsplash JPEG target quality (%)"
+ depends on BOOTSPLASH_CONVERT
+ range 1 100
+ # Default value set at the end of the file
+
+config BOOTSPLASH_CONVERT_RESIZE
+ bool "Resize bootsplash image"
+ depends on BOOTSPLASH_CONVERT
+ help
+ Resize the image to the given resolution. Aspect ratio will be kept,
+ adding black bars as necessary.
+
+config BOOTSPLASH_CONVERT_RESOLUTION
+ string "Bootsplash image target size"
+ depends on BOOTSPLASH_CONVERT_RESIZE
+ # Default value set at the end of the file
+ help
+ Target image resolution given as <width>x<height>, e.g. 1024x768.
+ Values not divisible by 16 will be rounded down.
+
+config BOOTSPLASH_CONVERT_COLORSWAP
+ bool "Swap red and blue color channels"
+ depends on BOOTSPLASH_CONVERT
+ help
+ The JPEG decoder currently ignores the framebuffer color order.
+ If your colors seem all wrong, try this option.
config FW_CONFIG
bool "Firmware Configuration Probing"
@@ -1444,6 +1489,18 @@
depends on BOOTSPLASH_IMAGE
default "bootsplash.jpg"
+config BOOTSPLASH_CONVERT
+ depends on BOOTSPLASH_IMAGE
+ default y
+
+config BOOTSPLASH_CONVERT_QUALITY
+ depends on BOOTSPLASH_CONVERT
+ default 70
+
+config BOOTSPLASH_CONVERT_RESOLUTION
+ depends on BOOTSPLASH_CONVERT_RESIZE
+ default "1024x768"
+
config CBFS_SIZE
default ROM_SIZE