diff options
author | Marek Olšák <[email protected]> | 2016-07-16 21:19:48 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-07-23 13:33:42 +0200 |
commit | 1ffe77e7bb2486ea74cda077ed2a9622b758395c (patch) | |
tree | 4a04818614fc8c4e086e9dcd32dbadecbac4b6fb /src/gallium/drivers/rbug | |
parent | 0ba7288376dc66f932336862c8a6abb629b47686 (diff) |
gallium: split transfer_inline_write into buffer and texture callbacks
to reduce the call indirections with u_resource_vtbl.
The worst call tree you could get was:
- u_transfer_inline_write_vtbl
- u_default_transfer_inline_write
- u_transfer_map_vtbl
- driver_transfer_map
- u_transfer_unmap_vtbl
- driver_transfer_unmap
That's 6 indirect calls. Some drivers only had 5. The goal is to have
1 indirect call for drivers that care. The resource type can be determined
statically at most call sites.
The new interface is:
pipe_context::buffer_subdata(ctx, resource, usage, offset, size, data)
pipe_context::texture_subdata(ctx, resource, level, usage, box, data,
stride, layer_stride)
v2: fix whitespace, correct ilo's behavior
Reviewed-by: Nicolai Hähnle <[email protected]>
Acked-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/rbug')
-rw-r--r-- | src/gallium/drivers/rbug/rbug_context.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 77f09b001a8..83914d3615b 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -1141,14 +1141,31 @@ rbug_context_transfer_unmap(struct pipe_context *_context, static void -rbug_context_transfer_inline_write(struct pipe_context *_context, - struct pipe_resource *_resource, - unsigned level, - unsigned usage, - const struct pipe_box *box, - const void *data, - unsigned stride, - unsigned layer_stride) +rbug_context_buffer_subdata(struct pipe_context *_context, + struct pipe_resource *_resource, + unsigned usage, unsigned offset, + unsigned size, const void *data) +{ + struct rbug_context *rb_pipe = rbug_context(_context); + struct rbug_resource *rb_resource = rbug_resource(_resource); + struct pipe_context *context = rb_pipe->pipe; + struct pipe_resource *resource = rb_resource->resource; + + pipe_mutex_lock(rb_pipe->call_mutex); + context->buffer_subdata(context, resource, usage, offset, size, data); + pipe_mutex_unlock(rb_pipe->call_mutex); +} + + +static void +rbug_context_texture_subdata(struct pipe_context *_context, + struct pipe_resource *_resource, + unsigned level, + unsigned usage, + const struct pipe_box *box, + const void *data, + unsigned stride, + unsigned layer_stride) { struct rbug_context *rb_pipe = rbug_context(_context); struct rbug_resource *rb_resource = rbug_resource(_resource); @@ -1156,14 +1173,14 @@ rbug_context_transfer_inline_write(struct pipe_context *_context, struct pipe_resource *resource = rb_resource->resource; pipe_mutex_lock(rb_pipe->call_mutex); - context->transfer_inline_write(context, - resource, - level, - usage, - box, - data, - stride, - layer_stride); + context->texture_subdata(context, + resource, + level, + usage, + box, + data, + stride, + layer_stride); pipe_mutex_unlock(rb_pipe->call_mutex); } @@ -1252,7 +1269,8 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.transfer_map = rbug_context_transfer_map; rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; - rb_pipe->base.transfer_inline_write = rbug_context_transfer_inline_write; + rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata; + rb_pipe->base.texture_subdata = rbug_context_texture_subdata; rb_pipe->pipe = pipe; |