From 538e5059d0fcc66b2f84d8bdd29e296e54968418 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 17 Mar 2021 21:15:57 -0700 Subject: [PATCH] freedreno: Don't count SW TF queries on a6xx. On a6xx, since we have GS and tess, we do this counting in hardware. The next fix is going to use some functions that don't work with GS prims. Part-of: --- .../drivers/freedreno/freedreno_draw.c | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index db064aba297..2c091656080 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -230,31 +230,33 @@ update_draw_stats(struct fd_context *ctx, const struct pipe_draw_info *info, const struct pipe_draw_start_count *draws, unsigned num_draws) assert_dt { - /* Counting prims in sw doesn't work for GS and tesselation. For older - * gens we don't have those stages and don't have the hw counters enabled, - * so keep the count accurate for non-patch geometry. - */ - unsigned prims = 0; - if ((info->mode != PIPE_PRIM_PATCHES) && - (info->mode != PIPE_PRIM_MAX)) { - for (unsigned i = 0; i < num_draws; i++) { - prims += u_reduced_prims_for_vertices(info->mode, draws[i].count); - } - } - ctx->stats.draw_calls++; - /* TODO prims_emitted should be clipped when the stream-out buffer is - * not large enough. See max_tf_vtx().. probably need to move that - * into common code. Although a bit more annoying since a2xx doesn't - * use ir3 so no common way to get at the pipe_stream_output_info - * which is needed for this calculation. - */ - if (ctx->streamout.num_targets > 0) { - assert(ctx->active_queries); - ctx->stats.prims_emitted += prims; + if (ctx->screen->gpu_id < 600) { + /* Counting prims in sw doesn't work for GS and tesselation. For older + * gens we don't have those stages and don't have the hw counters enabled, + * so keep the count accurate for non-patch geometry. + */ + unsigned prims = 0; + if ((info->mode != PIPE_PRIM_PATCHES) && + (info->mode != PIPE_PRIM_MAX)) { + for (unsigned i = 0; i < num_draws; i++) { + prims += u_reduced_prims_for_vertices(info->mode, draws[i].count); + } + } + + /* TODO prims_emitted should be clipped when the stream-out buffer is + * not large enough. See max_tf_vtx().. probably need to move that + * into common code. Although a bit more annoying since a2xx doesn't + * use ir3 so no common way to get at the pipe_stream_output_info + * which is needed for this calculation. + */ + if (ctx->streamout.num_targets > 0) { + assert(ctx->active_queries); + ctx->stats.prims_emitted += prims; + } + ctx->stats.prims_generated += prims; } - ctx->stats.prims_generated += prims; } static void