From 66fe119afd1cec2fdd47cec77523b4af2526df47 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 2 Oct 2012 17:17:40 +0200 Subject: [PATCH] tests/flip_test: test interaction with panning Since panning with set_crtc is synchronous, we need to stall for any outstanding pageflips. This new testcase exercise that code. Unfortunately we still need eyes to check whether we don't loose the offset :( --- tests/flip_test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/flip_test.c b/tests/flip_test.c index b9e55c1..57e4a6b 100644 --- a/tests/flip_test.c +++ b/tests/flip_test.c @@ -43,6 +43,7 @@ #define TEST_DPMS (1 << 0) #define TEST_WITH_DUMMY_LOAD (1 << 1) +#define TEST_PAN (1 << 2) drmModeRes *resources; int drm_fd; @@ -340,6 +341,9 @@ static void flip_mode(struct test_output *o, int crtc, int duration) width = o->mode.hdisplay; height = o->mode.vdisplay; + if (o->flags & TEST_PAN) + width *= 2; + o->fb_ids[0] = kmstest_create_fb(drm_fd, width, height, bpp, depth, false, &o->fb_info[0], paint_flip_mode, (void *)false); @@ -407,6 +411,21 @@ static void flip_mode(struct test_output *o, int crtc, int duration) break; } + /* pan before the flip completes */ + if (o->flags & TEST_PAN) { + int x_ofs = o->count * 10 > o->mode.hdisplay ? o->mode.hdisplay : + o->count * 10; + + if (drmModeSetCrtc(drm_fd, o->crtc, o->fb_ids[o->current_fb_id], + x_ofs, 0, + &o->id, 1, &o->mode)) { + fprintf(stderr, "failed to pan (%dx%d@%dHz): %s\n", + width, height, o->mode.vrefresh, + strerror(errno)); + exit(7); + } + } + drmHandleEvent(drm_fd, &evctx); } @@ -477,6 +496,7 @@ int main(int argc, char **argv) { 5, 0 , "plain flip" }, { 30, TEST_DPMS, "flip vs dpms" }, { 30, TEST_DPMS | TEST_WITH_DUMMY_LOAD, "delayed flip vs. dpms" }, + { 5, TEST_PAN, "flip vs panning" }, }; int i; -- 2.7.4