xf86-video-intel: 2 commits - configure.ac src/sna/sna_display.c test/dri2-test.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jan 28 04:06:52 PST 2015


 configure.ac          |    2 +-
 src/sna/sna_display.c |   13 +++++++++++++
 test/dri2-test.c      |   30 ++++++++++++++++++++++++++++--
 3 files changed, 42 insertions(+), 3 deletions(-)

New commits:
commit 2e7ae76038c808d80c39dfaa56ad4648cd94e7fc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 28 11:44:41 2015 +0000

    test/dri2: Use xcb for more accurate timing of SwapBuffers
    
    To do SwapBuffers correctly requires a Swap/Get buffers combination, and
    this is easiest using xcb rather than xlib.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 3704722..07e6af1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -205,7 +205,7 @@ if test "x$UDEV" != "xno"; then
 	fi
 fi
 
-PKG_CHECK_MODULES(X11, [x11 xrender xrandr xext xfixes cairo cairo-xlib-xrender pixman-1 libpng], [x11="yes"], [x11="no"])
+PKG_CHECK_MODULES(X11, [x11 x11-xcb xcb-dri2 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"
diff --git a/test/dri2-test.c b/test/dri2-test.c
index dd4179f..d44ed99 100644
--- a/test/dri2-test.c
+++ b/test/dri2-test.c
@@ -6,6 +6,10 @@
 #include <X11/Xutil.h>
 #include <X11/extensions/Xfixes.h>
 #include <X11/extensions/Xrandr.h>
+#include <X11/Xlib-xcb.h>
+#include <xcb/xcb.h>
+#include <xcb/xcbext.h>
+#include <xcb/dri2.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
@@ -101,10 +105,29 @@ static uint64_t check_msc(Display *dpy, Window win, uint64_t last_msc)
 	return current_msc;
 }
 
+static void swap_buffers(xcb_connection_t *c, Window win,
+		unsigned int *attachments, int nattachments)
+{
+	unsigned int seq[2];
+
+	seq[0] = xcb_dri2_swap_buffers_unchecked(c, win,
+						 0, 0, 0, 0, 0, 0).sequence;
+
+
+	seq[1] = xcb_dri2_get_buffers_unchecked(c, win,
+						nattachments, nattachments,
+						attachments).sequence;
+
+	xcb_flush(c);
+	xcb_discard_reply(c, seq[0]);
+	xcb_discard_reply(c, seq[1]);
+}
+
 static void run(Display *dpy, int width, int height,
 		unsigned int *attachments, int nattachments,
 		const char *name)
 {
+	xcb_connection_t *c = XGetXCBConnection(dpy);
 	Window win;
 	XSetWindowAttributes attr;
 	int count;
@@ -132,15 +155,17 @@ static void run(Display *dpy, int width, int height,
 	if (count != nattachments)
 		return;
 
+	swap_buffers(c, win, attachments, nattachments);
 	msc = check_msc(dpy, win, msc);
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	for (count = 0; count < COUNT; count++)
-		DRI2SwapBuffers(dpy, win, 0, 0, 0);
+		swap_buffers(c, win, attachments, nattachments);
 	msc = check_msc(dpy, win, msc);
 	clock_gettime(CLOCK_MONOTONIC, &end);
 	printf("%d %s (%dx%d) swaps in %fs.\n",
 	       count, name, width, height, elapsed(&start, &end));
 
+	swap_buffers(c, win, attachments, nattachments);
 	msc = check_msc(dpy, win, msc);
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	for (count = 0; count < COUNT; count++)
@@ -153,10 +178,11 @@ static void run(Display *dpy, int width, int height,
 
 	DRI2SwapInterval(dpy, win, 0);
 
+	swap_buffers(c, win, attachments, nattachments);
 	msc = check_msc(dpy, win, msc);
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	for (count = 0; count < COUNT; count++)
-		DRI2SwapBuffers(dpy, win, 0, 0, 0);
+		swap_buffers(c, win, attachments, nattachments);
 	msc = check_msc(dpy, win, msc);
 	clock_gettime(CLOCK_MONOTONIC, &end);
 	printf("%d %s (%dx%d) vblank=0 swaps in %fs.\n",
commit 6f6190abcfc3abdefdb2826415e242749fcfb9f8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 28 11:22:57 2015 +0000

    sna: Clear the per-crtc shadow buffer if they are clipped
    
    Before we present a buffer on the CRTC, we try to make sure it is
    initialised with the current contents. However, if it is larger than the
    screen then not all the buffer may be initialised and so we need to
    clear it first.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index bc1a511..f1bab9e 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2021,6 +2021,19 @@ force_shadow:
 				b.x2 = scrn->virtualX;
 			if (b.y2 > scrn->virtualY)
 				b.y2 = scrn->virtualY;
+			if (b.x2 - b.x1 < crtc->mode.HDisplay ||
+			    b.y2 - b.y1 < crtc->mode.VDisplay) {
+				bool ok = false;
+				if (!wedged(sna))
+					ok = sna->render.fill_one(sna, front, bo, 0,
+								  0, 0, crtc->mode.HDisplay, crtc->mode.VDisplay,
+								  GXclear);
+				if (!ok) {
+					void *ptr = kgem_bo_map__gtt(&sna->kgem, bo);
+					if (ptr)
+						memset(ptr, 0, bo->pitch * crtc->mode.VDisplay);
+				}
+			}
 			if (b.y2 > b.y1 && b.x2 > b.x1) {
 				DrawableRec tmp;
 


More information about the xorg-commit mailing list