Mesa (master): freedreno: fix prims-emitted query

Rob Clark robclark at kemper.freedesktop.org
Wed Apr 13 18:38:23 UTC 2016


Module: Mesa
Branch: master
Commit: 0a4b0fc3154f4e3f926dcd5f2effe199c9fc6754
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a4b0fc3154f4e3f926dcd5f2effe199c9fc6754

Author: Rob Clark <robclark at freedesktop.org>
Date:   Mon Apr 11 20:53:13 2016 -0400

freedreno: fix prims-emitted query

This should only count when TF is not paused.

Signed-off-by: Rob Clark <robclark at freedesktop.org>

---

 src/gallium/drivers/freedreno/freedreno_context.h  |  1 +
 src/gallium/drivers/freedreno/freedreno_draw.c     | 11 ++++++++++-
 src/gallium/drivers/freedreno/freedreno_query_sw.c |  2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index 85ce97c..8699296 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -241,6 +241,7 @@ struct fd_context {
 	 */
 	struct {
 		uint64_t prims_emitted;
+		uint64_t prims_generated;
 		uint64_t draw_calls;
 		uint64_t batch_total, batch_sysmem, batch_gmem, batch_restore;
 	} stats;
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index bf803cc..11d9f64 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -174,7 +174,16 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
 	prims = u_reduced_prims_for_vertices(info->mode, info->count);
 
 	ctx->stats.draw_calls++;
-	ctx->stats.prims_emitted += prims;
+
+	/* 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)
+		ctx->stats.prims_emitted += prims;
+	ctx->stats.prims_generated += prims;
 
 	/* any buffers that haven't been cleared yet, we need to restore: */
 	ctx->restore |= buffers & (FD_BUFFER_ALL & ~ctx->cleared);
diff --git a/src/gallium/drivers/freedreno/freedreno_query_sw.c b/src/gallium/drivers/freedreno/freedreno_query_sw.c
index 514df14..4af6a12 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_sw.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_sw.c
@@ -54,7 +54,7 @@ read_counter(struct fd_context *ctx, int type)
 {
 	switch (type) {
 	case PIPE_QUERY_PRIMITIVES_GENERATED:
-		/* for now same thing as _PRIMITIVES_EMITTED */
+		return ctx->stats.prims_generated;
 	case PIPE_QUERY_PRIMITIVES_EMITTED:
 		return ctx->stats.prims_emitted;
 	case FD_QUERY_DRAW_CALLS:




More information about the mesa-commit mailing list