From 03cd383a7b8665d77b69ab07ff7276127024b4fb Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 8 Nov 2017 22:19:08 +0000 Subject: [PATCH xf86-video-intel] 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 are now being reused and attached to new fd. References: https://bugs.freedesktop.org/show_bug.cgi?id=103618 Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 25a075c..863b331 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1216,10 +1216,22 @@ sna_set_shared_pixmap_backing(PixmapPtr pixmap, void *fd_handle) if (priv == NULL) return FALSE; - assert(!priv->pinned); - assert(priv->gpu_bo == NULL); + 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; + } + 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, -- 2.7.4