panfrost: Fix a list_assert() in schedule_block()
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 27 Aug 2019 10:36:42 +0000 (12:36 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Fri, 13 Sep 2019 09:01:40 +0000 (11:01 +0200)
list_for_each_entry() does not allow modifying the current item pointer.
Let's rework the skip-instructions logic in schedule_block() to not
break this rule.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_schedule.c

index 68b7a0b2fe4d8f34bcab56051fb124309b99e20a..b8d9b5ec9be1538cf919e4f1e191c79bae38dc4d 100644 (file)
@@ -630,8 +630,13 @@ schedule_block(compiler_context *ctx, midgard_block *block)
 
         block->quadword_count = 0;
 
+        int skip = 0;
         mir_foreach_instr_in_block(block, ins) {
-                int skip;
+                if (skip) {
+                        skip--;
+                        continue;
+                }
+
                 midgard_bundle bundle = schedule_bundle(ctx, block, ins, &skip);
                 util_dynarray_append(&block->bundles, midgard_bundle, bundle);
 
@@ -640,9 +645,6 @@ schedule_block(compiler_context *ctx, midgard_block *block)
                         ctx->blend_constant_offset = offset * 0x10;
                 }
 
-                while(skip--)
-                        ins = mir_next_op(ins);
-
                 block->quadword_count += quadword_size(bundle.tag);
         }