xf86-video-intel: 3 commits - configure.ac src/sna/sna_present.c test/dri2-speed.c test/present-speed.c test/present-test.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Apr 5 14:13:47 PDT 2015
configure.ac | 4 ++--
src/sna/sna_present.c | 26 ++++++++++++++++++++++++--
test/dri2-speed.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
test/present-speed.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
test/present-test.c | 36 ++++++++++++++++++++++++++++++++++--
5 files changed, 150 insertions(+), 6 deletions(-)
New commits:
commit d348f897c83632eb2b1742d664422d67fd9079e6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Apr 5 21:33:40 2015 +0100
test/present: Expland MSC accuracy test
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/test/present-test.c b/test/present-test.c
index bef7e50..f63e9de 100644
--- a/test/present-test.c
+++ b/test/present-test.c
@@ -1098,7 +1098,7 @@ static int test_modulus_msc(Display *dpy, void *Q)
target = check_msc(dpy, root, Q, 0, NULL);
xcb_present_notify_msc(c, root, 0, 0, 0, 0);
- for (x = 1; x <= 7; x++) {
+ for (x = 1; x <= 19; x++) {
for (y = 0; y < x; y++) {
xcb_present_notify_msc(c, root, y << 16 | x, 0, x, y);
}
commit 6de85a1e60f50d525c28da2f29466c40ce3f39bb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Apr 5 20:49:31 2015 +0100
test/present: Include composite redirected windows in the test matrix
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/configure.ac b/configure.ac
index a705483..0b6358b 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 bd7b6e1..87b9d0b 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 c2d6b1c..48964f7 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 0c6743b..bef7e50 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);
commit 56801202ded1f11608ff08e69c95f0a43c758322
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Apr 5 19:41:31 2015 +0100
sna/present: Use a vblank wait to fix up a timer firing too early
In cases of stress, we use a timer to create a fake vblank event and
then we adjust the timer when it fires to match it up with the CRTC msc.
However, sometimes we fire before the vblank but less than a millisecond
and so below the precision of the timer causing us to send notifies too
early. Use a blocking vblank wait to fixup these rare cases.
Testcase: present/notify/accuracy
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c
index 912bbe7..5c66206 100644
--- a/src/sna/sna_present.c
+++ b/src/sna/sna_present.c
@@ -148,9 +148,31 @@ static CARD32 sna_fake_vblank_handler(OsTimerPtr timer, CARD32 now, void *data)
DBG(("%s: event=%lld, target msc=%lld, now %lld\n",
__FUNCTION__, (long long)info->event_id[0], (long long)info->target_msc, (long long)msc));
if (msc < info->target_msc) {
- uint32_t delay = msc_to_delay(info->crtc, info->target_msc);
- if (delay)
+ uint32_t delay;
+
+ DBG(("%s: too early, requeuing\n", __FUNCTION__));
+
+ vbl.request.type = DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;
+ vbl.request.sequence = info->target_msc;
+ vbl.request.signal = (uintptr_t)MARK_PRESENT(info);
+ if (sna_wait_vblank(info->sna, &vbl, sna_crtc_to_pipe(info->crtc)) == 0) {
+ DBG(("%s: scheduled new vblank event for %lld\n", __FUNCTION__, (long long)info->target_msc));
+ return 0;
+ }
+
+ delay = msc_to_delay(info->crtc, info->target_msc);
+ if (delay) {
+ DBG(("%s: requeueing timer for %dms delay\n", __FUNCTION__, delay));
return delay;
+ }
+
+ /* As a last resort use a blocking wait.
+ * Less than a millisecond for a rare case.
+ */
+ DBG(("%s: blocking wait!\n", __FUNCTION__));
+ vbl.request.type = DRM_VBLANK_ABSOLUTE;
+ vbl.request.sequence = info->target_msc;
+ (void)sna_wait_vblank(info->sna, &vbl, sna_crtc_to_pipe(info->crtc));
}
} else {
const struct ust_msc *swap = sna_crtc_last_swap(info->crtc);
More information about the xorg-commit
mailing list