From d6209a50bb13a40c0823f4c53eb1566328ba6630 Mon Sep 17 00:00:00 2001 From: "Kristian H. Kristensen" Date: Tue, 22 Oct 2019 16:24:26 -0700 Subject: [PATCH] freedreno: Don't count primitives for patches The gallium helper doesn't like patches and we can't determine how many primitives it gets tessellated into anyway. On gens where we have tessellation, we get the prim count from a HW counter so just skip counting on the CPU. Signed-off-by: Kristian H. Kristensen Acked-by: Eric Anholt Reviewed-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_draw.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 059de2ec8c6..b738498c56b 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -256,7 +256,14 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) batch->num_draws++; - prims = u_reduced_prims_for_vertices(info->mode, info->count); + /* 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. + */ + if (info->mode != PIPE_PRIM_PATCHES) + prims = u_reduced_prims_for_vertices(info->mode, info->count); + else + prims = 0; ctx->stats.draw_calls++; -- 2.30.2