summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-20 21:09:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-20 22:40:25 +0000
commit6690ff51ec939367051985172a00bf8ed65ac4e3 (patch)
treed9becf6b9f17b9d24a1236d26ce460d062c7ea7f
parent743084bbc4c411694190f60cf5161086ada6454f (diff)
sna: Treat all exported bo as potentially active
Don't assume that a read/write will clear the active flag if the bo has been exported to another DRI client. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 03b7ceb8..53f100ca 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -243,7 +243,7 @@ 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;
+ bo->needs_flush = !bo->flush;
if (bo->domain == DOMAIN_GPU) {
kgem->sync = false;
kgem_retire(kgem);
@@ -774,6 +774,9 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
goto destroy;
}
+ assert(bo->vmap == false && bo->sync == false);
+ bo->flush = false;
+
if (bo->rq) {
DBG(("%s: handle=%d -> active\n", __FUNCTION__, bo->handle));
list_move(&bo->list, active(kgem, bo->size));
@@ -2247,7 +2250,7 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo, int prot)
set_domain.write_domain = I915_GEM_DOMAIN_GTT;
drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
- bo->needs_flush = false;
+ bo->needs_flush = !bo->flush;
if (bo->domain == DOMAIN_GPU) {
kgem->sync = false;
kgem_retire(kgem);
@@ -2353,7 +2356,7 @@ uint32_t kgem_bo_flink(struct kgem *kgem, struct kgem_bo *bo)
/* Henceforth, we need to broadcast all updates to clients and
* flush our rendering before doing so.
*/
- bo->flush = 1;
+ bo->flush = true;
if (bo->exec)
kgem->flush = 1;
@@ -2443,7 +2446,7 @@ void kgem_bo_sync__cpu(struct kgem *kgem, struct kgem_bo *bo)
drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
assert(!kgem_busy(kgem, bo->handle));
- bo->needs_flush = false;
+ bo->needs_flush = !bo->flush;
if (bo->domain == DOMAIN_GPU) {
kgem->sync = false;
kgem_retire(kgem);
@@ -2873,7 +2876,7 @@ void kgem_buffer_read_sync(struct kgem *kgem, struct kgem_bo *_bo)
bo->base.handle, (char *)(bo+1)+offset,
offset, length);
assert(!kgem_busy(kgem, bo->base.handle));
- bo->base.needs_flush = false;
+ bo->base.needs_flush = !bo->base.flush;
if (bo->base.domain == DOMAIN_GPU) {
kgem->sync = false;
kgem_retire(kgem);