summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-02-10 10:50:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-02-10 10:50:04 +0000
commit3aab3684124a77d3dafdfdf1f234b9b68faf7025 (patch)
treef1019bb83700e57768c121fb56ad8a9f08ae7851
parent8b8c9a36828e90e46ad0755c6861df85f5307fb5 (diff)
test/dri2-race: Use loops for iterating over divisor tests
Expand the test cases slightly to check high dividers everywhere. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--test/dri2-race.c696
1 files changed, 276 insertions, 420 deletions
diff --git a/test/dri2-race.c b/test/dri2-race.c
index 39e2bbd5..c8985627 100644
--- a/test/dri2-race.c
+++ b/test/dri2-race.c
@@ -21,6 +21,9 @@
#define COUNT 60
+#define N_DIVISORS 3
+static const int divisors[N_DIVISORS] = { 0, 1, 16 };
+
static uint32_t upper_32_bits(uint64_t val)
{
return val >> 32;
@@ -80,7 +83,7 @@ static void race_window(Display *dpy, int width, int height,
{
Window win;
XSetWindowAttributes attr;
- int count, loop;
+ int count, loop, n;
DRI2Buffer *buffers;
printf("%s(%s)\n", __func__, name);
@@ -89,132 +92,94 @@ static void race_window(Display *dpy, int width, int height,
* can guarantee we do not get clipped by children.
*/
attr.override_redirect = 1;
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- DRI2SwapBuffers(dpy, win, 0, 0, 0);
- XDestroyWindow(dpy, win);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- DRI2SwapBuffers(dpy, win, 0, 1, 0);
- XDestroyWindow(dpy, win);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 0, attachments, nattachments);
- XDestroyWindow(dpy, win);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 1, attachments, nattachments);
- XDestroyWindow(dpy, win);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- uint64_t ignore, msc;
- xcb_connection_t *c = XGetXCBConnection(dpy);
-
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
- DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
- for (count = 0; count < loop; count++)
- xcb_discard_reply(c,
- xcb_dri2_wait_msc(c, win,
- upper_32_bits(msc + count + 1),
- lower_32_bits(msc + count + 1),
- 0, 1, 0, 0).sequence);
- XFlush(dpy);
- XDestroyWindow(dpy, win);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("DRI2SwapBuffers(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+
+ buffers = DRI2GetBuffers(dpy, win, &width, &height,
+ attachments, nattachments, &count);
+ if (count != nattachments)
+ return;
+
+ free(buffers);
+ for (count = 0; count < loop; count++)
+ DRI2SwapBuffers(dpy, win, 0, divisors[n], count & (divisors[n]-1));
+ XDestroyWindow(dpy, win);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
+
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("xcb_dri2_swap_buffers(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+
+ buffers = DRI2GetBuffers(dpy, win, &width, &height,
+ attachments, nattachments, &count);
+ if (count != nattachments)
+ return;
+
+ free(buffers);
+ for (count = 0; count < loop; count++)
+ swap_buffers(dpy, win, divisors[n], attachments, nattachments);
+ XDestroyWindow(dpy, win);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
+
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("DRI2WaitMsc(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ uint64_t ignore, msc;
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+
+ win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+ DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
+ msc++;
+ for (count = 0; count < loop; count++) {
+ xcb_discard_reply(c,
+ xcb_dri2_wait_msc(c, win,
+ upper_32_bits(msc),
+ lower_32_bits(msc),
+ 0, 1, 0, 0).sequence);
+ msc += divisors[n];
+ }
+ XFlush(dpy);
+ XDestroyWindow(dpy, win);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
XSync(dpy, 1);
sleep(2);
@@ -228,7 +193,7 @@ static void race_manager(Display *dpy, int width, int height,
Display *mgr = XOpenDisplay(NULL);
Window win;
XSetWindowAttributes attr;
- int count, loop;
+ int count, loop, n;
DRI2Buffer *buffers;
printf("%s(%s)\n", __func__, name);
@@ -237,195 +202,99 @@ static void race_manager(Display *dpy, int width, int height,
* can guarantee we do not get clipped by children.
*/
attr.override_redirect = 1;
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- DRI2SwapBuffers(dpy, win, 0, 0, 0);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- DRI2SwapBuffers(dpy, win, 0, 1, 0);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- DRI2SwapBuffers(dpy, win, 0, 16, count & 15);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 0, attachments, nattachments);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 1, attachments, nattachments);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
-
- buffers = DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count);
- if (count != nattachments)
- return;
-
- free(buffers);
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 16, attachments, nattachments);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- uint64_t ignore, msc;
- xcb_connection_t *c = XGetXCBConnection(dpy);
-
- win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
- DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
- for (count = 0; count < loop; count++)
- xcb_discard_reply(c,
- xcb_dri2_wait_msc(c, win,
- upper_32_bits(msc + count + 1),
- lower_32_bits(msc + count + 1),
- 0, 1, 0, 0).sequence);
- XFlush(dpy);
- XDestroyWindow(mgr, win);
- XFlush(mgr);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("DRI2SwapBuffers(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+
+ buffers = DRI2GetBuffers(dpy, win, &width, &height,
+ attachments, nattachments, &count);
+ if (count != nattachments)
+ return;
+
+ free(buffers);
+ for (count = 0; count < loop; count++)
+ DRI2SwapBuffers(dpy, win, 0, divisors[n], count & (divisors[n]-1));
+ XFlush(dpy);
+ XDestroyWindow(mgr, win);
+ XFlush(mgr);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
+
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("xcb_dri2_swap_buffers(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+
+ buffers = DRI2GetBuffers(dpy, win, &width, &height,
+ attachments, nattachments, &count);
+ if (count != nattachments)
+ return;
+
+ free(buffers);
+ for (count = 0; count < loop; count++)
+ swap_buffers(dpy, win, divisors[n], attachments, nattachments);
+ XFlush(dpy);
+ XDestroyWindow(mgr, win);
+ XFlush(mgr);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
+
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("DRI2WaitMsc(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ uint64_t ignore, msc;
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+
+ win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+ DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
+ msc++;
+ for (count = 0; count < loop; count++) {
+ xcb_discard_reply(c,
+ xcb_dri2_wait_msc(c, win,
+ upper_32_bits(msc),
+ lower_32_bits(msc),
+ 0, 1, 0, 0).sequence);
+ msc += divisors[n];
+ }
+ XFlush(dpy);
+ XDestroyWindow(mgr, win);
+ XFlush(mgr);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
XSync(dpy, 1);
XSync(mgr, 1);
@@ -441,7 +310,7 @@ static void race_client(int width, int height,
const char *name)
{
XSetWindowAttributes attr;
- int count, loop;
+ int count, loop, n;
printf("%s(%s)\n", __func__, name);
@@ -449,108 +318,95 @@ static void race_client(int width, int height,
* can guarantee we do not get clipped by children.
*/
attr.override_redirect = 1;
- loop = 100;
- do {
- Display *dpy = XOpenDisplay(NULL);
- Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
-
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
- free(DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count));
- if (count != nattachments)
- return;
-
- for (count = 0; count < loop; count++)
- DRI2SwapBuffers(dpy, win, 0, 0, 0);
- XCloseDisplay(dpy);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- Display *dpy = XOpenDisplay(NULL);
- Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
-
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
- free(DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count));
- if (count != nattachments)
- return;
-
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 0, attachments, nattachments);
- XCloseDisplay(dpy);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- Display *dpy = XOpenDisplay(NULL);
- Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
-
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
- free(DRI2GetBuffers(dpy, win, &width, &height,
- attachments, nattachments, &count));
- if (count != nattachments)
- return;
-
- for (count = 0; count < loop; count++)
- swap_buffers(dpy, win, 1, attachments, nattachments);
- XCloseDisplay(dpy);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
-
- loop = 100;
- do {
- uint64_t ignore, msc;
- Display *dpy = XOpenDisplay(NULL);
- xcb_connection_t *c = XGetXCBConnection(dpy);
- Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
- 0, 0, width, height, 0,
- DefaultDepth(dpy, DefaultScreen(dpy)),
- InputOutput,
- DefaultVisual(dpy, DefaultScreen(dpy)),
- CWOverrideRedirect, &attr);
-
- XMapWindow(dpy, win);
-
- DRI2CreateDrawable(dpy, win);
- DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
- for (count = 0; count < loop; count++)
- xcb_discard_reply(c,
- xcb_dri2_wait_msc(c, win,
- upper_32_bits(msc + count + 1),
- lower_32_bits(msc + count + 1),
- 0, 1, 0, 0).sequence);
- XFlush(dpy);
- XCloseDisplay(dpy);
- printf("."); fflush(stdout);
- } while (--loop);
- printf("*\n");
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("DRI2SwapBuffers(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ Display *dpy = XOpenDisplay(NULL);
+ Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+ free(DRI2GetBuffers(dpy, win, &width, &height,
+ attachments, nattachments, &count));
+ if (count != nattachments)
+ return;
+
+ for (count = 0; count < loop; count++)
+ DRI2SwapBuffers(dpy, win, 0, divisors[n], count & (divisors[n]-1));
+ XCloseDisplay(dpy);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
+
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("xcb_dri2_swap_buffers(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ Display *dpy = XOpenDisplay(NULL);
+ Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+ free(DRI2GetBuffers(dpy, win, &width, &height,
+ attachments, nattachments, &count));
+ if (count != nattachments)
+ return;
+
+ for (count = 0; count < loop; count++)
+ swap_buffers(dpy, win, divisors[n], attachments, nattachments);
+ XCloseDisplay(dpy);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
+
+ for (n = 0; n < N_DIVISORS; n++) {
+ printf("DRI2WaitMsc(divisor=%d)", divisors[n]);
+ loop = 100;
+ do {
+ uint64_t ignore, msc;
+ Display *dpy = XOpenDisplay(NULL);
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ Window win = XCreateWindow(dpy, DefaultRootWindow(dpy),
+ 0, 0, width, height, 0,
+ DefaultDepth(dpy, DefaultScreen(dpy)),
+ InputOutput,
+ DefaultVisual(dpy, DefaultScreen(dpy)),
+ CWOverrideRedirect, &attr);
+
+ XMapWindow(dpy, win);
+
+ DRI2CreateDrawable(dpy, win);
+ DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
+ msc++;
+ for (count = 0; count < loop; count++) {
+ xcb_discard_reply(c,
+ xcb_dri2_wait_msc(c, win,
+ upper_32_bits(msc),
+ lower_32_bits(msc),
+ 0, 1, 0, 0).sequence);
+ msc += divisors[n];
+ }
+ XFlush(dpy);
+ XCloseDisplay(dpy);
+ printf("."); fflush(stdout);
+ } while (--loop);
+ printf("*\n");
+ }
}
int main(void)