test/present: Include composite redirected windows in the test matrix

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-04-05 20:49:31 +01:00
parent 56801202de
commit 6de85a1e60
4 changed files with 125 additions and 3 deletions

View File

@ -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")

View File

@ -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);

View File

@ -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);

View File

@ -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);