summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-16 14:25:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-16 15:59:12 +0100
commita4d845bc8f77e4a36064f132720ce462d0bdd5b4 (patch)
tree0da86388e25c88cf0e070d0055410d4773a93cf9
parent09f0fe9b3943ae2ba1e0ebd679ea04177427a8cf (diff)
sna: Regularly check the cache level on bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 924b0a43..da072836 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -248,6 +248,20 @@ static void assert_tiling(struct kgem *kgem, struct kgem_bo *bo)
assert(tiling.tiling_mode == bo->tiling);
}
+static void assert_cacheing(struct kgem *kgem, struct kgem_bo *bo)
+{
+ struct local_i915_gem_caching arg;
+ int expect = kgem->has_llc ? SNOOPED : UNCACHED;
+
+ VG_CLEAR(arg);
+ arg.handle = bo->handle;
+ arg.caching = expect;
+
+ (void)do_ioctl(kgem->fd, LOCAL_IOCTL_I915_GEM_GET_CACHING, &arg);
+
+ assert(arg.caching == expect);
+}
+
static void assert_bo_retired(struct kgem_bo *bo)
{
DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
@@ -257,9 +271,9 @@ static void assert_bo_retired(struct kgem_bo *bo)
assert(bo->exec == NULL);
assert(list_is_empty(&bo->request));
}
-
#else
#define assert_tiling(kgem, bo)
+#define assert_cacheing(kgem, bo)
#define assert_bo_retired(bo)
#endif
@@ -1888,6 +1902,7 @@ inline static void kgem_bo_move_to_inactive(struct kgem *kgem,
assert(!bo->needs_flush);
assert(list_is_empty(&bo->vma));
assert_tiling(kgem, bo);
+ assert_cacheing(kgem, bo);
ASSERT_IDLE(kgem, bo->handle);
if (bucket(bo) >= NUM_CACHE_BUCKETS) {
@@ -2263,6 +2278,7 @@ static void __kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
assert(bo->snoop == false);
assert(bo->io == false);
assert(bo->scanout == false);
+ assert_cacheing(kgem, bo);
kgem_bo_undo(kgem, bo);
assert(bo->refcnt == 0);