xf86-video-intel: 8 commits - src/sna/gen7_render.c src/sna/kgem.c src/sna/kgem.h src/sna/sna_accel.c src/sna/sna.h src/sna/sna_render_inline.h src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jan 16 00:18:13 PST 2013


 src/sna/gen7_render.c       |    4 +-
 src/sna/kgem.c              |    4 --
 src/sna/kgem.h              |    1 
 src/sna/sna.h               |    2 -
 src/sna/sna_accel.c         |   69 +++++++++++++++++++++++++++++++++++---------
 src/sna/sna_render_inline.h |    2 -
 src/sna/sna_trapezoids.c    |    3 +
 7 files changed, 62 insertions(+), 23 deletions(-)

New commits:
commit 588c5aa6bca441d7c9305fe2fcf268e89b6b617d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 22:21:56 2013 +0000

    sna: Revert use of a separate CAN_CREATE_SMALL flag
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 2f8d696..fdba699 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1102,7 +1102,7 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen)
 	DBG(("%s: buffer size=%d [%d KiB]\n", __FUNCTION__,
 	     kgem->buffer_size, kgem->buffer_size / 1024));
 
-	kgem->max_object_size = 2 * kgem->aperture_high / 3;
+	kgem->max_object_size = 3 * kgem->aperture_high / 4;
 	kgem->max_gpu_size = kgem->max_object_size;
 	if (!kgem->has_llc)
 		kgem->max_gpu_size = MAX_CACHE_SIZE;
@@ -3387,8 +3387,6 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
 				 I915_TILING_NONE, &pitch);
 	DBG(("%s: untiled size=%d\n", __FUNCTION__, size));
 	if (size > 0) {
-		if (size < 4096)
-			flags |= KGEM_CAN_CREATE_SMALL;
 		if (size <= kgem->max_cpu_size)
 			flags |= KGEM_CAN_CREATE_CPU;
 		if (size <= kgem->max_gpu_size)
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 372bfdb..d2b89f5 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -248,7 +248,6 @@ unsigned kgem_can_create_2d(struct kgem *kgem, int width, int height, int depth)
 #define KGEM_CAN_CREATE_CPU	0x2
 #define KGEM_CAN_CREATE_LARGE	0x4
 #define KGEM_CAN_CREATE_GTT	0x8
-#define KGEM_CAN_CREATE_SMALL	0x10
 
 struct kgem_bo *
 kgem_replace_bo(struct kgem *kgem,
diff --git a/src/sna/sna.h b/src/sna/sna.h
index bddeed4..112af35 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -126,7 +126,7 @@ struct sna_pixmap {
 #define PIN_SCANOUT 0x1
 #define PIN_DRI 0x2
 #define PIN_PRIME 0x4
-	uint8_t create :5;
+	uint8_t create :4;
 	uint8_t mapped :1;
 	uint8_t shm :1;
 	uint8_t clear :1;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index a168925..2d947a3 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1224,7 +1224,7 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 
 		ptr = MAKE_STATIC_PTR(pixmap->devPrivate.ptr);
 		pad = pixmap->devKind;
-		flags |= KGEM_CAN_CREATE_SMALL;
+		flags &= ~(KGEM_CAN_CREATE_GPU | KGEM_CAN_CREATE_CPU);
 	} else {
 		DBG(("%s: creating GPU pixmap %dx%d, stride=%d, flags=%x\n",
 		     __FUNCTION__, width, height, pad, flags));
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index a329707..432201f 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -97,7 +97,7 @@ too_small(struct sna_pixmap *priv)
 	if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo))
 		return false;
 
-	return priv->create & KGEM_CAN_CREATE_SMALL;
+	return (priv->create & KGEM_CAN_CREATE_GPU) == 0;
 }
 
 static inline bool
commit af85ffdec7047efa452d6bab3a0ee3889dd4f046
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 20:37:11 2013 +0000

    sna: Avoid serialising on an move-to-cpu for an async operation
    
    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 0b46218..a168925 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1615,6 +1615,8 @@ skip_inplace_map:
 	}
 
 	if (priv->gpu_damage &&
+	    ((flags & MOVE_ASYNC_HINT) == 0 ||
+	     !__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo)) &&
 	    priv->gpu_bo->tiling == I915_TILING_NONE &&
 	    sna_pixmap_move_to_gpu(pixmap, MOVE_READ)) {
 		kgem_bo_submit(&sna->kgem, priv->gpu_bo);
commit d70be85dc723168a481c1955444afd951c4817bf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 20:16:45 2013 +0000

    sna: Assert that we never try to mix INPLACE / ASYNC hints for move-to-cpu
    
    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 a6affcf..0b46218 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1444,13 +1444,15 @@ static inline bool use_cpu_bo_for_upload(struct sna *sna,
 
 static inline bool operate_inplace(struct sna_pixmap *priv, unsigned flags)
 {
-	if ((priv->create & KGEM_CAN_CREATE_GTT) == 0) {
-		DBG(("%s: no, not accessible via GTT\n", __FUNCTION__));
+	if ((flags & MOVE_INPLACE_HINT) == 0) {
+		DBG(("%s: no, inplace operation not suitable\n", __FUNCTION__));
 		return false;
 	}
 
-	if ((flags & MOVE_INPLACE_HINT) == 0) {
-		DBG(("%s: no, inplace operation not suitable\n", __FUNCTION__));
+	assert((flags & MOVE_ASYNC_HINT) == 0);
+
+	if ((priv->create & KGEM_CAN_CREATE_GTT) == 0) {
+		DBG(("%s: no, not accessible via GTT\n", __FUNCTION__));
 		return false;
 	}
 
commit 1287c3a24c277cb42930d8af2943b9f7b016f31d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 18:59:15 2013 +0000

    sna: Specialise sna_get_image_blt for clears to avoid sync readback
    
    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 27f2920..a6affcf 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13411,6 +13411,26 @@ sna_get_image_blt(DrawablePtr drawable,
 	if (priv == NULL)
 		return false;
 
+	if (priv->clear) {
+		int w = region->extents.x2 - region->extents.x1;
+		int h = region->extents.y2 - region->extents.y1;
+
+		pitch = PixmapBytePad(w, pixmap->drawable.depth);
+		if (priv->clear_color == 0 ||
+		    pixmap->drawable.bitsPerPixel == 8) {
+			memset(dst, priv->clear_color, pitch * h);
+		} else {
+			pixman_fill((uint32_t *)dst,
+				    pitch/sizeof(uint32_t),
+				    pixmap->drawable.bitsPerPixel,
+				    0, 0,
+				    w, h,
+				    priv->clear_color);
+		}
+
+		return true;
+	}
+
 	if (!sna->kgem.has_userptr)
 		return false;
 
commit da4972eec57e662b98a7abced6338ceb8a533a48
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 18:34:07 2013 +0000

    sna/trapezoids: Avoid the multiply for an opaque source
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 1a4b109..95e7d4f 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -4417,7 +4417,8 @@ struct inplace {
 static force_inline uint8_t coverage_opacity(int coverage, uint8_t opacity)
 {
 	coverage = coverage * 256 / FAST_SAMPLES_XY;
-	return mul_8_8(coverage - (coverage >> 8), opacity);
+	coverage -= coverage >> 8;
+	return opacity == 255 ? coverage : mul_8_8(coverage, opacity);
 }
 
 static void
commit 7f968c8c991cff751459939bdb42e14255f529b7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 18:41:00 2013 +0000

    sna: Add DBG to use_shm_bo()
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index cd36c95..2269b3a 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2617,8 +2617,8 @@ gen7_render_copy_boxes(struct sna *sna, uint8_t alu,
 	struct sna_composite_op tmp;
 	BoxRec extents;
 
-	DBG(("%s (%d, %d)->(%d, %d) x %d, alu=%x, self-copy=%d, overlaps? %d\n",
-	     __FUNCTION__, src_dx, src_dy, dst_dx, dst_dy, n, alu,
+	DBG(("%s (%d, %d)->(%d, %d) x %d, alu=%x, flags=%x, self-copy=%d, overlaps? %d\n",
+	     __FUNCTION__, src_dx, src_dy, dst_dx, dst_dy, n, alu, flags,
 	     src_bo == dst_bo,
 	     overlaps(sna,
 		      src_bo, src_dx, src_dy,
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2a0955a..27f2920 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4134,19 +4134,36 @@ static bool use_shm_bo(struct sna *sna,
 		       struct sna_pixmap *priv,
 		       int alu)
 {
-	if (priv == NULL || priv->cpu_bo == NULL)
+	if (priv == NULL || priv->cpu_bo == NULL) {
+		DBG(("%s: no, not attached\n", __FUNCTION__));
 		return false;
+	}
 
-	if (!priv->shm)
+	if (!priv->shm) {
+		DBG(("%s: yes, ordinary CPU bo\n", __FUNCTION__));
 		return true;
+	}
 
-	if (alu != GXcopy)
+	if (alu != GXcopy) {
+		DBG(("%s: yes, complex alu=%d\n", __FUNCTION__, alu));
+		return true;
+	}
+	if (bo->tiling) {
+		DBG(("%s:, yes, dst tiled=%d\n", __FUNCTION__, bo->tiling));
 		return true;
+	}
 
-	if (kgem_bo_is_busy(bo))
+	if (__kgem_bo_is_busy(&sna->kgem, bo)) {
+		DBG(("%s: yes, dst is busy\n", __FUNCTION__));
 		return true;
+	}
 
-	return bo->tiling || __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo);
+	if (__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
+		DBG(("%s: yes, src is busy\n", __FUNCTION__));
+		return true;
+	}
+
+	return false;
 }
 
 static void
@@ -4335,8 +4352,8 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		if (use_shm_bo(sna, bo, src_priv, alu)) {
 			bool ret;
 
-			DBG(("%s: region overlaps CPU damage, copy from CPU bo\n",
-			     __FUNCTION__));
+			DBG(("%s: region overlaps CPU damage, copy from CPU bo (shm? %d)\n",
+			     __FUNCTION__, src_priv->shm));
 
 			assert(bo != dst_priv->cpu_bo);
 
commit af63fab5047a43716c5df875ddc50f7c877f8a83
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 18:21:11 2013 +0000

    sna: Hint that a copy from a SHM bo will likely be the last in a batch
    
    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 ea0b786..2a0955a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4351,7 +4351,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 			if (!sna->render.copy_boxes(sna, alu,
 						    src_pixmap, src_priv->cpu_bo, src_dx, src_dy,
 						    dst_pixmap, bo, 0, 0,
-						    box, n, 0)) {
+						    box, n, src_priv->shm ? COPY_LAST : 0)) {
 				DBG(("%s: fallback - accelerated copy boxes failed\n",
 				     __FUNCTION__));
 				goto fallback;
commit 1be436409222c00ff66c6d747487b77f1037b27a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 15 18:20:29 2013 +0000

    sna: Pass the async hint for the upload into the GPU
    
    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 fc2ef07..ea0b786 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4312,7 +4312,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 			area.y2 += src_dy;
 
 			if (!sna_pixmap_move_area_to_gpu(src_pixmap, &area,
-							 MOVE_READ))
+							 MOVE_READ | MOVE_ASYNC_HINT))
 				goto fallback;
 
 			if (!sna->render.copy_boxes(sna, alu,


More information about the xorg-commit mailing list