summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_context.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-07-16 21:19:48 +0200
committerMarek Olšák <[email protected]>2016-07-23 13:33:42 +0200
commit1ffe77e7bb2486ea74cda077ed2a9622b758395c (patch)
tree4a04818614fc8c4e086e9dcd32dbadecbac4b6fb /src/gallium/drivers/trace/tr_context.c
parent0ba7288376dc66f932336862c8a6abb629b47686 (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/trace/tr_context.c')
-rw-r--r--src/gallium/drivers/trace/tr_context.c67
1 files changed, 52 insertions, 15 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index c1ad991eede..65d7f4eca79 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1470,7 +1470,7 @@ trace_context_transfer_map(struct pipe_context *_context,
/*
* Map and transfers can't be serialized so we convert all write transfers
- * to transfer_inline_write and ignore read transfers.
+ * to texture/buffer_subdata and ignore read transfers.
*/
map = context->transfer_map(context, texture, level, usage, box, &result);
@@ -1512,7 +1512,7 @@ trace_context_transfer_unmap(struct pipe_context *_context,
if (tr_trans->map) {
/*
- * Fake a transfer_inline_write
+ * Fake a texture/buffer_subdata
*/
struct pipe_resource *resource = transfer->resource;
@@ -1522,7 +1522,10 @@ trace_context_transfer_unmap(struct pipe_context *_context,
unsigned stride = transfer->stride;
unsigned layer_stride = transfer->layer_stride;
- trace_dump_call_begin("pipe_context", "transfer_inline_write");
+ if (resource->target == PIPE_BUFFER)
+ trace_dump_call_begin("pipe_context", "buffer_subdata");
+ else
+ trace_dump_call_begin("pipe_context", "texture_subdata");
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, resource);
@@ -1552,14 +1555,47 @@ trace_context_transfer_unmap(struct pipe_context *_context,
static void
-trace_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)
+trace_context_buffer_subdata(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ unsigned usage, unsigned offset,
+ unsigned size, const void *data)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_resource *tr_res = trace_resource(_resource);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_resource *resource = tr_res->resource;
+ struct pipe_box box;
+
+ assert(resource->screen == context->screen);
+
+ trace_dump_call_begin("pipe_context", "buffer_subdata");
+
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, resource);
+ trace_dump_arg(uint, usage);
+ trace_dump_arg(uint, offset);
+ trace_dump_arg(uint, size);
+
+ trace_dump_arg_begin("data");
+ u_box_1d(offset, size, &box);
+ trace_dump_box_bytes(data, resource, &box, 0, 0);
+ trace_dump_arg_end();
+
+ trace_dump_call_end();
+
+ context->buffer_subdata(context, resource, usage, offset, size, data);
+}
+
+
+static void
+trace_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 trace_context *tr_context = trace_context(_context);
struct trace_resource *tr_res = trace_resource(_resource);
@@ -1568,7 +1604,7 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
assert(resource->screen == context->screen);
- trace_dump_call_begin("pipe_context", "transfer_inline_write");
+ trace_dump_call_begin("pipe_context", "texture_subdata");
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, resource);
@@ -1589,8 +1625,8 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
trace_dump_call_end();
- 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);
}
@@ -1873,7 +1909,8 @@ trace_context_create(struct trace_screen *tr_scr,
TR_CTX_INIT(transfer_map);
TR_CTX_INIT(transfer_unmap);
TR_CTX_INIT(transfer_flush_region);
- TR_CTX_INIT(transfer_inline_write);
+ TR_CTX_INIT(buffer_subdata);
+ TR_CTX_INIT(texture_subdata);
#undef TR_CTX_INIT