summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-02-11 11:05:12 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-02-11 11:06:49 +0000
commitfc010846b13dcb757f030c06f25415c200f61f71 (patch)
tree5e75f10d8575f20d12f5dfdb6a5123b680debefe /test
parent4f5d7825dfc57a5f892f3f903cbfa36abf3c13ca (diff)
test/dri2-race: Actually queue a number of future WaitMSC
In order to have outstanding WaitMSC when the Client quits or the Window is destroyed, we need to use the xcb version so as not to immediately block on the play. And also print keepalive dots to console as test progresses. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test')
-rw-r--r--test/dri2-race.c51
1 files changed, 44 insertions, 7 deletions
diff --git a/test/dri2-race.c b/test/dri2-race.c
index 52353173..0c500f8c 100644
--- a/test/dri2-race.c
+++ b/test/dri2-race.c
@@ -21,6 +21,16 @@
#define COUNT 60
+static uint32_t upper_32_bits(uint64_t val)
+{
+ return val >> 32;
+}
+
+static uint32_t lower_32_bits(uint64_t val)
+{
+ return val & 0xffffffff;
+}
+
static int dri2_open(Display *dpy)
{
drm_auth_t auth;
@@ -73,6 +83,8 @@ static void race_window(Display *dpy, int width, int height,
int count, loop;
DRI2Buffer *buffers;
+ printf("%s(%s)\n", __func__, name);
+
/* Be nasty and install a fullscreen window on top so that we
* can guarantee we do not get clipped by children.
*/
@@ -98,7 +110,9 @@ static void race_window(Display *dpy, int width, int height,
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 {
@@ -121,11 +135,14 @@ static void race_window(Display *dpy, int width, int height,
for (count = 0; count < loop; count++)
swap_buffers(dpy, win, attachments, nattachments);
XDestroyWindow(dpy, win);
+ printf("."); fflush(stdout);
} while (--loop);
+ printf("*\n");
loop = 100;
do {
- uint64_t ignore;
+ uint64_t ignore, msc;
+ xcb_connection_t *c = XGetXCBConnection(dpy);
win = XCreateWindow(dpy, DefaultRootWindow(dpy),
0, 0, width, height, 0,
@@ -136,12 +153,18 @@ static void race_window(Display *dpy, int width, int height,
XMapWindow(dpy, win);
DRI2CreateDrawable(dpy, win);
-
+ DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
for (count = 0; count < loop; count++)
- DRI2WaitMSC(dpy, win, 0, 1, 0,
- &ignore, &ignore, &ignore);
+ 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");
XSync(dpy, 1);
sleep(2);
@@ -155,6 +178,8 @@ static void race_client(int width, int height,
XSetWindowAttributes attr;
int count, loop;
+ printf("%s(%s)\n", __func__, name);
+
/* Be nasty and install a fullscreen window on top so that we
* can guarantee we do not get clipped by children.
*/
@@ -180,7 +205,9 @@ static void race_client(int width, int height,
for (count = 0; count < loop; count++)
DRI2SwapBuffers(dpy, win, 0, 0, 0);
XCloseDisplay(dpy);
+ printf("."); fflush(stdout);
} while (--loop);
+ printf("*\n");
loop = 100;
do {
@@ -203,12 +230,15 @@ static void race_client(int width, int height,
for (count = 0; count < loop; count++)
swap_buffers(dpy, win, attachments, nattachments);
XCloseDisplay(dpy);
+ printf("."); fflush(stdout);
} while (--loop);
+ printf("*\n");
loop = 100;
do {
- uint64_t ignore;
+ 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)),
@@ -219,11 +249,18 @@ static void race_client(int width, int height,
XMapWindow(dpy, win);
DRI2CreateDrawable(dpy, win);
+ DRI2GetMSC(dpy, win, &ignore, &msc, &ignore);
for (count = 0; count < loop; count++)
- DRI2WaitMSC(dpy, win, 0, 1, 0,
- &ignore, &ignore, &ignore);
+ 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");
}
int main(void)