[Mesa-dev] [PATCH 3/3] i965: if DEBUG_OUT_OF_BOUND_CHK is up, check that noise padding for each bo used in batchbuffer is correct
Jason Ekstrand
jason at jlekstrand.net
Tue Dec 12 21:26:27 UTC 2017
On Fri, Dec 8, 2017 at 2:54 AM, <kevin.rogovin at intel.com> wrote:
> 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 | 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
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171212/17379e72/attachment.html>
More information about the mesa-dev
mailing list