diff options
author | Brian Paul <[email protected]> | 2018-01-11 11:17:45 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-01-17 11:17:56 -0700 |
commit | 7027d9c1fd2a1bc0ef3cd523d407367f81a6eed5 (patch) | |
tree | d0a810bf5e33f6a10b803dca23a6f977e67c4768 /src | |
parent | 92840bd27683996d1de86fbc5b95be798f99796b (diff) |
svga: add num-commands-per-draw HUD query
This query shows the ratio of total commands vs. drawing commands sent
to the vgpu device. This gives some idea of how many state changes
are sent per draw call. The closer the ratio is to 1.0, the better.
Reviewed-by: Charmaine Lee <[email protected]>
Reviewed-by: Neha Bhende <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/svga/svga_cmd.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_cmd_vgpu10.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_query.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_winsys.h | 4 |
6 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c index 7b78cb73547..2bd1cc21a75 100644 --- a/src/gallium/drivers/svga/svga_cmd.c +++ b/src/gallium/drivers/svga/svga_cmd.c @@ -121,6 +121,8 @@ SVGA3D_FIFOReserve(struct svga_winsys_context *swc, swc->last_command = cmd; + swc->num_commands++; + return &header[1]; } @@ -1022,6 +1024,8 @@ SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc, swc->hints |= SVGA_HINT_FLAG_CAN_PRE_FLUSH; + swc->num_draw_commands++; + return PIPE_OK; } diff --git a/src/gallium/drivers/svga/svga_cmd_vgpu10.c b/src/gallium/drivers/svga/svga_cmd_vgpu10.c index 55465f53030..bed1403ac1b 100644 --- a/src/gallium/drivers/svga/svga_cmd_vgpu10.c +++ b/src/gallium/drivers/svga/svga_cmd_vgpu10.c @@ -537,6 +537,7 @@ SVGA3D_vgpu10_Draw(struct svga_winsys_context *swc, swc->hints |= SVGA_HINT_FLAG_CAN_PRE_FLUSH; swc->commit(swc); + swc->num_draw_commands++; return PIPE_OK; } @@ -553,6 +554,7 @@ SVGA3D_vgpu10_DrawIndexed(struct svga_winsys_context *swc, swc->hints |= SVGA_HINT_FLAG_CAN_PRE_FLUSH; swc->commit(swc); + swc->num_draw_commands++; return PIPE_OK; } @@ -570,6 +572,7 @@ SVGA3D_vgpu10_DrawInstanced(struct svga_winsys_context *swc, swc->hints |= SVGA_HINT_FLAG_CAN_PRE_FLUSH; swc->commit(swc); + swc->num_draw_commands++; return PIPE_OK; } @@ -590,6 +593,7 @@ SVGA3D_vgpu10_DrawIndexedInstanced(struct svga_winsys_context *swc, swc->hints |= SVGA_HINT_FLAG_CAN_PRE_FLUSH; swc->commit(swc); + swc->num_draw_commands++; return PIPE_OK; } @@ -600,6 +604,7 @@ SVGA3D_vgpu10_DrawAuto(struct svga_winsys_context *swc) swc->hints |= SVGA_HINT_FLAG_CAN_PRE_FLUSH; swc->commit(swc); + swc->num_draw_commands++; return PIPE_OK; } diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index fd0c31222e6..bc881c943d6 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -73,6 +73,7 @@ enum svga_hud { SVGA_QUERY_NUM_SURFACE_VIEWS, SVGA_QUERY_NUM_GENERATE_MIPMAP, SVGA_QUERY_NUM_FAILED_ALLOCATIONS, + SVGA_QUERY_NUM_COMMANDS_PER_DRAW, /*SVGA_QUERY_MAX has to be last because it is size of an array*/ SVGA_QUERY_MAX diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 26924524372..cec95ed3b6f 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -751,6 +751,7 @@ svga_create_query(struct pipe_context *pipe, case SVGA_QUERY_NUM_CONST_BUF_UPDATES: case SVGA_QUERY_NUM_CONST_UPDATES: case SVGA_QUERY_NUM_FAILED_ALLOCATIONS: + case SVGA_QUERY_NUM_COMMANDS_PER_DRAW: break; case SVGA_QUERY_FLUSH_TIME: case SVGA_QUERY_MAP_BUFFER_TIME: @@ -832,6 +833,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_NUM_CONST_BUF_UPDATES: case SVGA_QUERY_NUM_CONST_UPDATES: case SVGA_QUERY_NUM_FAILED_ALLOCATIONS: + case SVGA_QUERY_NUM_COMMANDS_PER_DRAW: /* nothing */ break; default: @@ -945,6 +947,7 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_NUM_SURFACE_VIEWS: case SVGA_QUERY_NUM_GENERATE_MIPMAP: case SVGA_QUERY_NUM_FAILED_ALLOCATIONS: + case SVGA_QUERY_NUM_COMMANDS_PER_DRAW: /* nothing */ break; default: @@ -1059,6 +1062,7 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_NUM_SURFACE_VIEWS: case SVGA_QUERY_NUM_GENERATE_MIPMAP: case SVGA_QUERY_NUM_FAILED_ALLOCATIONS: + case SVGA_QUERY_NUM_COMMANDS_PER_DRAW: /* nothing */ break; default: @@ -1196,6 +1200,10 @@ svga_get_query_result(struct pipe_context *pipe, case SVGA_QUERY_NUM_FAILED_ALLOCATIONS: vresult->u64 = svgascreen->hud.num_failed_allocations; break; + case SVGA_QUERY_NUM_COMMANDS_PER_DRAW: + vresult->f = (float) svga->swc->num_commands + / (float) svga->swc->num_draw_commands; + break; default: assert(!"unexpected query type in svga_get_query_result"); } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 534e94ab22b..5d9d024e768 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -845,6 +845,8 @@ svga_get_driver_query_info(struct pipe_screen *screen, PIPE_DRIVER_QUERY_TYPE_UINT64), QUERY("num-failed-allocations", SVGA_QUERY_NUM_FAILED_ALLOCATIONS, PIPE_DRIVER_QUERY_TYPE_UINT64), + QUERY("num-commands-per-draw", SVGA_QUERY_NUM_COMMANDS_PER_DRAW, + PIPE_DRIVER_QUERY_TYPE_FLOAT), }; #undef QUERY diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h index e74d1ca4d72..f0db3e97cc0 100644 --- a/src/gallium/drivers/svga/svga_winsys.h +++ b/src/gallium/drivers/svga/svga_winsys.h @@ -453,6 +453,10 @@ struct svga_winsys_context /** The more recent command issued to command buffer */ SVGAFifo3dCmdId last_command; + + /** For HUD queries */ + uint64_t num_commands; + uint64_t num_draw_commands; }; |