[3/5] panfrost: Fix a list_assert() in schedule_block()

Submitted by Boris Brezillon on Aug. 27, 2019, 10:36 a.m.

Details

Message ID 20190827103644.16346-3-boris.brezillon@collabora.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Aug. 27, 2019, 10:36 a.m.
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>
---
 src/panfrost/midgard/midgard_schedule.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index f80a0354fb88..57b0904cf007 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -581,8 +581,11 @@  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--)
+                        continue;
+
                 midgard_bundle bundle = schedule_bundle(ctx, block, ins, &skip);
                 util_dynarray_append(&block->bundles, midgard_bundle, bundle);
 
@@ -592,9 +595,6 @@  schedule_block(compiler_context *ctx, midgard_block *block)
                         ctx->blend_constant_offset = quadwords_within_block * 0x10;
                 }
 
-                while(skip--)
-                        ins = mir_next_op(ins);
-
                 block->quadword_count += quadword_size(bundle.tag);
         }
 

Comments

On Tue, 27 Aug 2019 12:36:42 +0200
Boris Brezillon <boris.brezillon@collabora.com> wrote:

> 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>
> ---
>  src/panfrost/midgard/midgard_schedule.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
> index f80a0354fb88..57b0904cf007 100644
> --- a/src/panfrost/midgard/midgard_schedule.c
> +++ b/src/panfrost/midgard/midgard_schedule.c
> @@ -581,8 +581,11 @@ 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--)
> +                        continue;
> +

Hm, should be

		if (skip) {
			skip--;
			continue;
		}

I'll fix that in v2.

>                  midgard_bundle bundle = schedule_bundle(ctx, block, ins, &skip);
>                  util_dynarray_append(&block->bundles, midgard_bundle, bundle);
>  
> @@ -592,9 +595,6 @@ schedule_block(compiler_context *ctx, midgard_block *block)
>                          ctx->blend_constant_offset = quadwords_within_block * 0x10;
>                  }
>  
> -                while(skip--)
> -                        ins = mir_next_op(ins);
> -
>                  block->quadword_count += quadword_size(bundle.tag);
>          }
>