diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dri2-speed.c | 46 | ||||
-rw-r--r-- | test/present-speed.c | 44 | ||||
-rw-r--r-- | test/present-test.c | 34 |
3 files changed, 123 insertions, 1 deletions
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); |