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 <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17091>
This commit is contained in:
Alyssa Rosenzweig 2022-06-16 14:50:09 -04:00 committed by Marge Bot
parent 1b29a99b7b
commit 738a1572d2
2 changed files with 10 additions and 9 deletions

View File

@ -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;
}
}

View File

@ -29,6 +29,7 @@
#include <stdint.h>
#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