intel/common: add a INTEL_DECODE variable to parameter decoder at runtime

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 <lionel.g.landwerlin@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20874>
This commit is contained in:
Lionel Landwerlin
2023-01-20 11:30:46 +02:00
committed by Marge Bot
parent 31931754bc
commit 5b79745b04
2 changed files with 29 additions and 1 deletions
+10 -1
View File
@@ -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 <string.h>
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;