tests/flip_test: check whether the pageflip event took too long
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 2 Oct 2012 13:37:24 +0000 (15:37 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 2 Oct 2012 13:37:24 +0000 (15:37 +0200)
We're suspecting that something is fishy with the event deliver/vblank
timestamp handling on gmch platforms. Unfortunately, this isn't it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
tests/flip_test.c

index 6d3f46c..4f23155 100644 (file)
@@ -151,6 +151,20 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
 {
        struct test_output *o = data;
        unsigned int new_fb_id;
+       struct timeval now, diff, pageflip_ts;
+
+       pageflip_ts.tv_sec = sec;
+       pageflip_ts.tv_usec = usec;
+
+       gettimeofday(&now, NULL);
+
+       timersub(&pageflip_ts, &now, &diff);
+
+       if (diff.tv_sec > 0 || diff.tv_usec > 2000) {
+               fprintf(stderr, "pageflip timestamp delayed for too long: %us, %uusec\n",
+                       (unsigned) diff.tv_sec, (unsigned) diff.tv_usec);
+               exit(5);
+       }
 
        o->count++;