From 9168e7a65deefae7bb8a40c583c205c408cbecab Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 11 Feb 2020 15:58:18 -0500 Subject: [PATCH] pan/midgard: Improve barrier disassembly Just move some state from unknowns to actual keywords. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/disassemble.c | 20 +++++++++++++++++--- src/panfrost/midgard/midgard.h | 14 ++++++++++---- src/panfrost/midgard/midgard_compile.c | 5 ++++- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index ea5320a8cbe..d9be78c65c6 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -1354,7 +1354,17 @@ print_texture_barrier(FILE *fp, uint32_t *word) if (barrier->zero5) fprintf(fp, "/* zero4 = 0x%" PRIx64 " */ ", barrier->zero5); - fprintf(fp, " 0x%X\n", barrier->unknown4); + + /* Control barriers are always implied, so include for obviousness */ + fprintf(fp, " control"); + + if (barrier->buffer) + fprintf(fp, " | buffer"); + + if (barrier->shared) + fprintf(fp, " | shared"); + + fprintf(fp, "\n"); } #undef DEFINE_CASE @@ -1391,6 +1401,12 @@ print_texture_word(FILE *fp, uint32_t *word, unsigned tabs, unsigned in_reg_base if (texture->last) fprintf(fp, ".last"); + if (texture->barrier_buffer) + fprintf(fp, ".barrier_buffer /* XXX */"); + + if (texture->barrier_shared) + fprintf(fp, ".barrier_shared /* XXX */"); + /* Output modifiers are always interpreted floatly */ print_outmod(fp, texture->outmod, false); @@ -1524,10 +1540,8 @@ print_texture_word(FILE *fp, uint32_t *word, unsigned tabs, unsigned in_reg_base * following unknowns are zero, so we don't include them */ if (texture->unknown4 || - texture->unknownA || texture->unknown8) { fprintf(fp, "// unknown4 = 0x%x\n", texture->unknown4); - fprintf(fp, "// unknownA = 0x%x\n", texture->unknownA); fprintf(fp, "// unknown8 = 0x%x\n", texture->unknown8); } diff --git a/src/panfrost/midgard/midgard.h b/src/panfrost/midgard/midgard.h index 0f6ec698d8a..c022d47aabe 100644 --- a/src/panfrost/midgard/midgard.h +++ b/src/panfrost/midgard/midgard.h @@ -693,9 +693,14 @@ __attribute__((__packed__)) midgard_outmod_float outmod : 2; unsigned swizzle : 8; - unsigned unknown4 : 8; - unsigned unknownA : 4; + /* For barriers, control barriers are implied regardless, but these + * bits also enable memory barriers of various types. For regular + * textures, these bits are not yet understood. */ + unsigned barrier_buffer : 1; + unsigned barrier_shared : 1; + + unsigned unknown4 : 10; /* In immediate mode, each offset field is an immediate range [0, 7]. * @@ -765,8 +770,9 @@ __attribute__((__packed__)) unsigned zero2 : 14; unsigned zero3 : 24; - unsigned unknown4 : 1; - unsigned zero4 : 7; + unsigned buffer : 1; + unsigned shared : 1; + unsigned zero4 : 6; uint64_t zero5; } midgard_texture_barrier_word; diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 30a81a4afd1..c0334081574 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1513,7 +1513,10 @@ emit_control_barrier(compiler_context *ctx) .src = { ~0, ~0, ~0, ~0 }, .texture = { .op = TEXTURE_OP_BARRIER, - .unknown4 = 3 /* (control |) buffers | shared */ + + /* TODO: optimize */ + .barrier_buffer = 1, + .barrier_shared = 1 } }; -- 2.30.2