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>
This commit is contained in:
Chris Wilson 2014-01-29 13:06:08 +00:00
parent 001dd080e1
commit 7df3da10e7
5 changed files with 5 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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