[Mesa-dev] [PATCH v2 10/10] trace: add support for set_shader_buffers

Samuel Pitoiset samuel.pitoiset at gmail.com
Sun Jan 24 06:58:12 PST 2016



On 01/19/2016 03:30 AM, Ilia Mirkin wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
> ---
>   src/gallium/drivers/trace/tr_context.c    | 38 +++++++++++++++++++++++++++++++
>   src/gallium/drivers/trace/tr_dump_state.c | 18 +++++++++++++++
>   src/gallium/drivers/trace/tr_dump_state.h |  2 ++
>   3 files changed, 58 insertions(+)
>
> diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
> index b5ab924..4af4dfe 100644
> --- a/src/gallium/drivers/trace/tr_context.c
> +++ b/src/gallium/drivers/trace/tr_context.c
> @@ -1563,6 +1563,43 @@ static void trace_context_set_tess_state(struct pipe_context *_context,
>   }
>
>
> +static void trace_context_set_shader_buffers(struct pipe_context *_context,
> +                                             unsigned shader,
> +                                             unsigned start, unsigned nr,
> +                                             struct pipe_shader_buffer *buffers)
> +{
> +   struct trace_context *tr_context = trace_context(_context);
> +   struct pipe_context *context = tr_context->pipe;
> +   struct pipe_shader_buffer *_buffers = NULL;
> +
> +   trace_dump_call_begin("pipe_context", "set_shader_buffers");
> +   trace_dump_arg(ptr, context);
> +   trace_dump_arg(uint, shader);
> +   trace_dump_arg(uint, start);
> +   trace_dump_struct_array(shader_buffer, buffers, nr);

According to the other places where trace_dump_struct_array() is used, 
this should be:

trace_dump_arg_begin("buffers");
trace_dump_struct_array(shader_buffer, buffers, nr);
trace_dump_arg_end();

> +   trace_dump_call_end();
> +
> +   if (buffers) {
> +      int i;
> +
> +      _buffers = MALLOC(nr * sizeof(struct pipe_shader_buffer));
> +      if (!_buffers)
> +         return;
> +
> +      for (i = 0; i < nr; i++) {
> +         _buffers[i] = buffers[i];
> +         _buffers[i].buffer = trace_resource_unwrap(
> +            tr_context, _buffers[i].buffer);
> +      }
> +   }
> +
> +   context->set_shader_buffers(context, shader, start, nr, _buffers);
> +
> +   if (_buffers)
> +      FREE(_buffers);
> +}
> +
> +
>   static const struct debug_named_value rbug_blocker_flags[] = {
>      {"before", 1, NULL},
>      {"after", 2, NULL},
> @@ -1660,6 +1697,7 @@ trace_context_create(struct trace_screen *tr_scr,
>      TR_CTX_INIT(texture_barrier);
>      TR_CTX_INIT(memory_barrier);
>      TR_CTX_INIT(set_tess_state);
> +   TR_CTX_INIT(set_shader_buffers);
>
>      TR_CTX_INIT(transfer_map);
>      TR_CTX_INIT(transfer_unmap);
> diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
> index 54f022a..cfbf53c 100644
> --- a/src/gallium/drivers/trace/tr_dump_state.c
> +++ b/src/gallium/drivers/trace/tr_dump_state.c
> @@ -688,6 +688,24 @@ void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
>   }
>
>
> +void trace_dump_shader_buffer(const struct pipe_shader_buffer *state)
> +{
> +   if (!trace_dumping_enabled_locked())
> +      return;
> +
> +   if(!state) {
> +      trace_dump_null();
> +      return;
> +   }
> +
> +   trace_dump_struct_begin("pipe_shader_buffer");
> +   trace_dump_member(resource_ptr, state, buffer);
> +   trace_dump_member(uint, state, buffer_offset);
> +   trace_dump_member(uint, state, buffer_size);
> +   trace_dump_struct_end();
> +}
> +
> +
>   void trace_dump_draw_info(const struct pipe_draw_info *state)
>   {
>      if (!trace_dumping_enabled_locked())
> diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h
> index 117b3c7..4f4ade1 100644
> --- a/src/gallium/drivers/trace/tr_dump_state.h
> +++ b/src/gallium/drivers/trace/tr_dump_state.h
> @@ -78,6 +78,8 @@ void trace_dump_vertex_element(const struct pipe_vertex_element *state);
>
>   void trace_dump_constant_buffer(const struct pipe_constant_buffer *state);
>
> +void trace_dump_shader_buffer(const struct pipe_shader_buffer *buffer);
> +
>   void trace_dump_draw_info(const struct pipe_draw_info *state);
>
>   void trace_dump_blit_info(const struct pipe_blit_info *);
>


More information about the mesa-dev mailing list