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

Chris Wilson ickle at kemper.freedesktop.org
Wed Nov 8 23:21:02 UTC 2017


 src/sna/sna_accel.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 91822571baef836281ae3123e7fad0f5a7d08b48
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 8 22:19:08 2017 +0000

    sna: Allow a PRIME pixmap to be reused
    
    The code expected that a fresh pixmap header to be created for each
    PRIME pixmap, but it appears that set_shared_pixmap is being called on
    the same pixmap with fd=-1.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=103618
    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 25a075cf..e7e52003 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1216,10 +1216,25 @@ sna_set_shared_pixmap_backing(PixmapPtr pixmap, void *fd_handle)
 	if (priv == NULL)
 		return FALSE;
 
+	if (priv->pinned & ~PIN_PRIME)
+		return FALSE;
+
+	assert(!priv->flush);
+
+	if (priv->gpu_bo) {
+		priv->clear = false;
+		sna_damage_destroy(&priv->gpu_damage);
+		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
+		priv->gpu_bo = NULL;
+		priv->pinned = 0;
+	}
+
 	assert(!priv->pinned);
-	assert(priv->gpu_bo == NULL);
+
 	assert(priv->cpu_bo == NULL);
 	assert(priv->cpu_damage == NULL);
+
+	assert(priv->gpu_bo == NULL);
 	assert(priv->gpu_damage == NULL);
 
 	bo = kgem_create_for_prime(&sna->kgem,


More information about the xorg-commit mailing list