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

Chris Wilson ickle at kemper.freedesktop.org
Tue Jun 11 15:39:06 PDT 2013


 src/sna/sna_render.c |   49 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 19 deletions(-)

New commits:
commit 15b92c98755c709f41e59baeb206e5a3e56e3178
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 11 14:23:57 2013 +0100

    sna: Make sure the source is coherent on the CPU before uploading
    
    Similar to 7d91051c, but along the render path rather than CopyArea.
    
    Makes the presumption that for the upload path the region is stored on
    the CPU explicit.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=61628
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 6e95e55..330bfad 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -523,21 +523,20 @@ static struct kgem_bo *upload(struct sna *sna,
 
 	priv = sna_pixmap(pixmap);
 	if (priv) {
+		RegionRec region;
+
 		if (priv->cpu_damage == NULL)
+			return NULL; /* uninitialised */
+
+		region.extents = *box;
+		region.data = NULL;
+		if (!sna_drawable_move_region_to_cpu(&pixmap->drawable,
+						     &region, MOVE_READ))
 			return NULL;
 
-		/* As we know this box is on the CPU just fixup the shadow */
-		if (priv->mapped) {
-			pixmap->devPrivate.ptr = NULL;
-			priv->mapped = false;
-		}
-		if (pixmap->devPrivate.ptr == NULL) {
-			if (priv->ptr == NULL) /* uninitialised */
-				return NULL;
-			assert(priv->stride);
-			pixmap->devPrivate.ptr = PTR(priv->ptr);
-			pixmap->devKind = priv->stride;
-		}
+		assert(!priv->mapped);
+		if (pixmap->devPrivate.ptr == NULL)
+			return NULL; /* uninitialised */
 	}
 
 	bo = kgem_upload_source_image(&sna->kgem,
@@ -1188,20 +1187,32 @@ sna_render_picture_extract(struct sna *sna,
 	if (src_bo == NULL) {
 		src_bo = move_to_gpu(pixmap, &box, false);
 		if (src_bo == NULL) {
+			struct sna_pixmap *priv = sna_pixmap(pixmap);
+			if (priv) {
+				RegionRec region;
+
+				region.extents = box;
+				region.data = NULL;
+				if (!sna_drawable_move_region_to_cpu(&pixmap->drawable,
+								     &region, MOVE_READ))
+					return 0;
+
+				assert(!priv->mapped);
+				if (pixmap->devPrivate.ptr == NULL)
+					return 0; /* uninitialised */
+			}
+
 			bo = kgem_upload_source_image(&sna->kgem,
 						      pixmap->devPrivate.ptr,
 						      &box,
 						      pixmap->devKind,
 						      pixmap->drawable.bitsPerPixel);
-			if (bo != NULL &&
+			if (priv != NULL && bo != NULL &&
 			    box.x2 - box.x1 == pixmap->drawable.width &&
 			    box.y2 - box.y1 == pixmap->drawable.height) {
-				struct sna_pixmap *priv = sna_pixmap(pixmap);
-				if (priv) {
-					assert(priv->gpu_damage == NULL);
-					assert(priv->gpu_bo == NULL);
-					kgem_proxy_bo_attach(bo, &priv->gpu_bo);
-				}
+				assert(priv->gpu_damage == NULL);
+				assert(priv->gpu_bo == NULL);
+				kgem_proxy_bo_attach(bo, &priv->gpu_bo);
 			}
 		}
 	}


More information about the xorg-commit mailing list