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>
This commit is contained in:
Chris Wilson 2017-11-08 22:19:08 +00:00
parent 4798e18b2b
commit 91822571ba
1 changed files with 16 additions and 1 deletions

View File

@ -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,