summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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",