From 4e8763cb0904c30d1962cf5ad52fe3a87be7b4bd Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Sat, 6 Aug 2016 20:10:14 -0600 Subject: swr: [rasterizer core] split FE and BE stats Separated FE stats out into its own structure. There are 17 FE vs 3 BE stat fields. Since there is only one FE thread per DC then we don't have to loop over all threads and sum up FE stats over all the worker threads. This also reduces size of DC since we only need to store one copy of the FE stats and not one per worker. Finally, we can use the new FE callback mechanism to update these. Signed-off-by: Tim Rowley --- src/gallium/drivers/swr/swr_query.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src/gallium/drivers/swr/swr_query.cpp') diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp index 35d0e53fb23..c51c529e5f3 100644 --- a/src/gallium/drivers/swr/swr_query.cpp +++ b/src/gallium/drivers/swr/swr_query.cpp @@ -94,6 +94,7 @@ swr_gather_stats(struct pipe_context *pipe, struct swr_query *pq) /* TODO: should fence instead of stalling pipeline */ SwrWaitForIdle(ctx->swrContext); memcpy(&result->core, &ctx->stats, sizeof(result->core)); + memcpy(&result->coreFE, &ctx->statsFE, sizeof(result->coreFE)); #if 0 if (!pq->fence) { @@ -150,17 +151,17 @@ swr_get_query_result(struct pipe_context *pipe, result->u64 = end->timestamp - start->timestamp; break; case PIPE_QUERY_PRIMITIVES_GENERATED: - result->u64 = end->core.IaPrimitives - start->core.IaPrimitives; + result->u64 = end->coreFE.IaPrimitives - start->coreFE.IaPrimitives; break; case PIPE_QUERY_PRIMITIVES_EMITTED: - result->u64 = end->core.SoNumPrimsWritten[index] - - start->core.SoNumPrimsWritten[index]; + result->u64 = end->coreFE.SoNumPrimsWritten[index] + - start->coreFE.SoNumPrimsWritten[index]; break; /* Structures */ case PIPE_QUERY_SO_STATISTICS: { struct pipe_query_data_so_statistics *so_stats = &result->so_statistics; - struct SWR_STATS *start = &pq->start.core; - struct SWR_STATS *end = &pq->end.core; + struct SWR_STATS_FE *start = &pq->start.coreFE; + struct SWR_STATS_FE *end = &pq->end.coreFE; so_stats->num_primitives_written = end->SoNumPrimsWritten[index] - start->SoNumPrimsWritten[index]; so_stats->primitives_storage_needed = @@ -176,21 +177,23 @@ swr_get_query_result(struct pipe_context *pipe, &result->pipeline_statistics; struct SWR_STATS *start = &pq->start.core; struct SWR_STATS *end = &pq->end.core; - p_stats->ia_vertices = end->IaVertices - start->IaVertices; - p_stats->ia_primitives = end->IaPrimitives - start->IaPrimitives; - p_stats->vs_invocations = end->VsInvocations - start->VsInvocations; - p_stats->gs_invocations = end->GsInvocations - start->GsInvocations; - p_stats->gs_primitives = end->GsPrimitives - start->GsPrimitives; - p_stats->c_invocations = end->CPrimitives - start->CPrimitives; - p_stats->c_primitives = end->CPrimitives - start->CPrimitives; + struct SWR_STATS_FE *startFE = &pq->start.coreFE; + struct SWR_STATS_FE *endFE = &pq->end.coreFE; + p_stats->ia_vertices = endFE->IaVertices - startFE->IaVertices; + p_stats->ia_primitives = endFE->IaPrimitives - startFE->IaPrimitives; + p_stats->vs_invocations = endFE->VsInvocations - startFE->VsInvocations; + p_stats->gs_invocations = endFE->GsInvocations - startFE->GsInvocations; + p_stats->gs_primitives = endFE->GsPrimitives - startFE->GsPrimitives; + p_stats->c_invocations = endFE->CPrimitives - startFE->CPrimitives; + p_stats->c_primitives = endFE->CPrimitives - startFE->CPrimitives; p_stats->ps_invocations = end->PsInvocations - start->PsInvocations; - p_stats->hs_invocations = end->HsInvocations - start->HsInvocations; - p_stats->ds_invocations = end->DsInvocations - start->DsInvocations; + p_stats->hs_invocations = endFE->HsInvocations - startFE->HsInvocations; + p_stats->ds_invocations = endFE->DsInvocations - startFE->DsInvocations; p_stats->cs_invocations = end->CsInvocations - start->CsInvocations; } break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: { - struct SWR_STATS *start = &pq->start.core; - struct SWR_STATS *end = &pq->end.core; + struct SWR_STATS_FE *start = &pq->start.coreFE; + struct SWR_STATS_FE *end = &pq->end.coreFE; uint64_t num_primitives_written = end->SoNumPrimsWritten[index] - start->SoNumPrimsWritten[index]; uint64_t primitives_storage_needed = -- cgit v1.2.3