diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-11-21 14:46:45 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-11-21 14:51:59 +0000 |
commit | c0c48c7a5aca4d24936efbeaefc7674ada2ef87f (patch) | |
tree | be2fe54c0170b76682cbdf44e2896253c1c66044 /src/sna/kgem.h | |
parent | 0884777c33d20dbc329b98ad0db5ffb0df93ac8c (diff) |
sna: Add a few refcnt assertions
References: https://bugs.freedesktop.org/show_bug.cgi?id=47597
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.h')
-rw-r--r-- | src/sna/kgem.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/sna/kgem.h b/src/sna/kgem.h index b42a8e0a..01efc8ed 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -411,16 +411,6 @@ bool kgem_check_bo(struct kgem *kgem, ...) __attribute__((sentinel(0))); bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo); bool kgem_check_many_bo_fenced(struct kgem *kgem, ...) __attribute__((sentinel(0))); -void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo); -static inline void kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo) -{ - if (bo->proxy) - bo = bo->proxy; - - if (bo->exec == NULL) - _kgem_add_bo(kgem, bo); -} - #define KGEM_RELOC_FENCED 0x8000 uint32_t kgem_add_reloc(struct kgem *kgem, uint32_t pos, @@ -498,6 +488,7 @@ static inline bool kgem_bo_is_mappable(struct kgem *kgem, { DBG(("%s: domain=%d, offset: %d size: %d\n", __FUNCTION__, bo->domain, bo->presumed_offset, kgem_bo_size(bo))); + assert(bo->refcnt); if (bo->domain == DOMAIN_GTT) return true; @@ -516,6 +507,7 @@ static inline bool kgem_bo_mapped(struct kgem *kgem, struct kgem_bo *bo) { DBG(("%s: map=%p, tiling=%d, domain=%d\n", __FUNCTION__, bo->map, bo->tiling, bo->domain)); + assert(bo->refcnt); if (bo->map == NULL) return bo->tiling == I915_TILING_NONE && bo->domain == DOMAIN_CPU; @@ -539,6 +531,7 @@ static inline bool kgem_bo_can_map(struct kgem *kgem, struct kgem_bo *bo) static inline bool kgem_bo_is_snoop(struct kgem_bo *bo) { + assert(bo->refcnt); while (bo->proxy) bo = bo->proxy; return bo->snoop; @@ -548,6 +541,7 @@ static inline bool kgem_bo_is_busy(struct kgem_bo *bo) { DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__, bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL)); + assert(bo->refcnt); return bo->rq; } @@ -555,6 +549,7 @@ static inline bool __kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo) { DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__, bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL)); + assert(bo->refcnt); if (kgem_flush(kgem)) kgem_submit(kgem); if (bo->rq && !bo->exec) @@ -567,11 +562,13 @@ static inline bool kgem_bo_is_dirty(struct kgem_bo *bo) if (bo == NULL) return false; + assert(bo->refcnt); return bo->dirty; } static inline void kgem_bo_mark_dirty(struct kgem_bo *bo) { + assert(bo->refcnt); do { if (bo->dirty) return; |