[Mesa-dev] [PATCH v3 3/3] i965: if DEBUG_OUT_OF_BOUND_CHK is up, check that noise padding for each bo used in batchbuffer is correct
kevin.rogovin at intel.com
kevin.rogovin at intel.com
Fri Jan 26 08:56:08 UTC 2018
From: Kevin Rogovin <kevin.rogovin at intel.com>
Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
---
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 02bfd3f333..fc6998a7ca 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -1019,11 +1019,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_OUT_OF_BOUND_CHK))) {
fprintf(stderr, "waiting for idle\n");
brw_bo_wait_rendering(brw->batch.batch.bo);
}
+ if (unlikely(INTEL_DEBUG & DEBUG_OUT_OF_BOUND_CHK)) {
+ 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.15.1
More information about the mesa-dev
mailing list