sna/dri: Make sure we discard the existing mappings when swapping GPU bo

If the GPU bo is currently mapped to the Pixmap, we need to be sure to
invalidate that mapping if we swap the GPU bo (for SwapBuffers). If we
forget, we leave a dangling pointer to chase.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60042
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-01-30 08:42:48 +00:00
parent cf9b9ac318
commit de28027ffc
1 changed files with 6 additions and 0 deletions

View File

@ -498,6 +498,12 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
if (priv->gpu_bo != bo) {
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
priv->gpu_bo = ref(bo);
if (priv->mapped) {
assert(!priv->shm && priv->stride);
pixmap->devPrivate.ptr = PTR(priv->ptr);
pixmap->devKind = priv->stride;
priv->mapped = false;
}
}
if (bo->domain != DOMAIN_GPU)
bo->domain = DOMAIN_NONE;