summaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-19 13:23:59 -0700
committerAnatolij Gustschin <agust@denx.de>2021-12-26 23:23:52 +0100
commit4ea15482101bd2ef6d2086b1a8afb255de2e65e5 (patch)
treef9635b0e9e7a91c53c8b1d643fe764cad8f3b1bf /test/dm
parentc1cad06f69a8f3207bdb20ad038db930c0f5c139 (diff)
downloadu-boot-4ea15482101bd2ef6d2086b1a8afb255de2e65e5.tar.gz
u-boot-4ea15482101bd2ef6d2086b1a8afb255de2e65e5.tar.bz2
u-boot-4ea15482101bd2ef6d2086b1a8afb255de2e65e5.zip
video: theadorable: Use RGB565 for BMP blitting
At present this uses RGB555 format for blitting to a display. Sandbox uses 565 and that seems to be more normal for BMP as well. Update the code accordingly and add a test. Note that this likely breaks the theadorable board so we may need to discuss supporting both formats. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/video.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/dm/video.c b/test/dm/video.c
index c496b05df7..4e76574a91 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -363,6 +363,52 @@ static int dm_test_video_bmp16(struct unit_test_state *uts)
}
DM_TEST(dm_test_video_bmp16, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+/* Test drawing a 24bpp bitmap file on a 16bpp display */
+static int dm_test_video_bmp24(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-24bpp.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(3656, compress_frame_buffer(uts, dev));
+
+ return 0;
+}
+DM_TEST(dm_test_video_bmp24, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test drawing a 24bpp bitmap file on a 32bpp display */
+static int dm_test_video_bmp24_32(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_BPP32));
+
+ ut_assertok(read_file(uts, "tools/logos/denx-24bpp.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(6827, compress_frame_buffer(uts, dev));
+
+ return 0;
+}
+DM_TEST(dm_test_video_bmp24_32, 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)
{