diff options
author | José Fonseca <[email protected]> | 2013-11-27 11:40:14 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2013-11-28 12:19:30 +0000 |
commit | eb040bd54a22e831367939d0acbacdd256ab9d5b (patch) | |
tree | 05cf8acb951c3b1a2f76d01afeeadac5a3806f46 /src/gallium/drivers/trace/tr_context.c | |
parent | eeaa7a05a1322499545dadca33ae5254bcc05fee (diff) |
trace: Dump query results faithfully.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/trace/tr_context.c')
-rw-r--r-- | src/gallium/drivers/trace/tr_context.c | 82 |
1 files changed, 67 insertions, 15 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 6a986571e74..d9afb0aba7c 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -40,7 +40,29 @@ #include "tr_context.h" +struct trace_query +{ + unsigned type; + + struct pipe_query *query; +}; + + +static INLINE struct trace_query * +trace_query(struct pipe_query *query) { + return (struct trace_query *)query; +} + +static INLINE struct pipe_query * +trace_query_unwrap(struct pipe_query *query) +{ + if (query) { + return trace_query(query)->query; + } else { + return NULL; + } +} static INLINE struct pipe_resource * @@ -108,29 +130,46 @@ trace_context_create_query(struct pipe_context *_pipe, { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - struct pipe_query *result; + struct pipe_query *query; trace_dump_call_begin("pipe_context", "create_query"); trace_dump_arg(ptr, pipe); trace_dump_arg(uint, query_type); - result = pipe->create_query(pipe, query_type); + query = pipe->create_query(pipe, query_type); - trace_dump_ret(ptr, result); + trace_dump_ret(ptr, query); trace_dump_call_end(); - return result; + /* Wrap query object. */ + if (query) { + struct trace_query *tr_query = CALLOC_STRUCT(trace_query); + if (tr_query) { + tr_query->type = query_type; + tr_query->query = query; + query = (struct pipe_query *)tr_query; + } else { + pipe->destroy_query(pipe, query); + query = NULL; + } + } + + return query; } static INLINE void trace_context_destroy_query(struct pipe_context *_pipe, - struct pipe_query *query) + struct pipe_query *_query) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; + struct trace_query *tr_query = trace_query(_query); + struct pipe_query *query = tr_query->query; + + FREE(tr_query); trace_dump_call_begin("pipe_context", "destroy_query"); @@ -150,6 +189,8 @@ trace_context_begin_query(struct pipe_context *_pipe, struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; + query = trace_query_unwrap(query); + trace_dump_call_begin("pipe_context", "begin_query"); trace_dump_arg(ptr, pipe); @@ -168,6 +209,8 @@ trace_context_end_query(struct pipe_context *_pipe, struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; + query = trace_query_unwrap(query); + trace_dump_call_begin("pipe_context", "end_query"); trace_dump_arg(ptr, pipe); @@ -181,29 +224,36 @@ trace_context_end_query(struct pipe_context *_pipe, static INLINE boolean trace_context_get_query_result(struct pipe_context *_pipe, - struct pipe_query *query, + struct pipe_query *_query, boolean wait, - union pipe_query_result *presult) + union pipe_query_result *result) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - uint64_t result; - boolean _result; + struct trace_query *tr_query = trace_query(_query); + struct pipe_query *query = tr_query->query; + boolean ret; trace_dump_call_begin("pipe_context", "get_query_result"); trace_dump_arg(ptr, pipe); + trace_dump_arg(ptr, query); - _result = pipe->get_query_result(pipe, query, wait, presult); - /* XXX this depends on the query type */ - result = *((uint64_t*)presult); + ret = pipe->get_query_result(pipe, query, wait, result); - trace_dump_arg(uint, result); - trace_dump_ret(bool, _result); + trace_dump_arg_begin("result"); + if (ret) { + trace_dump_query_result(tr_query->type, result); + } else { + trace_dump_null(); + } + trace_dump_arg_end(); + + trace_dump_ret(bool, ret); trace_dump_call_end(); - return _result; + return ret; } @@ -1408,6 +1458,8 @@ static void trace_context_render_condition(struct pipe_context *_context, struct trace_context *tr_context = trace_context(_context); struct pipe_context *context = tr_context->pipe; + query = trace_query_unwrap(query); + trace_dump_call_begin("pipe_context", "render_condition"); trace_dump_arg(ptr, context); |