xf86-video-intel: 4 commits - src/sna/gen6_common.h src/sna/gen6_render.c src/sna/gen7_render.c src/sna/gen8_render.c src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 11 10:57:42 PDT 2014


 src/sna/gen6_common.h |    3 +++
 src/sna/gen6_render.c |    1 -
 src/sna/gen7_render.c |    1 -
 src/sna/gen8_render.c |    1 -
 src/sna/sna_accel.c   |   49 +++++++++++++++++++------------------------------
 5 files changed, 22 insertions(+), 33 deletions(-)

New commits:
commit e3a0e40310b6c46b2f887bc0d75b11cc06ec8fa0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 11 18:07:46 2014 +0100

    sna: Fix direction flags for memmove
    
    Under a compositor, the current deltas may invert the sense of the copy
    direction, causing scrolling corruption. Simplify handling those flags
    by making them invariant for the function.
    
    Reported-by: Bruno Prémont <bonbons at linux-vserver.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79843
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index db8091e..58f3fd7 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5407,7 +5407,7 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	BoxPtr box = region_rects(region);
 	int n = region_num_rects(region);
 	int alu = gc ? gc->alu : GXcopy;
-	int16_t tx, ty;
+	int16_t tx, ty, sx, sy;
 
 	assert(pixmap == get_drawable_pixmap(dst));
 
@@ -5428,10 +5428,10 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	     dx, dy, alu,
 	     pixmap->drawable.width, pixmap->drawable.height));
 
-	if (get_drawable_deltas(src, pixmap, &tx, &ty))
-		dx += tx, dy += ty;
-	if (dst != src)
-		get_drawable_deltas(dst, pixmap, &tx, &ty);
+	get_drawable_deltas(dst, pixmap, &tx, &ty);
+	get_drawable_deltas(src, pixmap, &sx, &sy);
+	sx += dx;
+	sy += dy;
 
 	if (priv == NULL || DAMAGE_IS_ALL(priv->cpu_damage)) {
 		DBG(("%s: unattached, or all damaged on CPU\n", __FUNCTION__));
@@ -5453,7 +5453,7 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		assert(priv->cpu_damage == NULL);
 
 		if (!sna->render.copy_boxes(sna, alu,
-					    pixmap, priv->gpu_bo, dx, dy,
+					    pixmap, priv->gpu_bo, sx, sy,
 					    pixmap, priv->gpu_bo, tx, ty,
 					    box, n, 0)) {
 			DBG(("%s: fallback - accelerated copy boxes failed\n",
@@ -5490,7 +5490,7 @@ fallback:
 					 ty * stride + tx * bpp / 8);
 				src_bits = (FbBits *)
 					((char *)pixmap->devPrivate.ptr +
-					 dy * stride + dx * bpp / 8);
+					 sy * stride + sx * bpp / 8);
 
 				for (i = 0; i < n; i++)
 					memmove_box(src_bits, dst_bits,
@@ -5503,9 +5503,8 @@ fallback:
 				goto out;
 
 			if (sigtrap_get() == 0) {
-				get_drawable_deltas(src, pixmap, &tx, &ty);
 				miCopyRegion(src, dst, gc,
-					     region, dx - tx, dy - ty,
+					     region, dx, dy,
 					     fbCopyNtoN, 0, NULL);
 				sigtrap_put();
 			}
commit 55660376d555131348e7efaaec66d6d27ffc1e6e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 11 17:43:33 2014 +0100

    sna: Use the pixmap header creation routine
    
    A few more places could use the common pixmap creator, just remember to
    handle the SHMPixmap complication!
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ac3867e..db8091e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -943,6 +943,7 @@ create_pixmap_hdr(struct sna *sna, ScreenPtr screen,
 	pixmap->drawable.height = height;
 	pixmap->usage_hint = usage;
 
+	(*priv)->header = true;
 	return pixmap;
 }
 
@@ -984,7 +985,6 @@ fallback:
 	priv->cpu_bo = kgem_create_map(&sna->kgem, addr, pitch*height, false);
 	if (priv->cpu_bo == NULL) {
 		DBG(("%s: mapping SHM segment failed\n", __FUNCTION__));
-		priv->header = true;
 		sna_pixmap_destroy(pixmap);
 		goto fallback;
 	}
@@ -997,6 +997,7 @@ fallback:
 #endif
 
 	/* Be wary as we cannot cache SHM Pixmap in our freed cache */
+	priv->header = false;
 	priv->cpu = true;
 	priv->shm = true;
 	priv->stride = pitch;
@@ -1055,7 +1056,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 		return NullPixmap;
 
 	priv->stride = PixmapBytePad(width, depth);
-	priv->header = true;
 
 	priv->gpu_bo = kgem_create_2d(&sna->kgem,
 				      width, height, bpp, tiling,
@@ -1226,28 +1226,20 @@ sna_create_pixmap_shared(struct sna *sna, ScreenPtr screen,
 	DBG(("%s: depth=%d\n", __FUNCTION__, depth));
 
 	/* Create a stub to be attached later */
-	pixmap = create_pixmap(sna, screen, 0, 0, depth, 0);
+	pixmap = create_pixmap_hdr(sna, screen,
+				   width, height, depth, 0,
+				   &priv);
 	if (pixmap == NullPixmap)
 		return NullPixmap;
 
-	pixmap->devKind = 0;
-	pixmap->devPrivate.ptr = NULL;
-
-	priv = sna_pixmap_attach(pixmap);
-	if (priv == NULL) {
-		free(pixmap);
-		return NullPixmap;
-	}
-
+	assert(!priv->mapped);
 	priv->stride = 0;
 	priv->create = 0;
 
 	if (width|height) {
-		int bpp = bits_per_pixel(depth);
-
-		assert(!priv->mapped);
 		priv->gpu_bo = kgem_create_2d(&sna->kgem,
-					      width, height, bpp,
+					      width, height,
+					      pixmap->drawable.bitsPerPixel,
 					      I915_TILING_NONE,
 					      CREATE_GTT_MAP | CREATE_PRIME);
 		if (priv->gpu_bo == NULL) {
@@ -1270,8 +1262,6 @@ sna_create_pixmap_shared(struct sna *sna, ScreenPtr screen,
 		}
 
 		pixmap->devKind = priv->gpu_bo->pitch;
-		pixmap->drawable.width = width;
-		pixmap->drawable.height = height;
 
 		priv->stride = priv->gpu_bo->pitch;
 		priv->mapped = MAPPED_GTT;
@@ -1372,7 +1362,6 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 		if (pixmap == NullPixmap)
 			return NullPixmap;
 
-		priv->header = true;
 		ptr = NULL;
 	}
 
@@ -1426,8 +1415,9 @@ static void __sna_free_pixmap(struct sna *sna,
 	__sna_pixmap_free_cpu(sna, priv);
 
 	if (priv->header) {
-		assert(!priv->shm);
 		assert(pixmap->drawable.pScreen == sna->scrn->pScreen);
+		assert(!priv->shm);
+		assert(priv->ptr == NULL);
 		pixmap->devPrivate.ptr = sna->freed_pixmap;
 		sna->freed_pixmap = pixmap;
 #if DEBUG_MEMORY
@@ -3884,7 +3874,7 @@ sna_pixmap_create_upload(ScreenPtr screen,
 	pixmap->devPrivate.ptr = ptr;
 	priv->ptr = MAKE_STATIC_PTR(ptr);
 	priv->stride = priv->gpu_bo->pitch;
-	priv->header = true;
+	priv->create = 0;
 
 	pixmap->usage_hint = 0;
 	if (!kgem_buffer_is_inplace(priv->gpu_bo))
commit 1beaa980ea6a9617f7dd4dc87b881c37cc7a277b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 11 16:41:22 2014 +0100

    sna/gen6+: On small GT avoid the intermediate copy for overlaps
    
    If the memory bw is constrained on the GPU avoid doing the 2-pass copy
    for overlaps on the render ring, and do the single pass slower BLT copy
    instead - as since it has to transfer less data it will be faster.
    
    Reported-by: Ildar Nurislamov <absorbb at gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77436
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen6_common.h b/src/sna/gen6_common.h
index 0dddeb5..8b60ef6 100644
--- a/src/sna/gen6_common.h
+++ b/src/sna/gen6_common.h
@@ -58,6 +58,9 @@ inline static bool can_switch_to_blt(struct sna *sna,
 	if (bo && RQ_IS_BLT(bo->rq))
 		return true;
 
+	if (sna->render_state.gt < 2)
+		return true;
+
 	return kgem_ring_is_idle(&sna->kgem, KGEM_BLT);
 }
 
commit 31467b01e3f5ece0c8f8d4c03b52fc3f238b3d7e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 11 16:21:13 2014 +0100

    sna/gen6+: Overlapping bo by definition have compatible depths
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index a7ed2ea..8668d12 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2729,7 +2729,6 @@ fallback_blt:
 			goto fallback_blt;
 
 		if (can_switch_to_blt(sna, dst_bo, flags) &&
-		    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 		    sna_blt_copy_boxes(sna, alu,
 				       src_bo, src_dx, src_dy,
 				       dst_bo, dst_dx, dst_dy,
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 68b2d35..3fcca3e 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2966,7 +2966,6 @@ fallback_blt:
 			goto fallback_blt;
 
 		if (can_switch_to_blt(sna, dst_bo, flags) &&
-		    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 		    sna_blt_copy_boxes(sna, alu,
 				       src_bo, src_dx, src_dy,
 				       dst_bo, dst_dx, dst_dy,
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 0cbfff9..54a67b1 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -2776,7 +2776,6 @@ fallback_blt:
 			goto fallback_blt;
 
 		if (can_switch_to_blt(sna, dst_bo, flags) &&
-		    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 		    sna_blt_copy_boxes(sna, alu,
 				       src_bo, src_dx, src_dy,
 				       dst_bo, dst_dx, dst_dy,


More information about the xorg-commit mailing list