diff options
author | Jerome Glisse <jglisse@redhat.com> | 2010-05-21 18:46:59 +0200 |
---|---|---|
committer | Jerome Glisse <jglisse@redhat.com> | 2010-05-21 18:46:59 +0200 |
commit | dcad701ea7f7d3af9da4fd1b83b0c98d43ca6f26 (patch) | |
tree | 3c72ee1acfb05f9ce21239794984404b6897d407 | |
parent | c1e091b2923a34b3c8bd32e15184dd28a9085547 (diff) |
radeondb: misc fix to r600 disassembler
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
-rw-r--r-- | src/r600_disassembler.c | 42 | ||||
-rw-r--r-- | src/radeondb.c | 7 |
2 files changed, 38 insertions, 11 deletions
diff --git a/src/r600_disassembler.c b/src/r600_disassembler.c index 9c517da..5fee579 100644 --- a/src/r600_disassembler.c +++ b/src/r600_disassembler.c @@ -312,8 +312,7 @@ static void print_op(unsigned sel, unsigned rel, unsigned neg, unsigned elem, pelem = 0; break; case 253: - printf("%f", lfloat[elem]); - pelem = 0; + printf("LT"); break; case 254: printf("PV"); @@ -373,7 +372,7 @@ static int do_alu_clause(struct disassembler *d) { u32 dword0, dword1; int count; - unsigned sel0, sel1, sel2, dsel; + unsigned sel0, sel1, sel2, dsel, last = 0; unsigned elem0, elem1, elem2, delem; unsigned neg0, neg1, neg2; unsigned rel0, rel1, rel2, drel; @@ -386,13 +385,14 @@ static int do_alu_clause(struct disassembler *d) while (count) { dword0 = d->bcode[d->id]; dword1 = d->bcode[d->id + 1]; - if (inline_const_count) { + if (inline_const_count && last) { fn = (float*)&dword0; printf("0x%08X 0x%08x CONST(%f)\n", d->id, dword0, *fn); fn = (float*)&dword1; printf("0x%08X 0x%08x CONST(%f)\n", d->id + 1, dword1, *fn); inline_const_count--; } else { + last = (dword0 >> 31) & 1; sel0 = (dword0 >> 0) & 0x1ff; sel1 = (dword0 >> 13) & 0x1ff; sel2 = 0; @@ -446,12 +446,35 @@ static int do_alu_clause(struct disassembler *d) } /* inline constants */ + if (sel0 == 253) { + if (elem0 > 1) { + inline_const_count = 2; + } else { + inline_const_count = 1; + } + } + if (sel1 == 253) { + if (elem1 > 1) { + inline_const_count = 2; + } else { + inline_const_count = 1; + } + } + if (sel2 == 253) { + if (elem2 > 1) { + inline_const_count = 2; + } else { + inline_const_count = 1; + } + } +#if 0 if ((sel0 == 253) || (sel1 == 253) || (sel2 == 253)) { if ((elem0 > 1) || (elem1 > 1) || (elem2 > 1)) inline_const_count = 2; // 3-4 constants else inline_const_count = 1; // 1-2 constants } +#endif } count--; d->id += 2; @@ -507,7 +530,7 @@ void vtx_dword1_sem(struct disassembler *d) fca = (dword1 >> 30) & 0x1; sma = (dword1 >> 31) & 0x1; - printf("0x%08X 0x%08X ", d->id, dword1); + printf("0x%08X 0x%08X ", d->id + 1, dword1); printf("(SID(%d),", semantic_id); printf("DX(%s),", sel[dsx]); printf("DY(%s),", sel[dsy]); @@ -540,7 +563,7 @@ void vtx_dword1_gpr(struct disassembler *d) fca = (dword1 >> 30) & 0x1; sma = (dword1 >> 31) & 0x1; - printf("0x%08X 0x%08X ", d->id, dword1); + printf("0x%08X 0x%08X ", d->id + 1, dword1); printf("(DGPR(%d),", dst_gpr); printf("DREL(%s),", rel[dr]); printf("DX(%s),", sel[dsx]); @@ -566,7 +589,7 @@ void vtx_dword2(struct disassembler *d) cbns = (dword2 >> 18) & 0x1; mf = (dword2 >> 19) & 0x1; - printf("0x%08X 0x%08X ", d->id, dword2); + printf("0x%08X 0x%08X ", d->id + 2, dword2); printf("(OFFSET(%d),", offset); printf("ESWAP(%s),", endian_swap[es]); printf("CBNSTRIDE(%d),", cbns); @@ -591,7 +614,7 @@ static int do_vtx_clause(struct disassembler *d) else vtx_dword1_gpr(d); vtx_dword2(d); - printf("0x%08X 0x%08X\n", d->id, d->bcode[d->id + 3]); + printf("0x%08X 0x%08X\n", d->id + 3, d->bcode[d->id + 3]); count--; d->id += 4; } @@ -681,7 +704,8 @@ static void r600_disassembler(u32 *bcode, unsigned ndw, int is_r700) if (d.section[d.id].disassemble(&d)) goto out; while (d.id < ndw && !d.section[d.id].count) { - printf("0x%08X 0x%08X\n", d.id, d.bcode[d.id++]); + printf("0x%08X 0x%08X\n", d.id, d.bcode[d.id]); + d.id++; } } while (d.id < ndw); out: diff --git a/src/radeondb.c b/src/radeondb.c index 7b4ac0c..6e5ec4d 100644 --- a/src/radeondb.c +++ b/src/radeondb.c @@ -338,13 +338,16 @@ static int conv(const char *file) fprintf(stderr, "failed to reconstruct draw sequences from %s\n", file); return -EINVAL; } - tmp = strstr(file, "bof"); + tmp = strstr(file, ".bof"); if (tmp == NULL) { return -EINVAL; } *tmp = 0; - sprintf(name, "%sjson", file); + sprintf(name, "%s.json", file); r = radeon_ctx_dump_json(ctx, name); + if (r) { + fprintf(stderr, "writting %s failed\n", name); + } ctx = radeon_ctx_decref(ctx); return r; } |