diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-15 16:12:56 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-15 21:30:49 +0000 |
commit | a0bf3c1f48bc77f508f169d3ec8b64aecc902bc2 (patch) | |
tree | fb46a7ae8f8c7cf00d05a545248b86a293b5a881 /test | |
parent | 4e88e7dcc704d89583620af6af2738d49db9e5aa (diff) |
test/present: Catch FPE when notifies are broken
If the Xserver reports 10 frames passed instantaneously, flag an error
rather than divide by zero.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test')
-rw-r--r-- | test/present-test.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/present-test.c b/test/present-test.c index b33fd2e0..af1882a3 100644 --- a/test/present-test.c +++ b/test/present-test.c @@ -248,6 +248,12 @@ static uint64_t msc_interval(Display *dpy, Window win, void *q) free(ev); } while (complete != 2); + printf("10 frame interval: msc=%lld, ust=%lld\n", + (long long)msc, (long long)ust); + XSync(dpy, True); + if (msc == 0) + return 0; + return (ust + msc/2) / msc; } @@ -466,6 +472,10 @@ static int test_future(Display *dpy, Window win, const char *phase, void *Q) _x_error_occurred = 0; interval = msc_interval(dpy, win, Q); + if (interval == 0) { + printf("Zero delay between frames\n"); + return 1; + } pixmap = XCreatePixmap(dpy, win, width, height, depth); msc = flush_flips(dpy, win, pixmap, Q, &ust); @@ -918,6 +928,10 @@ static int test_future_msc(Display *dpy, void *Q) _x_error_occurred = 0; interval = msc_interval(dpy, root, Q); + if (interval == 0) { + printf("Zero delay between frames\n"); + return 1; + } msc = check_msc(dpy, root, Q, 0, &ust); for (n = 1; n <= 10; n++) |