diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-16 20:35:03 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-16 23:00:55 +0100 |
commit | 1eea2c4e60af535ac6500b1b62367f9f63f2a784 (patch) | |
tree | 23ddc11a5e22a4cc3bc22f1e69f27bd509c46102 | |
parent | d743c456db11bd3c0d21948dc3a2eb4b33e46342 (diff) |
sna: Can't free bo from the active list
As the active bo is still referenced in the request list, we can not
simply free it but need to wait for it to be purged on expiration.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f179d200..c13fabfb 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1157,26 +1157,22 @@ void kgem_cleanup_cache(struct kgem *kgem) static struct kgem_bo * search_linear_cache(struct kgem *kgem, int size, bool active) { - struct kgem_bo *bo, *next; + struct kgem_bo *bo; struct list *cache; cache = active ? &kgem->active : inactive(kgem, size); - list_for_each_entry_safe(bo, next, cache, list) { + list_for_each_entry(bo, cache, list) { if (size > bo->size) continue; if (active && bo->tiling != I915_TILING_NONE) continue; - list_del(&bo->list); - if (bo->rq == NULL) - list_del(&bo->request); - if (bo->deleted) { if (!gem_madvise(kgem->fd, bo->handle, I915_MADV_WILLNEED)) { kgem->need_purge |= bo->gpu; - goto next_bo; + continue; } bo->deleted = 0; @@ -1185,7 +1181,11 @@ search_linear_cache(struct kgem *kgem, int size, bool active) if (I915_TILING_NONE != bo->tiling && gem_set_tiling(kgem->fd, bo->handle, I915_TILING_NONE, 0) != I915_TILING_NONE) - goto next_bo; + continue; + + list_del(&bo->list); + if (bo->rq == NULL) + list_del(&bo->request); bo->tiling = I915_TILING_NONE; bo->pitch = 0; @@ -1197,10 +1197,6 @@ search_linear_cache(struct kgem *kgem, int size, bool active) assert(bo->reusable); assert(active || !kgem_busy(kgem, bo->handle)); return bo; -next_bo: - list_del(&bo->request); - gem_close(kgem->fd, bo->handle); - free(bo); } return NULL; |