From: Kevin Rogovin <[email protected]>
Signed-off-by: Kevin Rogovin <[email protected]>
---
src/mesa/drivers/dri/i965/intel_batchbuffer.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 86d88a701f..749a384def 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -1023,11 +1023,31 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,
ret = submit_batch(brw, in_fence_fd, out_fence_fd);
- if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) {
+ if (unlikely(INTEL_DEBUG & (DEBUG_SYNC | DEBUG_CHECK_OOB))) {
fprintf(stderr, "waiting for idle\n");
brw_bo_wait_rendering(brw->batch.batch.bo);
}
+ if (unlikely(INTEL_DEBUG & DEBUG_CHECK_OOB)) {
+ bool detected_out_of_bounds_write = false;
+
+ for (int i = 0; i < brw->batch.exec_count; i++) {
+ struct brw_bo *bo = brw->batch.exec_bos[i];
+
+ if (!brw_bo_padding_is_good(bo)) {
+ detected_out_of_bounds_write = true;
+ fprintf(stderr,
+ "Detected buffer out-of-bounds write from brw_bo %p "
+ "(GEM %u, label = \"%s\")\n",
+ bo, bo->gem_handle, bo->name);
+ }
+ }
+
+ if (unlikely(detected_out_of_bounds_write)) {
+ abort();
+ }
+ }
+
/* Start a new batch buffer. */
brw_new_batch(brw);
--
2.16.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev