summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-16 17:57:55 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-16 19:39:24 +0100
commit6fdc9e3fd3f8defb7ad62de11f8cb069a10e5736 (patch)
treeece1f5a5d51d750fd34da27c928922e37280d596
parent30dff81cd62b5fc5a28d5175a08c5a3ee09667bd (diff)
sna: Simplify busy tracking by trusting the bo->gpu flag
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c19
-rw-r--r--src/sna/kgem.h13
2 files changed, 11 insertions, 21 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 15ddd7a8..d27ba78b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -190,9 +190,8 @@ Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
return FALSE;
bo->needs_flush = false;
- if (bo->rq)
+ if (bo->gpu)
kgem_retire(kgem);
- bo->gpu = false;
return TRUE;
}
@@ -510,6 +509,7 @@ void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
{
bo->exec = kgem_add_handle(kgem, bo);
bo->rq = kgem->next_request;
+ bo->gpu = true;
list_move(&bo->request, &kgem->next_request->buffers);
kgem->flush |= bo->flush;
}
@@ -665,7 +665,6 @@ static void kgem_commit(struct kgem *kgem)
bo->presumed_offset = bo->exec->offset;
bo->exec = NULL;
bo->dirty = false;
- bo->gpu = true;
bo->cpu_read = false;
bo->cpu_write = false;
@@ -841,7 +840,6 @@ void kgem_reset(struct kgem *kgem)
bo->src_bound = bo->dst_bound = 0;
bo->exec = NULL;
bo->dirty = false;
- bo->gpu = true;
bo->cpu_read = false;
bo->cpu_write = false;
@@ -1713,11 +1711,8 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo, int prot)
return NULL;
bo->needs_flush = false;
- if (prot & PROT_WRITE) {
- if (bo->rq)
- kgem_retire(kgem);
- bo->gpu = false;
- }
+ if (prot & PROT_WRITE && bo->gpu)
+ kgem_retire(kgem);
return ptr;
}
@@ -1820,9 +1815,8 @@ void kgem_bo_sync(struct kgem *kgem, struct kgem_bo *bo, bool for_write)
drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
bo->needs_flush = false;
- if (bo->rq)
+ if (bo->gpu)
kgem_retire(kgem);
- bo->gpu = false;
bo->cpu_read = true;
if (for_write)
bo->cpu_write = true;
@@ -2136,9 +2130,8 @@ void kgem_buffer_sync(struct kgem *kgem, struct kgem_bo *_bo)
else
gem_read(kgem->fd, bo->base.handle, bo+1, bo->used);
bo->base.needs_flush = false;
- if (bo->base.rq)
+ if (bo->base.gpu)
kgem_retire(kgem);
- bo->base.gpu = false;
bo->need_io = 0;
}
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 49ca3d70..aba8d3fe 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -305,15 +305,12 @@ Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo,
static inline bool kgem_bo_is_busy(struct kgem_bo *bo)
{
- DBG_HDR(("%s: exec? %d, gpu? %d, rq? %d\n",
- __FUNCTION__, bo->exec != NULL, bo->gpu, bo->rq != NULL));
+ DBG_HDR(("%s: gpu? %d exec? %d, rq? %d\n",
+ __FUNCTION__, bo->gpu, bo->exec != NULL, bo->rq != NULL));
- if (bo->exec)
- return true;
- if (!bo->gpu)
- return false;
-
- return bo->rq != NULL;
+ assert(bo->proxy == NULL);
+ assert(bo->gpu || bo->rq == NULL);
+ return bo->gpu;
}
static inline bool kgem_bo_is_dirty(struct kgem_bo *bo)