tests: add drm_screenshot_no_damage

I am working on adding a test to ensure Weston repaints damage
correctly, where I rely on Weston repainting exactly and only the damage
submitted by a client. That means I have to stop screenshooting from
damaging everything automatically. Doing that, I noticed that
screenshots on DRM-backend could theoretically get stuck if I do that.
So test for it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2020-12-04 16:12:33 +02:00
parent 4cff869a4f
commit 0f7da612eb
2 changed files with 26 additions and 1 deletions

View File

@ -43,7 +43,6 @@ fixture_setup(struct weston_test_harness *harness)
DECLARE_FIXTURE_SETUP(fixture_setup);
TEST(drm_smoke) {
struct client *client;
struct buffer *buffer;
struct wl_surface *surface;
@ -70,3 +69,29 @@ TEST(drm_smoke) {
client_destroy(client);
}
TEST(drm_screenshot_no_damage) {
struct client *client;
int i;
bool ret;
client = create_client_and_test_surface(0, 0, 200, 200);
assert(client);
/*
* DRM-backend has an optimization to not even call the renderer if
* there is no damage to be repainted on the primary plane occupied by
* renderer's buffer. However, renderer must be called for a screenshot
* to complete.
*
* Therefore, if there is no damage, it is possible that screenshots
* might get stuck. This test makes sure they run regardless.
*/
for (i = 0; i < 5; i++) {
ret = verify_screen_content(client, "drm_screenshot_no_damage",
0, NULL, i);
assert(ret);
}
client_destroy(client);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB