From 2554d0d76e0fcae6e324938c28bb50deeb8814dc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 15 Aug 2012 18:04:18 +0100 Subject: [PATCH] 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 --- src/sna/kgem.c | 3 ++- src/sna/sna_accel.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 6db986f4..a3df628e 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -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++) { diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 95d2b1a8..661dde07 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -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; }