[Mesa-dev] [PATCH] trace: fix a segfault when tracing indirect draw calls

Ilia Mirkin imirkin at alum.mit.edu
Sun Jan 24 08:02:56 PST 2016


On Sun, Jan 24, 2016 at 10:47 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Like other resources, the indirect draw buffer must be unwrapped.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/gallium/drivers/trace/tr_context.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
> index 5017669..56e7818 100644
> --- a/src/gallium/drivers/trace/tr_context.c
> +++ b/src/gallium/drivers/trace/tr_context.c
> @@ -119,7 +119,20 @@ trace_context_draw_vbo(struct pipe_context *_pipe,
>
>     trace_dump_trace_flush();
>
> -   pipe->draw_vbo(pipe, info);
> +   if (info->indirect) {
> +      struct pipe_draw_info *_info = NULL;
> +
> +      _info = MALLOC(sizeof(*_info));
> +      if (!_info)
> +         return;
> +
> +      memcpy(_info, info, sizeof(*_info));
> +      _info->indirect = trace_resource_unwrap(tr_ctx, _info->indirect);

While you're at it, can you also do this for indirect_params?

> +      pipe->draw_vbo(pipe, _info);
> +      FREE(_info);
> +   } else {
> +      pipe->draw_vbo(pipe, info);
> +   }
>
>     trace_dump_call_end();
>  }
> --
> 2.6.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list