summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-06-15 19:11:05 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-06-15 19:11:05 +0100
commit881f961a1c78e554e566ef624d6edcf28fee8fdf (patch)
tree88c5d64e08301c74477e68a6d6ef95064c119458
parenta1ee4b930846d4ba9274028c08800b882fc926f1 (diff)
sna: Clear the gpu flag once is not busy and no flush is pending
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 1d5ed067..fd220ab1 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -176,8 +176,10 @@ Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
if (gem_write(kgem->fd, bo->handle, 0, length, data))
return FALSE;
+ bo->needs_flush = false;
if (bo->gpu)
kgem_retire(kgem);
+ assert(bo->gpu == false);
return TRUE;
}
@@ -569,13 +571,13 @@ void kgem_retire(struct kgem *kgem)
request);
list_del(&bo->request);
bo->rq = NULL;
+ bo->gpu = bo->needs_flush;
if (bo->refcnt == 0) {
assert(bo->deleted);
if (bo->needs_flush) {
list_add(&bo->request, &kgem->flushing);
} else if (bo->reusable) {
- bo->gpu = false;
list_move(&bo->list,
inactive(kgem, bo->size));
} else {
@@ -1607,8 +1609,10 @@ void kgem_bo_sync(struct kgem *kgem, struct kgem_bo *bo, bool for_write)
set_domain.write_domain = for_write ? I915_GEM_DOMAIN_CPU : 0;
drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
+ bo->needs_flush = false;
if (bo->gpu)
kgem_retire(kgem);
+ assert(bo->gpu == false);
bo->cpu_read = true;
if (for_write)
bo->cpu_write = true;
@@ -1804,8 +1808,10 @@ void kgem_buffer_sync(struct kgem *kgem, struct kgem_bo *_bo)
0, bo->used, bo+1);
else
gem_read(kgem->fd, bo->base.handle, bo+1, bo->used);
+ bo->base.needs_flush = false;
if (bo->base.gpu)
kgem_retire(kgem);
+ assert(bo->base.gpu == false);
bo->need_io = 0;
}