xf86-video-intel: 3 commits - src/intel_dri.c src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 6 03:13:40 PDT 2012


 src/intel_dri.c     |    8 +++----
 src/sna/sna_accel.c |   58 +++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 52 insertions(+), 14 deletions(-)

New commits:
commit 18726a4975ab2ddf85eaa6eb1602dcbe599217f7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 10:58:49 2012 +0100

    sna: Perform CopyArea directly onto a CPU bo if available
    
    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 e2a2c12..2ead80a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3887,6 +3887,33 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 		}
 
 		goto out;
+	} else if (dst_priv->cpu_bo &&
+		   src_priv && DAMAGE_IS_ALL(src_priv->gpu_damage) && !src_priv->clear) {
+		if (!sna->render.copy_boxes(sna, alu,
+					    src_pixmap, src_priv->gpu_bo, src_dx, src_dy,
+					    dst_pixmap, dst_priv->cpu_bo, dst_dx, dst_dy,
+					    box, n)) {
+			DBG(("%s: fallback - accelerated copy boxes failed\n",
+			     __FUNCTION__));
+			goto fallback;
+		}
+
+		if (replaces) {
+			sna_damage_all(&dst_priv->cpu_damage,
+				       dst_pixmap->drawable.width,
+				       dst_pixmap->drawable.height);
+			dst_priv->undamaged = false;
+		} else {
+			RegionTranslate(&region, dst_dx, dst_dy);
+			assert_pixmap_contains_box(dst_pixmap,
+						   RegionExtents(&region));
+			sna_damage_add(&dst_priv->cpu_damage, &region);
+			RegionTranslate(&region, -dst_dx, -dst_dy);
+		}
+		if (dst_priv->flush)
+			list_move(&dst_priv->list, &sna->dirty_pixmaps);
+
+		goto out;
 	}
 
 fallback:
commit 57d7d5de78bcf01d75d7a7de03fe50a2a9bd1b7e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 00:08:17 2012 +0100

    sna: Use GPU for readback onto CPU bo
    
    Time to blt from GTT to LLC 16384 bytes:	 125.000µs (snb)
    Time to blt from GTT to LLC 16384 bytes:	  71.000µs (ivb)
    Time to blt from GTT to LLC 1048576 bytes:	1400.000µs (snb)
    Time to blt from GTT to LLC 1048576 bytes:	 938.000µs (ivb)
    
    Time to copy from GTT to LLC 16384 bytes:	 118.000µs (snb)
    Time to copy from GTT to LLC 16384 bytes:	 134.000µs (ivb)
    Time to copy from GTT to LLC 1048576 bytes:	6723.000µs (snb)
    Time to copy from GTT to LLC 1048576 bytes:	7424.000µs (ivb)
    
    And conversely,
    
    Time to blt from LLC to GTT 16384 bytes:	 10.000µs (snb)
    Time to blt from LLC to GTT 16384 bytes:	  8.000µs (ivb)
    Time to blt from LLC to GTT 1048576 bytes:	217.000µs (snb)
    Time to blt from LLC to GTT 1048576 bytes:	135.000µs (ivb)
    
    Time to copy from LLC to GTT 16384 bytes:	  4.000µs (snb)
    Time to copy from LLC to GTT 16384 bytes:	  4.000µs (ivb)
    Time to copy from LLC to GTT 1048576 bytes:	270.000µs (snb)
    Time to copy from LLC to GTT 1048576 bytes:	179.500µs (ivb)
    
    It seems clear then that even with the extra synchronisation cost
    copying from the GTT is much preferable with the GPU than using the
    uncached reads by the CPU. Streaming write-combines from the CPU into
    the GTT seem about as efficient as we can manage, so continue to use the
    mapping unless busy.
    
    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 afd9ed7..e2a2c12 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -930,8 +930,19 @@ sna_pixmap_create_mappable_gpu(PixmapPtr pixmap)
 	return priv->gpu_bo && kgem_bo_is_mappable(&sna->kgem, priv->gpu_bo);
 }
 
-static bool use_cpu_bo_for_xfer(struct sna_pixmap *priv)
+static inline bool use_cpu_bo_for_write(struct sna *sna,
+					struct sna_pixmap *priv)
 {
+	return priv->cpu_bo != NULL && sna->kgem.gen >= 30;
+}
+
+static inline bool use_cpu_bo_for_read(struct sna_pixmap *priv)
+{
+#if 0
+	if (pixmap->devPrivate.ptr == NULL)
+		return TRUE;
+#endif
+
 	if (priv->cpu_bo == NULL)
 		return FALSE;
 
@@ -1112,7 +1123,7 @@ skip_inplace_map:
 		if (n) {
 			Bool ok = FALSE;
 
-			if (sna->kgem.gen >= 30 && use_cpu_bo_for_xfer(priv))
+			if (use_cpu_bo_for_write(sna, priv))
 				ok = sna->render.copy_boxes(sna, GXcopy,
 							    pixmap, priv->gpu_bo, 0, 0,
 							    pixmap, priv->cpu_bo, 0, 0,
@@ -1503,7 +1514,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 			assert(pixmap_contains_damage(pixmap, priv->gpu_damage));
 
 			ok = FALSE;
-			if (sna->kgem.gen >= 30 && use_cpu_bo_for_xfer(priv))
+			if (use_cpu_bo_for_write(sna, priv))
 				ok = sna->render.copy_boxes(sna, GXcopy,
 							    pixmap, priv->gpu_bo, 0, 0,
 							    pixmap, priv->cpu_bo, 0, 0,
@@ -1604,7 +1615,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 				if (n) {
 					Bool ok = FALSE;
 
-					if (sna->kgem.gen >= 30 && use_cpu_bo_for_xfer(priv))
+					if (use_cpu_bo_for_write(sna, priv))
 						ok = sna->render.copy_boxes(sna, GXcopy,
 									    pixmap, priv->gpu_bo, 0, 0,
 									    pixmap, priv->cpu_bo, 0, 0,
@@ -1626,7 +1637,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 				int n = REGION_NUM_RECTS(r);
 				Bool ok = FALSE;
 
-				if (sna->kgem.gen >= 30 && use_cpu_bo_for_xfer(priv))
+				if (use_cpu_bo_for_write(sna, priv))
 					ok = sna->render.copy_boxes(sna, GXcopy,
 								    pixmap, priv->gpu_bo, 0, 0,
 								    pixmap, priv->cpu_bo, 0, 0,
@@ -1648,7 +1659,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 					int n = REGION_NUM_RECTS(&need);
 					Bool ok = FALSE;
 
-					if (sna->kgem.gen >= 30 && use_cpu_bo_for_xfer(priv))
+					if (use_cpu_bo_for_write(sna, priv))
 						ok = sna->render.copy_boxes(sna, GXcopy,
 									    pixmap, priv->gpu_bo, 0, 0,
 									    pixmap, priv->cpu_bo, 0, 0,
@@ -1878,7 +1889,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box, unsigned int flags)
 		if (n) {
 			Bool ok = FALSE;
 
-			if (pixmap->devPrivate.ptr == NULL || use_cpu_bo_for_xfer(priv))
+			if (use_cpu_bo_for_read(priv))
 				ok = sna->render.copy_boxes(sna, GXcopy,
 							    pixmap, priv->cpu_bo, 0, 0,
 							    pixmap, priv->gpu_bo, 0, 0,
@@ -1916,7 +1927,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box, unsigned int flags)
 	} else if (DAMAGE_IS_ALL(priv->cpu_damage) ||
 		   sna_damage_contains_box__no_reduce(priv->cpu_damage, box)) {
 		Bool ok = FALSE;
-		if (pixmap->devPrivate.ptr == NULL || use_cpu_bo_for_xfer(priv))
+		if (use_cpu_bo_for_read(priv))
 			ok = sna->render.copy_boxes(sna, GXcopy,
 						    pixmap, priv->cpu_bo, 0, 0,
 						    pixmap, priv->gpu_bo, 0, 0,
@@ -1945,7 +1956,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box, unsigned int flags)
 
 		box = REGION_RECTS(&i);
 		ok = FALSE;
-		if (pixmap->devPrivate.ptr == NULL || use_cpu_bo_for_xfer(priv))
+		if (use_cpu_bo_for_read(priv))
 			ok = sna->render.copy_boxes(sna, GXcopy,
 						    pixmap, priv->cpu_bo, 0, 0,
 						    pixmap, priv->gpu_bo, 0, 0,
@@ -2441,7 +2452,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 		DBG(("%s: uploading %d damage boxes\n", __FUNCTION__, n));
 
 		ok = FALSE;
-		if (pixmap->devPrivate.ptr == NULL || use_cpu_bo_for_xfer(priv))
+		if (use_cpu_bo_for_read(priv))
 			ok = sna->render.copy_boxes(sna, GXcopy,
 						    pixmap, priv->cpu_bo, 0, 0,
 						    pixmap, priv->gpu_bo, 0, 0,
commit f2513cb0fdb0d1214854fd4e4dcd477ba8583862
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 10:41:35 2012 +0100

    uxa/dri: Do not use undeclared stdbool features
    
    The header isn't pulled in, so stop using the undefined values of
    true/false.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 4890fe4..d2b828e 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -263,7 +263,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 	DRI2BufferPtr buffers;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap, pDepthPixmap;
-	bool is_glamor_pixmap = false;
+	Bool is_glamor_pixmap = FALSE;
 	int i;
 
 	buffers = calloc(count, sizeof *buffers);
@@ -282,7 +282,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 			pixmap = get_front_buffer(drawable);
 
 			if (pixmap && intel_get_pixmap_private(pixmap) == NULL) {
-				is_glamor_pixmap = true;
+				is_glamor_pixmap = TRUE;
 				drawable = &pixmap->drawable;
 				pixmap = NULL;
 			}
@@ -390,7 +390,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 	DRI2Buffer2Ptr buffer;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap;
-	bool is_glamor_pixmap = false;
+	Bool is_glamor_pixmap = FALSE;
 
 	buffer = calloc(1, sizeof *buffer);
 	if (buffer == NULL)
@@ -406,7 +406,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 		pixmap = get_front_buffer(drawable);
 
 		if (pixmap && intel_get_pixmap_private(pixmap) == NULL) {
-			is_glamor_pixmap = true;
+			is_glamor_pixmap = FALSE;
 			drawable = &pixmap->drawable;
 			pixmap = NULL;
 		}


More information about the xorg-commit mailing list