freedreno/ir3: hack to avoid getting stuck in a loop
authorRob Clark <robclark@freedesktop.org>
Mon, 11 Apr 2016 17:03:51 +0000 (13:03 -0400)
committerRob Clark <robclark@freedesktop.org>
Wed, 13 Apr 2016 18:15:13 +0000 (14:15 -0400)
There are still some edge cases which result in a neighbor-loop.  Which
needs to be fixed, but this hack at least makes deqp tests finish.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3.h

index 3859f6a39f319ad834a82276742f1441b3978141..f68275e568c38ced5eacbde7ffa7d7e5e614a68d 100644 (file)
@@ -308,8 +308,14 @@ struct ir3_instruction {
 static inline struct ir3_instruction *
 ir3_neighbor_first(struct ir3_instruction *instr)
 {
-       while (instr->cp.left)
+       int cnt = 0;
+       while (instr->cp.left) {
                instr = instr->cp.left;
+               if (++cnt > 0xffff) {
+                       debug_assert(0);
+                       break;
+               }
+       }
        return instr;
 }
 
@@ -322,6 +328,10 @@ static inline int ir3_neighbor_count(struct ir3_instruction *instr)
        while (instr->cp.right) {
                num++;
                instr = instr->cp.right;
+               if (num > 0xffff) {
+                       debug_assert(0);
+                       break;
+               }
        }
 
        return num;