sna: Submit the batch upon destroying a ShmPixmap

The midlayer has already detached the pixmap from the segment (possibly
destroying that segment in the process, thanks midlayer!) so we need to
submit the batch asap before the segment disappears.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-08-15 18:04:18 +01:00
parent 4e604d721b
commit 2554d0d76e
2 changed files with 6 additions and 3 deletions

View File

@ -2186,13 +2186,14 @@ void _kgem_submit(struct kgem *kgem)
break;
}
}
ErrorF("exec[%d] = handle:%d, presumed offset: %x, size: %d, tiling %d, fenced %d, deleted %d\n",
ErrorF("exec[%d] = handle:%d, presumed offset: %x, size: %d, tiling %d, fenced %d, snooped %d, deleted %d\n",
i,
kgem->exec[i].handle,
(int)kgem->exec[i].offset,
found ? kgem_bo_size(found) : -1,
found ? found->tiling : -1,
(int)(kgem->exec[i].flags & EXEC_OBJECT_NEEDS_FENCE),
found ? found->snoop : -1,
found ? found->purged : -1);
}
for (i = 0; i < kgem->nreloc; i++) {

View File

@ -1033,6 +1033,7 @@ static void __sna_free_pixmap(struct sna *sna,
sna_pixmap_free_cpu(sna, priv);
if (priv->header) {
assert(!priv->shm);
pixmap->devPrivate.ptr = sna->freed_pixmap;
sna->freed_pixmap = pixmap;
} else {
@ -1062,9 +1063,10 @@ static Bool sna_destroy_pixmap(PixmapPtr pixmap)
if (priv->gpu_bo)
kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
if (priv->shm && priv->cpu_bo->rq)
if (priv->shm && kgem_bo_is_busy(priv->cpu_bo)) {
kgem_bo_submit(&sna->kgem, priv->cpu_bo); /* XXX ShmDetach */
add_flush_pixmap(sna, priv);
else
} else
__sna_free_pixmap(sna, pixmap, priv);
return TRUE;
}