summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-31 16:39:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-31 16:41:31 +0000
commit0a08de1f02577aef0da289108270c1b35e5d9703 (patch)
tree1e242fb625e8b8d424a2c488d5adaa1ed38fd38b /src
parentfff0686342f8ec3b3f3510340e073defdf2fb73f (diff)
sna: After removing the bo from a batch, check whether it is still busy
If we transfer a bo to the current batch, then subsequently discard it, we lose the information about its current active state. Try to recover this information, by querying the kernel and adding it to the flushing list if necessary. Reported-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/kgem.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index fed6d8c1..653a0912 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2111,6 +2111,7 @@ static void kgem_commit(struct kgem *kgem)
list_del(&bo->request);
bo->rq = NULL;
bo->exec = NULL;
+ bo->needs_flush = false;
}
kgem->scanout_busy |= bo->scanout;
@@ -2355,6 +2356,7 @@ static void kgem_cleanup(struct kgem *kgem)
bo->exec = NULL;
bo->domain = DOMAIN_NONE;
bo->dirty = false;
+ bo->needs_flush = false;
if (bo->refcnt == 0)
kgem_bo_free(kgem, bo);
}
@@ -2419,9 +2421,16 @@ void kgem_reset(struct kgem *kgem)
bo->exec = NULL;
bo->target_handle = -1;
bo->dirty = false;
- bo->rq = NULL;
bo->domain = DOMAIN_NONE;
+ if (bo->needs_flush && kgem_busy(kgem, bo->handle)) {
+ list_add(&bo->request, &kgem->flushing);
+ bo->rq = (void *)kgem;
+ } else {
+ bo->rq = NULL;
+ bo->needs_flush = false;
+ }
+
if (!bo->refcnt && !bo->reusable) {
assert(!bo->snoop);
DBG(("%s: discarding handle=%d\n",