summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-02-16 09:45:17 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-02-16 09:45:17 +0000
commitb9eeb9dd8434251310b292e3a3af31ce87d93b13 (patch)
tree69a562639c31bf4cf401dec8fa3ae49638497f25 /test
parent3382bd78d9e9885a7714ebbfd777a03ee8708a01 (diff)
test/present: Tighten MSC modulus computation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test')
-rw-r--r--test/present-test.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/test/present-test.c b/test/present-test.c
index 029e4eb9..55d18b1d 100644
--- a/test/present-test.c
+++ b/test/present-test.c
@@ -144,7 +144,7 @@ static uint64_t check_msc(Display *dpy, Window win, void *q, uint64_t last_msc,
uint64_t msc = 0;
int complete = 0;
- xcb_present_notify_msc(c, win, serial, 0, 0, 0);
+ xcb_present_notify_msc(c, win, serial ^ 0xcc00ffee, 0, 0, 0);
xcb_flush(c);
do {
@@ -157,7 +157,7 @@ static uint64_t check_msc(Display *dpy, Window win, void *q, uint64_t last_msc,
ce = (xcb_present_complete_notify_event_t *)ev;
if (ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC &&
- ce->serial == serial) {
+ ce->serial == (serial ^ 0xcc00ffee)) {
msc = ce->msc;
if (ust)
*ust = ce->ust;
@@ -952,11 +952,12 @@ static int test_exhaustion_msc(Display *dpy, void *Q)
msc = check_msc(dpy, root, Q, 0, NULL);
for (n = N_VBLANKS; n--; )
- xcb_present_notify_msc(c, root, N_VBLANKS, msc + N_VBLANKS, 1, 0);
- xcb_present_notify_msc(c, root, 1, msc, 1, 0);
+ xcb_present_notify_msc(c, root, N_VBLANKS, msc + N_VBLANKS, 0, 0);
+ for (n = 1; n <= N_VBLANKS ; n++)
+ xcb_present_notify_msc(c, root, n, msc + n, 0, 0);
xcb_flush(c);
- complete = N_VBLANKS + 1;
+ complete = 2*N_VBLANKS;
do {
xcb_present_complete_notify_event_t *ce;
xcb_generic_event_t *ev;
@@ -1070,6 +1071,8 @@ static int test_modulus_msc(Display *dpy, void *Q)
{
xcb_connection_t *c = XGetXCBConnection(dpy);
Window root = DefaultRootWindow(dpy);
+ xcb_present_complete_notify_event_t *ce;
+ xcb_generic_event_t *ev;
int x, y, ret = 0;
uint64_t target;
int early = 0, late = 0;
@@ -1080,6 +1083,8 @@ static int test_modulus_msc(Display *dpy, void *Q)
_x_error_occurred = 0;
target = check_msc(dpy, root, Q, 0, NULL);
+
+ xcb_present_notify_msc(c, root, 0, 0, 0, 0);
for (x = 1; x <= 7; x++) {
for (y = 0; y < x; y++) {
xcb_present_notify_msc(c, root, y << 16 | x, 0, x, y);
@@ -1088,11 +1093,16 @@ static int test_modulus_msc(Display *dpy, void *Q)
xcb_present_notify_msc(c, root, 0xdeadbeef, target + 2*x, 0, 0);
xcb_flush(c);
+ ev = xcb_wait_for_special_event(c, Q);
+ if (ev) {
+ ce = (xcb_present_complete_notify_event_t *)ev;
+ assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
+ assert(ce->serial == 0);
+ target = ce->msc;
+ }
+
complete = 0;
do {
- xcb_present_complete_notify_event_t *ce;
- xcb_generic_event_t *ev;
-
ev = xcb_wait_for_special_event(c, Q);
if (ev == NULL)
break;
@@ -1117,14 +1127,14 @@ static int test_modulus_msc(Display *dpy, void *Q)
diff = (int64_t)(ce->msc - msc);
if (diff < 0) {
if (-diff > earliest) {
- fprintf(stderr, "\tnotify (%d, %d) early by %d msc\n", y, x, -diff);
+ fprintf(stderr, "\tnotify (%d, %d) early by %d msc (target %lld, reported %lld)\n", y, x, -diff, (long long)msc, (long long)ce->msc);
earliest = -diff;
}
early++;
ret++;
} else if (diff > 0) {
if (diff > latest) {
- fprintf(stderr, "\tnotify (%d, %d) late by %d msc\n", y, x, diff);
+ fprintf(stderr, "\tnotify (%d, %d) late by %d msc (target %lld, reported %lld)\n", y, x, diff, (long long)msc, (long long)ce->msc);
latest = diff;
}
late++;