diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-04-05 17:03:02 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-04-05 17:03:02 +0100 |
commit | f4588b64e294ede0b21d7aebc0c1ffcbd6045d51 (patch) | |
tree | a386043fa6abf7686813e5440f07b47b64b4432b /test/present-speed.c | |
parent | be0fc3ce20fda064d68f38e24717552222d1fd74 (diff) |
test/present-speed: Export the pixmap over DRI3
Improve the DRI3 simulation by exporting the Pixmap to force DRI3
syncflushes.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test/present-speed.c')
-rw-r--r-- | test/present-speed.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/test/present-speed.c b/test/present-speed.c index 5c5b930b..3b9d3cc4 100644 --- a/test/present-speed.c +++ b/test/present-speed.c @@ -137,10 +137,11 @@ struct buffer { struct list link; Pixmap pixmap; struct dri3_fence fence; + int fd; int busy; }; -#define FENCE 1 +#define DRI3 1 #define NOCOPY 2 static void run(Display *dpy, Window win, const char *name, unsigned options) { @@ -172,9 +173,24 @@ static void run(Display *dpy, Window win, const char *name, unsigned options) buffer[n].pixmap = XCreatePixmap(dpy, win, width, height, depth); buffer[n].fence.xid = 0; - if (options & FENCE) { + buffer[n].fd = -1; + if (options & DRI3) { + xcb_dri3_buffer_from_pixmap_reply_t *reply; + int *fds; + if (dri3_create_fence(dpy, win, &buffer[n].fence)) return; + + reply = xcb_dri3_buffer_from_pixmap_reply (c, + xcb_dri3_buffer_from_pixmap(c, buffer[n].pixmap), + NULL); + if (reply == NULL) + return; + + fds = xcb_dri3_buffer_from_pixmap_reply_fds (c, reply); + buffer[n].fd = fds[0]; + free(reply); + /* start idle */ xshmfence_trigger(buffer[n].fence.addr); } @@ -286,6 +302,8 @@ static void run(Display *dpy, Window win, const char *name, unsigned options) for (n = 0; n < N_BACK; n++) { if (buffer[n].fence.xid) dri3_fence_free(dpy, &buffer[n].fence); + if (buffer[n].fd != -1) + close(buffer[n].fd); XFreePixmap(dpy, buffer[n].pixmap); } @@ -301,7 +319,7 @@ static void run(Display *dpy, Window win, const char *name, unsigned options) if (options) { snprintf(test_name, sizeof(test_name), "(%s%s )", options & NOCOPY ? " no-copy" : "", - options & FENCE ? " fence" : ""); + options & DRI3 ? " dri3" : ""); } printf("%s%s: Completed %d presents in %.1fs, %.3fus each (%.1f FPS)\n", name, test_name, @@ -533,11 +551,13 @@ int main(void) XRRSetCrtcConfig(dpy, res, res->crtcs[i], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0); +#if 0 loop(dpy, res, 0); if (has_xfixes(dpy)) loop(dpy, res, NOCOPY); +#endif if (has_dri3(dpy)) - loop(dpy, res, FENCE); + loop(dpy, res, DRI3); for (i = 0; i < res->ncrtc; i++) XRRSetCrtcConfig(dpy, res, res->crtcs[i], CurrentTime, |