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

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



 NEWS                       |   51 ++++++
 configure.ac               |   14 +
 man/intel.man              |   13 +
 src/intel_device.c         |   58 ++++++-
 src/intel_driver.c         |    5 
 src/intel_list.h           |    2 
 src/intel_module.c         |   56 -------
 src/intel_options.c        |    2 
 src/intel_options.h        |    2 
 src/sna/compiler.h         |    4 
 src/sna/gen2_render.c      |   26 ++-
 src/sna/gen3_render.c      |    9 -
 src/sna/gen4_render.c      |   57 +++++--
 src/sna/gen5_render.c      |   26 ++-
 src/sna/gen6_render.c      |   16 +-
 src/sna/gen7_render.c      |   16 +-
 src/sna/kgem.c             |  250 ++++++++++++++++++++++++++------
 src/sna/kgem.h             |    9 +
 src/sna/sna.h              |    7 
 src/sna/sna_accel.c        |  232 ++++++++++++++++++++++--------
 src/sna/sna_blt.c          |   73 +++++----
 src/sna/sna_composite.c    |    6 
 src/sna/sna_damage.c       |   46 ++----
 src/sna/sna_display.c      |  343 ++++++++++++++++++++++-----------------------
 src/sna/sna_display_fake.c |   59 -------
 src/sna/sna_dri.c          |    4 
 src/sna/sna_driver.c       |   30 ---
 src/sna/sna_glyphs.c       |    3 
 src/sna/sna_io.c           |  238 +++++++++++++++++--------------
 src/sna/sna_render.c       |    6 
 src/sna/sna_render.h       |    3 
 src/sna/sna_tiling.c       |   45 +++--
 32 files changed, 1046 insertions(+), 665 deletions(-)

New commits:
commit e83e7e60f41cb29132d5eef60af16b65b1b3cd4e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jul 14 09:31:39 2013 +0100

    2.21.12 release

diff --git a/NEWS b/NEWS
index 576ef86..8202e78 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,54 @@
+Release 2.21.12 (2013-07-14)
+============================
+In this release, we clear up the teething troubles from preserving the KMS
+configuration, notably external connections on Haswell and plugging in new
+outputs after startup were broken. Besides these regression fixes, there
+are a couple of fixes for some long standing issues, such as incorrect
+rendering on gen2, an infinite loop with very, very large pixmaps and a
+slight improvement to the tempermental gen4.
+
+ * Allow untiled scanouts again (required for large extended desktops on
+   gen2 and gen3).
+   [Regression from 2.21.11]
+
+ * Use the correct count of the number of dirty damage boxes for the quick
+   check on whether the existing damage contains the requested area.
+   The danger is that we may get a false result and skip migration and so
+   cause pixmap corruption (in the unlikely event that the application
+   frequently causes fallbacks).
+   [Regression from 2.21.11]
+   https://bugs.freedesktop.org/show_bug.cgi?id=66430
+
+ * Fix initial connection probing for multi-function encoders, such as the
+   external connections on Haswell.
+   [Regression from 2.21.11, initial connection probing]
+   https://bugs.freedesktop.org/show_bug.cgi?id=66488
+
+ * Fix gen2 rendercopy into a8 surfaces, for example, glyph uploads into
+   the glyph cache.
+
+ * Fix detection of user overrides for initial connection configuration.
+   The code used the xorg-server-1.15 values, having missed the
+   introduction of ZoomModes into that release.
+   [Regression from 2.21.11, initial connection probing]
+
+ * Always initialise the gamma ramp, even on unconnected CRTCs.
+   https://bugs.freedesktop.org/show_bug.cgi?id=66563
+   [Regression from 2.21.11, initial connection probing]
+
+ * Some more tuning of the gen4 vertex corruption workaround. The root
+   cause behind the GPU using incorrect texture coordinates is still
+   not solved, but by reducing the maximum number or rectangles in
+   flight through the GPU we reduce the likelihood of corruption.
+
+ * Fix compilation with gcc-4.5
+   [Regression from 2.21.11]
+
+ * Avoid integer overflow when performing tiled uploads and operations
+   on very large (>28k pixels wide or tall pixmaps)
+   https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1200766
+
+
 Release 2.21.11 (2013-06-30)
 ============================
 An eventful week. What started with a regression with some builds of
diff --git a/configure.ac b/configure.ac
index 46a5a6f..2c41f20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.21.11],
+        [2.21.12],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 0230ef72cbb2d3bcf7157548ddd52a71c0c771c5
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 12 23:57:42 2013 +0100

    sna: Skip copying to the intermediate target if we will completely overwrite it
    
    Occasionally when forced to use an intermediate destination surface, we
    know that we will completely overwrite the contents of the surface and
    so we can forgo the initial copy from the target.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index ba57643..385a5fd 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1889,7 +1889,8 @@ gen2_render_composite(struct sna *sna,
 	if (too_large(tmp->dst.width, tmp->dst.height) ||
 	    tmp->dst.bo->pitch > MAX_3D_PITCH) {
 		if (!sna_render_composite_redirect(sna, tmp,
-						   dst_x, dst_y, width, height))
+						   dst_x, dst_y, width, height,
+						   op > PictOpSrc || dst->pCompositeClip->data != NULL))
 			return false;
 	}
 
@@ -2551,7 +2552,8 @@ gen2_render_composite_spans(struct sna *sna,
 	if (too_large(tmp->base.dst.width, tmp->base.dst.height) ||
 	    tmp->base.dst.bo->pitch > MAX_3D_PITCH) {
 		if (!sna_render_composite_redirect(sna, &tmp->base,
-						   dst_x, dst_y, width, height))
+						   dst_x, dst_y, width, height,
+						   true))
 			return false;
 	}
 
@@ -3256,7 +3258,8 @@ fallback:
 						   extents.x1 + dst_dx,
 						   extents.y1 + dst_dy,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   alu != GXcopy || n > 1))
 			goto fallback_tiled;
 	}
 
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 8d65e6e..c7f9512 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3550,7 +3550,8 @@ gen3_render_composite(struct sna *sna,
 	if (too_large(tmp->dst.width, tmp->dst.height) ||
 	    !gen3_check_pitch_3d(tmp->dst.bo)) {
 		if (!sna_render_composite_redirect(sna, tmp,
-						   dst_x, dst_y, width, height))
+						   dst_x, dst_y, width, height,
+						   op > PictOpSrc || dst->pCompositeClip->data))
 			return false;
 	}
 
@@ -4895,7 +4896,8 @@ gen3_render_composite_spans(struct sna *sna,
 	if (too_large(tmp->base.dst.width, tmp->base.dst.height) ||
 	    !gen3_check_pitch_3d(tmp->base.dst.bo)) {
 		if (!sna_render_composite_redirect(sna, &tmp->base,
-						   dst_x, dst_y, width, height))
+						   dst_x, dst_y, width, height,
+						   true))
 			return false;
 	}
 
@@ -5675,7 +5677,8 @@ fallback_blt:
 						   extents.x1 + dst_dx,
 						   extents.y1 + dst_dy,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			goto fallback_tiled;
 	}
 
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 8e03910..cc6ee1d 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -1585,7 +1585,8 @@ static bool
 gen4_composite_set_target(struct sna *sna,
 			  struct sna_composite_op *op,
 			  PicturePtr dst,
-			  int x, int y, int w, int h)
+			  int x, int y, int w, int h,
+			  bool partial)
 {
 	BoxRec box;
 
@@ -1621,7 +1622,7 @@ gen4_composite_set_target(struct sna *sna,
 	assert(op->dst.bo->proxy == NULL);
 
 	if (too_large(op->dst.width, op->dst.height) &&
-	    !sna_render_composite_redirect(sna, op, x, y, w, h))
+	    !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
 		return false;
 
 	return true;
@@ -1903,7 +1904,8 @@ gen4_render_composite(struct sna *sna,
 					    tmp);
 
 	if (!gen4_composite_set_target(sna, tmp, dst,
-				       dst_x, dst_y, width, height)) {
+				       dst_x, dst_y, width, height,
+				       op > PictOpSrc || dst->pCompositeClip->data)) {
 		DBG(("%s: failed to set composite target\n", __FUNCTION__));
 		return false;
 	}
@@ -2203,7 +2205,7 @@ gen4_render_composite_spans(struct sna *sna,
 
 	tmp->base.op = op;
 	if (!gen4_composite_set_target(sna, &tmp->base, dst,
-				       dst_x, dst_y, width, height))
+				       dst_x, dst_y, width, height, true))
 		return false;
 
 	switch (gen4_composite_picture(sna, src, &tmp->base.src,
@@ -2389,7 +2391,8 @@ fallback_blt:
 						   extents.x1 + dst_dx,
 						   extents.y1 + dst_dy,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			goto fallback_tiled;
 	}
 
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 2b75ff6..4fa44c0 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1541,7 +1541,8 @@ static bool
 gen5_composite_set_target(struct sna *sna,
 			  struct sna_composite_op *op,
 			  PicturePtr dst,
-			  int x, int y, int w, int h)
+			  int x, int y, int w, int h,
+			  bool partial)
 {
 	BoxRec box;
 
@@ -1577,7 +1578,7 @@ gen5_composite_set_target(struct sna *sna,
 	assert(op->dst.bo->proxy == NULL);
 
 	if (too_large(op->dst.width, op->dst.height) &&
-	    !sna_render_composite_redirect(sna, op, x, y, w, h))
+	    !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
 		return false;
 
 	return true;
@@ -1862,7 +1863,8 @@ gen5_render_composite(struct sna *sna,
 					    tmp);
 
 	if (!gen5_composite_set_target(sna, tmp, dst,
-				       dst_x, dst_y, width, height)) {
+				       dst_x, dst_y, width, height,
+				       op > PictOpSrc || dst->pCompositeClip->data)) {
 		DBG(("%s: failed to set composite target\n", __FUNCTION__));
 		return false;
 	}
@@ -2149,7 +2151,8 @@ gen5_render_composite_spans(struct sna *sna,
 
 	tmp->base.op = op;
 	if (!gen5_composite_set_target(sna, &tmp->base, dst,
-				       dst_x, dst_y, width, height))
+				       dst_x, dst_y, width, height,
+				       true))
 		return false;
 
 	switch (gen5_composite_picture(sna, src, &tmp->base.src,
@@ -2320,7 +2323,8 @@ fallback_blt:
 						   extents.x1 + dst_dx,
 						   extents.y1 + dst_dy,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			goto fallback_tiled;
 	}
 
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index d87ac12..9b45d79 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1823,7 +1823,8 @@ static bool
 gen6_composite_set_target(struct sna *sna,
 			  struct sna_composite_op *op,
 			  PicturePtr dst,
-			  int x, int y, int w, int h)
+			  int x, int y, int w, int h,
+			  bool partial)
 {
 	BoxRec box;
 
@@ -1860,7 +1861,7 @@ gen6_composite_set_target(struct sna *sna,
 	assert(op->dst.bo->proxy == NULL);
 
 	if (too_large(op->dst.width, op->dst.height) &&
-	    !sna_render_composite_redirect(sna, op, x, y, w, h))
+	    !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
 		return false;
 
 	return true;
@@ -2196,7 +2197,8 @@ gen6_render_composite(struct sna *sna,
 		op = PictOpSrc;
 	tmp->op = op;
 	if (!gen6_composite_set_target(sna, tmp, dst,
-				       dst_x, dst_y, width, height))
+				       dst_x, dst_y, width, height,
+				       op > PictOpSrc || dst->pCompositeClip->data))
 		return false;
 
 	switch (gen6_composite_picture(sna, src, &tmp->src,
@@ -2490,7 +2492,7 @@ gen6_render_composite_spans(struct sna *sna,
 
 	tmp->base.op = op;
 	if (!gen6_composite_set_target(sna, &tmp->base, dst,
-				       dst_x, dst_y, width, height))
+				       dst_x, dst_y, width, height, true))
 		return false;
 
 	switch (gen6_composite_picture(sna, src, &tmp->base.src,
@@ -2745,7 +2747,8 @@ fallback_blt:
 						   extents.x1 + dst_dx,
 						   extents.y1 + dst_dy,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			goto fallback_tiled;
 
 		dst_dx += tmp.dst.x;
@@ -3102,7 +3105,8 @@ gen6_render_fill_boxes(struct sna *sna,
 		if (!sna_render_composite_redirect(sna, &tmp,
 						   extents.x1, extents.y1,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			return sna_tiling_fill_boxes(sna, op, format, color,
 						     dst, dst_bo, box, n);
 	}
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index a36ecf7..7d4d85f 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2029,7 +2029,8 @@ static bool
 gen7_composite_set_target(struct sna *sna,
 			  struct sna_composite_op *op,
 			  PicturePtr dst,
-			  int x, int y, int w, int h)
+			  int x, int y, int w, int h,
+			  bool partial)
 {
 	BoxRec box;
 
@@ -2067,7 +2068,7 @@ gen7_composite_set_target(struct sna *sna,
 	assert(op->dst.bo->proxy == NULL);
 
 	if (too_large(op->dst.width, op->dst.height) &&
-	    !sna_render_composite_redirect(sna, op, x, y, w, h))
+	    !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
 		return false;
 
 	return true;
@@ -2403,7 +2404,8 @@ gen7_render_composite(struct sna *sna,
 		op = PictOpSrc;
 	tmp->op = op;
 	if (!gen7_composite_set_target(sna, tmp, dst,
-				       dst_x, dst_y, width, height))
+				       dst_x, dst_y, width, height,
+				       op > PictOpSrc || dst->pCompositeClip->data))
 		return false;
 
 	switch (gen7_composite_picture(sna, src, &tmp->src,
@@ -2677,7 +2679,7 @@ gen7_render_composite_spans(struct sna *sna,
 
 	tmp->base.op = op;
 	if (!gen7_composite_set_target(sna, &tmp->base, dst,
-				       dst_x, dst_y, width, height))
+				       dst_x, dst_y, width, height, true))
 		return false;
 
 	switch (gen7_composite_picture(sna, src, &tmp->base.src,
@@ -2928,7 +2930,8 @@ fallback_blt:
 						   extents.x1 + dst_dx,
 						   extents.y1 + dst_dy,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			goto fallback_tiled;
 
 		dst_dx += tmp.dst.x;
@@ -3273,7 +3276,8 @@ gen7_render_fill_boxes(struct sna *sna,
 		if (!sna_render_composite_redirect(sna, &tmp,
 						   extents.x1, extents.y1,
 						   extents.x2 - extents.x1,
-						   extents.y2 - extents.y1))
+						   extents.y2 - extents.y1,
+						   n > 1))
 			return sna_tiling_fill_boxes(sna, op, format, color,
 						     dst, dst_bo, box, n);
 	}
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 032dba7..139081d 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1883,7 +1883,8 @@ sna_render_picture_convert(struct sna *sna,
 bool
 sna_render_composite_redirect(struct sna *sna,
 			      struct sna_composite_op *op,
-			      int x, int y, int width, int height)
+			      int x, int y, int width, int height,
+			      bool partial)
 {
 	struct sna_composite_redirect *t = &op->redirect;
 	int bpp = op->dst.pixmap->drawable.bitsPerPixel;
@@ -2026,7 +2027,8 @@ sna_render_composite_redirect(struct sna *sna,
 	DBG(("%s: original box (%d, %d), (%d, %d)\n",
 	     __FUNCTION__, t->box.x1, t->box.y1, t->box.x2, t->box.y2));
 
-	if (!sna_blt_copy_boxes(sna, GXcopy,
+	if (partial &&
+	    !sna_blt_copy_boxes(sna, GXcopy,
 				op->dst.bo, 0, 0,
 				bo, -t->box.x1, -t->box.y1,
 				bpp, &t->box, 1)) {
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index ab69fe0..aace869 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -727,7 +727,8 @@ inline static void sna_render_composite_redirect_init(struct sna_composite_op *o
 bool
 sna_render_composite_redirect(struct sna *sna,
 			      struct sna_composite_op *op,
-			      int x, int y, int width, int height);
+			      int x, int y, int width, int height,
+			      bool partial);
 
 void
 sna_render_composite_redirect_done(struct sna *sna,

commit 2b16eaefb38b4a6efe50a397e68793ab9a1cb2ef
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 12 23:22:59 2013 +0100

    sna: Avoid integer overflow when computing the tiled extents
    
    When stepping over the tiles, beware that the step may overflow the
    int16_t region extents, so use an int for the calculation.
    
    Reported-by: Andrew Woodward
    Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1200766
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 0a38aa8..406fa63 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -309,14 +309,16 @@ fallback:
 			     __FUNCTION__, step, step));
 
 			for (tile.y1 = extents.y1; tile.y1 < extents.y2; tile.y1 = tile.y2) {
-				tile.y2 = tile.y1 + step;
-				if (tile.y2 > extents.y2)
-					tile.y2 = extents.y2;
+				int y2 = tile.y1 + step;
+				if (y2 > extents.y2)
+					y2 = extents.y2;
+				tile.y2 = y2;
 
 				for (tile.x1 = extents.x1; tile.x1 < extents.x2; tile.x1 = tile.x2) {
-					tile.x2 = tile.x1 + step;
-					if (tile.x2 > extents.x2)
-						tile.x2 = extents.x2;
+					int x2 = tile.x1 + step;
+					if (x2 > extents.x2)
+						x2 = extents.x2;
+					tile.x2 = x2;
 
 					tmp.drawable.width  = tile.x2 - tile.x1;
 					tmp.drawable.height = tile.y2 - tile.y1;
@@ -767,14 +769,16 @@ tile:
 				clipped = stack;
 
 			for (tile.y1 = extents.y1; tile.y1 < extents.y2; tile.y1 = tile.y2) {
-				tile.y2 = tile.y1 + step;
-				if (tile.y2 > extents.y2)
-					tile.y2 = extents.y2;
+				int y2 = tile.y1 + step;
+				if (y2 > extents.y2)
+					y2 = extents.y2;
+				tile.y2 = y2;
 
 				for (tile.x1 = extents.x1; tile.x1 < extents.x2; tile.x1 = tile.x2) {
-					tile.x2 = tile.x1 + step;
-					if (tile.x2 > extents.x2)
-						tile.x2 = extents.x2;
+					int x2 = tile.x1 + step;
+					if (x2 > extents.x2)
+						x2 = extents.x2;
+					tile.x2 = x2;
 
 					tmp.drawable.width  = tile.x2 - tile.x1;
 					tmp.drawable.height = tile.y2 - tile.y1;
@@ -1136,14 +1140,16 @@ tile:
 				clipped = stack;
 
 			for (tile.y1 = extents.y1; tile.y1 < extents.y2; tile.y1 = tile.y2) {
-				tile.y2 = tile.y1 + step;
-				if (tile.y2 > extents.y2)
-					tile.y2 = extents.y2;
+				int y2 = tile.y1 + step;
+				if (y2 > extents.y2)
+					y2 = extents.y2;
+				tile.y2 = y2;
 
 				for (tile.x1 = extents.x1; tile.x1 < extents.x2; tile.x1 = tile.x2) {
-					tile.x2 = tile.x1 + step;
-					if (tile.x2 > extents.x2)
-						tile.x2 = extents.x2;
+					int x2 = tile.x1 + step;
+					if (x2 > extents.x2)
+						x2 = extents.x2;
+					tile.x2 = x2;
 
 					tmp.drawable.width  = tile.x2 - tile.x1;
 					tmp.drawable.height = tile.y2 - tile.y1;
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index e6cc193..aa5fe8f 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -607,18 +607,19 @@ sna_tiling_fill_boxes(struct sna *sna,
 	for (tile.extents.y1 = tile.extents.y2 = region.extents.y1;
 	     tile.extents.y2 < region.extents.y2;
 	     tile.extents.y1 = tile.extents.y2) {
-		tile.extents.y2 = tile.extents.y1 + step;
-		if (tile.extents.y2 > region.extents.y2)
-			tile.extents.y2 = region.extents.y2;
+		int y2 = tile.extents.y1 + step;
+		if (y2 > region.extents.y2)
+			y2 = region.extents.y2;
+		tile.extents.y2 = y2;
 
 		for (tile.extents.x1 = tile.extents.x2 = region.extents.x1;
 		     tile.extents.x2 < region.extents.x2;
 		     tile.extents.x1 = tile.extents.x2) {
 			PixmapRec tmp;
-
-			tile.extents.x2 = tile.extents.x1 + step;
-			if (tile.extents.x2 > region.extents.x2)
-				tile.extents.x2 = region.extents.x2;
+			int x2 = tile.extents.x1 + step;
+			if (x2 > region.extents.x2)
+				x2 = region.extents.x2;
+			tile.extents.x2 = x2;
 
 			tile.data = NULL;
 
@@ -733,18 +734,19 @@ bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
 	for (tile.extents.y1 = tile.extents.y2 = region.extents.y1;
 	     tile.extents.y2 < region.extents.y2;
 	     tile.extents.y1 = tile.extents.y2) {
-		tile.extents.y2 = tile.extents.y1 + step;
-		if (tile.extents.y2 > region.extents.y2)
-			tile.extents.y2 = region.extents.y2;
+		int y2 = tile.extents.y1 + step;
+		if (y2 > region.extents.y2)
+			y2 = region.extents.y2;
+		tile.extents.y2 = y2;
 
 		for (tile.extents.x1 = tile.extents.x2 = region.extents.x1;
 		     tile.extents.x2 < region.extents.x2;
 		     tile.extents.x1 = tile.extents.x2) {
 			int w, h;
-
-			tile.extents.x2 = tile.extents.x1 + step;
-			if (tile.extents.x2 > region.extents.x2)
-				tile.extents.x2 = region.extents.x2;
+			int x2 = tile.extents.x1 + step;
+			if (x2 > region.extents.x2)
+				x2 = region.extents.x2;
+			tile.extents.x2 = x2;
 
 			tile.data = NULL;
 
@@ -851,16 +853,17 @@ sna_tiling_copy_boxes(struct sna *sna, uint8_t alu,
 	p.devPrivate.ptr = NULL;
 
 	for (tile.y1 = extents.y1; tile.y1 < extents.y2; tile.y1 = tile.y2) {
-		tile.y2 = tile.y1 + step;
-		if (tile.y2 > extents.y2)
-			tile.y2 = extents.y2;
+		int y2 = tile.y1 + step;
+		if (y2 > extents.y2)
+			y2 = extents.y2;
+		tile.y2 = y2;
 
 		for (tile.x1 = extents.x1; tile.x1 < extents.x2; tile.x1 = tile.x2) {
 			struct kgem_bo *tmp_bo;
-
-			tile.x2 = tile.x1 + step;
-			if (tile.x2 > extents.x2)
-				tile.x2 = extents.x2;
+			int x2 = tile.x1 + step;
+			if (x2 > extents.x2)
+				x2 = extents.x2;
+			tile.x2 = x2;
 
 			c = clipped;
 			for (i = 0; i < n; i++) {

commit 835ceccb27afa18704c34dc3283476340f999317
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 12 23:20:56 2013 +0100

    sna/gen5: Add some more DBG
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index b31ac1e..2b75ff6 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -2247,6 +2247,13 @@ gen5_render_copy_boxes(struct sna *sna, uint8_t alu,
 {
 	struct sna_composite_op tmp;
 
+	DBG(("%s alu=%d, src=%d:handle=%d, dst=%d:handle=%d boxes=%d x [((%d, %d), (%d, %d))...], flags=%x\n",
+	     __FUNCTION__, alu,
+	     src->drawable.serialNumber, src_bo->handle,
+	     dst->drawable.serialNumber, dst_bo->handle,
+	     n, box->x1, box->y1, box->x2, box->y2,
+	     flags));
+
 	if (sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 	    sna_blt_copy_boxes(sna, alu,
 			       src_bo, src_dx, src_dy,
@@ -2359,8 +2366,10 @@ fallback_blt:
 
 	if (!kgem_check_bo(&sna->kgem, dst_bo, src_bo, NULL)) {
 		kgem_submit(&sna->kgem);
-		if (!kgem_check_bo(&sna->kgem, dst_bo, src_bo, NULL))
+		if (!kgem_check_bo(&sna->kgem, dst_bo, src_bo, NULL)) {
+			DBG(("%s: aperture check failed\n", __FUNCTION__));
 			goto fallback_tiled_src;
+		}
 	}
 
 	dst_dx += tmp.dst.x;
@@ -2420,6 +2429,7 @@ fallback_tiled:
 			       box, n))
 		return true;
 
+	DBG(("%s: tiled fallback\n", __FUNCTION__));
 	return sna_tiling_copy_boxes(sna, alu,
 				     src, src_bo, src_dx, src_dy,
 				     dst, dst_bo, dst_dx, dst_dy,
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index ec3278b..1df23de 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -2667,7 +2667,7 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
 	     __FUNCTION__, bpp, pixel, alu, nbox));
 
 	if (!kgem_bo_can_blt(kgem, bo)) {
-		DBG(("%s: fallback -- dst uses Y-tiling\n", __FUNCTION__));
+		DBG(("%s: fallback -- cannot blt to dst\n", __FUNCTION__));
 		return false;
 	}
 

commit 39f1954f667bf20cd0c25dfa5fb5267a3f9eb113
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 11 21:57:02 2013 +0100

    sna: Replace parsing of /proc/cpuinfo with parsing of cpuid
    
    Courtesy of a patch from Chad Versace via Ben Widawsky, actually digging
    through CPUID for the cache info looks quite easy in comparison to the
    fragile approach of parsing a linux specific file that may or may not be
    available.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 7091ca4..13b509b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -38,6 +38,7 @@
 #include <time.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <cpuid.h>
 
 #include <xf86drm.h>
 
@@ -696,29 +697,47 @@ total_ram_size(void)
 	return 0;
 }
 
-static size_t
+static unsigned
 cpu_cache_size(void)
 {
-	FILE *file = fopen("/proc/cpuinfo", "r");
-	size_t size = -1;
-	if (file) {
-		size_t len = 0;
-		char *line = NULL;
-		while (getline(&line, &len, file) != -1) {
-			int mb;
-			if (sscanf(line, "cache size : %d KB", &mb) == 1) {
-				/* Paranoid check against gargantuan caches */
-				if (mb <= 1<<20)
-					size = mb * 1024;
-				break;
-			}
-		}
-		free(line);
-		fclose(file);
-	}
-	if (size == -1)
-		ErrorF("Unknown CPU cache size\n");
-	return size;
+	/* Deterministic Cache Parmaeters (Function 04h)":
+	 *    When EAX is initialized to a value of 4, the CPUID instruction
+	 *    returns deterministic cache information in the EAX, EBX, ECX
+	 *    and EDX registers.  This function requires ECX be initialized
+	 *    with an index which indicates which cache to return information
+	 *    about. The OS is expected to call this function (CPUID.4) with
+	 *    ECX = 0, 1, 2, until EAX[4:0] == 0, indicating no more caches.
+	 *    The order in which the caches are returned is not specified
+	 *    and may change at Intel's discretion.
+	 *
+	 * Calculating the Cache Size in bytes:
+	 *          = (Ways +1) * (Partitions +1) * (Line Size +1) * (Sets +1)
+	 */
+
+	 unsigned int eax, ebx, ecx, edx;
+	 unsigned int llc_size = 0;
+	 int cnt = 0;
+
+	 if (__get_cpuid_max(false, 0) < 4)
+		 return 0;
+
+	 do {
+		 unsigned associativity, line_partitions, line_size, sets;
+
+		 __cpuid_count(4, cnt++, eax, ebx, ecx, edx);
+
+		 if ((eax & 0x1f) == 0)
+			 break;
+
+		 associativity = ((ebx >> 22) & 0x3ff) + 1;
+		 line_partitions = ((ebx >> 12) & 0x3ff) + 1;
+		 line_size = (ebx & 0xfff) + 1;
+		 sets = ecx + 1;
+
+		 llc_size = associativity * line_partitions * line_size * sets;
+	 } while (1);
+
+	 return llc_size;
 }
 
 static int gem_param(struct kgem *kgem, int name)
@@ -1177,8 +1196,8 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen)
 		kgem->min_alignment = 64;
 
 	kgem->half_cpu_cache_pages = cpu_cache_size() >> 13;
-	DBG(("%s: half cpu cache %d pages\n", __FUNCTION__,
-	     kgem->half_cpu_cache_pages));
+	DBG(("%s: last-level cache size: %d bytes, threshold in pages: %d\n",
+	     __FUNCTION__, cpu_cache_size(), kgem->half_cpu_cache_pages));
 
 	kgem->next_request = __kgem_request_alloc(kgem);
 

commit c604d1426cc11f9799044710acf1ef7d226d2604
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 11 16:40:51 2013 +0100

    sna: Remove the duplicated open-coding of SetScreenPixmap
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 17cae7e..249d57c 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -149,7 +149,7 @@ struct sna_glyph {
 	uint16_t size, pos;
 };
 
-static inline WindowPtr root(ScreenPtr screen)
+static inline WindowPtr get_root_window(ScreenPtr screen)
 {
 #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,10,0,0,0)
 	return screen->root;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 50aa48e..2eb1699 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -15062,6 +15062,77 @@ sna_set_window_pixmap(WindowPtr window, PixmapPtr pixmap)
 	*(PixmapPtr *)__get_private(window, sna_window_key) = pixmap;
 }
 
+struct sna_visit_set_pixmap_window {
+	PixmapPtr old, new;
+};
+
+static int
+sna_visit_set_window_pixmap(WindowPtr window, pointer data)
+{
+    struct sna_visit_set_pixmap_window *visit = data;
+
+    if (fbGetWindowPixmap(window) == visit->old) {
+	    window->drawable.pScreen->SetWindowPixmap(window, visit->new);
+	    return WT_WALKCHILDREN;
+    }
+
+    return WT_DONTWALKCHILDREN;
+}
+
+static void
+migrate_dirty_tracking(PixmapPtr old_front, PixmapPtr new_front)
+{
+#if HAS_PIXMAP_SHARING
+	ScreenPtr screen = old_front->drawable.pScreen;
+	PixmapDirtyUpdatePtr dirty, safe;
+
+	xorg_list_for_each_entry_safe(dirty, safe, &screen->pixmap_dirty_list, ent) {
+		assert(dirty->src == old_front);
+		if (dirty->src != old_front)
+			continue;
+
+		DamageUnregister(&dirty->src->drawable, dirty->damage);
+		DamageDestroy(dirty->damage);
+
+		dirty->damage = DamageCreate(NULL, NULL,
+					     DamageReportNone,
+					     TRUE, screen, screen);
+		if (!dirty->damage) {
+			xorg_list_del(&dirty->ent);
+			free(dirty);
+			continue;
+		}
+
+		DamageRegister(&new_front->drawable, dirty->damage);
+		dirty->src = new_front;
+	}
+#endif
+}
+
+static void
+sna_set_screen_pixmap(PixmapPtr pixmap)
+{
+	PixmapPtr old_front = pixmap->drawable.pScreen->devPrivate;
+	WindowPtr root;
+
+	assert(pixmap == to_sna_from_pixmap(pixmap)->front);
+
+	if (old_front)
+		migrate_dirty_tracking(old_front, pixmap);
+
+	root = get_root_window(pixmap->drawable.pScreen);
+	if (root) {
+		struct sna_visit_set_pixmap_window visit;
+
+		visit.old = old_front;
+		visit.new = pixmap;
+		TraverseTree(root, sna_visit_set_window_pixmap, &visit);
+		assert(fbGetWindowPixmap(root) == pixmap);
+	}
+
+	pixmap->drawable.pScreen->devPrivate = pixmap;
+}
+
 static Bool
 sna_create_window(WindowPtr win)
 {
@@ -15236,6 +15307,8 @@ bool sna_accel_init(ScreenPtr screen, struct sna *sna)
 	assert(screen->SetWindowPixmap == NULL);
 	screen->SetWindowPixmap = sna_set_window_pixmap;
 
+	screen->SetScreenPixmap = sna_set_screen_pixmap;
+
 	if (sna->kgem.has_userptr)
 		ShmRegisterFuncs(screen, &shm_funcs);
 	else
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index e1fc6fc..1427cd6 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2610,24 +2610,6 @@ sna_mode_compute_possible_clones(ScrnInfoPtr scrn)
 	}
 }
 
-struct sna_visit_set_pixmap_window {
-	PixmapPtr old, new;
-};
-
-static int
-sna_visit_set_window_pixmap(WindowPtr window, pointer data)
-{
-    struct sna_visit_set_pixmap_window *visit = data;
-    ScreenPtr screen = window->drawable.pScreen;
-
-    if (screen->GetWindowPixmap(window) == visit->old) {
-	    screen->SetWindowPixmap(window, visit->new);
-	    return WT_WALKCHILDREN;
-    }
-
-    return WT_DONTWALKCHILDREN;
-}
-
 static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
 {
 	struct sna_pixmap *old_priv, *new_priv;
@@ -2695,36 +2677,6 @@ static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
 			       new->drawable.height);
 }
 
-static void
-migrate_dirty_tracking(struct sna *sna, PixmapPtr old_front)
-{
-#if HAS_PIXMAP_SHARING
-	ScreenPtr screen = sna->scrn->pScreen;
-	PixmapDirtyUpdatePtr dirty, safe;
-
-	xorg_list_for_each_entry_safe(dirty, safe, &screen->pixmap_dirty_list, ent) {
-		assert(dirty->src == old_front);
-		if (dirty->src != old_front)
-			continue;
-
-		DamageUnregister(&dirty->src->drawable, dirty->damage);
-		DamageDestroy(dirty->damage);
-
-		dirty->damage = DamageCreate(NULL, NULL,
-					     DamageReportNone,
-					     TRUE, screen, screen);
-		if (!dirty->damage) {
-			xorg_list_del(&dirty->ent);
-			free(dirty);
-			continue;
-		}
-
-		DamageRegister(&sna->front->drawable, dirty->damage);
-		dirty->src = sna->front;
-	}
-#endif
-}
-
 static Bool
 sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
 {
@@ -2783,17 +2735,6 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
 			sna_crtc_disable(crtc);
 	}
 
-	/* Open-coded screen->SetScreenPixmap */
-	migrate_dirty_tracking(sna, old_front);
-
-	if (root(screen)) {
-		struct sna_visit_set_pixmap_window visit;
-
-		visit.old = old_front;
-		visit.new = sna->front;
-		TraverseTree(root(screen), sna_visit_set_window_pixmap, &visit);
-		assert(screen->GetWindowPixmap(root(screen)) == sna->front);
-	}
 	screen->SetScreenPixmap(sna->front);
 	assert(screen->GetScreenPixmap(screen) == sna->front);
 
diff --git a/src/sna/sna_display_fake.c b/src/sna/sna_display_fake.c
index b4a5a94..113c44a 100644
--- a/src/sna/sna_display_fake.c
+++ b/src/sna/sna_display_fake.c
@@ -199,54 +199,6 @@ sna_output_fake(struct sna *sna)
 	return true;


Reply to: