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

Chris Wilson ickle at kemper.freedesktop.org
Fri Jun 6 08:15:45 PDT 2014


 src/sna/sna_accel.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 23840bd329cf4da3a4bdd5a1a466125a95473534
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 6 16:10:29 2014 +0100

    sna: Only allow the inplace copy to replace a complete overwritten GPU bo
    
    And double check after recreating the new GPU bo that is still mappable.
    
    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 50e0b2c..47a346c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5624,7 +5624,8 @@ static bool
 sna_copy_boxes__inplace(struct sna *sna, RegionPtr region, int alu,
 			PixmapPtr src_pixmap, struct sna_pixmap *src_priv,
 			int dx, int dy,
-			PixmapPtr dst_pixmap, struct sna_pixmap *dst_priv)
+			PixmapPtr dst_pixmap, struct sna_pixmap *dst_priv,
+			bool replaces)
 {
 	const BoxRec *box;
 	char *ptr;
@@ -5765,18 +5766,14 @@ upload_inplace:
 		return false;
 	}
 
-	if (!kgem_bo_can_map__cpu(&sna->kgem, dst_priv->gpu_bo, true)) {
-		DBG(("%s - no, cannot map dst for reads into the CPU\n", __FUNCTION__));
-		return false;
-	}
-
-	if (__kgem_bo_is_busy(&sna->kgem, dst_priv->gpu_bo)) {
-		if (!dst_priv->pinned) {
+	if (!kgem_bo_can_map__cpu(&sna->kgem, dst_priv->gpu_bo, true) ||
+	    __kgem_bo_is_busy(&sna->kgem, dst_priv->gpu_bo)) {
+		if (replaces && !dst_priv->pinned) {
 			unsigned create;
 			struct kgem_bo *bo;
 
 			create = CREATE_CPU_MAP | CREATE_INACTIVE;
-			if (dst_pixmap->usage_hint == SNA_CREATE_FB)
+			if (dst_priv->gpu_bo->scanout)
 				create |= CREATE_SCANOUT;
 
 			bo = kgem_create_2d(&sna->kgem,
@@ -5795,6 +5792,11 @@ upload_inplace:
 			DBG(("%s - no, dst is busy\n", __FUNCTION__));
 			return false;
 		}
+
+		if (!kgem_bo_can_map__cpu(&sna->kgem, dst_priv->gpu_bo, true)) {
+			DBG(("%s - no, cannot map dst for reads into the CPU\n", __FUNCTION__));
+			return false;
+		}
 	}
 
 	if (src_priv &&
@@ -6373,7 +6375,8 @@ fallback:
 	} else if (!sna_copy_boxes__inplace(sna, region, alu,
 					    src_pixmap, src_priv,
 					    src_dx, src_dy,
-					    dst_pixmap, dst_priv)) {
+					    dst_pixmap, dst_priv,
+					    replaces)) {
 		FbBits *dst_bits, *src_bits;
 		int dst_stride, src_stride;
 


More information about the xorg-commit mailing list