summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-10 22:12:41 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-10 22:12:41 +0000
commitf0e3f6b5bebf7471d3e3e84bd9b2d8469eb64093 (patch)
treeba0bd7381f01d9a8105827cbe7dd14c5ab385ec4
parentb4ae6dbaedd774f250b610b1e7323897c4abe23a (diff)
sna: Check needs-flush status immediately upon destroy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 27d271d4..09e8ea22 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -905,29 +905,33 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
assert(list_is_empty(&bo->list));
if (bo->rq) {
DBG(("%s: handle=%d -> active\n", __FUNCTION__, bo->handle));
- list_move(&bo->list, &kgem->active[bo->bucket]);
- } else if (bo->needs_flush) {
+ list_add(&bo->list, &kgem->active[bo->bucket]);
+ return;
+ }
+
+ assert(bo->exec == NULL);
+ assert(list_is_empty(&bo->request));
+
+ if (bo->needs_flush &&
+ (bo->needs_flush = kgem_busy(kgem, bo->handle))) {
DBG(("%s: handle=%d -> flushing\n", __FUNCTION__, bo->handle));
- assert(list_is_empty(&bo->request));
list_add(&bo->request, &kgem->flushing);
- list_move(&bo->list, &kgem->active[bo->bucket]);
+ list_add(&bo->list, &kgem->active[bo->bucket]);
bo->rq = &_kgem_static_request;
- } else {
- assert(bo->exec == NULL);
- if (!IS_CPU_MAP(bo->map)) {
- if (!kgem_bo_set_purgeable(kgem, bo)) {
- kgem->need_purge |= bo->domain == DOMAIN_GPU;
- goto destroy;
- }
- DBG(("%s: handle=%d, purged\n",
- __FUNCTION__, bo->handle));
- }
+ return;
+ }
- DBG(("%s: handle=%d -> inactive\n", __FUNCTION__, bo->handle));
- kgem_bo_move_to_inactive(kgem, bo);
- kgem->need_expire = true;
+ if (!IS_CPU_MAP(bo->map)) {
+ if (!kgem_bo_set_purgeable(kgem, bo)) {
+ kgem->need_purge |= bo->domain == DOMAIN_GPU;
+ goto destroy;
+ }
+ DBG(("%s: handle=%d, purged\n",
+ __FUNCTION__, bo->handle));
}
+ DBG(("%s: handle=%d -> inactive\n", __FUNCTION__, bo->handle));
+ kgem_bo_move_to_inactive(kgem, bo);
return;
destroy:
@@ -2577,7 +2581,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 = !bo->flush;
+ bo->needs_flush = bo->flush;
if (bo->domain == DOMAIN_GPU)
kgem_retire(kgem);
bo->domain = DOMAIN_GTT;