sna: Ensure that the tearfree swap is unmapped afterwards

After swapping the bo for the screen pixmap, we need to make sure that
we don't chase any dangling pointers.

References: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1133490
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-03-05 09:23:07 +00:00
parent 007a95d62f
commit ad4901a035
1 changed files with 15 additions and 1 deletions

View File

@ -3278,6 +3278,20 @@ sna_crtc_redisplay(xf86CrtcPtr crtc, RegionPtr region)
sna_crtc_redisplay__composite(crtc, region);
}
static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
{
struct sna_pixmap *priv = sna_pixmap(pixmap);
if (priv->mapped) {
assert(!priv->shm && priv->stride);
pixmap->devPrivate.ptr = PTR(priv->ptr);
pixmap->devKind = priv->stride;
priv->mapped = false;
}
priv->gpu_bo = bo;
}
void sna_mode_redisplay(struct sna *sna)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
@ -3406,7 +3420,7 @@ disable:
COPY_LAST);
kgem_submit(&sna->kgem);
sna_pixmap(sna->front)->gpu_bo = old;
set_bo(sna->front, old);
sna_dri_pixmap_update_bo(sna, sna->front);
sna->mode.shadow = new;