From: Kevin Rogovin <kevin.rogo...@intel.com> Signed-off-by: Kevin Rogovin <kevin.rogo...@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 a17e169925..7ae945c71c 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -939,11 +939,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.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev