pan/bi: Determine block successors correctly
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 9 Apr 2021 22:03:38 +0000 (18:03 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sun, 11 Apr 2021 02:05:31 +0000 (02:05 +0000)
Fixes GPU timeouts in Google Maps.

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

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bir.c

index d9f28fc..324a0e9 100644 (file)
@@ -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;
 
index 3a62f55..397710c 100644 (file)
@@ -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);