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

Chris Wilson ickle at kemper.freedesktop.org
Fri Jun 5 08:54:34 PDT 2015


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

New commits:
commit ada30742ec115a44445e24c1775583b2684d94a4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 5 16:44:18 2015 +0100

    sna: Add COW source pixmap to flushing list
    
    In the case of an exported pixmap, e.g. with DRI3, it is possible for
    the client to render into the pixmap whilst we are unaware. To serialise
    the xserver and the client, we flush all operations on exported pixmaps
    before talking to the client. In the case of COW however, we did not
    flush the copy-on-write when transferring control to the client, and
    thereby we could capture the modified contents.
    
    Bugzilla: https://bugs.kde.org/show_bug.cgi?id=340202
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90836
    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 17b6ec9..8a6bf5a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2046,6 +2046,10 @@ sna_pixmap_make_cow(struct sna *sna,
 		     cow->bo->handle));
 
 		src_priv->cow = MAKE_COW_OWNER(cow);
+		if (src_priv->flush) {
+			assert(!src_priv->shm);
+			sna_add_flush_pixmap(sna, src_priv, src_priv->gpu_bo);
+		}
 	}
 
 	if (cow == COW(dst_priv->cow)) {
@@ -17316,17 +17320,19 @@ void sna_accel_flush(struct sna *sna)
 				__sna_free_pixmap(sna, priv->pixmap, priv);
 			}
 		} else {
+			unsigned hints;
 			DBG(("%s: flushing DRI pixmap=%ld\n", __FUNCTION__,
 			     priv->pixmap->drawable.serialNumber));
 			assert(priv->flush);
-			if (sna_pixmap_move_to_gpu(priv->pixmap,
-						   MOVE_READ | __MOVE_FORCE)) {
+			hints = MOVE_READ | __MOVE_FORCE;
+			if (priv->flush & IS_CLIPPED)
+				hints |= MOVE_WRITE;
+			if (sna_pixmap_move_to_gpu(priv->pixmap, hints)) {
 				if (priv->flush & IS_CLIPPED) {
 					kgem_bo_unclean(&sna->kgem, priv->gpu_bo);
 					sna_damage_all(&priv->gpu_damage, priv->pixmap);
 					assert(priv->cpu_damage == NULL);
-					priv->clear = false;
-					priv->cpu = false;
+					assert(priv->clear == false);
 				}
 			}
 		}


More information about the xorg-commit mailing list