xf86-video-intel: src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Jun 29 09:13:18 PDT 2013


 src/sna/sna_accel.c |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

New commits:
commit c7d246ba6f750ee080c38ccc5603d01fcf7fce92
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 29 16:31:34 2013 +0100

    sna: Move the clone discard into free-gpu
    
    Rather than peppering the discard manually before the call to free the
    GPU bo, always discard the COW when we actually free 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 2666798..2ed5007 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -423,6 +423,9 @@ sna_copy_init_blt(struct sna_copy_op *copy,
 static void sna_pixmap_free_gpu(struct sna *sna, struct sna_pixmap *priv)
 {
 	assert(priv->gpu_damage == NULL || priv->gpu_bo);
+
+	if (priv->cow)
+		sna_pixmap_undo_cow(sna, priv, 0);
 	assert(priv->cow == NULL);
 
 	sna_damage_destroy(&priv->gpu_damage);
@@ -2069,8 +2072,6 @@ mark_damage:
 			       pixmap->drawable.width,
 			       pixmap->drawable.height);
 		assert(priv->gpu_damage == NULL);
-		if (priv->cow)
-			sna_pixmap_undo_cow(sna, priv, 0);
 		sna_pixmap_free_gpu(sna, priv);
 
 		if (priv->flush) {
@@ -2083,14 +2084,14 @@ done:
 	if (flags & MOVE_WRITE) {
 		assert(DAMAGE_IS_ALL(priv->cpu_damage));
 		assert(priv->gpu_damage == NULL);
+		assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL);
 		if (priv->cow)
 			sna_pixmap_undo_cow(sna, priv, 0);
-		priv->source_count = SOURCE_BIAS;
-		assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL);
-		if (priv->gpu_bo && priv->gpu_bo->domain != DOMAIN_GPU) {
-			DBG(("%s: discarding inactive GPU bo\n", __FUNCTION__));
+		if (priv->gpu_bo && priv->gpu_bo->rq == NULL) {
+			DBG(("%s: discarding idle GPU bo\n", __FUNCTION__));
 			sna_pixmap_free_gpu(sna, priv);
 		}
+		priv->source_count = SOURCE_BIAS;
 	}
 
 	if (priv->cpu_bo) {
@@ -2102,10 +2103,6 @@ done:
 			assert(pixmap->devPrivate.ptr == (void *)((unsigned long)priv->cpu_bo->map & ~3));
 			assert((flags & MOVE_WRITE) == 0 || !kgem_bo_is_busy(priv->cpu_bo));
 		}
-		if (flags & MOVE_WRITE) {
-			DBG(("%s: discarding GPU bo in favour of CPU bo\n", __FUNCTION__));
-			sna_pixmap_free_gpu(sna, priv);
-		}
 	}
 	priv->cpu =
 		(flags & (MOVE_INPLACE_HINT | MOVE_ASYNC_HINT)) == 0 &&
@@ -2691,11 +2688,8 @@ done:
 				      pixmap->drawable.width,
 				      pixmap->drawable.height);
 		if (DAMAGE_IS_ALL(priv->cpu_damage)) {
-			if (priv->gpu_bo) {
-				DBG(("%s: replaced entire pixmap\n",
-				     __FUNCTION__));
-				sna_pixmap_free_gpu(sna, priv);
-			}
+			DBG(("%s: replaced entire pixmap\n", __FUNCTION__));
+			sna_pixmap_free_gpu(sna, priv);
 		}
 		if (priv->flush) {
 			assert(!priv->shm);
@@ -4032,8 +4026,6 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 
 	if (priv->gpu_bo && (replaces || priv->gpu_bo->proxy)) {
 		DBG(("%s: discarding cached upload proxy\n", __FUNCTION__));
-		if (priv->cow)
-			sna_pixmap_undo_cow(sna, priv, 0);
 		sna_pixmap_free_gpu(sna, priv);
 	}
 


More information about the xorg-commit mailing list