From ca48143ec4ba78ea472016add2c7531018549cbe Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 14 May 2020 13:29:54 -0400 Subject: [PATCH] pan/mdg: Implement condense_writemask for 8-bit Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/disassemble.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index e97cee163a2..9758904fb6e 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -56,8 +56,17 @@ static inline unsigned condense_writemask(unsigned expanded_mask, unsigned bits_per_component) { - if (bits_per_component == 8) - unreachable("XXX TODO: sort out how 8-bit constant encoding works"); + if (bits_per_component == 8) { + /* Duplicate every bit to go from 8 to 16-channel wrmask */ + unsigned omask = 0; + + for (unsigned i = 0; i < 8; ++i) { + if (expanded_mask & (1 << i)) + omask |= (3 << (2 * i)); + } + + return omask; + } unsigned slots_per_component = bits_per_component / 16; unsigned max_comp = (16 * 8) / bits_per_component; -- 2.30.2