[PATCH 03/39] video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE

Simon Glass sjg at chromium.org
Wed Oct 19 13:23:20 CEST 2022


This option should not have the SYS_ in it. Drop it so it fits in with the
other video options.

Also simplify the alignment code in gunzip_bmp(), since malloc() always
returns a 32-bit-aligned pointer.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 board/menlo/m53menlo/m53menlo.c     |  6 +++---
 cmd/bmp.c                           | 19 ++++++++-----------
 drivers/video/Kconfig               |  3 +++
 include/configs/m53menlo.h          |  2 +-
 include/configs/mx23evk.h           |  2 +-
 include/configs/mx28evk.h           |  2 +-
 include/configs/nitrogen6x.h        |  2 +-
 include/configs/s5pc210_universal.h |  2 +-
 include/configs/trats.h             |  2 +-
 include/configs/trats2.h            |  2 +-
 scripts/config_whitelist.txt        |  2 +-
 11 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index 4afc5aaa436..14324c7087d 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -358,7 +358,7 @@ int board_late_init(void)
 		return 0;
 
 	addr = hextoul(s, NULL);
-	dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
+	dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE);
 	if (!dst)
 		return -ENOMEM;
 
@@ -366,8 +366,8 @@ int board_late_init(void)
 	if (ret < 0)
 		goto splasherr;
 
-	len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
-	ret = gunzip(dst + 2, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE - 2,
+	len = CONFIG_VIDEO_LOGO_MAX_SIZE;
+	ret = gunzip(dst + 2, CONFIG_VIDEO_LOGO_MAX_SIZE - 2,
 		     (uchar *)addr, &len);
 	if (ret) {
 		printf("Error: no valid bmp or bmp.gz image at %lx\n", addr);
diff --git a/cmd/bmp.c b/cmd/bmp.c
index d72a826ae74..5a3c8ddf8c8 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -48,27 +48,24 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
 	/*
 	 * Decompress bmp image
 	 */
-	len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
+	len = CONFIG_VIDEO_LOGO_MAX_SIZE;
 	/* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */
-	dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE + 3);
-	if (dst == NULL) {
+	dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE + 3);
+	if (!dst) {
 		puts("Error: malloc in gunzip failed!\n");
 		return NULL;
 	}
 
-	bmp = dst;
-
 	/* align to 32-bit-aligned-address + 2 */
-	bmp = (struct bmp_image *)((((uintptr_t)dst + 1) & ~3) + 2);
+	bmp = dst + 2;
 
-	if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
-		   &len) != 0) {
+	if (gunzip(bmp, CONFIG_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
+		   &len)) {
 		free(dst);
 		return NULL;
 	}
-	if (len == CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)
-		puts("Image could be truncated"
-				" (increase CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n");
+	if (len == CONFIG_VIDEO_LOGO_MAX_SIZE)
+		puts("Image could be truncated (increase CONFIG_VIDEO_LOGO_MAX_SIZE)!\n");
 
 	/*
 	 * Check for bmp mark 'BM'
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 8c110639dbc..a4c9bc62daa 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -918,6 +918,9 @@ config VIDEO_BMP_GZIP
 	  images, gzipped BMP images can be displayed via the
 	  splashscreen support or the bmp command.
 
+config VIDEO_LOGO_MAX_SIZE
+	bool "Maximum size of the bitmap logo in bytes"
+
 config VIDEO_BMP_RLE8
 	bool "Run length encoded BMP image (RLE8) support"
 	depends on DM_VIDEO
diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h
index 0499e633512..139919f391e 100644
--- a/include/configs/m53menlo.h
+++ b/include/configs/m53menlo.h
@@ -81,7 +81,7 @@
 /*
  * LCD
  */
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE	(2 << 20)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE	(2 << 20)
 
 /* LVDS display */
 #define CONFIG_SYS_LDB_CLOCK			33260000
diff --git a/include/configs/mx23evk.h b/include/configs/mx23evk.h
index 3507e83fb38..69d4552546f 100644
--- a/include/configs/mx23evk.h
+++ b/include/configs/mx23evk.h
@@ -23,7 +23,7 @@
 
 /* Framebuffer support */
 #ifdef CONFIG_DM_VIDEO
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE	(512 << 10)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE	(512 << 10)
 #endif
 
 /* Extra Environments */
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 9f3ac48b70a..6c2fcbf7645 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -26,7 +26,7 @@
 
 /* Framebuffer support */
 #ifdef CONFIG_DM_VIDEO
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE	(512 << 10)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE	(512 << 10)
 #endif
 
 /* Extra Environment */
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index 2007b48868f..92c8198cc4b 100644
--- a/include/configs/nitrogen6x.h
+++ b/include/configs/nitrogen6x.h
@@ -27,7 +27,7 @@
 #define CONFIG_MXC_USB_FLAGS	0
 
 /* Framebuffer and LCD */
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (6 * 1024 * 1024)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE (6 * 1024 * 1024)
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
 
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 137537d65f6..585c67b7912 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -121,6 +121,6 @@ int universal_spi_read(void);
  * LCD Settings
  */
 #define CONFIG_LD9040
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 530b413d5b6..973d15962cd 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -148,6 +148,6 @@
 #define LCD_BPP			LCD_COLOR16
 
 /* LCD */
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE  ((500 * 160 * 4) + 54)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE  ((500 * 160 * 4) + 54)
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 06c1fcd23e0..24afc220226 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -138,6 +138,6 @@
 #define LCD_BPP                 LCD_COLOR16
 
 /* LCD */
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
 
 #endif	/* __CONFIG_H */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 3cace62682c..31ecb3fe602 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1282,7 +1282,6 @@ CONFIG_SYS_VCXK_INVERT_PORT
 CONFIG_SYS_VCXK_REQUEST_DDR
 CONFIG_SYS_VCXK_REQUEST_PIN
 CONFIG_SYS_VCXK_REQUEST_PORT
-CONFIG_SYS_VIDEO_LOGO_MAX_SIZE
 CONFIG_SYS_VSC7385_BASE
 CONFIG_SYS_VSC7385_BASE_PHYS
 CONFIG_SYS_VSC7385_BR_PRELIM
@@ -1352,6 +1351,7 @@ CONFIG_USB_TTY
 CONFIG_U_BOOT_HDR_SIZE
 CONFIG_VAR_SIZE_SPL
 CONFIG_VERY_BIG_RAM
+CONFIG_VIDEO_LOGO_MAX_SIZE
 CONFIG_VSC7385_ENET
 CONFIG_VSC7385_IMAGE
 CONFIG_VSC7385_IMAGE_SIZE
-- 
2.38.0.413.g74048e4d9e-goog



More information about the U-Boot mailing list