[Mesa-dev] [PATCH 18/18] trace: add all compute related functions

Marek Olšák maraeo at gmail.com
Tue Jan 26 03:47:06 PST 2016


On Sun, Jan 24, 2016 at 10:18 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>
> I have forgot this one...
>
>  src/gallium/drivers/trace/tr_context.c    | 80 +++++++++++++++++++++++++++++++
>  src/gallium/drivers/trace/tr_dump_state.c | 51 ++++++++++++++++++++
>  src/gallium/drivers/trace/tr_dump_state.h |  4 ++
>  src/gallium/drivers/trace/tr_screen.c     | 25 ++++++++++
>  4 files changed, 160 insertions(+)
>
> diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
> index 4af4dfe..a508a49 100644
> --- a/src/gallium/drivers/trace/tr_context.c
> +++ b/src/gallium/drivers/trace/tr_context.c
> @@ -560,6 +560,51 @@ TRACE_SHADER_STATE(tes)
>
>
>  static inline void *
> +trace_context_create_compute_state(struct pipe_context *_pipe,
> +                                   const struct pipe_compute_state *state)
> +{
> +   struct trace_context *tr_ctx = trace_context(_pipe);
> +   struct pipe_context *pipe = tr_ctx->pipe;
> +   void * result;
> +
> +   trace_dump_call_begin("pipe_context", "create_compute_state");
> +   trace_dump_arg(ptr, pipe);
> +   trace_dump_arg(compute_state, state);
> +   result = pipe->create_compute_state(pipe, state);
> +   trace_dump_ret(ptr, result);
> +   trace_dump_call_end();
> +   return result;
> +}
> +
> +static inline void
> +trace_context_bind_compute_state(struct pipe_context *_pipe,
> +                                 void *state)
> +{
> +   struct trace_context *tr_ctx = trace_context(_pipe);
> +   struct pipe_context *pipe = tr_ctx->pipe;
> +
> +   trace_dump_call_begin("pipe_context", "bind_compute_state");
> +   trace_dump_arg(ptr, pipe);
> +   trace_dump_arg(ptr, state);
> +   pipe->bind_compute_state(pipe, state);
> +   trace_dump_call_end();
> +}
> +
> +static inline void
> +trace_context_delete_compute_state(struct pipe_context *_pipe,
> +                                   void *state)
> +{
> +   struct trace_context *tr_ctx = trace_context(_pipe);
> +   struct pipe_context *pipe = tr_ctx->pipe;
> +
> +   trace_dump_call_begin("pipe_context", "delete_compute_state");
> +   trace_dump_arg(ptr, pipe);
> +   trace_dump_arg(ptr, state);
> +   pipe->delete_compute_state(pipe, state);
> +   trace_dump_call_end();
> +}
> +
> +static inline void *
>  trace_context_create_vertex_elements_state(struct pipe_context *_pipe,
>                                             unsigned num_elements,
>                                             const struct  pipe_vertex_element *elements)
> @@ -1599,6 +1644,37 @@ static void trace_context_set_shader_buffers(struct pipe_context *_context,
>        FREE(_buffers);
>  }
>
> +static void trace_context_launch_grid(struct pipe_context *_pipe,
> +                                      const struct pipe_grid_info *info)
> +{
> +   struct trace_context *tr_ctx = trace_context(_pipe);
> +   struct pipe_context *pipe = tr_ctx->pipe;
> +
> +   trace_dump_call_begin("pipe_context", "launch_grid");
> +
> +   trace_dump_arg(ptr,  pipe);
> +   trace_dump_arg(grid_info, info);
> +
> +   trace_dump_trace_flush();
> +
> +   if (info->indirect) {
> +      struct pipe_grid_info *_info = NULL;
> +
> +      _info = MALLOC(sizeof(*_info));
> +      if (!_info)
> +         return;

There is no reason to use malloc here.

Marek


More information about the mesa-dev mailing list