X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fvideo%2Fvideo_bmp.c;h=193f37d275e59c24a7d1441e521817c0301b19df;hb=cf8dcc5d02c32173b74bf1b7600dd2b990a90b13;hp=fb7943e06d99698e379dbd2a8346c7d166302bc5;hpb=595af9db2422fa5ae734cfe615415b17a5098f34;p=oweals%2Fu-boot.git diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index fb7943e06d..193f37d275 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -1,13 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2015 Google, Inc - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include #include +#include #include #include #include @@ -141,8 +141,6 @@ __weak void fb_put_word(uchar **fb, uchar **from) } #endif /* CONFIG_BMP_16BPP */ -#define BMP_ALIGN_CENTER 0x7fff - /** * video_splash_align_axis() - Align a single coordinate * @@ -231,11 +229,12 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, } /* - * We support displaying 8bpp BMPs on 16bpp LCDs + * We support displaying 8bpp and 24bpp BMPs on 16bpp LCDs * and displaying 24bpp BMPs on 32bpp LCDs - * */ + */ if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16) && + !(bmp_bpix == 24 && bpix == 16) && !(bmp_bpix == 24 && bpix == 32)) { printf("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n", bpix, get_unaligned_le16(&bmp->header.bit_count)); @@ -312,23 +311,33 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, fb_put_word(&fb, &bmap); bmap += (padded_width - width) * 2; - fb -= width * 2 + lcd_line_length; + fb -= width * 2 + priv->line_length; } break; #endif /* CONFIG_BMP_16BPP */ -#if defined(CONFIG_BMP_24BMP) +#if defined(CONFIG_BMP_24BPP) case 24: for (i = 0; i < height; ++i) { for (j = 0; j < width; j++) { - *(fb++) = *(bmap++); - *(fb++) = *(bmap++); - *(fb++) = *(bmap++); - *(fb++) = 0; + if (bpix == 16) { + /* 16bit 555RGB format */ + *(u16 *)fb = ((bmap[2] >> 3) << 10) | + ((bmap[1] >> 3) << 5) | + (bmap[0] >> 3); + bmap += 3; + fb += 2; + } else { + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + *(fb++) = 0; + } } - fb -= lcd_line_length + width * (bpix / 8); + fb -= priv->line_length + width * (bpix / 8); + bmap += (padded_width - width) * 3; } break; -#endif /* CONFIG_BMP_24BMP */ +#endif /* CONFIG_BMP_24BPP */ #if defined(CONFIG_BMP_32BPP) case 32: for (i = 0; i < height; ++i) { @@ -338,7 +347,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, *(fb++) = *(bmap++); *(fb++) = *(bmap++); } - fb -= lcd_line_length + width * (bpix / 8); + fb -= priv->line_length + width * (bpix / 8); } break; #endif /* CONFIG_BMP_32BPP */ @@ -346,7 +355,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, break; }; - video_sync(dev); + video_sync(dev, false); return 0; }