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

Author: Alyssa Rosenzweig <aly...@collabora.com>
Date:   Fri Apr  9 18:03:38 2021 -0400

pan/bi: Determine block successors correctly

Fixes GPU timeouts in Google Maps.

Signed-off-by: Alyssa Rosenzweig <aly...@collabora.com>
Reviewed-by: Icecream95 <i...@disroot.org>
Tested-by: Icecream95 <i...@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10145>

---

 src/panfrost/bifrost/bi_pack.c | 23 ++++++++++++-----------
 src/panfrost/bifrost/bir.c     |  3 +++
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index d9f28fcfebd..324a0e9762b 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -733,20 +733,21 @@ bi_pack(bi_context *ctx, struct util_dynarray *emission)
 
                 bi_assign_branch_offset(ctx, block);
 
-                /* Passthrough the first clause of where we're branching to for
-                 * the last clause of the block (the clause with the branch) */
-
-                bi_clause *succ_clause = block->base.successors[1] ?
-                        bi_next_clause(ctx, block->base.successors[1], NULL) : 
NULL;
+                bi_foreach_clause_in_block(block, clause) {
+                        bool is_last = (clause->link.next == &block->clauses);
 
-                if (!succ_clause && block->base.successors[0])
-                        succ_clause = bi_next_clause(ctx, 
block->base.successors[0], NULL);
+                        /* Get the succeeding clauses, either two successors of
+                         * the block for the last clause in the block or just
+                         * the next clause within the block */
 
-                bi_foreach_clause_in_block(block, clause) {
-                        bool is_last = clause->link.next == &block->clauses;
+                        bi_clause *next = NULL, *next_2 = NULL;
 
-                        bi_clause *next = bi_next_clause(ctx, _block, clause);
-                        bi_clause *next_2 = is_last ? succ_clause : NULL;
+                        if (is_last) {
+                                next = bi_next_clause(ctx, 
block->base.successors[0], NULL);
+                                next_2 = bi_next_clause(ctx, 
block->base.successors[1], NULL);
+                        } else {
+                                next = bi_next_clause(ctx, _block, clause);
+                        }
 
                         previous_size = emission->size;
 
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c
index 3a62f554615..397710c44c3 100644
--- a/src/panfrost/bifrost/bir.c
+++ b/src/panfrost/bifrost/bir.c
@@ -116,6 +116,9 @@ bi_writemask(bi_instr *ins, unsigned d)
 bi_clause *
 bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
 {
+        if (!block && !clause)
+                return NULL;
+
         /* Try the first clause in this block if we're starting from scratch */
         if (!clause && !list_is_empty(&((bi_block *) block)->clauses))
                 return list_first_entry(&((bi_block *) block)->clauses, 
bi_clause, link);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to