From 649e45234f1f1a242866b39877cb015aca9f68c7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 5 Feb 2021 18:12:59 -0500 Subject: [PATCH] pan/bi: Move bi_constant_field to bifrost.h It's a hardware invariant, and useful for the scheduler (not just packing). Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/bi_pack.c | 11 ----------- src/panfrost/bifrost/bifrost.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index c988f16fc4d..d37e2aeb826 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -86,17 +86,6 @@ bi_lookup_constant(bi_clause *clause, uint32_t cons, bool *hi) unreachable("Invalid constant accessed"); } -static unsigned -bi_constant_field(unsigned idx) -{ - assert(idx <= 5); - - const unsigned values[] = { - 4, 5, 6, 7, 2, 3 - }; - - return values[idx] << 4; -} static bool bi_assign_fau_idx_single(bi_registers *regs, diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index daa0e69e577..0f0afb3b473 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -28,6 +28,7 @@ #include #include +#include #define BIFROST_DBG_MSGS 0x0001 #define BIFROST_DBG_SHADERS 0x0002 @@ -602,4 +603,18 @@ struct bi_constants { enum bi_constmod mods[6]; }; +/* FAU selectors for constants are out-of-order, construct the top bits + * here given a embedded constant index in a clause */ + +static inline unsigned +bi_constant_field(unsigned idx) +{ + const unsigned values[] = { + 4, 5, 6, 7, 2, 3 + }; + + assert(idx <= 5); + return values[idx] << 4; +} + #endif