From e00fe451b8bac0aa4f03e07fddee08a870f79bb0 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 1 May 2014 11:20:25 -0700 Subject: [PATCH] i965/disasm: Disassemble the compaction control bit. brw_disasm doesn't disassemble compacted instructions, so we uncompact before disassembling them which would unset the compaction control bit. Instead pass it as a separate argument. Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_clip.c | 2 +- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/i965/brw_disasm.c | 9 ++++++++- src/mesa/drivers/dri/i965/brw_eu.c | 3 ++- src/mesa/drivers/dri/i965/brw_eu_compact.c | 4 ++-- src/mesa/drivers/dri/i965/brw_gs.c | 2 +- src/mesa/drivers/dri/i965/brw_sf.c | 2 +- src/mesa/drivers/dri/i965/brw_state_dump.c | 2 +- src/mesa/drivers/dri/i965/test_eu_compact.c | 2 +- 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index c32bf5c0e7c..d1815f2216e 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -121,7 +121,7 @@ static void compile_clip_prog( struct brw_context *brw, fprintf(stderr, "clip:\n"); for (i = 0; i < program_size / sizeof(struct brw_instruction); i++) brw_disasm(stderr, &((struct brw_instruction *)program)[i], - brw->gen); + brw->gen, false); fprintf(stderr, "\n"); } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a9adbf2cecc..9e459cd8dba 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1573,7 +1573,7 @@ void brw_fs_alloc_reg_sets(struct intel_screen *screen); void brw_vec4_alloc_reg_set(struct intel_screen *screen); /* brw_disasm.c */ -int brw_disasm (FILE *file, struct brw_instruction *inst, int gen); +int brw_disasm (FILE *file, struct brw_instruction *inst, int gen, bool is_compacted); /* brw_vs.c */ gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx); diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index e54172c6c78..b9654a3420c 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -167,6 +167,11 @@ static const char * const saturate[2] = { [1] = ".sat" }; +static const char * const cmpt_ctrl[2] = { + [0] = "", + [1] = "compacted" +}; + static const char * const accwr[2] = { [0] = "", [1] = "AccWrEnable" @@ -1114,7 +1119,7 @@ static int qtr_ctrl(FILE *file, struct brw_instruction *inst) return 0; } -int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) +int brw_disasm (FILE *file, struct brw_instruction *inst, int gen, bool is_compacted) { int err = 0; int space = 0; @@ -1136,6 +1141,7 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) err |= print_opcode (file, inst->header.opcode); err |= control (file, "saturate", saturate, inst->header.saturate, NULL); + err |= control (file, "debug control", debug_ctrl, inst->header.debug_control, NULL); if (inst->header.opcode == BRW_OPCODE_MATH) { @@ -1449,6 +1455,7 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) } } + err |= control (file, "compaction control", cmpt_ctrl, is_compacted, &space); err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space); if (gen >= 6) err |= control (file, "acc write control", accwr, inst->header.acc_wr_control, &space); diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c index bb840291f25..15105c2944c 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.c +++ b/src/mesa/drivers/dri/i965/brw_eu.c @@ -265,6 +265,7 @@ brw_dump_compile(struct brw_compile *p, FILE *out, int start, int end) for (int offset = start; offset < end;) { struct brw_instruction *insn = store + offset; struct brw_instruction uncompacted; + bool compacted = insn->header.cmpt_control; fprintf(out, "0x%08x: ", offset); if (insn->header.cmpt_control) { @@ -289,6 +290,6 @@ brw_dump_compile(struct brw_compile *p, FILE *out, int start, int end) offset += 16; } - brw_disasm(out, insn, p->brw->gen); + brw_disasm(out, insn, p->brw->gen, compacted); } } diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c index fbee942aa31..54b29fdcd16 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c @@ -585,10 +585,10 @@ void brw_debug_compact_uncompact(struct brw_context *brw, brw->gen); fprintf(stderr, " before: "); - brw_disasm(stderr, orig, brw->gen); + brw_disasm(stderr, orig, brw->gen, true); fprintf(stderr, " after: "); - brw_disasm(stderr, uncompacted, brw->gen); + brw_disasm(stderr, uncompacted, brw->gen, false); uint32_t *before_bits = (uint32_t *)orig; uint32_t *after_bits = (uint32_t *)uncompacted; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index ddfb296f2c1..866d2988e37 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -138,7 +138,7 @@ static void compile_ff_gs_prog(struct brw_context *brw, fprintf(stderr, "gs:\n"); for (i = 0; i < program_size / sizeof(struct brw_instruction); i++) brw_disasm(stderr, &((struct brw_instruction *)program)[i], - brw->gen); + brw->gen, false); fprintf(stderr, "\n"); } diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 7714aaed9a2..61d308a3f8d 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -118,7 +118,7 @@ static void compile_sf_prog( struct brw_context *brw, fprintf(stderr, "sf:\n"); for (i = 0; i < program_size / sizeof(struct brw_instruction); i++) brw_disasm(stderr, &((struct brw_instruction *)program)[i], - brw->gen); + brw->gen, false); fprintf(stderr, "\n"); } diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index 40b5c65fb90..57dd2e77b9b 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -530,7 +530,7 @@ dump_prog_cache(struct brw_context *brw) name, data[i * 4], data[i * 4 + 1], data[i * 4 + 2], data[i * 4 + 3]); - brw_disasm(stderr, (void *)(data + i * 4), brw->gen); + brw_disasm(stderr, (void *)(data + i * 4), brw->gen, false); } } } diff --git a/src/mesa/drivers/dri/i965/test_eu_compact.c b/src/mesa/drivers/dri/i965/test_eu_compact.c index 26bf77bf2cd..8713918f81f 100644 --- a/src/mesa/drivers/dri/i965/test_eu_compact.c +++ b/src/mesa/drivers/dri/i965/test_eu_compact.c @@ -51,7 +51,7 @@ test_compact_instruction(struct brw_compile *p, struct brw_instruction src) if (memcmp(&unchanged, &dst, sizeof(dst))) { fprintf(stderr, "Failed to compact, but dst changed\n"); fprintf(stderr, " Instruction: "); - brw_disasm(stderr, &src, brw->gen); + brw_disasm(stderr, &src, brw->gen, false); return false; } } -- 2.30.2