Mesa (master): pan/mdg: prepare effective_writemask()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 30 23:13:18 UTC 2020


Module: Mesa
Branch: master
Commit: 598527f2febfd14b97d179363827f6c6a1d5281e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=598527f2febfd14b97d179363827f6c6a1d5281e

Author: Italo Nicola <italonicola at collabora.com>
Date:   Fri Jul 10 16:07:06 2020 +0000

pan/mdg: prepare effective_writemask()

In the next commits we will be removing the `alu` field from
midgard_instruction in order to simplify the code.
effective_writemask() doesn't actually use `alu` for anything, it only
needs to know the opcode.

Signed-off-by: Italo Nicola <italonicola at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>

---

 src/panfrost/midgard/disassemble.c     | 2 +-
 src/panfrost/midgard/midgard_compile.c | 2 +-
 src/panfrost/midgard/midgard_ops.h     | 4 ++--
 src/panfrost/midgard/midgard_print.c   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c
index 1e598e8161c..9ffbf495618 100644
--- a/src/panfrost/midgard/disassemble.c
+++ b/src/panfrost/midgard/disassemble.c
@@ -372,7 +372,7 @@ print_vector_constants(FILE *fp, unsigned src_binary,
         assert(consts);
         assert(max_comp <= 16);
 
-        comp_mask = effective_writemask(alu, condense_writemask(alu->mask, bits));
+        comp_mask = effective_writemask(alu->op, condense_writemask(alu->mask, bits));
         num_comp = util_bitcount(comp_mask);
 
         fprintf(fp, "<");
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 44db10463d5..d6b0e8af806 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -2520,7 +2520,7 @@ embedded_to_inline_constant(compiler_context *ctx, midgard_block *block)
                         uint32_t value = is_16 ? cons->u16[component] : cons->u32[component];
 
                         bool is_vector = false;
-                        unsigned mask = effective_writemask(&ins->alu, ins->mask);
+                        unsigned mask = effective_writemask(ins->alu.op, ins->mask);
 
                         for (unsigned c = 0; c < MIR_VEC_COMPONENTS; ++c) {
                                 /* We only care if this component is actually used */
diff --git a/src/panfrost/midgard/midgard_ops.h b/src/panfrost/midgard/midgard_ops.h
index 6919c3155b6..6c5bd4d0942 100644
--- a/src/panfrost/midgard/midgard_ops.h
+++ b/src/panfrost/midgard/midgard_ops.h
@@ -62,12 +62,12 @@ midgard_is_integer_out_op(int op)
 /* Determines effective writemask, taking quirks and expansion into account */
 
 static inline unsigned
-effective_writemask(midgard_vector_alu *alu, unsigned existing_mask)
+effective_writemask(midgard_alu_op op, unsigned existing_mask)
 {
         /* Channel count is off-by-one to fit in two-bits (0 channel makes no
          * sense) */
 
-        unsigned channel_count = GET_CHANNEL_COUNT(alu_opcode_props[alu->op].props);
+        unsigned channel_count = GET_CHANNEL_COUNT(alu_opcode_props[op].props);
 
         /* If there is a fixed channel count, construct the appropriate mask */
 
diff --git a/src/panfrost/midgard/midgard_print.c b/src/panfrost/midgard/midgard_print.c
index 3e880071043..6f389025fec 100644
--- a/src/panfrost/midgard/midgard_print.c
+++ b/src/panfrost/midgard/midgard_print.c
@@ -244,7 +244,7 @@ mir_print_embedded_constant(midgard_instruction *ins, unsigned src_idx)
                 src = vector_alu_from_unsigned(ins->alu.src2);
 
         unsigned *swizzle = ins->swizzle[src_idx];
-        unsigned comp_mask = effective_writemask(&ins->alu, ins->mask);
+        unsigned comp_mask = effective_writemask(ins->alu.op, ins->mask);
         unsigned num_comp = util_bitcount(comp_mask);
         unsigned max_comp = mir_components_for_type(ins->dest_type);
         bool first = true;



More information about the mesa-commit mailing list