mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 02:50:16 +01:00
etnaviv: add support for performance warnings
These performance warnings should help to get a better understanding where we doing non performance optimal things. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23615>
This commit is contained in:
parent
00a91d8870
commit
3d49619071
8 changed files with 42 additions and 7 deletions
|
|
@ -176,6 +176,7 @@ etna_resource_copy_region(struct pipe_context *pctx, struct pipe_resource *dst,
|
|||
util_blitter_copy_texture(ctx->blitter, dst, dst_level, dstx, dsty, dstz,
|
||||
src, src_level, src_box);
|
||||
} else {
|
||||
perf_debug_ctx(ctx, "copy_region falls back to sw");
|
||||
util_resource_copy_region(pctx, dst, dst_level, dstx, dsty, dstz, src,
|
||||
src_level, src_box);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ main(int argc, char **argv)
|
|||
shader.compiler = compiler;
|
||||
|
||||
struct util_debug_callback debug = {}; // TODO: proper debug callback
|
||||
struct etna_shader_variant *v = etna_shader_variant(&shader, &key, &debug);
|
||||
struct etna_shader_variant *v = etna_shader_variant(&shader, &key, &debug, false);
|
||||
if (!v) {
|
||||
fprintf(stderr, "shader variant creation failed!\n");
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ etna_get_vs(struct etna_context *ctx, struct etna_shader_key* const key)
|
|||
{
|
||||
const struct etna_shader_variant *old = ctx->shader.vs;
|
||||
|
||||
ctx->shader.vs = etna_shader_variant(ctx->shader.bind_vs, key, &ctx->base.debug);
|
||||
ctx->shader.vs = etna_shader_variant(ctx->shader.bind_vs, key, &ctx->base.debug, true);
|
||||
|
||||
if (!ctx->shader.vs)
|
||||
return false;
|
||||
|
|
@ -204,7 +204,7 @@ etna_get_fs(struct etna_context *ctx, struct etna_shader_key* const key)
|
|||
}
|
||||
}
|
||||
|
||||
ctx->shader.fs = etna_shader_variant(ctx->shader.bind_fs, key, &ctx->base.debug);
|
||||
ctx->shader.fs = etna_shader_variant(ctx->shader.bind_fs, key, &ctx->base.debug, true);
|
||||
|
||||
if (!ctx->shader.fs)
|
||||
return false;
|
||||
|
|
@ -676,6 +676,8 @@ etna_render_condition_check(struct pipe_context *pctx)
|
|||
if (!ctx->cond_query)
|
||||
return true;
|
||||
|
||||
perf_debug_ctx(ctx, "Implementing conditional rendering on the CPU");
|
||||
|
||||
union pipe_query_result res = { 0 };
|
||||
bool wait =
|
||||
ctx->cond_mode != PIPE_RENDER_COND_NO_WAIT &&
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef H_ETNA_DEBUG
|
||||
#define H_ETNA_DEBUG
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/log.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
#define ETNA_DBG_LINKER_MSGS 0x10
|
||||
#define ETNA_DBG_DUMP_SHADERS 0x20
|
||||
#define ETNA_DRM_MSGS 0x40 /* Debug messages from DRM */
|
||||
#define ETNA_DBG_PERF 0x80
|
||||
|
||||
/* Bypasses */
|
||||
#define ETNA_DBG_NO_TS 0x1000 /* Disable TS */
|
||||
|
|
@ -82,4 +84,21 @@ extern int etna_mesa_debug; /* set in etnaviv_screen.c from ETNA_MESA_DEBUG */
|
|||
mesa_loge("%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define perf_debug_message(debug, type, ...) \
|
||||
do { \
|
||||
if (DBG_ENABLED(ETNA_DBG_PERF)) \
|
||||
mesa_logw(__VA_ARGS__); \
|
||||
struct util_debug_callback *__d = (debug); \
|
||||
if (__d) \
|
||||
util_debug_message(__d, type, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define perf_debug_ctx(ctx, ...) \
|
||||
do { \
|
||||
struct etna_context *__c = (ctx); \
|
||||
perf_debug_message(__c ? &__c->base.debug : NULL, PERF_INFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define perf_debug(...) perf_debug_ctx(NULL, PERF_INFO, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -826,6 +826,9 @@ manual:
|
|||
if ((etna_resource_status(ctx, src) & ETNA_PENDING_WRITE) ||
|
||||
(etna_resource_status(ctx, dst) & ETNA_PENDING_WRITE))
|
||||
etna_flush(pctx, NULL, 0, true);
|
||||
|
||||
perf_debug_ctx(ctx, "RS blit falls back to sw");
|
||||
|
||||
return etna_manual_blit(dst, dst_lev, dst_offset, src, src_lev, src_offset, blit_info);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ static const struct debug_named_value etna_debug_options[] = {
|
|||
{"linear_pe", ETNA_DBG_LINEAR_PE, "Enable linear PE"},
|
||||
{"msaa", ETNA_DBG_MSAA, "Enable MSAA support"},
|
||||
{"shared_ts", ETNA_DBG_SHARED_TS, "Enable TS sharing"},
|
||||
{"perf", ETNA_DBG_PERF, "Enable performance warnings"},
|
||||
DEBUG_NAMED_VALUE_END
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -433,7 +433,8 @@ fail:
|
|||
struct etna_shader_variant *
|
||||
etna_shader_variant(struct etna_shader *shader,
|
||||
const struct etna_shader_key* const key,
|
||||
struct util_debug_callback *debug)
|
||||
struct util_debug_callback *debug,
|
||||
bool called_from_draw)
|
||||
{
|
||||
struct etna_shader_variant *v;
|
||||
|
||||
|
|
@ -451,6 +452,13 @@ etna_shader_variant(struct etna_shader *shader,
|
|||
dump_shader_info(v, debug);
|
||||
}
|
||||
|
||||
if (called_from_draw) {
|
||||
perf_debug_message(debug, SHADER_INFO,
|
||||
"%s shader: recompiling at draw time: global "
|
||||
"0x%08x\n",
|
||||
etna_shader_stage(v), key->global);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +483,7 @@ create_initial_variants_async(void *job, void *gdata, int thread_index)
|
|||
struct util_debug_callback debug = {};
|
||||
static struct etna_shader_key key;
|
||||
|
||||
etna_shader_variant(shader, &key, &debug);
|
||||
etna_shader_variant(shader, &key, &debug, false);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
@ -502,7 +510,7 @@ etna_create_shader_state(struct pipe_context *pctx,
|
|||
|
||||
if (initial_variants_synchronous(ctx)) {
|
||||
struct etna_shader_key key = {};
|
||||
etna_shader_variant(shader, &key, &ctx->base.debug);
|
||||
etna_shader_variant(shader, &key, &ctx->base.debug, false);
|
||||
} else {
|
||||
struct etna_screen *screen = ctx->screen;
|
||||
util_queue_add_job(&screen->shader_compiler_queue, shader, &shader->ready,
|
||||
|
|
|
|||
|
|
@ -101,7 +101,8 @@ etna_shader_update_vertex(struct etna_context *ctx);
|
|||
struct etna_shader_variant *
|
||||
etna_shader_variant(struct etna_shader *shader,
|
||||
const struct etna_shader_key* const key,
|
||||
struct util_debug_callback *debug);
|
||||
struct util_debug_callback *debug,
|
||||
bool called_from_draw);
|
||||
|
||||
void
|
||||
etna_shader_init(struct pipe_context *pctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue