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 <sjg@chromium.org>
diff --git a/.gitattributes b/.gitattributes
index 899473a..1879a2d 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 c390afe..5dffc70 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -285,6 +285,7 @@
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 f184723..f16d890 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -198,6 +198,7 @@
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 d5648f0..c496b05 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <bzlib.h>
#include <dm.h>
+#include <gzip.h>
#include <log.h>
#include <malloc.h>
#include <mapmem.h>
@@ -339,6 +340,29 @@
}
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 0000000..ed99c58
--- /dev/null
+++ b/tools/logos/denx-16bpp.bmp.gz
Binary files differ