xf86-video-intel: 5 commits - src/sna/kgem.h src/sna/sna_accel.c src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jan 10 08:35:04 PST 2013


 src/sna/kgem.h           |    8 ++++++++
 src/sna/sna_accel.c      |   39 +++++++++++++++++++++++++++------------
 src/sna/sna_trapezoids.c |    5 +++--
 3 files changed, 38 insertions(+), 14 deletions(-)

New commits:
commit a37d56f338c5fae832d5eeea1283b6dbde827678
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 10 16:28:24 2013 +0000

    sna: Use some surplus bits to back our temporary pixman_image_t
    
    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 5bedcbf..1a4b109 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -5214,9 +5214,10 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			pi.op = op;
 			pi.color = color;
 
-			pi.source = pixman_image_create_bits(PIXMAN_a8r8g8b8, 1, 1, NULL, 0);
+			pi.bits = (uint32_t *)&pi.sx;
+			pi.source = pixman_image_create_bits(PIXMAN_a8r8g8b8,
+							     1, 1, pi.bits, 0);
 			pixman_image_set_repeat(pi.source, PIXMAN_REPEAT_NORMAL);
-			pi.bits = pixman_image_get_data(pi.source);
 
 			if (dst->pCompositeClip->data)
 				span = pixmask_span_solid__clipped;
commit 09ea1f4402b3bd0e411b90eb5575b3ff066d7356
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 10 16:26:24 2013 +0000

    sna: Prefer to use the GPU for copies from SHM onto tiled destinations
    
    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 e82fb20..ca1fd27 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4392,7 +4392,7 @@ static bool use_shm_bo(struct sna *sna,
 	if (kgem_bo_is_busy(bo))
 		return true;
 
-	return __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo);
+	return bo->tiling || __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo);
 }
 
 static void
commit c63147a3c33fd26f5c04a8648881659b4a90df06
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 10 15:15:15 2013 +0000

    sna: Allow CPU bo to copy to GPU bo if the device is idle.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 4819dd6..ac63488 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -297,6 +297,14 @@ static inline bool kgem_ring_is_idle(struct kgem *kgem, int ring)
 	return __kgem_ring_is_idle(kgem, ring);
 }
 
+static inline bool kgem_is_idle(struct kgem *kgem)
+{
+	if (!kgem->need_retire)
+		return true;
+
+	return kgem_ring_is_idle(kgem, kgem->ring);
+}
+
 void _kgem_submit(struct kgem *kgem);
 static inline void kgem_submit(struct kgem *kgem)
 {
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 253ad87..e82fb20 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4345,7 +4345,7 @@ sna_pixmap_is_gpu(PixmapPtr pixmap)
 }
 
 static int
-source_prefer_gpu(struct sna_pixmap *priv)
+source_prefer_gpu(struct sna *sna, struct sna_pixmap *priv)
 {
 	if (priv == NULL) {
 		DBG(("%s: source unattached, use cpu\n", __FUNCTION__));
@@ -4368,7 +4368,7 @@ source_prefer_gpu(struct sna_pixmap *priv)
 	}
 
 	if (DAMAGE_IS_ALL(priv->cpu_damage))
-		return 0;
+		return priv->cpu_bo && kgem_is_idle(&sna->kgem);
 
 	DBG(("%s: source has GPU bo? %d\n",
 	     __FUNCTION__, priv->gpu_bo != NULL));
@@ -4466,7 +4466,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	if (dst_priv == NULL)
 		goto fallback;
 
-	hint = source_prefer_gpu(src_priv) ?:
+	hint = source_prefer_gpu(sna, src_priv) ?:
 		region_inplace(sna, dst_pixmap, region,
 			       dst_priv, alu_overwrites(alu));
 	if (dst_priv->cpu_damage && alu_overwrites(alu)) {
commit 2933e7595838c28081810d4959ca1e005a0419e1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 10 13:07:19 2013 +0000

    sna: Ignore the last pixmap cpu setting if overwritting all damage
    
    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 359d3be..253ad87 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2622,7 +2622,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
 		flags |= PREFER_GPU;
 	if (priv->shm)
 		flags &= ~PREFER_GPU;
-	if (priv->cpu && (flags & FORCE_GPU) == 0)
+	if (priv->cpu && (flags & (FORCE_GPU | IGNORE_CPU)) == 0)
 		flags &= ~PREFER_GPU;
 
 	DBG(("%s: flush=%d, shm=%d, cpu=%d => flags=%x\n",
@@ -4484,6 +4484,8 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		if (region->data == NULL)
 			hint |= IGNORE_CPU;
 	}
+	if (replaces)
+		hint |= IGNORE_CPU;
 
 	bo = sna_drawable_use_bo(&dst_pixmap->drawable, hint,
 				 &region->extents, &damage);
commit 934ea64f7ff080b00d00c50ba94f63247d7bb130
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 10 13:06:06 2013 +0000

    sna: With a GPU bo and a shm source, do not fall all the way back
    
    The normal source upload into GPU bo knows a few more tricks that we may
    want to apply first before copying into the shadow of the GPU bo.
    
    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 c826815..359d3be 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4375,6 +4375,26 @@ source_prefer_gpu(struct sna_pixmap *priv)
 	return priv->gpu_bo != NULL;
 }
 
+static bool use_shm_bo(struct sna *sna,
+		       struct kgem_bo *bo,
+		       struct sna_pixmap *priv,
+		       int alu)
+{
+	if (priv == NULL || priv->cpu_bo == NULL)
+		return false;
+
+	if (!priv->shm)
+		return true;
+
+	if (alu != GXcopy)
+		return true;
+
+	if (kgem_bo_is_busy(bo))
+		return true;
+
+	return __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo);
+}
+
 static void
 sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	       RegionPtr region, int dx, int dy,
@@ -4556,7 +4576,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		if (bo != dst_priv->gpu_bo)
 			goto fallback;
 
-		if (src_priv && src_priv->cpu_bo) {
+		if (use_shm_bo(sna, bo, src_priv, alu)) {
 			bool ret;
 
 			DBG(("%s: region overlaps CPU damage, copy from CPU bo\n",
@@ -4564,13 +4584,6 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 
 			assert(bo != dst_priv->cpu_bo);
 
-			if (src_priv->shm &&
-			    alu == GXcopy &&
-			    DAMAGE_IS_ALL(src_priv->cpu_damage) &&
-			    !__kgem_bo_is_busy(&sna->kgem, src_priv->cpu_bo) &&
-			    (replaces || !__kgem_bo_is_busy(&sna->kgem, bo)))
-				goto fallback;
-
 			RegionTranslate(region, src_dx, src_dy);
 			ret = sna_drawable_move_region_to_cpu(&src_pixmap->drawable,
 							      region,


More information about the xorg-commit mailing list