From 738a1572d264be8bab8cb27301f842bcc4695b13 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 16 Jun 2022 14:50:09 -0400 Subject: [PATCH] pan/va: Move va_flow_is_wait_or_none to common We want to use this helper in the "mark last" pass too. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/valhall/va_merge_flow.c | 12 +++--------- src/panfrost/bifrost/valhall/valhall.h | 7 +++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/panfrost/bifrost/valhall/va_merge_flow.c b/src/panfrost/bifrost/valhall/va_merge_flow.c index f50ac2f84fe..a6987f8a6e7 100644 --- a/src/panfrost/bifrost/valhall/va_merge_flow.c +++ b/src/panfrost/bifrost/valhall/va_merge_flow.c @@ -104,12 +104,6 @@ merge_end_reconverge(bi_block *block) bi_remove_instruction(last); } -static bool -is_wait_or_none(enum va_flow flow) -{ - return (flow <= VA_FLOW_WAIT); -} - /* * Calculate the union of two waits. We may wait on any combination of slots #0, * #1, #2 or the entirety of 0126 and 01267. If we wait on the entirety, the @@ -120,7 +114,7 @@ is_wait_or_none(enum va_flow flow) static enum va_flow union_waits(enum va_flow x, enum va_flow y) { - assert(is_wait_or_none(x) && is_wait_or_none(y)); + assert(va_flow_is_wait_or_none(x) && va_flow_is_wait_or_none(y)); if ((x == VA_FLOW_WAIT) || (y == VA_FLOW_WAIT)) return VA_FLOW_WAIT; @@ -138,7 +132,7 @@ merge_waits(bi_block *block) bi_foreach_instr_in_block_safe(block, I) { if (last_free != NULL && - I->op == BI_OPCODE_NOP && is_wait_or_none(I->flow)) { + I->op == BI_OPCODE_NOP && va_flow_is_wait_or_none(I->flow)) { /* Merge waits with compatible instructions */ last_free->flow = union_waits(last_free->flow, I->flow); @@ -157,7 +151,7 @@ merge_waits(bi_block *block) * This includes such an instruction after merging in a wait. It also * includes async instructions. */ - if (is_wait_or_none(I->flow)) + if (va_flow_is_wait_or_none(I->flow)) last_free = I; } } diff --git a/src/panfrost/bifrost/valhall/valhall.h b/src/panfrost/bifrost/valhall/valhall.h index 07a71cbbaf0..a634a1487eb 100644 --- a/src/panfrost/bifrost/valhall/valhall.h +++ b/src/panfrost/bifrost/valhall/valhall.h @@ -29,6 +29,7 @@ #include #include "bi_opcodes.h" +#include "valhall_enums.h" #ifdef __cplusplus extern "C" { @@ -148,6 +149,12 @@ va_src_info(enum bi_opcode op, unsigned src) return valhall_opcodes[op].srcs[idx]; } +static inline bool +va_flow_is_wait_or_none(enum va_flow flow) +{ + return (flow <= VA_FLOW_WAIT); +} + #ifdef __cplusplus } /* extern C */ #endif