From 683cd9b6f4f8c7c9531b39c5c5ef6f21a5396ea5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 26 Mar 2020 10:10:33 -0400 Subject: [PATCH] pan/bi: Fix off-by-one in scoreboarding packing Clauses actually encode the *next* clauses' dependencies. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 2 +- src/panfrost/bifrost/bi_schedule.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index aab59f724d0..9e83a56e1e7 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -43,7 +43,7 @@ bi_pack_header(bi_clause *clause, bi_clause *next, bool is_fragment) .branch_cond = clause->branch_conditional, .datareg_writebarrier = clause->data_register_write_barrier, .datareg = clause->data_register, - .scoreboard_deps = clause->dependencies, + .scoreboard_deps = next ? next->dependencies : 0, .scoreboard_index = clause->scoreboard_id, .clause_type = clause->clause_type, .next_clause_type = next ? next->clause_type : 0, diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 589c84897ac..f112553c05a 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -104,17 +104,16 @@ bi_schedule(bi_context *ctx) if (is_first) is_first = false; - else + else { + /* Rule: first instructions cannot have write barriers */ u->dependencies |= (1 << last_id); + u->data_register_write_barrier = true; + } ids = ids & 1; last_id = u->scoreboard_id; u->back_to_back = true; - /* Rule: first instructions cannot have write barriers */ - if (!is_first) - u->data_register_write_barrier = true; - u->constant_count = 1; u->constants[0] = ins->constant.u64; -- 2.30.2