[Mesa-dev] [PATCH 3/6] rbug: implement streamout context functions

Roland Scheidegger sroland at vmware.com
Mon Aug 18 16:12:02 PDT 2014


Am 18.08.2014 23:24, schrieb Marek Olšák:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/gallium/drivers/rbug/rbug_context.c | 46 +++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
> index d6fca2e..71bc216 100644
> --- a/src/gallium/drivers/rbug/rbug_context.c
> +++ b/src/gallium/drivers/rbug/rbug_context.c
> @@ -803,6 +803,49 @@ rbug_set_sample_mask(struct pipe_context *_pipe,
>     pipe_mutex_unlock(rb_pipe->call_mutex);
>  }
>  
> +static struct pipe_stream_output_target *
> +rbug_create_stream_output_target(struct pipe_context *_pipe,
> +                                 struct pipe_resource *_res,
> +                                 unsigned buffer_offset, unsigned buffer_size)
> +{
> +   struct rbug_context *rb_pipe = rbug_context(_pipe);
> +   struct pipe_context *pipe = rb_pipe->pipe;
> +   struct pipe_resource *res = rbug_resource_unwrap(_res);
> +   struct pipe_stream_output_target *target;
> +
> +   pipe_mutex_lock(rb_pipe->call_mutex);
> +   target = pipe->create_stream_output_target(pipe, res, buffer_offset,
> +                                              buffer_size);
> +   pipe_mutex_unlock(rb_pipe->call_mutex);
> +   return target;
> +}
> +
> +static void
> +rbug_stream_output_target_destroy(struct pipe_context *_pipe,
> +                                  struct pipe_stream_output_target *target)
> +{
> +   struct rbug_context *rb_pipe = rbug_context(_pipe);
> +   struct pipe_context *pipe = rb_pipe->pipe;
> +
> +   pipe_mutex_lock(rb_pipe->call_mutex);
> +   pipe->stream_output_target_destroy(pipe, target);
> +   pipe_mutex_unlock(rb_pipe->call_mutex);
> +}
> +
> +static void
> +rbug_set_stream_output_targets(struct pipe_context *_pipe,
> +                               unsigned num_targets,
> +                               struct pipe_stream_output_target **targets,
> +                               const unsigned *offsets)
> +{
> +   struct rbug_context *rb_pipe = rbug_context(_pipe);
> +   struct pipe_context *pipe = rb_pipe->pipe;
> +
> +   pipe_mutex_lock(rb_pipe->call_mutex);
> +   pipe->set_stream_output_targets(pipe, num_targets, targets, offsets);
> +   pipe_mutex_unlock(rb_pipe->call_mutex);
> +}
> +
>  static void
>  rbug_resource_copy_region(struct pipe_context *_pipe,
>                            struct pipe_resource *_dst,
> @@ -1174,6 +1217,9 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
>     rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers;
>     rb_pipe->base.set_index_buffer = rbug_set_index_buffer;
>     rb_pipe->base.set_sample_mask = rbug_set_sample_mask;
> +   rb_pipe->base.create_stream_output_target = rbug_create_stream_output_target;
> +   rb_pipe->base.stream_output_target_destroy = rbug_stream_output_target_destroy;
> +   rb_pipe->base.set_stream_output_targets = rbug_set_stream_output_targets;
>     rb_pipe->base.resource_copy_region = rbug_resource_copy_region;
>     rb_pipe->base.blit = rbug_blit;
>     rb_pipe->base.flush_resource = rbug_flush_resource;
> 

Wouldn't it be better if we'd wrap that too?
I guess though it's better than what we've got so

Reviewed-by: Roland Scheidegger <sroland at vmware.com>


More information about the mesa-dev mailing list