[PATCH] video: vidconsole: avoid multiple lines overwrite logo

Fix the bug that multiple lines wraps to overwrite logo bmp display.
Signed-off-by: Ye Li ye.li@nxp.com --- drivers/video/vidconsole-uclass.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index d30e6db..9b76154 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -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); }

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,
Signed-off-by: Ye Li ye.li@nxp.com --- common/splash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/splash.c b/common/splash.c index e7d8477..2b9313e 100644 --- a/common/splash.c +++ b/common/splash.c @@ -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)

On Wed, Jun 10, 2020 at 3:23 PM Ye Li ye.li@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,
Signed-off-by: Ye Li ye.li@nxp.com
Reviewed-by: Jagan Teki jagan@amarulasolutions.com Tested-by: Jagan Teki jagan@amarulasolutions.com # bpi-m1+, bpi-m64

On Wed, 10 Jun 2020 02:52:22 -0700 Ye Li ye.li@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,
Signed-off-by: Ye Li ye.li@nxp.com
common/splash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-video/master, thanks!
-- Anatolij

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
Signed-off-by: Ye Li ye.li@nxp.com --- drivers/video/video_bmp.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index eb96365..283e699 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -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);

On Wed, Jun 10, 2020 at 3:23 PM Ye Li ye.li@nxp.com wrote:
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
Signed-off-by: Ye Li ye.li@nxp.com
Reviewed-by: Jagan Teki jagan@amarulasolutions.com Tested-by: Jagan Teki jagan@amarulasolutions.com # bpi-m1+, bpi-m64

Hi Anatolij,
On Wed, Jun 10, 2020 at 6:53 AM Ye Li ye.li@nxp.com wrote:
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
Signed-off-by: Ye Li ye.li@nxp.com
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

Hi Fabio,
On Thu, 18 Jun 2020 18:04:40 -0300 Fabio Estevam festevam@gmail.com wrote:
Hi Anatolij,
On Wed, Jun 10, 2020 at 6:53 AM Ye Li ye.li@nxp.com wrote:
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
Signed-off-by: Ye Li ye.li@nxp.com
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

From: Ye Li ye.li@nxp.com
Update video bmp code so that we can display 8 bits logo on 24 or 32 bpp framebuffer.
Signed-off-by: Ye Li ye.li@nxp.com Signed-off-by: Anatolij Gustschin agust@denx.de Reviewed-by: Jagan Teki jagan@amarulasolutions.com Tested-by: Jagan Teki jagan@amarulasolutions.com # bpi-m1+, bpi-m64 --- Changes in v2: - reduce code - update commit message
drivers/video/video_bmp.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index eb9636541d..7d7f37b445 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -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);

On Sun, 28 Jun 2020 00:59:44 +0200 Anatolij Gustschin agust@denx.de wrote: ...
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

On Wed, Jun 10, 2020 at 3:22 PM Ye Li ye.li@nxp.com wrote:
Fix the bug that multiple lines wraps to overwrite logo bmp display.
Signed-off-by: Ye Li ye.li@nxp.com
Reviewed-by: Jagan Teki jagan@amarulasolutions.com Tested-by: Jagan Teki jagan@amarulasolutions.com # bpi-m1+, bpi-m64

On Wed, 10 Jun 2020 02:52:21 -0700 Ye Li ye.li@nxp.com wrote:
Fix the bug that multiple lines wraps to overwrite logo bmp display.
Signed-off-by: Ye Li ye.li@nxp.com
drivers/video/vidconsole-uclass.c | 1 + 1 file changed, 1 insertion(+)
Applied to u-boot-video/master, thanks!
-- Anatolij
participants (4)
-
Anatolij Gustschin
-
Fabio Estevam
-
Jagan Teki
-
Ye Li