summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-30 17:26:28 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-30 17:28:19 +0000
commita31fd03bd4c87c48dc3ca15e3082e29348224b8c (patch)
treebc0f751dd84e72d1759981d9e0d2e645ec4152c8
parent6f1b862282ddb4545987fb9f0a45b528b7b7b5ee (diff)
sna: Add a bunch of assertions to make sure we do not misplace scanouts
As scanouts are uncached, they need to be treated carefully and decontaminated before being placed in the general cache. So double check that no bo in those caches are still marked as a scanout. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c14
-rw-r--r--src/sna/sna_display.c1
2 files changed, 14 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index ad6a5aaf..f0ec167f 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1619,6 +1619,7 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
list_for_each_entry(bo, &kgem->snoop, list) {
assert(bo->refcnt == 0);
assert(bo->snoop);
+ assert(!bo->scanout);
assert(bo->proxy == NULL);
assert(bo->tiling == I915_TILING_NONE);
assert(bo->rq == NULL);
@@ -1707,7 +1708,7 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
}
if (bo->scanout) {
- assert (bo->delta);
+ assert(bo->delta);
DBG(("%s: handle=%d -> scanout\n",
__FUNCTION__, bo->handle));
list_add(&bo->list, &kgem->scanout);
@@ -2994,6 +2995,7 @@ search_linear_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
assert(bo->proxy == NULL);
assert(bo->rq == NULL);
assert(bo->exec == NULL);
+ assert(!bo->scanout);
if (num_pages > num_pages(bo)) {
DBG(("inactive too small: %d < %d\n",
@@ -3037,6 +3039,7 @@ search_linear_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
assert(bo->reusable);
assert(!!bo->rq == !!use_active);
assert(bo->proxy == NULL);
+ assert(!bo->scanout);
if (num_pages > num_pages(bo))
continue;
@@ -3519,6 +3522,7 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
list_for_each_entry(bo, &kgem->large, list) {
assert(!bo->purged);
+ assert(!bo->scanout);
assert(bo->refcnt == 0);
assert(bo->reusable);
assert(bo->flush == true);
@@ -3562,6 +3566,7 @@ large_inactive:
list_for_each_entry(bo, &kgem->large_inactive, list) {
assert(bo->refcnt == 0);
assert(bo->reusable);
+ assert(!bo->scanout);
if (size > num_pages(bo))
continue;
@@ -3608,6 +3613,7 @@ large_inactive:
list_for_each_entry(bo, cache, vma) {
assert(bucket(bo) == bucket);
assert(bo->refcnt == 0);
+ assert(!bo->scanout);
assert(bo->map);
assert(IS_CPU_MAP(bo->map) == for_cpu);
assert(bo->rq == NULL);
@@ -3672,6 +3678,7 @@ search_again:
assert(bo->reusable);
assert(bo->tiling == tiling);
assert(bo->flush == false);
+ assert(!bo->scanout);
if (kgem->gen < 040) {
if (bo->pitch < pitch) {
@@ -3713,6 +3720,7 @@ search_again:
assert(!bo->purged);
assert(bo->refcnt == 0);
assert(bo->reusable);
+ assert(!bo->scanout);
assert(bo->tiling == tiling);
assert(bo->flush == false);
@@ -3743,6 +3751,7 @@ search_again:
assert(!bo->purged);
assert(bo->refcnt == 0);
assert(bo->reusable);
+ assert(!bo->scanout);
assert(bo->flush == false);
if (num_pages(bo) < size)
@@ -3784,6 +3793,7 @@ search_again:
assert(!bo->purged);
assert(bo->refcnt == 0);
assert(bo->reusable);
+ assert(!bo->scanout);
assert(bo->flush == false);
if (bo->tiling) {
@@ -3824,6 +3834,7 @@ search_inactive:
list_for_each_entry(bo, cache, list) {
assert(bucket(bo) == bucket);
assert(bo->reusable);
+ assert(!bo->scanout);
assert(bo->flush == false);
if (size > num_pages(bo)) {
@@ -4779,6 +4790,7 @@ struct kgem_bo *kgem_create_proxy(struct kgem *kgem,
bo->tiling = target->tiling;
bo->pitch = target->pitch;
+ assert(!bo->scanout);
bo->proxy = kgem_bo_reference(target);
bo->delta = offset;
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index e7eeb44d..28e8b4b5 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -164,6 +164,7 @@ static unsigned get_fb(struct sna *sna, struct kgem_bo *bo,
scrn->depth, scrn->bitsPerPixel, bo->pitch, errno);
return 0;
}
+ assert(arg.fb_id != 0);
bo->scanout = true;
return bo->delta = arg.fb_id;