summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_context.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-08 07:10:24 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-13 09:43:04 -0700
commit72fc06df9cabdc67ccbf53a99e3d61d516feab7b (patch)
treed5f06f6e7151e60f743cc7f1616f6d7f362ad59a /src/gallium/drivers/panfrost/pan_context.c
parent7c224c10083e5a3cb109dd559497e846dd5d3ea2 (diff)
panfrost: Wire up statistics for primitives
GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN should now be handled. Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_context.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 0b9360c0f63..661c1474cd5 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -38,6 +38,7 @@
#include "util/half_float.h"
#include "util/u_helpers.h"
#include "util/u_format.h"
+#include "util/u_prim.h"
#include "util/u_prim_restart.h"
#include "indices/u_primconvert.h"
#include "tgsi/tgsi_parse.h"
@@ -234,6 +235,9 @@ panfrost_invalidate_frame(struct panfrost_context *ctx)
/* XXX */
ctx->dirty |= PAN_DIRTY_SAMPLERS | PAN_DIRTY_TEXTURES;
+
+ /* TODO: When does this need to be handled? */
+ ctx->active_queries = true;
}
/* In practice, every field of these payloads should be configurable
@@ -1560,6 +1564,26 @@ panfrost_scissor_culls_everything(struct panfrost_context *ctx)
return (ss->minx == ss->maxx) || (ss->miny == ss->maxy);
}
+/* Count generated primitives (when there is no geom/tess shaders) for
+ * transform feedback */
+
+static void
+panfrost_statistics_record(
+ struct panfrost_context *ctx,
+ const struct pipe_draw_info *info)
+{
+ if (!ctx->active_queries)
+ return;
+
+ uint32_t prims = u_prims_for_vertices(info->mode, info->count);
+ ctx->prims_generated += prims;
+
+ if (ctx->streamout.num_targets <= 0)
+ return;
+
+ ctx->tf_prims_generated += prims;
+}
+
static void
panfrost_draw_vbo(
struct pipe_context *pipe,
@@ -1646,6 +1670,8 @@ panfrost_draw_vbo(
draw_flags |= 0x800;
}
+ panfrost_statistics_record(ctx, info);
+
if (info->index_size) {
/* Calculate the min/max index used so we can figure out how
* many times to invoke the vertex shader */