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>
This commit is contained in:
Chris Wilson 2012-11-21 14:46:45 +00:00
parent 0884777c33
commit c0c48c7a5a
3 changed files with 14 additions and 12 deletions

View File

@ -1242,7 +1242,7 @@ kgem_add_handle(struct kgem *kgem, struct kgem_bo *bo)
return exec;
}
void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
static void kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
{
bo->exec = kgem_add_handle(kgem, bo);
bo->rq = kgem->next_request;
@ -3907,7 +3907,7 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
}
if (bo->exec == NULL)
_kgem_add_bo(kgem, bo);
kgem_add_bo(kgem, bo);
assert(bo->rq == kgem->next_request);
if (kgem->gen < 40 && read_write_domain & KGEM_RELOC_FENCED) {

View File

@ -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;

View File

@ -2588,6 +2588,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
flags));
assert(box->x2 > box->x1 && box->y2 > box->y1);
assert(pixmap->refcnt);
assert_pixmap_damage(pixmap);
assert_drawable_contains_box(drawable, box);
@ -2785,6 +2786,7 @@ move_to_gpu:
done:
assert(priv->gpu_bo != NULL);
assert(priv->gpu_bo->refcnt);
if (sna_damage_is_all(&priv->gpu_damage,
pixmap->drawable.width,
pixmap->drawable.height)) {
@ -2806,6 +2808,7 @@ done:
use_gpu_bo:
DBG(("%s: using whole GPU bo\n", __FUNCTION__));
assert(priv->gpu_bo != NULL);
assert(priv->gpu_bo->refcnt);
assert(priv->gpu_bo->proxy == NULL);
assert(priv->gpu_damage);
priv->clear = false;
@ -2820,6 +2823,8 @@ use_cpu_bo:
if (priv->cpu_bo == NULL)
return NULL;
assert(priv->cpu_bo->refcnt);
sna = to_sna_from_pixmap(pixmap);
if ((flags & FORCE_GPU) == 0 &&
!__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {