[Mesa-dev] [PATCH] trace: remove useless MALLOC() in trace_context_draw_vbo()

Ilia Mirkin imirkin at alum.mit.edu
Sun Feb 7 21:54:21 UTC 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

Please double-check that GALLIUM_TRACE=foo and
bin/arb_indirect_parameters-tf-count -fbo -auto work together.

On Sun, Feb 7, 2016 at 4:36 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> There is no need to allocate memory when unwrapping the indirect buf.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/gallium/drivers/trace/tr_context.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
> index b04c88d..2280898 100644
> --- a/src/gallium/drivers/trace/tr_context.c
> +++ b/src/gallium/drivers/trace/tr_context.c
> @@ -120,18 +120,13 @@ trace_context_draw_vbo(struct pipe_context *_pipe,
>     trace_dump_trace_flush();
>
>     if (info->indirect) {
> -      struct pipe_draw_info *_info = NULL;
> +      struct pipe_draw_info _info;
>
> -      _info = MALLOC(sizeof(*_info));
> -      if (!_info)
> -         return;
> -
> -      memcpy(_info, info, sizeof(*_info));
> -      _info->indirect = trace_resource_unwrap(tr_ctx, _info->indirect);
> -      _info->indirect_params = trace_resource_unwrap(tr_ctx,
> -                                                     _info->indirect_params);
> -      pipe->draw_vbo(pipe, _info);
> -      FREE(_info);
> +      memcpy(&_info, info, sizeof(_info));
> +      _info.indirect = trace_resource_unwrap(tr_ctx, _info.indirect);
> +      _info.indirect_params = trace_resource_unwrap(tr_ctx,
> +                                                    _info.indirect_params);
> +      pipe->draw_vbo(pipe, &_info);
>     } else {
>        pipe->draw_vbo(pipe, info);
>     }
> --
> 2.6.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list