xf86-video-intel: 2 commits - src/sna/sna_display.c test/present-test.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Apr 6 06:11:24 PDT 2015


 src/sna/sna_display.c |   22 ++++++++++++++--------
 test/present-test.c   |   39 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 50 insertions(+), 11 deletions(-)

New commits:
commit c47fd1dcada882757573261a0d714bccad5aa21c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Apr 6 14:00:44 2015 +0100

    test/present: Synchronize MSC notifiy modulus test to the vblank
    
    As the test presumes we can queue all the modulus queries within the
    same vblank, we can improve matters by synchronizing to the next vblank
    first.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/present-test.c b/test/present-test.c
index f63e9de..3630241 100644
--- a/test/present-test.c
+++ b/test/present-test.c
@@ -178,6 +178,39 @@ static uint64_t check_msc(Display *dpy, Window win, void *q, uint64_t last_msc,
 	return msc;
 }
 
+static uint64_t wait_vblank(Display *dpy, Window win, void *q)
+{
+	xcb_connection_t *c = XGetXCBConnection(dpy);
+	static uint32_t serial = 1;
+	uint64_t msc = 0;
+	int complete = 0;
+
+	xcb_present_notify_msc(c, win, serial ^ 0xdeadbeef, 0, 1, 0);
+	xcb_flush(c);
+
+	do {
+		xcb_present_complete_notify_event_t *ce;
+		xcb_generic_event_t *ev;
+
+		ev = xcb_wait_for_special_event(c, q);
+		if (ev == NULL)
+			break;
+
+		ce = (xcb_present_complete_notify_event_t *)ev;
+		if (ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC &&
+		    ce->serial == (serial ^ 0xdeadbeef)) {
+			msc = ce->msc;
+			complete = 1;
+		}
+		free(ev);
+	} while (!complete);
+
+	if (++serial == 0)
+		serial = 1;
+
+	return msc;
+}
+
 static uint64_t msc_interval(Display *dpy, Window win, void *q)
 {
 	xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -1095,13 +1128,12 @@ static int test_modulus_msc(Display *dpy, void *Q)
 	printf("Testing notify modulus\n");
 	_x_error_occurred = 0;
 
-	target = check_msc(dpy, root, Q, 0, NULL);
+	target = wait_vblank(dpy, root, Q);
 
 	xcb_present_notify_msc(c, root, 0, 0, 0, 0);
 	for (x = 1; x <= 19; x++) {
-		for (y = 0; y < x; y++) {
+		for (y = 0; y < x; y++)
 			xcb_present_notify_msc(c, root, y << 16 | x, 0, x, y);
-		}
 	}
 	xcb_present_notify_msc(c, root, 0xdeadbeef, target + 2*x, 0, 0);
 	xcb_flush(c);
@@ -1111,6 +1143,7 @@ static int test_modulus_msc(Display *dpy, void *Q)
 		ce = (xcb_present_complete_notify_event_t *)ev;
 		assert(ce->kind == XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC);
 		assert(ce->serial == 0);
+		assert(target == ce->msc);
 		target = ce->msc;
 	}
 
commit e74ff581449e92d7933da1b5df6680cb880fc454
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Apr 6 13:58:35 2015 +0100

    sna: Force the TearFree redisplay when populating a rotated configuration
    
    We have to disable the "shadow idle; skipping" test if the CRTCs are
    showing stale content following a sna_crtc_attach().
    
    Reported-by: Chris Bainbridge <chris.bainbridge at gmail.com>
    References: https://bugs.freedesktop.org/show_bug.cgi?id=89904
    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 eacfe14..03595da 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1995,9 +1995,9 @@ get_scanout_bo(struct sna *sna, PixmapPtr pixmap)
 	return priv->gpu_bo;
 }
 
-static void clear(struct sna *sna,
-		  PixmapPtr front, struct kgem_bo *bo,
-		  xf86CrtcPtr crtc)
+static void shadow_clear(struct sna *sna,
+			 PixmapPtr front, struct kgem_bo *bo,
+			 xf86CrtcPtr crtc)
 {
 	bool ok = false;
 	if (!wedged(sna))
@@ -2009,6 +2009,12 @@ static void clear(struct sna *sna,
 		if (ptr)
 			memset(ptr, 0, bo->pitch * crtc->mode.HDisplay);
 	}
+	sna->mode.shadow_dirty = true;
+}
+
+static bool rr_active(xf86CrtcPtr crtc)
+{
+	return crtc->transformPresent || crtc->rotation != RR_Rotate_0;
 }
 
 static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
@@ -2082,7 +2088,7 @@ force_shadow:
 		}
 
 		front = sna_crtc->slave_pixmap ?: sna->front;
-		if (__sna_pixmap_get_bo(front) && !crtc->transformPresent) {
+		if (__sna_pixmap_get_bo(front) && !rr_active(crtc)) {
 			BoxRec b;
 
 			b.x1 = crtc->x;
@@ -2100,7 +2106,7 @@ force_shadow:
 				b.y2 = scrn->virtualY;
 			if (b.x2 - b.x1 < crtc->mode.HDisplay ||
 			    b.y2 - b.y1 < crtc->mode.VDisplay)
-				clear(sna, front, bo, crtc);
+				shadow_clear(sna, front, bo, crtc);
 
 			if (b.y2 > b.y1 && b.x2 > b.x1) {
 				DrawableRec tmp;
@@ -2120,11 +2126,11 @@ force_shadow:
 				if (!sna->render.copy_boxes(sna, GXcopy,
 							     &front->drawable, __sna_pixmap_get_bo(front), 0, 0,
 							     &tmp, bo, -crtc->x, -crtc->y,
-							     &b, 1, 0))
-					clear(sna, front, bo, crtc);
+							     &b, 1, COPY_LAST))
+					shadow_clear(sna, front, bo, crtc);
 			}
 		} else
-			clear(sna, front, bo, crtc);
+			shadow_clear(sna, front, bo, crtc);
 
 		sna_crtc->shadow_bo_width = crtc->mode.HDisplay;
 		sna_crtc->shadow_bo_height = crtc->mode.VDisplay;


More information about the xorg-commit mailing list