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 <charmainel@vmware.com> Reviewed-by: Neha Bhende <bhenden@vmware.com>tags/18.0-branchpoint
@@ -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; | |||
} | |||
@@ -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; | |||
} | |||
@@ -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 |
@@ -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"); | |||
} |
@@ -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 | |||
@@ -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; | |||
}; | |||