Mesa (master): pan/bi: Fix RA wrt 16-bit swizzles

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 15:06:57 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Apr 27 10:38:00 2020 -0400

pan/bi: Fix RA wrt 16-bit swizzles

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

---

 src/panfrost/bifrost/bi_ra.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c
index b6da1df7038..0124bf5ebc9 100644
--- a/src/panfrost/bifrost/bi_ra.c
+++ b/src/panfrost/bifrost/bi_ra.c
@@ -124,8 +124,14 @@ bi_adjust_src_ra(bi_instruction *ins, struct lcra_state *l, unsigned src)
                 /* Use the swizzle as component select */
                 unsigned components = bi_get_component_count(ins, src);
 
+                nir_alu_type T = ins->src_types[src];
+                unsigned size = nir_alu_type_get_type_size(T);
+ 
+                /* TODO: 64-bit? */
+                unsigned components_per_word = MAX2(32 / size, 1);
+
                 for (unsigned i = 0; i < components; ++i) {
-                        unsigned off = ins->swizzle[src][i] / components;
+                        unsigned off = ins->swizzle[src][i] / components_per_word;
 
                         /* We can't cross register boundaries in a swizzle */
                         if (i == 0)
@@ -133,7 +139,7 @@ bi_adjust_src_ra(bi_instruction *ins, struct lcra_state *l, unsigned src)
                         else
                                 assert(off == offset);
 
-                        ins->swizzle[src][i] %= components;
+                        ins->swizzle[src][i] %= components_per_word;
                 }
         }
 
@@ -147,6 +153,7 @@ bi_adjust_dest_ra(bi_instruction *ins, struct lcra_state *l)
                 return;
 
         ins->dest = bi_reg_from_index(l, ins->dest, ins->dest_offset);
+        ins->dest_offset = 0;
 }
 
 static void



More information about the mesa-commit mailing list