From 9ccb6621be2f40a74f75efe30d83b7813e3c3f56 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 6 Nov 2017 16:59:05 -0800 Subject: broadcom/vc5: Add partial transform feedback query support. We have to compute the queries in software, so we're counting the primitives by hand. We still need to make sure to not increment the PRIMITIVES_EMITTED if we overflowed, but leave that for later. --- src/gallium/drivers/vc5/vc5_draw.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/gallium/drivers/vc5/vc5_draw.c') diff --git a/src/gallium/drivers/vc5/vc5_draw.c b/src/gallium/drivers/vc5/vc5_draw.c index 8020e26802a..55a2e49b98d 100644 --- a/src/gallium/drivers/vc5/vc5_draw.c +++ b/src/gallium/drivers/vc5/vc5_draw.c @@ -270,6 +270,25 @@ vc5_emit_gl_shader_state(struct vc5_context *vc5, job->shader_rec_count++; } +/** + * Computes the various transform feedback statistics, since they can't be + * recorded by CL packets. + */ +static void +vc5_tf_statistics_record(struct vc5_context *vc5, + const struct pipe_draw_info *info, + bool prim_tf) +{ + uint32_t prims = u_prims_for_vertices(info->mode, info->count); + + vc5->prims_generated += prims; + + if (prim_tf) { + /* XXX: Only count if we didn't overflow. */ + vc5->tf_prims_generated += prims; + } +} + static void vc5_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) { @@ -363,6 +382,8 @@ vc5_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) if (vc5->prog.bind_vs->num_tf_outputs) prim_tf_enable = (V3D_PRIM_POINTS_TF - V3D_PRIM_POINTS); + vc5_tf_statistics_record(vc5, info, prim_tf_enable); + /* Note that the primitive type fields match with OpenGL/gallium * definitions, up to but not including QUADS. */ -- cgit v1.2.3