etnaviv: add context flush sw query

Context flushes can be caused by all kinds of operations that aren't
obvious to a GL API user. As those are quite heavy-weight operations
it is nice to have some insight into how many of those are happening
per frame. Add a sw query to make this information easily accessible.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34350>
This commit is contained in:
Lucas Stach
2025-04-02 18:27:41 +02:00
committed by Marge Bot
parent ee535aa039
commit d917625226
4 changed files with 8 additions and 0 deletions
@@ -558,6 +558,8 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
struct etna_context *ctx = etna_context(pctx);
int out_fence_fd = -1;
ctx->stats.flushes++;
list_for_each_entry(struct etna_acc_query, aq, &ctx->active_acc_queries, node)
etna_acc_query_suspend(aq, ctx);
@@ -192,6 +192,7 @@ struct etna_context {
uint64_t prims_generated;
uint64_t draw_calls;
uint64_t rs_operations;
uint64_t flushes;
} stats;
int in_fence_fd;
@@ -51,6 +51,8 @@ read_counter(struct etna_context *ctx, unsigned type)
return ctx->stats.draw_calls;
case ETNA_QUERY_RS_OPERATIONS:
return ctx->stats.rs_operations;
case ETNA_QUERY_CTX_FLUSHES:
return ctx->stats.flushes;
}
return 0;
@@ -100,6 +102,7 @@ etna_sw_create_query(struct etna_context *ctx, unsigned query_type)
case PIPE_QUERY_PRIMITIVES_GENERATED:
case ETNA_QUERY_DRAW_CALLS:
case ETNA_QUERY_RS_OPERATIONS:
case ETNA_QUERY_CTX_FLUSHES:
break;
default:
return NULL;
@@ -120,6 +123,7 @@ static const struct pipe_driver_query_info list[] = {
{"prims-generated", PIPE_QUERY_PRIMITIVES_GENERATED, { 0 }},
{"draw-calls", ETNA_QUERY_DRAW_CALLS, { 0 }},
{"rs-operations", ETNA_QUERY_RS_OPERATIONS, { 0 }},
{"ctx-flushes", ETNA_QUERY_CTX_FLUSHES, { 0 }},
};
int
@@ -32,6 +32,7 @@
#define ETNA_QUERY_DRAW_CALLS (ETNA_SW_QUERY_BASE + 0)
#define ETNA_QUERY_RS_OPERATIONS (ETNA_SW_QUERY_BASE + 1)
#define ETNA_QUERY_CTX_FLUSHES (ETNA_SW_QUERY_BASE + 2)
struct etna_sw_query {
struct etna_query base;