summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-01-29 13:06:08 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-01-29 13:06:08 +0000
commit7df3da10e744d7f168ea3f30b21c434f99beae17 (patch)
tree041a1d8a3e72c237eb48db3a504f77e221a90e28
parent001dd080e15157961188c96718669dd1b4d6b939 (diff)
sna/gen4+: Assert that the cached binding location is valid
We can at least check that it is in the right region (i.e. not past where the current surface has been allocated from). References: https://bugs.freedesktop.org/show_bug.cgi?id=74176 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen4_render.c1
-rw-r--r--src/sna/gen5_render.c1
-rw-r--r--src/sna/gen6_render.c1
-rw-r--r--src/sna/gen7_render.c1
-rw-r--r--src/sna/gen8_render.c1
5 files changed, 5 insertions, 0 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 4f4a4c80..1d164b6e 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -514,6 +514,7 @@ gen4_bind_bo(struct sna *sna,
/* After the first bind, we manage the cache domains within the batch */
offset = kgem_bo_get_binding(bo, format | is_dst << 31);
if (offset) {
+ assert(offset >= sna->kgem.surface);
if (is_dst)
kgem_bo_mark_dirty(bo);
return offset * sizeof(uint32_t);
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 3396acd0..8fb47cb6 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -499,6 +499,7 @@ gen5_bind_bo(struct sna *sna,
if (offset) {
if (is_dst)
kgem_bo_mark_dirty(bo);
+ assert(offset >= sna->kgem.surface);
return offset * sizeof(uint32_t);
}
}
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index cf417d4c..08c9f785 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1052,6 +1052,7 @@ gen6_bind_bo(struct sna *sna,
DBG(("[%x] bo(handle=%d), format=%d, reuse %s binding\n",
offset, bo->handle, format,
is_dst ? "render" : "sampler"));
+ assert(offset >= sna->kgem.surface);
if (is_dst)
kgem_bo_mark_dirty(bo);
return offset * sizeof(uint32_t);
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index f15e057f..1574813a 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1286,6 +1286,7 @@ gen7_bind_bo(struct sna *sna,
/* After the first bind, we manage the cache domains within the batch */
offset = kgem_bo_get_binding(bo, format | is_dst << 30 | is_scanout << 31);
if (offset) {
+ assert(offset >= sna->kgem.surface);
if (is_dst)
kgem_bo_mark_dirty(bo);
return offset * sizeof(uint32_t);
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 25fd5285..5c718bc5 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -1303,6 +1303,7 @@ gen8_bind_bo(struct sna *sna,
if (offset) {
if (is_dst)
kgem_bo_mark_dirty(bo);
+ assert(offset >= sna->kgem.surface);
return offset * sizeof(uint32_t);
}