From c9f4eface3f50fee852ac4621b6fb4269252182b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 23 Jan 2020 21:17:07 -0500 Subject: [PATCH] pan/midgard: Disassemble barrier instructions We don't need to print all the usual texture noise; just the relevant fields and the rest can be guarded to zero. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/disassemble.c | 35 ++++++++++++++++++++++++++++++ src/panfrost/midgard/midgard.h | 28 +++++++++++++++++++++--- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index bfa42b17278..a3eddaa514a 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -1283,6 +1283,35 @@ sampler_type_name(enum mali_sampler_type t) } +static void +print_texture_barrier(FILE *fp, uint32_t *word) +{ + midgard_texture_barrier_word *barrier = (midgard_texture_barrier_word *) word; + + if (!barrier->cont) + fprintf(fp, "/* cont missing? */"); + + if (!barrier->last) + fprintf(fp, "/* last missing? */"); + + if (barrier->zero1) + fprintf(fp, "/* zero1 = 0x%X */ ", barrier->zero1); + + if (barrier->zero2) + fprintf(fp, "/* zero2 = 0x%X */ ", barrier->zero2); + + if (barrier->zero3) + fprintf(fp, "/* zero3 = 0x%X */ ", barrier->zero3); + + if (barrier->zero4) + fprintf(fp, "/* zero4 = 0x%X */ ", barrier->zero4); + + if (barrier->zero5) + fprintf(fp, "/* zero4 = 0x%" PRIx64 " */ ", barrier->zero5); + + fprintf(fp, " 0x%X\n", barrier->unknown4); +} + #undef DEFINE_CASE static void @@ -1296,6 +1325,12 @@ print_texture_word(FILE *fp, uint32_t *word, unsigned tabs, unsigned in_reg_base /* Broad category of texture operation in question */ print_texture_op(fp, texture->op, texture->is_gather); + /* Barriers use a dramatically different code path */ + if (texture->op == TEXTURE_OP_BARRIER) { + print_texture_barrier(fp, word); + return; + } + /* Specific format in question */ print_texture_format(fp, texture->format); diff --git a/src/panfrost/midgard/midgard.h b/src/panfrost/midgard/midgard.h index e2ca42a0e1c..0f6ec698d8a 100644 --- a/src/panfrost/midgard/midgard.h +++ b/src/panfrost/midgard/midgard.h @@ -745,9 +745,31 @@ __attribute__((__packed__)) } midgard_texture_word; -/* Up to 16 constant bytes can be embedded in a bundle. This union describes - * all possible layouts. - */ +/* Technically barriers are texture instructions but it's less work to add them + * as an explicitly zeroed special case, since most fields are forced to go to + * zero */ + +typedef struct +__attribute__((__packed__)) +{ + unsigned type : 4; + unsigned next_type : 4; + + /* op = TEXTURE_OP_BARRIER */ + unsigned op : 6; + unsigned zero1 : 2; + + /* Since helper invocations don't make any sense, these are forced to one */ + unsigned cont : 1; + unsigned last : 1; + unsigned zero2 : 14; + + unsigned zero3 : 24; + unsigned unknown4 : 1; + unsigned zero4 : 7; + + uint64_t zero5; +} midgard_texture_barrier_word; typedef union midgard_constants { double f64[2]; -- 2.30.2