From: Simon Glass Date: Fri, 19 Nov 2021 20:23:58 +0000 (-0700) Subject: video: Add a test for 16bpp BMP files X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=c1cad06f69a8f3207bdb20ad038db930c0f5c139;p=u-boot.git video: Add a test for 16bpp BMP files Add a compressed 16bpp BMP file and a test to cover this. Signed-off-by: Simon Glass --- diff --git a/.gitattributes b/.gitattributes index 899473ab0f..1879a2dfb3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ # Denote all files that are truly binary and should not be modified *.bmp binary *.ttf binary +*.gz binary diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index c390afe9de..5dffc704bd 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -285,6 +285,7 @@ CONFIG_OSD=y CONFIG_SANDBOX_OSD=y CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y +CONFIG_BMP_16BPP=y CONFIG_W1=y CONFIG_W1_GPIO=y CONFIG_W1_EEPROM=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index f184723a89..f16d890048 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -198,6 +198,7 @@ CONFIG_VIDEO_SANDBOX_SDL=y CONFIG_OSD=y CONFIG_SANDBOX_OSD=y CONFIG_VIDEO_BMP_RLE8=y +CONFIG_BMP_16BPP=y CONFIG_CMD_DHRYSTONE=y CONFIG_RSA_VERIFY_WITH_PKEY=y CONFIG_TPM=y diff --git a/test/dm/video.c b/test/dm/video.c index d5648f0c59..c496b05df7 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -339,6 +340,29 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) } DM_TEST(dm_test_video_bmp8, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +/* Test drawing a bitmap file on a 16bpp display */ +static int dm_test_video_bmp16(struct unit_test_state *uts) +{ + ulong src, src_len = ~0UL; + uint dst_len = ~0U; + struct udevice *dev; + ulong dst = 0x10000; + + ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev)); + ut_assertnonnull(dev); + ut_assertok(sandbox_sdl_set_bpp(dev, VIDEO_BPP16)); + + ut_assertok(read_file(uts, "tools/logos/denx-16bpp.bmp.gz", &src)); + ut_assertok(gunzip(map_sysmem(dst, 0), dst_len, map_sysmem(src, 0), + &src_len)); + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); + ut_asserteq(3700, compress_frame_buffer(uts, dev)); + + return 0; +} +DM_TEST(dm_test_video_bmp16, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + /* Test drawing a bitmap file on a 32bpp display */ static int dm_test_video_bmp32(struct unit_test_state *uts) { diff --git a/tools/logos/denx-16bpp.bmp.gz b/tools/logos/denx-16bpp.bmp.gz new file mode 100644 index 0000000000..ed99c58192 Binary files /dev/null and b/tools/logos/denx-16bpp.bmp.gz differ