xf86-video-intel: 2 commits - src/sna/gen2_render.c src/sna/gen3_render.c src/sna/kgem.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Dec 10 04:51:00 PST 2013


 src/sna/gen2_render.c |   27 +--------------------------
 src/sna/gen3_render.c |   33 ++++-----------------------------
 src/sna/kgem.c        |    2 +-
 3 files changed, 6 insertions(+), 56 deletions(-)

New commits:
commit 628b68f3a07ee619642521e0992eee81b9edd76f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Dec 10 10:25:56 2013 +0000

    sna/gen2,3: Replace stale bo replacement with simple asserts
    
    The surface creation routines should ensure that the minimum pitch
    alignments are met. However, when rendering to a CPU bo, the pitch is
    not under our control so we need to be more careful.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index b539a81..ef7b985 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1593,32 +1593,7 @@ gen2_composite_set_target(struct sna *sna,
 	if (op->dst.bo == NULL)
 		return false;
 
-	if (op->dst.bo->pitch < 8) {
-		struct sna_pixmap *priv;
-		struct kgem_bo *bo;
-
-		priv = sna_pixmap_move_to_gpu (op->dst.pixmap,
-					       MOVE_READ | MOVE_WRITE);
-		if (priv == NULL || priv->pinned)
-			return false;
-
-		assert(op->dst.bo == priv->gpu_bo);
-		bo = kgem_replace_bo(&sna->kgem, priv->gpu_bo,
-				     op->dst.width, op->dst.height, 8,
-				     op->dst.pixmap->drawable.bitsPerPixel);
-		if (bo == NULL)
-			return false;
-
-		sna_pixmap_unmap(op->dst.pixmap, priv);
-		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
-		priv->gpu_bo = bo;
-
-		op->dst.bo = priv->gpu_bo;
-		op->damage = &priv->gpu_damage;
-		if (sna_damage_is_all(op->damage,
-				      op->dst.width, op->dst.height))
-			op->damage = NULL;
-	}
+	assert((op->dst.bo->pitch & 7) == 0);
 
 	get_drawable_deltas(dst->pDrawable, op->dst.pixmap,
 			    &op->dst.x, &op->dst.y);
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 348cb86..58e6204 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3178,36 +3178,11 @@ gen3_composite_set_target(struct sna *sna,
 
 	/* For single-stream mode there should be no minimum alignment
 	 * required, except that the width must be at least 2 elements.
+	 * Furthermore, it appears that the pitch must be a multiple of
+	 * 2 elements.
 	 */
-	if (op->dst.bo->pitch < 2*op->dst.pixmap->drawable.bitsPerPixel) {
-		struct sna_pixmap *priv;
-
-		priv = sna_pixmap_move_to_gpu (op->dst.pixmap,
-					       MOVE_READ | MOVE_WRITE);
-		if (priv == NULL || priv->pinned)
-			return false;
-
-		if (priv->gpu_bo->pitch < 2*op->dst.pixmap->drawable.bitsPerPixel) {
-			struct kgem_bo *bo;
-
-			bo = kgem_replace_bo(&sna->kgem, priv->gpu_bo,
-					     op->dst.width, op->dst.height,
-					     2*op->dst.pixmap->drawable.bitsPerPixel,
-					     op->dst.pixmap->drawable.bitsPerPixel);
-			if (bo == NULL)
-				return false;
-
-			sna_pixmap_unmap(op->dst.pixmap, priv);
-			kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
-			priv->gpu_bo = bo;
-		}
-
-		op->dst.bo = priv->gpu_bo;
-		op->damage = &priv->gpu_damage;
-		if (sna_damage_is_all(op->damage,
-				      op->dst.width, op->dst.height))
-			op->damage = NULL;
-	}
+	if (op->dst.bo->pitch & ((2*op->dst.pixmap->drawable.bitsPerPixel >> 3) - 1))
+		return false;
 
 	get_drawable_deltas(dst->pDrawable, op->dst.pixmap,
 			    &op->dst.x, &op->dst.y);
commit 6c91ec29807e96682c2e752744b60c06bf3f02d9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Dec 10 12:37:44 2013 +0000

    sna: Set minimum pitch alignment to 8 bytes
    
    This prevents render corruption on gen3 and should not adversely affect
    BLT pitch requirements or other GPUs.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 0d1368c..777326e 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1420,7 +1420,7 @@ inline static uint32_t kgem_pitch_alignment(struct kgem *kgem, unsigned flags)
 		return 256;
 	if (flags & CREATE_SCANOUT)
 		return 64;
-	return 4;
+	return 8;
 }
 
 void kgem_get_tile_size(struct kgem *kgem, int tiling, int pitch,


More information about the xorg-commit mailing list