xf86-video-intel: 2 commits - src/intel_uxa.c src/sna/sna_accel.c src/sna/sna_damage.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Sep 6 01:04:41 PDT 2012


 src/intel_uxa.c      |    5 ++++-
 src/sna/sna_accel.c  |   16 ++++++++++++++++
 src/sna/sna_damage.c |   20 ++++++++++++++------
 3 files changed, 34 insertions(+), 7 deletions(-)

New commits:
commit fbe4080816191ee97347128444f56bcc34858481
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 6 08:57:34 2012 +0100

    prime: Align pitch of shared untiled buffers to 256 bytes
    
    In order for nvidia to handle the buffers we are currently generating,
    they need to have a pitch alignment of 256 bytes. Make it so.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 9bb0e0a..452db6e 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -228,11 +228,14 @@ intel_uxa_pixmap_compute_size(PixmapPtr pixmap,
 	}
 
 	if (*tiling == I915_TILING_NONE) {
+		/* We only require a 64 byte alignment for scanouts, but
+		 * a 256 byte alignment for sharing with PRIME.
+		 */
+		*stride = ALIGN(pitch, 256);
 		/* Round the height up so that the GPU's access to a 2x2 aligned
 		 * subspan doesn't address an invalid page offset beyond the
 		 * end of the GTT.
 		 */
-		*stride = ALIGN(pitch, 64);
 		size = *stride * ALIGN(h, 2);
 	}
 
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 1a02db3..c00b5b8 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -944,6 +944,22 @@ sna_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, void **fd_handle)
 	if (priv->gpu_bo->tiling &&
 	    !sna_pixmap_change_tiling(pixmap, I915_TILING_NONE))
 		return FALSE;
+
+	/* nvidia requires a minimum pitch alignment of 256 */
+	if (priv->gpu_bo->pitch & 255) {
+		struct kgem_bo *bo;
+
+		bo = kgem_replace_bo(&sna->kgem, priv->gpu_bo,
+				     pixmap->drawable.width,
+				     pixmap->drawable.height,
+				     ALIGN(priv->gpu_bo->pitch, 256),
+				     pixmap->drawable.bitsPerPixel);
+		if (bo == NULL)
+			return FALSE;
+
+		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
+		priv->gpu_bo = bo;
+	}
 	assert(priv->gpu_bo->tiling == I915_TILING_NONE);
 
 	/* And export the bo->pitch via pixmap->devKind */
commit c5fb025267bf1019907dfcc60f0efef2691be436
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 6 08:55:46 2012 +0100

    sna: Correct assertions for adding damage that bypasses the region
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 0390bf9..d726b61 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -658,6 +658,7 @@ fastcall struct sna_damage *_sna_damage_add(struct sna_damage *damage,
 
 	ErrorF("  = %s\n",
 	       _debug_describe_damage(damage_buf, sizeof(damage_buf), damage));
+	assert(RegionNumRects(&damage->region));
 	assert(damage->region.extents.x2 > damage->region.extents.x1);
 	assert(damage->region.extents.y2 > damage->region.extents.y1);
 
@@ -741,8 +742,10 @@ struct sna_damage *_sna_damage_add_boxes(struct sna_damage *damage,
 
 	ErrorF("  = %s\n",
 	       _debug_describe_damage(damage_buf, sizeof(damage_buf), damage));
-	assert(damage->region.extents.x2 > damage->region.extents.x1);
-	assert(damage->region.extents.y2 > damage->region.extents.y1);
+	if (RegionNumRects(&damage->region)) {
+		assert(damage->region.extents.x2 > damage->region.extents.x1);
+		assert(damage->region.extents.y2 > damage->region.extents.y1);
+	}
 
 	return damage;
 }
@@ -828,8 +831,10 @@ struct sna_damage *_sna_damage_add_rectangles(struct sna_damage *damage,
 
 	ErrorF("  = %s\n",
 	       _debug_describe_damage(damage_buf, sizeof(damage_buf), damage));
-	assert(damage->region.extents.x2 > damage->region.extents.x1);
-	assert(damage->region.extents.y2 > damage->region.extents.y1);
+	if (RegionNumRects(&damage->region)) {
+		assert(damage->region.extents.x2 > damage->region.extents.x1);
+		assert(damage->region.extents.y2 > damage->region.extents.y1);
+	}
 
 	return damage;
 }
@@ -912,8 +917,10 @@ struct sna_damage *_sna_damage_add_points(struct sna_damage *damage,
 
 	ErrorF("  = %s\n",
 	       _debug_describe_damage(damage_buf, sizeof(damage_buf), damage));
-	assert(damage->region.extents.x2 > damage->region.extents.x1);
-	assert(damage->region.extents.y2 > damage->region.extents.y1);
+	if (RegionNumRects(&damage->region)) {
+		assert(damage->region.extents.x2 > damage->region.extents.x1);
+		assert(damage->region.extents.y2 > damage->region.extents.y1);
+	}
 
 	return damage;
 }
@@ -940,6 +947,7 @@ fastcall struct sna_damage *_sna_damage_add_box(struct sna_damage *damage,
 
 	ErrorF("  = %s\n",
 	       _debug_describe_damage(damage_buf, sizeof(damage_buf), damage));
+	assert(RegionNumRects(&damage->region));
 	assert(damage->region.extents.x2 > damage->region.extents.x1);
 	assert(damage->region.extents.y2 > damage->region.extents.y1);
 


More information about the xorg-commit mailing list