Skip to contentSkip to conversation

video: vidconsole: avoid multiple lines overwrite logo

PATCH New Ye Li 4 participants 12 messages Jun 10, 2020 – Jun 29, 2020 Framebuffer layer

lore
Share & tools
lore

Ye Li

author
#0 lore raw

PATCH 1/1 video: vidconsole: avoid multiple lines overwrite logo

Fix the bug that multiple lines wraps to overwrite logo bmp display.

---
 drivers/video/vidconsole-uclass.c | 1 +
 1 file changed, 1 insertion(+)
drivers/video/vidconsole-uclass.c +1 -0
index d30e6db..9b76154 100644
@@ -622,6 +622,7 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
 	col *= priv->x_charsize;
 	row *= priv->y_charsize;
 	priv->xcur_frac = VID_TO_POS(min_t(short, col, vid_priv->xsize - 1));
+	priv->xstart_frac = priv->xcur_frac;
 	priv->ycur = min_t(short, row, vid_priv->ysize - 1);
 }
 
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/1 splash: Fix build warning on 64 bits CPU

Get below warning on ARM64 platform, because the bmp_load_addr is defined to u32.

common/splash.c: In function ?splash_video_logo_load?:
common/splash.c:74:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
74 | memcpy((void *)bmp_load_addr, bmp_logo_bitmap,

---
 common/splash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/splash.c +1 -1
index e7d8477..2b9313e 100644
@@ -59,7 +59,7 @@ static struct splash_location default_splash_locations[] = {
 static int splash_video_logo_load(void)
 {
 	char *splashimage;
-	u32 bmp_load_addr;
+	ulong bmp_load_addr;
 
 	splashimage = env_get("splashimage");
 	if (!splashimage)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/1 splash: Fix build warning on 64 bits CPU

Quoted 11 lines · Ye Li

Get below warning on ARM64 platform, because the bmp_load_addr is defined to u32.

common/splash.c: In function ?splash_video_logo_load?:
common/splash.c:74:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
74 | memcpy((void *)bmp_load_addr, bmp_logo_bitmap,

---

#3 lore raw

PATCH 1/1 splash: Fix build warning on 64 bits CPU

In reply to Ye Li
Quoted 8 lines · On Wed, 10 Jun 2020 02:52:22 -0700 Ye Li ye.li at nxp.com wrote:

Get below warning on ARM64 platform, because the bmp_load_addr is defined to u32.

common/splash.c: In function ?splash_video_logo_load?:
common/splash.c:74:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
74 | memcpy((void *)bmp_load_addr, bmp_logo_bitmap,

Quoted 4 lines
---
 common/splash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-video/master, thanks!

--
Anatolij

author
#4 lore raw

PATCH 1/1 video: bmp: Support 8bits BMP to 24/32 bits display

In reply to Ye Li

Update video bmp codes to support 8 bits BMP to 32 bits conversion so that we can display 8 bits logo on 24 bits or 32 bits display

---
 drivers/video/video_bmp.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/video/video_bmp.c +26 -4
index eb96365..283e699 100644
@@ -233,6 +233,8 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 	 */
 	if (bpix != bmp_bpix &&
 	    !(bmp_bpix == 8 && bpix == 16) &&
+	    !(bmp_bpix == 8 && bpix == 24) &&
+	    !(bmp_bpix == 8 && bpix == 32) &&
 	    !(bmp_bpix == 24 && bpix == 16) &&
 	    !(bmp_bpix == 24 && bpix == 32)) {
 		printf("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
@@ -265,6 +267,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 	switch (bmp_bpix) {
 	case 1:
 	case 8: {
+		struct bmp_color_table_entry *cte;
 		cmap_base = priv->cmap;
 #ifdef CONFIG_VIDEO_BMP_RLE8
 		u32 compression = get_unaligned_le32(&bmp->header.compression);
@@ -281,20 +284,39 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 		}
 #endif
 
-		if (bpix != 16)
+		if (bpix == 8)
 			byte_width = width;
-		else
+		else if (bpix == 16)
 			byte_width = width * 2;
+		else if (bpix == 24)
+			byte_width = width * 3;
+		else /* 32 */
+			byte_width = width * 4;
 
 		for (i = 0; i < height; ++i) {
 			WATCHDOG_RESET();
 			for (j = 0; j < width; j++) {
-				if (bpix != 16) {
+				if (bpix == 8) {
 					fb_put_byte(&fb, &bmap);
-				} else {
+				} else if (bpix == 16) {
 					*(uint16_t *)fb = cmap_base[*bmap];
 					bmap++;
 					fb += sizeof(uint16_t) / sizeof(*fb);
+				} else if (bpix == 24) {
+					/* Only support big endian */
+					cte = &palette[*bmap];
+					bmap++;
+					*(fb++) = cte->red;
+					*(fb++) = cte->green;
+					*(fb++) = cte->blue;
+				} else if (bpix == 32) {
+					/* Only support big endian */
+					cte = &palette[*bmap];
+					bmap++;
+					*(fb++) = cte->blue;
+					*(fb++) = cte->green;
+					*(fb++) = cte->red;
+					*(fb++) = 0;
 				}
 			}
 			bmap += (padded_width - width);
Signature · 1 line
2.7.4
#6 lore raw

PATCH 1/1 video: bmp: Support 8bits BMP to 24/32 bits display

In reply to Ye Li

Hi Anatolij,

Quoted 5 lines · Ye Li

Update video bmp codes to support 8 bits BMP to 32 bits conversion so that we can display 8 bits logo on 24 bits or 32 bits display

I haven't had a chance to test this yet, but it seems to solve an outstanding splash screen issue on mx6ul evk/mx7d sabresd boards.

Maybe we should get this one and the other two from Ye Li to 2020.07?

Thanks

#7 lore raw

PATCH 1/1 video: bmp: Support 8bits BMP to 24/32 bits display

Hi Fabio,

Quoted 7 lines · On Thu, 18 Jun 2020 18:04:40 -0300 Fabio Estevam festevam at gmail.com wrote:

Hi Anatolij,

Quoted 4 lines · Ye Li

Update video bmp codes to support 8 bits BMP to 32 bits conversion so that we can display 8 bits logo on 24 bits or 32 bits display

Quoted 6 lines
Quoted 1 line

I haven't had a chance to test this yet, but it seems to solve an outstanding splash screen issue on mx6ul evk/mx7d sabresd boards.

Maybe we should get this one and the other two from Ye Li to 2020.07?

yes, we need a fix for the release, I will look later this week which patch should be merged (we have another older patch addressing this issue).

--
Anatolij

#8 lore raw

PATCH v2 1/1 video: bmp: support 8bits BMP drawing on 24/32 bpp framebuffer

In reply to Ye Li

From: Ye Li <[email protected]>

Update video bmp code so that we can display 8 bits logo on 24 or 32 bpp framebuffer.

---
Changes in v2:
- reduce code
- update commit message

 drivers/video/video_bmp.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/video/video_bmp.c +21 -6
index eb9636541d..7d7f37b445 100644
@@ -233,6 +233,8 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 	 */
 	if (bpix != bmp_bpix &&
 	    !(bmp_bpix == 8 && bpix == 16) &&
+	    !(bmp_bpix == 8 && bpix == 24) &&
+	    !(bmp_bpix == 8 && bpix == 32) &&
 	    !(bmp_bpix == 24 && bpix == 16) &&
 	    !(bmp_bpix == 24 && bpix == 32)) {
 		printf("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
@@ -265,6 +267,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 	switch (bmp_bpix) {
 	case 1:
 	case 8: {
+		struct bmp_color_table_entry *cte;
 		cmap_base = priv->cmap;
 #ifdef CONFIG_VIDEO_BMP_RLE8
 		u32 compression = get_unaligned_le32(&bmp->header.compression);
@@ -280,21 +283,33 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 			break;
 		}
 #endif
-
-		if (bpix != 16)
+		byte_width = width * (bpix / 8);
+		if (!byte_width)
 			byte_width = width;
-		else
-			byte_width = width * 2;
 
 		for (i = 0; i < height; ++i) {
 			WATCHDOG_RESET();
 			for (j = 0; j < width; j++) {
-				if (bpix != 16) {
+				if (bpix == 8) {
 					fb_put_byte(&fb, &bmap);
-				} else {
+				} else if (bpix == 16) {
 					*(uint16_t *)fb = cmap_base[*bmap];
 					bmap++;
 					fb += sizeof(uint16_t) / sizeof(*fb);
+				} else {
+					/* Only support big endian */
+					cte = &palette[*bmap];
+					bmap++;
+					if (bpix == 24) {
+						*(fb++) = cte->red;
+						*(fb++) = cte->green;
+						*(fb++) = cte->blue;
+					} else {
+						*(fb++) = cte->blue;
+						*(fb++) = cte->green;
+						*(fb++) = cte->red;
+						*(fb++) = 0;
+					}
 				}
 			}
 			bmap += (padded_width - width);
Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 1/1 video: bmp: support 8bits BMP drawing on 24/32 bpp framebuffer

On Sun, 28 Jun 2020 00:59:44 +0200
Anatolij Gustschin agust at denx.de wrote:
...

Quoted 6 lines

Changes in v2:
- reduce code
- update commit message

 drivers/video/video_bmp.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

Applied to u-boot-video/master, thanks!

--
Anatolij

#11 lore raw

PATCH 1/1 video: vidconsole: avoid multiple lines overwrite logo

In reply to Ye Li
Quoted 7 lines · On Wed, 10 Jun 2020 02:52:21 -0700 Ye Li ye.li at nxp.com wrote:

Fix the bug that multiple lines wraps to overwrite logo bmp display.

---
 drivers/video/vidconsole-uclass.c | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-video/master, thanks!

--
Anatolij