diff options
| author | Alper Nebi Yasak <[email protected]> | 2023-08-18 17:55:08 +0300 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-01 04:31:18 -0600 |
| commit | 9ffa352c82285ef2d0d2312140e82e041ec8b9b4 (patch) | |
| tree | d9573c8a2e46d9ac08ac0b5497a3477791348b8f /test | |
| parent | 17f0f77a593bfa2964990bdd5bdc02ecffc55a88 (diff) | |
video: test: Test video damage tracking via vidconsole
With VIDEO_DAMAGE, the video uclass tracks updated regions of the frame
buffer in order to avoid unnecessary work during a video sync. Enable
the config in sandbox and add a test for it, by printing strings at a
few locations and checking the tracked region.
Signed-off-by: Alper Nebi Yasak <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Adjust test avoid temporary failures in this patch:
Signed-off-by: Simon Glass <[email protected]>
Link: https://lore.kernel.org/u-boot/[email protected]/
Diffstat (limited to 'test')
| -rw-r--r-- | test/dm/video.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/dm/video.c b/test/dm/video.c index 80e65d66dba..cf81b907969 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -710,3 +710,59 @@ static int dm_test_video_copy(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_copy, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test video damage tracking */ +static int dm_test_video_damage(struct unit_test_state *uts) +{ + struct sandbox_sdl_plat *plat; + struct udevice *dev, *con; + struct video_priv *priv; + const char *test_string_1 = "Criticism may not be agreeable, "; + const char *test_string_2 = "but it is necessary."; + const char *test_string_3 = "It fulfils the same function as pain in the human body."; + + if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) + return -EAGAIN; + + ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); + ut_assert(!device_active(dev)); + plat = dev_get_plat(dev); + plat->font_size = 32; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + priv = dev_get_uclass_priv(dev); + + vidconsole_position_cursor(con, 14, 10); + vidconsole_put_string(con, test_string_2); + ut_asserteq(449, priv->damage.xstart); + ut_asserteq(325, priv->damage.ystart); + ut_asserteq(661, priv->damage.xend); + ut_asserteq(350, priv->damage.yend); + + vidconsole_position_cursor(con, 7, 5); + vidconsole_put_string(con, test_string_1); + ut_asserteq(225, priv->damage.xstart); + ut_asserteq(164, priv->damage.ystart); + ut_asserteq(661, priv->damage.xend); + ut_asserteq(350, priv->damage.yend); + + vidconsole_position_cursor(con, 21, 15); + vidconsole_put_string(con, test_string_3); + ut_asserteq(225, priv->damage.xstart); + ut_asserteq(164, priv->damage.ystart); + ut_asserteq(1280, priv->damage.xend); + ut_asserteq(510, priv->damage.yend); + + video_sync(dev, true); + ut_asserteq(priv->xsize, priv->damage.xstart); + ut_asserteq(priv->ysize, priv->damage.ystart); + ut_asserteq(0, priv->damage.xend); + ut_asserteq(0, priv->damage.yend); + + ut_asserteq(7339, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +} +DM_TEST(dm_test_video_damage, UTF_SCAN_PDATA | UTF_SCAN_FDT); |
