xf86-video-intel: 2 commits - src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Jun 2 04:14:36 PDT 2013


 src/sna/kgem.c      |    4 ++--
 src/sna/sna_accel.c |   21 +++++++++++++++------
 src/sna/sna_dri.c   |    8 +++++++-
 3 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 66ad4d6f3c990bd40d816b4a22122bbf64786e4c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 2 12:13:46 2013 +0100

    sna/dri: Undo any COW before performing a copy with DRI2CopyRegion
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65250
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 9f8d9a7..9c1bda0 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -477,6 +477,12 @@ static void damage(PixmapPtr pixmap, RegionPtr region)
 	priv = sna_pixmap(pixmap);
 	assert(priv != NULL);
 	assert(priv->gpu_bo);
+
+	if (priv->cow) {
+		sna_pixmap_undo_cow(to_sna_from_pixmap(pixmap), priv,
+				    region ? MOVE_READ : 0);
+	}
+
 	if (DAMAGE_IS_ALL(priv->gpu_damage))
 		return;
 
@@ -509,7 +515,7 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
 	assert((priv->pinned & PIN_PRIME) == 0);
 	assert(priv->flush);
 
-	if (priv->cow)
+	if (priv->cow && priv->gpu_bo != bo)
 		sna_pixmap_undo_cow(sna, priv, 0);
 
 	/* Post damage on the new front buffer so that listeners, such
commit 9a8ff7861c50b2f8698a968a011d5d833c7d5975
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 2 12:13:28 2013 +0100

    sna: Add some more DBG hints to copy-on-write cloning
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index ef8f036..62713de 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1771,8 +1771,8 @@ void kgem_bo_undo(struct kgem *kgem, struct kgem_bo *bo)
 	if (kgem->nexec != 1 || bo->exec == NULL)
 		return;
 
-	DBG(("%s: only handle in batch, discarding last operations\n",
-	     __FUNCTION__));
+	DBG(("%s: only handle in batch, discarding last operations for handle=%ld\n",
+	     __FUNCTION__, bo->handle));
 
 	assert(bo->exec == &kgem->exec[0]);
 	assert(kgem->exec[0].handle == bo->handle);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index fccc69e..7e0ca6d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1668,11 +1668,13 @@ sna_pixmap_make_cow(struct sna *sna,
 	if (src_priv->gpu_bo->proxy)
 		return false;
 
-	DBG(("%s: make cow src=%ld, dst=%ld, handle=%ld\n",
+	DBG(("%s: make cow src=%ld, dst=%ld, handle=%ld (already cow? src=%d, dst=%d)\n",
 	     __FUNCTION__,
 	     src_priv->pixmap->drawable.serialNumber,
 	     dst_priv->pixmap->drawable.serialNumber,
-	     src_priv->gpu_bo->handle));
+	     src_priv->gpu_bo->handle,
+	     src_priv->cow ? IS_COW_OWNER(src_priv->cow) ? 1 : -1 : 0,
+	     dst_priv->cow ? IS_COW_OWNER(dst_priv->cow) ? 1 : -1 : 0));
 
 	if (dst_priv->pinned) {
 		DBG(("%s: can't cow, dst_pinned=%x\n",
@@ -1693,8 +1695,10 @@ sna_pixmap_make_cow(struct sna *sna,
 		cow->bo = src_priv->gpu_bo;
 		cow->refcnt = 1;
 
-		DBG(("%s: attaching source cow to pixmap=%ld\n",
-		     __FUNCTION__, src_priv->pixmap->drawable.serialNumber));
+		DBG(("%s: moo! attaching source cow to pixmap=%ld, handle=%d\n",
+		     __FUNCTION__,
+		     src_priv->pixmap->drawable.serialNumber,
+		     cow->bo->handle));
 
 		src_priv->cow = MAKE_COW_OWNER(cow);
 		list_init(&src_priv->cow_list);
@@ -1721,8 +1725,11 @@ sna_pixmap_make_cow(struct sna *sna,
 	list_add(&dst_priv->cow_list, &cow->list);
 	cow->refcnt++;
 
-	DBG(("%s: attaching clone to pixmap=%ld\n",
-	     __FUNCTION__, dst_priv->pixmap->drawable.serialNumber));
+	DBG(("%s: moo! attaching clone to pixmap=%ld (source=%ld, handle=%d)\n",
+	     __FUNCTION__,
+	     dst_priv->pixmap->drawable.serialNumber,
+	     src_priv->pixmap->drawable.serialNumber,
+	     cow->bo->handle));
 
 	if (dst_priv->mapped) {
 		dst_priv->pixmap->devPrivate.ptr = NULL;
@@ -4645,6 +4652,8 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 
 	/* XXX hack for firefox -- subsequent uses of src will be corrupt! */
 	if (src_priv && src_priv->cow && src_priv->gpu_bo == dst_priv->gpu_bo) {
+		DBG(("%s: discarding cow reference for cousin copy\n",
+		     __FUNCTION__));
 		assert(src_priv->cpu_damage == NULL);
 		bo = dst_priv->gpu_bo;
 		damage = NULL;


More information about the xorg-commit mailing list