summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-21 13:18:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-07-21 13:33:03 +0100
commitf36b656ab2bc16ec8849cadb0afb574bb742c3a3 (patch)
tree6428be12e9271dd4c43393826143b71aa8aa77e4
parent37dfdb0e9e86effc3ca8b590c98aa2382e8f0cea (diff)
sna: Avoid marking io/snoop buffers as unreusable unnecessarily
As they are kept in special caches, we can reserve the unreusable flags for exceptional buffers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c11
-rw-r--r--src/sna/sna_accel.c1
2 files changed, 5 insertions, 7 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index dbe64233..ab78e51c 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1431,14 +1431,14 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
__FUNCTION__, bo->handle));
/* transfer the handle to a minimum bo */
memcpy(base, bo, sizeof(*base));
- base->reusable = true;
base->io = false;
list_init(&base->list);
list_replace(&bo->request, &base->request);
list_replace(&bo->vma, &base->vma);
free(bo);
bo = base;
- }
+ } else
+ bo->reusable = false;
}
if (!bo->reusable) {
@@ -1749,7 +1749,8 @@ static void kgem_commit(struct kgem *kgem)
bo->presumed_offset = bo->exec->offset;
bo->exec = NULL;
- if (!bo->refcnt && !bo->reusable && !bo->snoop) {
+ if (!bo->refcnt && !bo->reusable) {
+ assert(!bo->snoop);
kgem_bo_free(kgem, bo);
continue;
}
@@ -3801,7 +3802,6 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
return NULL;
}
- bo->reusable = false;
bo->snoop = true;
debug_alloc__bo(kgem, bo);
@@ -4040,7 +4040,6 @@ create_snoopable_buffer(struct kgem *kgem, unsigned alloc)
assert(bo->mmapped == true);
assert(bo->need_io == false);
- bo->base.reusable = false;
bo->base.snoop = true;
bo->mem = kgem_bo_map__cpu(kgem, &bo->base);
@@ -4080,7 +4079,6 @@ create_snoopable_buffer(struct kgem *kgem, unsigned alloc)
bo->base.refcnt = 1;
bo->base.snoop = true;
- bo->base.reusable = false;
bo->base.map = MAKE_USER_MAP(bo->mem);
return bo;
@@ -4408,7 +4406,6 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
}
init:
bo->base.io = true;
- bo->base.reusable = false;
assert(bo->base.refcnt == 1);
assert(num_pages(&bo->base) == alloc);
assert(!bo->need_io || !bo->base.needs_flush);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 32f70070..74db52e4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -461,6 +461,7 @@ static void sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv)
#endif
if (priv->cpu_bo->flush) {
kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
+ priv->cpu_bo->reusable = false;
sna_accel_watch_flush(sna, -1);
}
kgem_bo_destroy(&sna->kgem, priv->cpu_bo);