panfrost: Fix scoreboarding with dependency on job #0
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 20 Aug 2019 19:07:31 +0000 (12:07 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 15:40:53 +0000 (08:40 -0700)
Subtle issue masked by how we emitted SET_VALUE jobs, but this case can
and does occur, so let's fix it.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_scoreboard.c

index 692f542544419a346a1ff4fd28b615ec481721cd..0873dd1fbe143c0e589441a1e553c850e62e9a44 100644 (file)
@@ -414,12 +414,12 @@ panfrost_scoreboard_link_batch(struct panfrost_job *batch)
 
                 if (dep_1) {
                         assert(!dependents[dep_1 - 1]);
-                        dependents[dep_1 - 1] = i;
+                        dependents[dep_1 - 1] = i + 1;
                 }
 
                 if (dep_2) {
                         assert(!dependents[dep_2 - 1]);
-                        dependents[dep_2 - 1] = i;
+                        dependents[dep_2 - 1] = i + 1;
                 }
         }
 
@@ -461,9 +461,11 @@ panfrost_scoreboard_link_batch(struct panfrost_job *batch)
                 tail = n;
 
                 /* Grab the dependent, if there is one */
-                unsigned node_m = dependents[node_n];
+                unsigned node_m_1 = dependents[node_n];
+
+                if (node_m_1) {
+                        unsigned node_m = node_m_1 - 1;
 
-                if (node_m) {
                         struct mali_job_descriptor_header *m =
                                 DESCRIPTOR_FOR_NODE(node_m);