summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-11-08 22:19:08 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-11-08 23:20:18 +0000
commit91822571baef836281ae3123e7fad0f5a7d08b48 (patch)
tree71d323041fd77e51a87b25124be4d2735b70a28a /src/sna/sna_accel.c
parent4798e18b2b2c8b0a05dc967e6140fd9962bc1a73 (diff)
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@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c17
1 files changed, 16 insertions, 1 deletions
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,