[PATCH 05/10] sandbox: video: Drop CONFIG_LCD_BMP_RLE8

Simon Glass sjg at chromium.org
Sun Nov 14 04:21:56 CET 2021


This is not defined by any board except sandbox. Even sandbox doesn't
actually use it since it has migrated to DM_VIDEO.

Drop this option. Remove the dead code also, for completeness, even
though the whole lcd.c file will be dropped soon.

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

 README                       |   4 -
 common/lcd.c                 | 142 -----------------------------------
 include/configs/sandbox.h    |   3 -
 scripts/config_whitelist.txt |   1 -
 4 files changed, 150 deletions(-)

diff --git a/README b/README
index 70485e7fb9f..53707dbef70 100644
--- a/README
+++ b/README
@@ -1181,10 +1181,6 @@ The following options need to be configured:
 		If CONFIG_LCD_ROTATION is not defined, the console will be
 		initialized with 0degree rotation.
 
-		CONFIG_LCD_BMP_RLE8
-
-		Support drawing of RLE8-compressed bitmaps on the LCD.
-
 - MII/PHY support:
 		CONFIG_PHY_CLOCK_FREQ (ppc4xx)
 
diff --git a/common/lcd.c b/common/lcd.c
index 16a0a7cea8f..02973721051 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -399,135 +399,6 @@ static void splash_align_axis(int *axis, unsigned long panel_size,
 }
 #endif
 
-#ifdef CONFIG_LCD_BMP_RLE8
-#define BMP_RLE8_ESCAPE		0
-#define BMP_RLE8_EOL		0
-#define BMP_RLE8_EOBMP		1
-#define BMP_RLE8_DELTA		2
-
-static void draw_unencoded_bitmap(ushort **fbp, uchar *bmap, ushort *cmap,
-				  int cnt)
-{
-	while (cnt > 0) {
-		*(*fbp)++ = cmap[*bmap++];
-		cnt--;
-	}
-}
-
-static void draw_encoded_bitmap(ushort **fbp, ushort c, int cnt)
-{
-	ushort *fb = *fbp;
-	int cnt_8copy = cnt >> 3;
-
-	cnt -= cnt_8copy << 3;
-	while (cnt_8copy > 0) {
-		*fb++ = c;
-		*fb++ = c;
-		*fb++ = c;
-		*fb++ = c;
-		*fb++ = c;
-		*fb++ = c;
-		*fb++ = c;
-		*fb++ = c;
-		cnt_8copy--;
-	}
-	while (cnt > 0) {
-		*fb++ = c;
-		cnt--;
-	}
-	*fbp = fb;
-}
-
-/*
- * Do not call this function directly, must be called from lcd_display_bitmap.
- */
-static void lcd_display_rle8_bitmap(struct bmp_image *bmp, ushort *cmap,
-				    uchar *fb, int x_off, int y_off)
-{
-	uchar *bmap;
-	ulong width, height;
-	ulong cnt, runlen;
-	int x, y;
-	int decode = 1;
-
-	width = get_unaligned_le32(&bmp->header.width);
-	height = get_unaligned_le32(&bmp->header.height);
-	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
-
-	x = 0;
-	y = height - 1;
-
-	while (decode) {
-		if (bmap[0] == BMP_RLE8_ESCAPE) {
-			switch (bmap[1]) {
-			case BMP_RLE8_EOL:
-				/* end of line */
-				bmap += 2;
-				x = 0;
-				y--;
-				/* 16bpix, 2-byte per pixel, width should *2 */
-				fb -= (width * 2 + lcd_line_length);
-				break;
-			case BMP_RLE8_EOBMP:
-				/* end of bitmap */
-				decode = 0;
-				break;
-			case BMP_RLE8_DELTA:
-				/* delta run */
-				x += bmap[2];
-				y -= bmap[3];
-				/* 16bpix, 2-byte per pixel, x should *2 */
-				fb = (uchar *) (lcd_base + (y + y_off - 1)
-					* lcd_line_length + (x + x_off) * 2);
-				bmap += 4;
-				break;
-			default:
-				/* unencoded run */
-				runlen = bmap[1];
-				bmap += 2;
-				if (y < height) {
-					if (x < width) {
-						if (x + runlen > width)
-							cnt = width - x;
-						else
-							cnt = runlen;
-						draw_unencoded_bitmap(
-							(ushort **)&fb,
-							bmap, cmap, cnt);
-					}
-					x += runlen;
-				}
-				bmap += runlen;
-				if (runlen & 1)
-					bmap++;
-			}
-		} else {
-			/* encoded run */
-			if (y < height) {
-				runlen = bmap[0];
-				if (x < width) {
-					/* aggregate the same code */
-					while (bmap[0] == 0xff &&
-					       bmap[2] != BMP_RLE8_ESCAPE &&
-					       bmap[1] == bmap[3]) {
-						runlen += bmap[2];
-						bmap += 2;
-					}
-					if (x + runlen > width)
-						cnt = width - x;
-					else
-						cnt = runlen;
-					draw_encoded_bitmap((ushort **)&fb,
-						cmap[bmap[1]], cnt);
-				}
-				x += runlen;
-			}
-			bmap += 2;
-		}
-	}
-}
-#endif
-
 __weak void fb_put_byte(uchar **fb, uchar **from)
 {
 	*(*fb)++ = *(*from)++;
@@ -633,19 +504,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	case 1:
 	case 8: {
 		cmap_base = configuration_get_cmap();
-#ifdef CONFIG_LCD_BMP_RLE8
-		u32 compression = get_unaligned_le32(&bmp->header.compression);
-		debug("compressed %d %d\n", compression, BMP_BI_RLE8);
-		if (compression == BMP_BI_RLE8) {
-			if (bpix != 16) {
-				/* TODO implement render code for bpix != 16 */
-				printf("Error: only support 16 bpix");
-				return 1;
-			}
-			lcd_display_rle8_bitmap(bmp, cmap_base, fb, x, y);
-			break;
-		}
-#endif
 
 		if (bpix != 16)
 			byte_width = width;
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 48cae7d972a..0500ed1f8ae 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -50,9 +50,6 @@
 
 /* LCD and keyboard require SDL support */
 #ifdef CONFIG_SANDBOX_SDL
-#define LCD_BPP			LCD_COLOR16
-#define CONFIG_LCD_BMP_RLE8
-
 #define CONFIG_KEYBOARD
 
 #define SANDBOX_SERIAL_SETTINGS		"stdin=serial,cros-ec-keyb,usbkbd\0" \
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 72391d4c456..cca9f074868 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -697,7 +697,6 @@ CONFIG_LAYERSCAPE_NS_ACCESS
 CONFIG_LBA48
 CONFIG_LBDAF
 CONFIG_LCD_ALIGNMENT
-CONFIG_LCD_BMP_RLE8
 CONFIG_LCD_DT_SIMPLEFB
 CONFIG_LCD_INFO
 CONFIG_LCD_INFO_BELOW_LOGO
-- 
2.34.0.rc1.387.gb447b232ab-goog



More information about the U-Boot mailing list