[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-intel: Changes to 'upstream-experimental'



 NEWS                     |   21 ++++
 autogen.sh               |    4 
 configure.ac             |    6 -
 src/intel_driver.c       |   19 +++-
 src/sna/gen6_render.c    |    3 
 src/sna/gen7_render.c    |    3 
 src/sna/kgem.c           |   43 +++++----
 src/sna/sna.h            |    2 
 src/sna/sna_accel.c      |  209 +++++++++++++++++++----------------------------
 src/sna/sna_composite.c  |    2 
 src/sna/sna_damage.c     |    6 -
 src/sna/sna_display.c    |    2 
 src/sna/sna_dri.c        |    9 +-
 src/sna/sna_driver.c     |    4 
 src/sna/sna_glyphs.c     |    2 
 src/sna/sna_render.h     |    1 
 src/sna/sna_tiling.c     |    4 
 src/sna/sna_trapezoids.c |    3 
 test/Makefile.am         |    9 +-
 test/mkvsync.sh          |   27 ++++++
 20 files changed, 213 insertions(+), 166 deletions(-)

New commits:
commit a88a9b9a59fa2d5fd427fa6e1f74fb9844379264
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 20 12:06:09 2013 +0000

    2.20.19 release

diff --git a/NEWS b/NEWS
index e9dd6e4..9fa9009 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,24 @@
+Release 2.20.19 (2013-01-20)
+============================
+A quick release as the last broke USB DisplayLink slave outputs badly. The
+performance of those displays was unusable due to a inadvertent change that
+caused us to flush the entire scanout over the USB for every drawing
+operation.
+
+ * Implement the GNOME Build API. A couple of minor changes to make
+   integrators and distributors lives a little easier, or at least more
+   consistent.
+
+ * Correctly offset inplace trapezoids for subwindows, such as the GTK+
+   close button after it has a background image uploaded.
+
+ * Explicitly prevent ring-switching for synchronized rendering to
+   scanouts (for vsync).
+
+ * Clip dirty region to slave pixmaps (otherwise UDL is nigh unusuable)
+   https://bugs.freedesktop.org/show_bug.cgi?id=59539
+
+
 Release 2.20.18 (2013-01-16)
 ============================
 A bunch of miscellaneous fixes for assertion failures and various
diff --git a/configure.ac b/configure.ac
index e93fd88..317bc6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.20.18],
+        [2.20.19],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 7822bbacbece6fcb2e12863cd6c7a53ab614c37c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 20 11:43:49 2013 +0000

    test: Add script to generate source file for testing vsync
    
    Courtesy of an original script by Mark Schreiber,
    https://bugs.freedesktop.org/show_bug.cgi?id=59606

diff --git a/test/Makefile.am b/test/Makefile.am
index 96c87f8..c1dd0e9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -35,4 +35,11 @@ libtest_la_SOURCES = \
 	dri2.h \
 	$(NULL)
 
-EXTRA_DIST = README
+vsync.avi: mkvsync.sh
+	./mkvsync.sh $@
+
+clean-vsync-avi:
+	rm -rf vsync.avi .build.tmp
+
+EXTRA_DIST = README mkvsync.sh
+clean-local: clean-vsync-avi
diff --git a/test/mkvsync.sh b/test/mkvsync.sh
new file mode 100755
index 0000000..dd96ad8
--- /dev/null
+++ b/test/mkvsync.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+OUT="$1"
+[ -n "$OUT" ] || OUT="vsync.avi"
+
+TMP=".build.tmp"
+
+rm -rf ${TMP}
+mkdir ${TMP}
+convert -size 640x480 -depth 24 canvas:black png24:${TMP}/black.png
+convert -size 640x480 -depth 24 canvas:white png24:${TMP}/white.png
+
+mkdir ${TMP}/anim
+
+for ((a=0; $a < 1000; a=$a+2)); do
+	ln -s ../black.png ${TMP}/anim/$a.png
+done
+
+for ((a=1; $a < 1000; a=$a+2)); do
+	ln -s ../white.png ${TMP}/anim/$a.png
+done
+
+mencoder "mf://${TMP}/anim/*.png" -v -vf-clr -mf fps=60 -o "${OUT}" -ovc lavc
+exitcode=$?
+rm -rf ${TMP}
+
+exit ${exitcode}

commit 9329d8755981989ccbe66df6085fbab7c809a2c6
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 20 10:14:21 2013 +0000

    sna: Make DEBUG_SYNC a configure option
    
    As it is advisable to combined the synchronous rendering debug option
    with other debugging options, it is more convenient to make it into a
    configure option: --enable-debug=sync
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index ff26462..e93fd88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -418,6 +418,9 @@ if test "x$DEBUG" != xno; then
 		AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
 	fi
 fi
+if test "x$DEBUG" = xsync; then
+	AC_DEFINE(DEBUG_SYNC,1,[Enable synchronous rendering for debugging])
+fi
 if test "x$DEBUG" = xmemory; then
 	AC_DEFINE(DEBUG_MEMORY,1,[Enable memory debugging])
 fi
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 89558af..49815e7 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -75,6 +75,10 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags);
 #define DBG_NO_HANDLE_LUT 0
 #define DBG_DUMP 0
 
+#ifndef DEBUG_SYNC
+#define DEBUG_SYNC 0
+#endif
+
 #define SHOW_BATCH 0
 
 #ifndef USE_FASTRELOC
@@ -2650,7 +2654,7 @@ void _kgem_submit(struct kgem *kgem)
 				ret = 0;
 			}
 
-			if (DEBUG_FLUSH_SYNC && ret == 0) {
+			if (DEBUG_SYNC && ret == 0) {
 				struct drm_i915_gem_set_domain set_domain;
 
 				DBG(("%s: debug sync, starting\n", __FUNCTION__));
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 8304f42..2ba5fe4 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -82,7 +82,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define DEBUG_NO_BLT 0
 
 #define DEBUG_FLUSH_BATCH 0
-#define DEBUG_FLUSH_SYNC 0
 
 #define TEST_ALL 0
 #define TEST_ACCEL (TEST_ALL || 0)
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index dff2901..a0707ed 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -1141,6 +1141,10 @@ Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
 		   "SNA compiled with assertions enabled\n");
 #endif
+#if DEBUG_SYNC
+	xf86DrvMsg(scrn->scrnIndex, X_INFO,
+		   "SNA compiled with synchronous rendering\n");
+#endif
 #if DEBUG_MEMORY
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
 		   "SNA compiled with memory allocation reporting enabled\n");

commit c9263f192e2f85dd961bc1c4e9ca8180db874517
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 20 01:39:12 2013 +0000

    sna: Apply DEBUG_SYNC prior to emitting error report
    
    This is handy for the case where the batch triggers a GPU hang rather
    than being rejected by the kernel.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 98f3ec9..89558af 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2649,6 +2649,26 @@ void _kgem_submit(struct kgem *kgem)
 				kgem_throttle(kgem);
 				ret = 0;
 			}
+
+			if (DEBUG_FLUSH_SYNC && ret == 0) {
+				struct drm_i915_gem_set_domain set_domain;
+
+				DBG(("%s: debug sync, starting\n", __FUNCTION__));
+
+				VG_CLEAR(set_domain);
+				set_domain.handle = handle;
+				set_domain.read_domains = I915_GEM_DOMAIN_GTT;
+				set_domain.write_domain = I915_GEM_DOMAIN_GTT;
+
+				ret = drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
+				if (ret == -1) {
+					DBG(("%s: sync: GPU hang detected\n", __FUNCTION__));
+					kgem_throttle(kgem);
+				}
+
+				DBG(("%s: debug sync, completed\n", __FUNCTION__));
+			}
+
 #if !NDEBUG
 			if (ret < 0) {
 				ret = errno;
@@ -2695,25 +2715,6 @@ void _kgem_submit(struct kgem *kgem)
 				FatalError("SNA: failed to submit batchbuffer, errno=%d\n", ret);
 			}
 #endif
-
-			if (DEBUG_FLUSH_SYNC) {
-				struct drm_i915_gem_set_domain set_domain;
-
-				DBG(("%s: debug sync, starting\n", __FUNCTION__));
-
-				VG_CLEAR(set_domain);
-				set_domain.handle = handle;
-				set_domain.read_domains = I915_GEM_DOMAIN_GTT;
-				set_domain.write_domain = I915_GEM_DOMAIN_GTT;
-
-				ret = drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
-				if (ret == -1) {
-					DBG(("%s: sync: GPU hang detected\n", __FUNCTION__));
-					kgem_throttle(kgem);
-				}
-
-				DBG(("%s: debug sync, completed\n", __FUNCTION__));
-			}
 		}
 
 		kgem_commit(kgem);

commit 42ab789cce8423d99864776c6d5ba759c4129b54
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 18 13:56:53 2013 +0000

    sna: Clear the non-intersecting damage after skipping the slave update
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 8539481..ba9a3cb 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13822,7 +13822,7 @@ static void sna_accel_post_damage(struct sna *sna)
 
 		RegionIntersect(&region, &region, damage);
 		if (RegionNil(&region))
-			continue;
+			goto skip;
 
 		RegionTranslate(&region, -dirty->x, -dirty->y);
 		DamageRegionAppend(&dirty->slave_dst->drawable, &region);

commit 828a3a80aa3f0692e7be2831d58bccf02e2c481d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 18 13:16:23 2013 +0000

    uxa: Clip dirty region to slave pixmap before appending damage
    
    Fixes regression from
    
    commit c789d06cf8a0debc67058d7be1483f5b542e2baa
    Author: Dave Airlie <airlied@redhat.com>
    Date:   Mon Jan 7 13:57:21 2013 +1000
    
        intel: fixup damage posting to be done correctly around slave pixmap
    
    which causes the entire slave scanout to be readback from uncached
    memory every time a pixel is modified.
    
    Reported-by: Stephen Liang <inteldriver@angrywalls.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59539
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index d22c063..7807106 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -686,7 +686,7 @@ void IntelEmitInvarientState(ScrnInfoPtr scrn)
 }
 
 #ifdef INTEL_PIXMAP_SHARING
-static Bool
+static void
 redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
 {
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
@@ -695,9 +695,19 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
 	int was_blocked;
 
 	PixmapRegionInit(&pixregion, dirty->slave_dst->master_pixmap);
-
+	RegionTranslate(&pixregion, dirty->x, dirty->y);
+	RegionIntersect(&pixregion, &pixregion, DamageRegion(dirty->damage));
+	RegionTranslate(&pixregion, -dirty->x, -dirty->y);
+	was_blocked = RegionNil(&pixregion);
 	DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
+	RegionUninit(&pixregion);
+	if (was_blocked)
+		return;
+
+	PixmapRegionInit(&pixregion, dirty->slave_dst->master_pixmap);
 	PixmapSyncDirtyHelper(dirty, &pixregion);
+	RegionUninit(&pixregion);
+
 	intel_batch_submit(scrn);
 	if (!intel->has_prime_vmap_flush) {
 		drm_intel_bo *bo = intel_get_pixmap_bo(dirty->slave_dst->master_pixmap);
@@ -706,10 +716,9 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
 		drm_intel_bo_unmap(bo);
 		xf86UnblockSIGIO(was_blocked);
 	}
-	DamageRegionProcessPending(&dirty->slave_dst->drawable);
 
-	RegionUninit(&pixregion);
-	return 0;
+	DamageRegionProcessPending(&dirty->slave_dst->drawable);
+	return;
 }
 
 static void

commit e17eaf540b614cdcb8f7349dd01852c3afc5ab05
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 18 13:09:36 2013 +0000

    sna: Replace double negative '!RegionNotEmpty' with the equivalent RegionNil
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 99063de..8539481 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -350,7 +350,7 @@ static void assert_pixmap_damage(PixmapPtr p)
 		_sna_damage_debug_get_region(DAMAGE_PTR(priv->cpu_damage), &cpu);
 
 	RegionIntersect(&reg, &cpu, &gpu);
-	assert(!RegionNotEmpty(&reg));
+	assert(RegionNil(&reg));
 
 	RegionUninit(&reg);
 	RegionUninit(&gpu);
@@ -3766,7 +3766,7 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth,
 	    gc->pCompositeClip->extents.x2 < region.extents.x2 ||
 	    gc->pCompositeClip->extents.y2 < region.extents.y2) {
 		RegionIntersect(&region, &region, gc->pCompositeClip);
-		if (!RegionNotEmpty(&region))
+		if (RegionNil(&region))
 			return;
 	}
 
@@ -4713,7 +4713,7 @@ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		 * VT is inactive, make sure the region isn't empty
 		 */
 		if (((WindowPtr)src)->parent ||
-		    !RegionNotEmpty(&((WindowPtr)src)->borderClip)) {
+		    RegionNil(&((WindowPtr)src)->borderClip)) {
 			DBG(("%s: include inferiors\n", __FUNCTION__));
 			free_clip = clip = NotClippedByChildren((WindowPtr)src);
 		}
@@ -5376,7 +5376,7 @@ no_damage_clipped:
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 
 		assert(dx + clip.extents.x1 >= 0);
@@ -5477,7 +5477,7 @@ damage_clipped:
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 
 		assert(dx + clip.extents.x1 >= 0);
@@ -5798,7 +5798,7 @@ fallback:
 	DBG(("%s: fallback\n", __FUNCTION__));
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &region))
@@ -5838,7 +5838,7 @@ sna_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
 fallback:
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &region))
@@ -6287,7 +6287,7 @@ sna_copy_plane(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	     __FUNCTION__,
 	     region.extents.x1, region.extents.y1,
 	     region.extents.x2, region.extents.y2));
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		goto empty;
 
 	RegionTranslate(&region,
@@ -6544,7 +6544,7 @@ fallback:
 	DBG(("%s: fallback\n", __FUNCTION__));
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &region))
@@ -6599,7 +6599,7 @@ sna_poly_zero_line_blt(DrawablePtr drawable,
 	region_set(&clip, extents);
 	if (clipped) {
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 	}
 
@@ -7024,7 +7024,7 @@ sna_poly_line_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 
 		last.x = pt->x + drawable->x;
@@ -7466,7 +7466,7 @@ spans_fallback:
 				} else {
 					region_maybe_clip(&data.region,
 							  gc->pCompositeClip);
-					if (!RegionNotEmpty(&data.region))
+					if (RegionNil(&data.region))
 						return;
 
 					if (region_is_singular(&data.region))
@@ -7491,7 +7491,7 @@ spans_fallback:
 				} else {
 					region_maybe_clip(&data.region,
 							  gc->pCompositeClip);
-					if (!RegionNotEmpty(&data.region))
+					if (RegionNil(&data.region))
 						return;
 
 					if (region_is_singular(&data.region))
@@ -7568,7 +7568,7 @@ spans_fallback:
 fallback:
 	DBG(("%s: fallback\n", __FUNCTION__));
 	region_maybe_clip(&data.region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&data.region))
+	if (RegionNil(&data.region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &data.region))
@@ -7698,7 +7698,7 @@ sna_poly_segment_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			goto done;
 
 		if (clip.data) {
@@ -7805,7 +7805,7 @@ sna_poly_zero_segment_blt(DrawablePtr drawable,
 	region_set(&clip, extents);
 	if (clipped) {
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 	}
 	DBG(("%s: [clipped] extents=(%d, %d), (%d, %d), delta=(%d, %d)\n",
@@ -8373,7 +8373,7 @@ spans_fallback:
 			} else {
 				region_maybe_clip(&data.region,
 						  gc->pCompositeClip);
-				if (!RegionNotEmpty(&data.region))
+				if (RegionNil(&data.region))
 					return;
 
 				if (region_is_singular(&data.region))
@@ -8412,7 +8412,7 @@ spans_fallback:
 fallback:
 	DBG(("%s: fallback\n", __FUNCTION__));
 	region_maybe_clip(&data.region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&data.region))
+	if (RegionNil(&data.region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &data.region))
@@ -8567,7 +8567,7 @@ zero_clipped:
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			goto done;
 
 		if (clip.data) {
@@ -8713,7 +8713,7 @@ wide_clipped:
 		     __FUNCTION__,
 		     clip.extents.x1, clip.extents.y1,
 		     clip.extents.x2, clip.extents.y2));
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			goto done;
 
 		if (clip.data) {
@@ -9022,7 +9022,7 @@ fallback:
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &region))
@@ -9161,7 +9161,7 @@ sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc)
 				} else {
 					region_maybe_clip(&data.region,
 							  gc->pCompositeClip);
-					if (!RegionNotEmpty(&data.region))
+					if (RegionNil(&data.region))
 						return;
 
 					if (region_is_singular(&data.region)) {
@@ -9185,7 +9185,7 @@ sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc)
 			} else {
 				region_maybe_clip(&data.region,
 						  gc->pCompositeClip);
-				if (!RegionNotEmpty(&data.region))
+				if (RegionNil(&data.region))
 					return;
 
 				sna_gc_ops__tmp.FillSpans = sna_fill_spans__gpu;
@@ -9221,7 +9221,7 @@ sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, xArc *arc)
 fallback:
 	DBG(("%s -- fallback\n", __FUNCTION__));
 	region_maybe_clip(&data.region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&data.region))
+	if (RegionNil(&data.region))
 		return;
 
 	if (!sna_gc_move_to_cpu(gc, drawable, &data.region))
@@ -9364,7 +9364,7 @@ sna_poly_fill_rect_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			goto done;
 
 		if (clip.data == NULL) {
@@ -9535,7 +9535,7 @@ sna_poly_fill_polygon(DrawablePtr draw, GCPtr gc,
 			} else {
 				region_maybe_clip(&data.region,
 						  gc->pCompositeClip);
-				if (!RegionNotEmpty(&data.region))
+				if (RegionNil(&data.region))
 					return;
 
 				if (region_is_singular(&data.region))
@@ -9572,7 +9572,7 @@ fallback:
 	     data.region.extents.x1, data.region.extents.y1,
 	     data.region.extents.x2, data.region.extents.y2));
 	region_maybe_clip(&data.region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&data.region)) {
+	if (RegionNil(&data.region)) {
 		DBG(("%s: nothing to do, all clipped\n", __FUNCTION__));
 		return;
 	}
@@ -9782,7 +9782,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			goto done;
 
 		b = sna->kgem.batch + sna->kgem.nbatch;
@@ -10109,7 +10109,7 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			goto done;
 
 		if (clip.data == NULL) {
@@ -10388,7 +10388,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 
 		b = sna->kgem.batch + sna->kgem.nbatch;
@@ -10720,7 +10720,7 @@ sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (RegionNil(&clip))
 			return true;
 
 		pat.x = origin->x + drawable->x;
@@ -11329,7 +11329,7 @@ sna_poly_fill_rect_stippled_n_blt__imm(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip)) {
+		if (RegionNil(&clip)) {
 			DBG(("%s: all clipped\n", __FUNCTION__));
 			return true;
 		}
@@ -11474,7 +11474,7 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip)) {
+		if (RegionNil(&clip)) {
 			DBG(("%s: all clipped\n", __FUNCTION__));
 			return true;
 		}
@@ -11812,7 +11812,7 @@ fallback:
 	     region.extents.x2, region.extents.y2));
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region)) {
+	if (RegionNil(&region)) {
 		DBG(("%s: nothing to do, all clipped\n", __FUNCTION__));
 		return;
 	}
@@ -11905,7 +11905,7 @@ sna_poly_fill_arc(DrawablePtr draw, GCPtr gc, int n, xArc *arc)
 			} else {
 				region_maybe_clip(&data.region,
 						  gc->pCompositeClip);
-				if (!RegionNotEmpty(&data.region))
+				if (RegionNil(&data.region))
 					return;
 
 				if (region_is_singular(&data.region))
@@ -11942,7 +11942,7 @@ fallback:
 	     data.region.extents.x1, data.region.extents.y1,
 	     data.region.extents.x2, data.region.extents.y2));
 	region_maybe_clip(&data.region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&data.region)) {
+	if (RegionNil(&data.region)) {
 		DBG(("%s: nothing to do, all clipped\n", __FUNCTION__));
 		return;
 	}
@@ -12399,7 +12399,7 @@ sna_poly_text8(DrawablePtr drawable, GCPtr gc,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return x + extents.overallRight;
 
 	if (FORCE_FALLBACK)
@@ -12473,7 +12473,7 @@ sna_poly_text16(DrawablePtr drawable, GCPtr gc,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return x + extents.overallRight;
 
 	if (FORCE_FALLBACK)
@@ -12554,7 +12554,7 @@ sna_image_text8(DrawablePtr drawable, GCPtr gc,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	DBG(("%s: clipped extents (%d, %d), (%d, %d)\n",
@@ -12636,7 +12636,7 @@ sna_image_text16(DrawablePtr drawable, GCPtr gc,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	DBG(("%s: clipped extents (%d, %d), (%d, %d)\n",
@@ -12938,7 +12938,7 @@ sna_image_glyph(DrawablePtr drawable, GCPtr gc,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (FORCE_FALLBACK)
@@ -13016,7 +13016,7 @@ sna_poly_glyph(DrawablePtr drawable, GCPtr gc,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (FORCE_FALLBACK)
@@ -13217,7 +13217,7 @@ sna_push_pixels(GCPtr gc, PixmapPtr bitmap, DrawablePtr drawable,
 
 	region.data = NULL;
 	region_maybe_clip(&region, gc->pCompositeClip);
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	switch (gc->fillStyle) {
@@ -13529,7 +13529,7 @@ sna_copy_window(WindowPtr win, DDXPointRec origin, RegionPtr src)
 
 	RegionNull(&dst);
 	RegionIntersect(&dst, &win->borderClip, src);
-	if (!RegionNotEmpty(&dst))
+	if (RegionNil(&dst))
 		return;
 
 #ifdef COMPOSITE
@@ -13800,7 +13800,7 @@ static void sna_accel_post_damage(struct sna *sna)
 		int n;
 
 		damage = DamageRegion(dirty->damage);
-		if (!RegionNotEmpty(damage))
+		if (RegionNil(damage))
 			continue;
 
 		src = dirty->src;
@@ -13821,7 +13821,7 @@ static void sna_accel_post_damage(struct sna *sna)
 		     region.extents.x2, region.extents.y2));
 
 		RegionIntersect(&region, &region, damage);
-		if (!RegionNotEmpty(&region))
+		if (RegionNil(&region))
 			continue;
 
 		RegionTranslate(&region, -dirty->x, -dirty->y);
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 73d94e1..ab693af 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -1034,7 +1034,7 @@ static struct sna_damage *__sna_damage_subtract(struct sna_damage *damage,
 	if (damage == NULL)
 		return NULL;
 
-	if (!RegionNotEmpty(&damage->region)) {
+	if (RegionNil(&damage->region)) {
 no_damage:
 		__sna_damage_destroy(damage);
 		return NULL;
@@ -1127,7 +1127,7 @@ inline static struct sna_damage *__sna_damage_subtract_box(struct sna_damage *da
 	if (damage == NULL)
 		return NULL;
 
-	if (!RegionNotEmpty(&damage->region)) {
+	if (RegionNil(&damage->region)) {
 		__sna_damage_destroy(damage);
 		return NULL;
 	}
@@ -1199,7 +1199,7 @@ static struct sna_damage *__sna_damage_subtract_boxes(struct sna_damage *damage,
 	if (damage == NULL)
 		return NULL;
 
-	if (!RegionNotEmpty(&damage->region)) {
+	if (RegionNil(&damage->region)) {
 		__sna_damage_destroy(damage);
 		return NULL;
 	}
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 4ff4d8f..0a581da 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3203,7 +3203,7 @@ void sna_mode_redisplay(struct sna *sna)
 	assert(sna->mode.shadow_active);
 
 	region = DamageRegion(sna->mode.shadow_damage);
-	if (!RegionNotEmpty(region))
+	if (RegionNil(region))
 		return;
 
 	if (!sna_pixmap_move_to_gpu(sna->front, MOVE_READ)) {
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 6225397..130c1ea 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -1357,7 +1357,7 @@ glyphs_fallback(CARD8 op,
 	     __FUNCTION__,
 	     RegionExtents(&region)->x1, RegionExtents(&region)->y1,
 	     RegionExtents(&region)->x2, RegionExtents(&region)->y2));
-	if (!RegionNotEmpty(&region))
+	if (RegionNil(&region))
 		return;
 
 	if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 9e70833..5bebf00 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -624,7 +624,7 @@ sna_tiling_fill_boxes(struct sna *sna,
 
 			RegionNull(&this);
 			RegionIntersect(&this, &region, &tile);
-			if (!RegionNotEmpty(&this))
+			if (RegionNil(&this))
 				continue;
 
 			tmp.drawable.width  = this.extents.x2 - this.extents.x1;
@@ -737,7 +737,7 @@ bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
 
 			RegionNull(&this);
 			RegionIntersect(&this, &region, &tile);
-			if (!RegionNotEmpty(&this))
+			if (RegionNil(&this))
 				continue;
 
 			w = this.extents.x2 - this.extents.x1;

commit 2de43a0164ba5364ffd7cb48f0bccc9873e87332
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 18 12:01:54 2013 +0000

    sna: Skip an empty slave update
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ed13569..99063de 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13821,6 +13821,9 @@ static void sna_accel_post_damage(struct sna *sna)
 		     region.extents.x2, region.extents.y2));
 
 		RegionIntersect(&region, &region, damage);
+		if (!RegionNotEmpty(&region))
+			continue;
+
 		RegionTranslate(&region, -dirty->x, -dirty->y);
 		DamageRegionAppend(&dirty->slave_dst->drawable, &region);
 

commit 38de17f80d780bf219fc3c4018ad9cc8808ba50f
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 18 10:16:42 2013 +0000

    sna: Remove bogus assertion invalidated by 'read-read' sync
    
    If we perform a read-read synchronisation, the kernel may still believe
    that the bo is busy as it remains on the active lists being read by the
    GPU.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 1e6289d..ed13569 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2268,7 +2268,6 @@ out:
 		DBG(("%s: syncing cpu bo\n", __FUNCTION__));
 		kgem_bo_sync__cpu_full(&sna->kgem,
 				       priv->cpu_bo, flags & MOVE_WRITE);
-		assert(!kgem_bo_is_busy(priv->cpu_bo));
 	}
 	priv->cpu = (flags & MOVE_ASYNC_HINT) == 0;
 	assert(pixmap->devPrivate.ptr);

commit 9f68ac60ae37cc72503ec40691d1ae43a476f8e7
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jan 17 20:00:34 2013 +0000

    sna/dri: Explicitly flag sync copies for the backends
    
    As gen6/7 need to prevent ring switching and perform a rendercopy if we
    need to perform a vsync'ed copy.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 8b1ae3c..7af59ae 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2453,6 +2453,9 @@ static inline bool prefer_blt_copy(struct sna *sna,
 				   struct kgem_bo *dst_bo,
 				   unsigned flags)
 {
+	if (flags & COPY_SYNC)
+		return false;
+
 	if (PREFER_RENDER)
 		return PREFER_RENDER > 0;
 
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 2269b3a..5880e7a 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2557,6 +2557,9 @@ static inline bool prefer_blt_copy(struct sna *sna,
 				   struct kgem_bo *dst_bo,
 				   unsigned flags)
 {
+	if (flags & COPY_SYNC)
+		return false;
+
 	if (sna->kgem.ring == KGEM_BLT)
 		return true;
 
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index e972537..b48894e 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -677,10 +677,15 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
 				      dst_bo, 0, 0,
 				      boxes, n);
 	} else {
+		unsigned flags;
+
+		flags = COPY_LAST;
+		if (flush)
+			flags |= COPY_SYNC;
 		sna->render.copy_boxes(sna, GXcopy,
 				       (PixmapPtr)draw, src_bo, -draw->x-dx, -draw->y-dy,
 				       pixmap, dst_bo, 0, 0,
-				       boxes, n, COPY_LAST);
+				       boxes, n, flags);
 
 		DBG(("%s: flushing? %d\n", __FUNCTION__, flush));
 		if (flush) { /* STAT! */
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index 4174b6f..13a3e7d 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -242,6 +242,7 @@ struct sna_render {
 			   PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
 			   const BoxRec *box, int n, unsigned flags);
 #define COPY_LAST 0x1
+#define COPY_SYNC 0x2
 
 	bool (*copy)(struct sna *sna, uint8_t alu,
 		     PixmapPtr src, struct kgem_bo *src_bo,

commit 1ee00c408d8142cfaf4202393c2364c9ae73cb6e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jan 17 13:09:47 2013 +0000


Reply to: