From 5b79745b045ac6161ba531ca6de3fa78487a6cc7 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 20 Jan 2023 11:30:46 +0200 Subject: [PATCH] intel/common: add a INTEL_DECODE variable to parameter decoder at runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes you want to diff 2 runs with INTEL_DEBUG=bat, but a tiny allocation change can mess quite badly with offsets printed in the decoding, making it hard to look at the diff with meld. Fortunately our decoder can avoid printing offsets. We just need a variable to specify that. We still use the defaults specified by the driver but you can turn things on/off with : INTEL_DECODE=+color,-offsets,-floats INTEL_DEBUG=bat ./my_app Signed-off-by: Lionel Landwerlin Reviewed-by: Marcin Ĺšlusarz Part-of: --- docs/envvars.rst | 19 +++++++++++++++++++ src/intel/common/intel_batch_decoder.c | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 26186cc789b..e65e362adcc 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -518,6 +518,25 @@ Intel driver environment variables ``wm`` dump shader assembly for fragment shaders (same as ``fs``) +.. envvar:: INTEL_DECODE + + a comma-separated list of enable/disable flags configuring the + output produced by ``INTEL_DEBUG=bat`` (use with + ``INTEL_DECODE=+color,-floats``) : + + ``color`` + print colored output + + ``floats`` + try to decode floating point data in buffers + + ``full`` + print additional custom information for instructions (usually + pulling more information by inspecting memory) + + ``offsets`` + print offsets of instructions + .. envvar:: INTEL_MEASURE Collects GPU timestamps over common intervals, and generates a CSV report diff --git a/src/intel/common/intel_batch_decoder.c b/src/intel/common/intel_batch_decoder.c index a73ee2d7175..30ce06eea8f 100644 --- a/src/intel/common/intel_batch_decoder.c +++ b/src/intel/common/intel_batch_decoder.c @@ -24,10 +24,19 @@ #include "common/intel_decoder.h" #include "intel_disasm.h" #include "util/macros.h" +#include "util/u_debug.h" #include "util/u_math.h" /* Needed for ROUND_DOWN_TO */ #include +static const struct debug_control debug_control[] = { + { "color", INTEL_BATCH_DECODE_IN_COLOR }, + { "full", INTEL_BATCH_DECODE_FULL }, + { "offsets", INTEL_BATCH_DECODE_OFFSETS }, + { "floats", INTEL_BATCH_DECODE_FLOATS }, + { NULL, 0 } +}; + void intel_batch_decode_ctx_init(struct intel_batch_decode_ctx *ctx, const struct brw_isa_info *isa, @@ -49,7 +58,7 @@ intel_batch_decode_ctx_init(struct intel_batch_decode_ctx *ctx, ctx->get_state_size = get_state_size; ctx->user_data = user_data; ctx->fp = fp; - ctx->flags = flags; + ctx->flags = parse_enable_string(getenv("INTEL_DECODE"), flags, debug_control); ctx->max_vbo_decoded_lines = -1; /* No limit! */ ctx->engine = INTEL_ENGINE_CLASS_RENDER;