summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-04 19:12:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-04 19:14:24 +0000
commitd7600e4e7726bb8bd6c7256ad2baf195d4427c60 (patch)
tree617dcf3111e809915f4569e55656488170ffe71a
parent3b5d556a93ac0afebf6c1dd02e0c92f6eb73f633 (diff)
sna: Add some assertions to partial buffer list tracking
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f9133693..279faced 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1425,6 +1425,7 @@ static void kgem_finish_partials(struct kgem *kgem)
list_for_each_entry_safe(bo, next, &kgem->active_partials, base.list) {
assert(next->base.list.prev == &bo->base.list);
assert(bo->base.io);
+ assert(bo->base.refcnt >= 1);
if (!bo->base.exec)
continue;
@@ -3366,6 +3367,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
flags &= ~KGEM_BUFFER_INPLACE;
list_for_each_entry(bo, &kgem->active_partials, base.list) {
+ assert(bo->base.io);
+ assert(bo->base.refcnt >= 1);
+
/* We can reuse any write buffer which we can fit */
if (flags == KGEM_BUFFER_LAST &&
bo->write == KGEM_BUFFER_WRITE &&
@@ -3415,6 +3419,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
if (flags & KGEM_BUFFER_WRITE) {
list_for_each_entry_reverse(bo, &kgem->inactive_partials, base.list) {
+ assert(bo->base.io);
+ assert(bo->base.refcnt == 1);
+
if (size > bytes(&bo->base))
continue;
@@ -3691,6 +3698,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
init:
bo->base.reusable = false;
assert(num_pages(&bo->base) == alloc);
+ assert(bo->base.io);
assert(!bo->need_io || !bo->base.needs_flush);
assert(!bo->need_io || bo->base.domain != DOMAIN_GPU);