asahi: Implement perf_debug
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19811>
This commit is contained in:
committed by
Marge Bot
parent
c8e520985b
commit
efb5aef935
@@ -39,6 +39,7 @@ enum agx_dbg {
|
||||
AGX_DBG_NO16 = BITFIELD_BIT(2),
|
||||
AGX_DBG_DIRTY = BITFIELD_BIT(3),
|
||||
AGX_DBG_PRECOMPILE = BITFIELD_BIT(4),
|
||||
AGX_DBG_PERF = BITFIELD_BIT(5),
|
||||
};
|
||||
|
||||
struct agx_device {
|
||||
|
||||
@@ -12,8 +12,10 @@ agx_flush_readers(struct agx_context *ctx, struct agx_resource *rsrc, const char
|
||||
if (ctx->batch) {
|
||||
struct agx_batch *batch = ctx->batch;
|
||||
|
||||
if (agx_batch_uses_bo(batch, rsrc->bo))
|
||||
if (agx_batch_uses_bo(batch, rsrc->bo)) {
|
||||
perf_debug_ctx(ctx, "Flush reader due to: %s\n", reason);
|
||||
agx_flush_batch(ctx, batch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +24,10 @@ agx_flush_writer(struct agx_context *ctx, struct agx_resource *rsrc, const char
|
||||
{
|
||||
struct hash_entry *ent = _mesa_hash_table_search(ctx->writer, rsrc);
|
||||
|
||||
if (ent)
|
||||
if (ent) {
|
||||
perf_debug_ctx(ctx, "Flush writer due to: %s\n", reason);
|
||||
agx_flush_batch(ctx, ent->data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -71,6 +71,7 @@ static const struct debug_named_value agx_debug_options[] = {
|
||||
{"trace", AGX_DBG_TRACE, "Trace the command stream"},
|
||||
{"deqp", AGX_DBG_DEQP, "Hacks for dEQP"},
|
||||
{"no16", AGX_DBG_NO16, "Disable 16-bit support"},
|
||||
{"perf", AGX_DBG_PERF, "Print performance warnings"},
|
||||
#ifndef NDEBUG
|
||||
{"dirty", AGX_DBG_DIRTY, "Disable dirty tracking"},
|
||||
#endif
|
||||
|
||||
@@ -272,6 +272,15 @@ agx_device(struct pipe_screen *p)
|
||||
return &(agx_screen(p)->dev);
|
||||
}
|
||||
|
||||
#define perf_debug(dev, ...) \
|
||||
do { \
|
||||
if (unlikely((dev)->debug & AGX_DBG_PERF)) \
|
||||
mesa_logw(__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
#define perf_debug_ctx(ctx, ...) \
|
||||
perf_debug(agx_device((ctx)->base.screen), __VA_ARGS__);
|
||||
|
||||
struct agx_resource {
|
||||
struct pipe_resource base;
|
||||
uint64_t modifier;
|
||||
@@ -420,7 +429,7 @@ void agx_internal_shaders(struct agx_device *dev);
|
||||
static void
|
||||
agx_flush_all(struct agx_context *ctx, const char *reason)
|
||||
{
|
||||
//printf("Flushing due to: %s\n", reason);
|
||||
perf_debug_ctx(ctx, "Flushing due to: %s\n", reason);
|
||||
ctx->base.flush(&ctx->base, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user