diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-04-05 20:49:31 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-04-05 21:13:38 +0100 |
commit | 6de85a1e60f50d525c28da2f29466c40ce3f39bb (patch) | |
tree | c1ee6daa2e15592149a55362fcc27873a02d033e | |
parent | 56801202ded1f11608ff08e69c95f0a43c758322 (diff) |
test/present: Include composite redirected windows in the test matrix
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | test/dri2-speed.c | 46 | ||||
-rw-r--r-- | test/present-speed.c | 44 | ||||
-rw-r--r-- | test/present-test.c | 34 |
4 files changed, 125 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index a7054839..0b6358b8 100644 --- a/configure.ac +++ b/configure.ac @@ -210,7 +210,7 @@ if test "x$UDEV" != "xno"; then fi fi -PKG_CHECK_MODULES(X11, [x11 x11-xcb xcb-dri2 xrender xrandr xext xfixes cairo cairo-xlib-xrender pixman-1 libpng], [x11="yes"], [x11="no"]) +PKG_CHECK_MODULES(X11, [x11 x11-xcb xcb-dri2 xcomposite xdamage xrender xrandr xext xfixes cairo cairo-xlib-xrender pixman-1 libpng], [x11="yes"], [x11="no"]) AM_CONDITIONAL(HAVE_X11, test "x$x11" = "xyes") cpuid="yes" @@ -275,7 +275,7 @@ if test "x$shm" = "xyes"; then AC_DEFINE([HAVE_MIT_SHM], 1, [Define to 1 if MIT-SHM is available]) fi -PKG_CHECK_MODULES(X11_DRI3, [xcb-dri3 xcb-sync xcb-xfixes xcb-present x11-xcb xshmfence x11 xrender xrandr xxf86vm xext libdrm], [x11_dri3="yes"], [x11_dri3="no"]) +PKG_CHECK_MODULES(X11_DRI3, [xcb-dri3 xcb-sync xcb-xfixes xcb-present x11-xcb xshmfence x11 xcomposite xdamage xrender xrandr xxf86vm xext libdrm], [x11_dri3="yes"], [x11_dri3="no"]) AM_CONDITIONAL(X11_DRI3, test "x$x11_dri3" = "xyes" -a "x$shm" = "xyes") AM_CONDITIONAL(X11_SHM, test "x$shm" = "xyes") diff --git a/test/dri2-speed.c b/test/dri2-speed.c index bd7b6e18..87b9d0b6 100644 --- a/test/dri2-speed.c +++ b/test/dri2-speed.c @@ -33,6 +33,8 @@ #include <X11/Xlibint.h> #include <X11/extensions/dpms.h> #include <X11/extensions/randr.h> +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/Xdamage.h> #include <X11/extensions/Xrandr.h> #include <xcb/xcb.h> #include <xcb/dri2.h> @@ -166,6 +168,22 @@ static void fullscreen(Display *dpy, Window win) (unsigned char *)&atom, 1); } +static int has_composite(Display *dpy) +{ + int event, error; + int major, minor; + + if (!XDamageQueryExtension (dpy, &event, &error)) + return 0; + + if (!XCompositeQueryExtension(dpy, &event, &error)) + return 0; + + XCompositeQueryVersion(dpy, &major, &minor); + + return major > 0 || minor >= 4; +} + int main(void) { Display *dpy; @@ -211,6 +229,7 @@ int main(void) DRI2CreateDrawable(dpy, root); DRI2SwapInterval(dpy, root, 0); run(dpy, root, "off"); + XSync(dpy, True); for (i = 0; i < res->noutput; i++) { XRROutputInfo *output; @@ -236,6 +255,7 @@ int main(void) 0, 0, output->modes[0], RR_Rotate_0, &res->outputs[i], 1); run(dpy, root, "root"); + XSync(dpy, True); win = XCreateWindow(dpy, root, 0, 0, mode->width, mode->height, 0, @@ -249,6 +269,7 @@ int main(void) XMapWindow(dpy, win); run(dpy, win, "fullscreen"); XDestroyWindow(dpy, win); + XSync(dpy, True); win = XCreateWindow(dpy, root, 0, 0, mode->width, mode->height, 0, @@ -261,6 +282,30 @@ int main(void) XMapWindow(dpy, win); run(dpy, win, "windowed"); XDestroyWindow(dpy, win); + XSync(dpy, True); + + if (has_composite(dpy)) { + Damage damage; + + _x_error_occurred = 0; + win = XCreateWindow(dpy, root, + 0, 0, mode->width, mode->height, 0, + DefaultDepth(dpy, DefaultScreen(dpy)), + InputOutput, + DefaultVisual(dpy, DefaultScreen(dpy)), + CWOverrideRedirect, &attr); + XCompositeRedirectWindow(dpy, win, CompositeRedirectManual); + damage = XDamageCreate(dpy, win, XDamageReportRawRectangles); + DRI2CreateDrawable(dpy, win); + DRI2SwapInterval(dpy, win, 0); + XMapWindow(dpy, win); + XSync(dpy, True); + if (!_x_error_occurred) + run(dpy, win, "composited"); + XDamageDestroy(dpy, damage); + XDestroyWindow(dpy, win); + XSync(dpy, True); + } win = XCreateWindow(dpy, root, 0, 0, mode->width/2, mode->height/2, 0, @@ -273,6 +318,7 @@ int main(void) XMapWindow(dpy, win); run(dpy, win, "half"); XDestroyWindow(dpy, win); + XSync(dpy, True); XRRSetCrtcConfig(dpy, res, output->crtcs[c], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0); diff --git a/test/present-speed.c b/test/present-speed.c index c2d6b1c7..48964f74 100644 --- a/test/present-speed.c +++ b/test/present-speed.c @@ -32,6 +32,8 @@ #include <X11/xshmfence.h> #include <X11/Xutil.h> #include <X11/Xlibint.h> +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/Xdamage.h> #include <X11/extensions/dpms.h> #include <X11/extensions/randr.h> #include <X11/extensions/Xrandr.h> @@ -350,6 +352,22 @@ static int has_present(Display *dpy) return 1; } +static int has_composite(Display *dpy) +{ + int event, error; + int major, minor; + + if (!XDamageQueryExtension (dpy, &event, &error)) + return 0; + + if (!XCompositeQueryExtension(dpy, &event, &error)) + return 0; + + XCompositeQueryVersion(dpy, &major, &minor); + + return major > 0 || minor >= 4; +} + static int dri3_query_version(Display *dpy, int *major, int *minor) { xcb_connection_t *c = XGetXCBConnection(dpy); @@ -451,6 +469,7 @@ static void loop(Display *dpy, XRRScreenResources *res, unsigned options) attr.override_redirect = 1; run(dpy, root, "off", options); + XSync(dpy, True); for (i = 0; i < res->noutput; i++) { XRROutputInfo *output; @@ -476,6 +495,7 @@ static void loop(Display *dpy, XRRScreenResources *res, unsigned options) 0, 0, output->modes[0], RR_Rotate_0, &res->outputs[i], 1); run(dpy, root, "root", options); + XSync(dpy, True); win = XCreateWindow(dpy, root, 0, 0, mode->width, mode->height, 0, @@ -487,6 +507,7 @@ static void loop(Display *dpy, XRRScreenResources *res, unsigned options) XMapWindow(dpy, win); run(dpy, win, "fullscreen", options); XDestroyWindow(dpy, win); + XSync(dpy, True); win = XCreateWindow(dpy, root, 0, 0, mode->width, mode->height, 0, @@ -497,6 +518,28 @@ static void loop(Display *dpy, XRRScreenResources *res, unsigned options) XMapWindow(dpy, win); run(dpy, win, "windowed", options); XDestroyWindow(dpy, win); + XSync(dpy, True); + + if (has_composite(dpy)) { + Damage damage; + + _x_error_occurred = 0; + win = XCreateWindow(dpy, root, + 0, 0, mode->width, mode->height, 0, + DefaultDepth(dpy, DefaultScreen(dpy)), + InputOutput, + DefaultVisual(dpy, DefaultScreen(dpy)), + CWOverrideRedirect, &attr); + XCompositeRedirectWindow(dpy, win, CompositeRedirectManual); + damage = XDamageCreate(dpy, win, XDamageReportRawRectangles); + XMapWindow(dpy, win); + XSync(dpy, True); + if (!_x_error_occurred) + run(dpy, win, "composited", options); + XDamageDestroy(dpy, damage); + XDestroyWindow(dpy, win); + XSync(dpy, True); + } win = XCreateWindow(dpy, root, 0, 0, mode->width/2, mode->height/2, 0, @@ -507,6 +550,7 @@ static void loop(Display *dpy, XRRScreenResources *res, unsigned options) XMapWindow(dpy, win); run(dpy, win, "half", options); XDestroyWindow(dpy, win); + XSync(dpy, True); XRRSetCrtcConfig(dpy, res, output->crtcs[c], CurrentTime, 0, 0, None, RR_Rotate_0, NULL, 0); diff --git a/test/present-test.c b/test/present-test.c index 0c6743b9..bef7e505 100644 --- a/test/present-test.c +++ b/test/present-test.c @@ -33,6 +33,7 @@ #include <X11/Xlibint.h> #include <X11/extensions/dpms.h> #include <X11/extensions/randr.h> +#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrender.h> #include <X11/extensions/XShm.h> @@ -1774,6 +1775,19 @@ static int has_present(Display *dpy) return 1; } +static int has_composite(Display *dpy) +{ + int event, error; + int major, minor; + + if (!XCompositeQueryExtension(dpy, &event, &error)) + return 0; + + XCompositeQueryVersion(dpy, &major, &minor); + + return major > 0 || minor >= 4; +} + int main(void) { Display *dpy; @@ -1813,7 +1827,7 @@ int main(void) error += test_exhaustion_msc(dpy, queue); last_msc = check_msc(dpy, root, queue, last_msc, NULL); - for (dummy = 0; dummy < 3; dummy++) { + for (dummy = 0; dummy <= 3; dummy++) { Window win; uint64_t msc = 0; XSetWindowAttributes attr; @@ -1829,6 +1843,7 @@ int main(void) XGetGeometry(dpy, root, &win, &x, &y, &width, &height, &border, &depth); + _x_error_occurred = 0; switch (dummy) { case 0: win = root; @@ -1848,6 +1863,20 @@ int main(void) CWOverrideRedirect, &attr); phase = "window"; break; + case 3: + if (!has_composite(dpy)) + continue; + + win = XCreateWindow(dpy, root, + 0, 0, width, height, 0, + DefaultDepth(dpy, DefaultScreen(dpy)), + InputOutput, + DefaultVisual(dpy, DefaultScreen(dpy)), + CWOverrideRedirect, &attr); + XCompositeRedirectWindow(dpy, win, CompositeRedirectManual); + phase = "composite"; + break; + default: phase = "broken"; win = root; @@ -1856,6 +1885,9 @@ int main(void) } XMapWindow(dpy, win); + XSync(dpy, True); + if (_x_error_occurred) + continue; Q = setup_msc(dpy, win); msc = check_msc(dpy, win, Q, msc, NULL); |