On Fri, Dec 8, 2017 at 2:54 AM, <[email protected]> wrote:
> From: Kevin Rogovin <[email protected]>
>
> Signed-off-by: Kevin Rogovin <[email protected]>
> ---
> src/mesa/drivers/dri/i965/intel_batchbuffer.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> index 91a6506..549ea3e 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> @@ -758,6 +758,7 @@ execbuffer(int fd,
> };
>
> unsigned long cmd = DRM_IOCTL_I915_GEM_EXECBUFFER2;
> + bool detected_out_of_bounds_write = false;
>
> if (in_fence != -1) {
> execbuf.rsvd2 = in_fence;
> @@ -787,6 +788,20 @@ execbuffer(int fd,
> batch->validation_list[i].offset);
> bo->gtt_offset = batch->validation_list[i].offset;
> }
> +
> + if (unlikely(INTEL_DEBUG & DEBUG_OUT_OF_BOUND_CHK)) {
> + 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);
> + }
> + }
> + }
>
I think you want to do this at the end of submit_batch instead and add a
brw_bo_wait_rendering on the batch. Otherwise, your bounds checking is
racing with the GPU.
> +
> + if (unlikely(detected_out_of_bounds_write)) {
> + abort();
> }
>
> if (ret == 0 && out_fence != NULL)
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev