diff options
author | Brian Paul <[email protected]> | 2013-04-01 17:51:43 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2013-04-03 09:56:08 -0600 |
commit | 3838edaf5d3f75ca5c2276db22ea0b96fce2bad7 (patch) | |
tree | bfbf4127c4d08f694bbe74100d827deb45f84c7f /src/gallium/drivers/svga/svga_pipe_query.c | |
parent | 49ed1f3cb335fada1f9ee26d5420889292da3c92 (diff) |
svga: add HUD queries for number of draw calls, number of fallbacks
The fallbacks count is the number of drawing calls that use a "draw"
module fallback, such as polygon stipple.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_pipe_query.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_query.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 5cfebaf6f79..11f6a052730 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -51,6 +51,9 @@ struct svga_query { struct svga_winsys_buffer *hwbuf; volatile SVGA3dQueryResult *queryResult; struct pipe_fence_handle *fence; + + /** For non-GPU SVGA_QUERY_x queries */ + uint64_t begin_count, end_count; }; /*********************************************************************** @@ -106,6 +109,9 @@ static struct pipe_query *svga_create_query( struct pipe_context *pipe, */ sws->buffer_unmap(sws, sq->hwbuf); break; + case SVGA_QUERY_DRAW_CALLS: + case SVGA_QUERY_FALLBACKS: + break; default: assert(!"unexpected query type in svga_create_query()"); } @@ -136,6 +142,10 @@ static void svga_destroy_query(struct pipe_context *pipe, sws->buffer_destroy(sws, sq->hwbuf); sws->fence_reference(sws, &sq->fence, NULL); break; + case SVGA_QUERY_DRAW_CALLS: + case SVGA_QUERY_FALLBACKS: + /* nothing */ + break; default: assert(!"svga: unexpected query type in svga_destroy_query()"); } @@ -187,6 +197,12 @@ static void svga_begin_query(struct pipe_context *pipe, svga->sq = sq; break; + case SVGA_QUERY_DRAW_CALLS: + sq->begin_count = svga->num_draw_calls; + break; + case SVGA_QUERY_FALLBACKS: + sq->begin_count = svga->num_fallbacks; + break; default: assert(!"unexpected query type in svga_begin_query()"); } @@ -224,6 +240,12 @@ static void svga_end_query(struct pipe_context *pipe, svga->sq = NULL; break; + case SVGA_QUERY_DRAW_CALLS: + sq->end_count = svga->num_draw_calls; + break; + case SVGA_QUERY_FALLBACKS: + sq->end_count = svga->num_fallbacks; + break; default: assert(!"unexpected query type in svga_end_query()"); } @@ -277,6 +299,11 @@ static boolean svga_get_query_result(struct pipe_context *pipe, *result = (uint64_t)sq->queryResult->result32; break; + case SVGA_QUERY_DRAW_CALLS: + /* fall-through */ + case SVGA_QUERY_FALLBACKS: + vresult->u64 = sq->end_count - sq->begin_count; + break; default: assert(!"unexpected query type in svga_get_query_result"); } |