pan/bi: Expose FAU slots

Instead of adding a BIR_INDEX_ per FAU index, let's group some of those
together.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
This commit is contained in:
Boris Brezillon 2020-11-12 16:18:13 +01:00
parent 9f640c0f3d
commit f0e3de7e91
3 changed files with 42 additions and 2 deletions

View file

@ -179,6 +179,15 @@ bi_assign_fau_idx_single(bi_registers *regs,
regs->fau_idx = 8 | rt;
assigned = true;
} else if (ins->src[s] & BIR_INDEX_FAU) {
unsigned index = ins->src[s] & BIR_FAU_TYPE_MASK;
bool hi = !!(ins->src[s] & BIR_FAU_HI);
assert(!assigned || regs->fau_idx == index);
regs->fau_idx = index;
ins->src[s] = BIR_INDEX_PASS |
(hi ? BIFROST_SRC_FAU_HI : BIFROST_SRC_FAU_LO);
assigned = true;
} else if (s & BIR_INDEX_UNIFORM) {
unreachable("Push uniforms not implemented yet");
}

View file

@ -99,6 +99,18 @@ bi_print_dest_index(FILE *fp, bi_instruction *ins, unsigned index)
return true;
}
static const char *
bir_fau_name(unsigned fau_idx)
{
const char *names[] = {
"zero", "lane-id", "wrap-id", "core-id",
"fb-extent", "atest-param", "sample-pos"
};
assert(fau_idx < ARRAY_SIZE(names));
return names[fau_idx];
}
static void
bi_print_index(FILE *fp, bi_instruction *ins, unsigned index, unsigned s)
{
@ -114,6 +126,9 @@ bi_print_index(FILE *fp, bi_instruction *ins, unsigned index, unsigned s)
else if (index & BIR_INDEX_BLEND)
fprintf(fp, "blend_descriptor_%u.%c", ins->blend_location,
(index & ~BIR_INDEX_BLEND) == BIFROST_SRC_FAU_HI ? 'y' : 'x');
else if (index & BIR_INDEX_FAU)
fprintf(fp, "%s.%c", bir_fau_name(index & BIR_FAU_TYPE_MASK),
(index & BIR_FAU_HI) ? 'y' : 'x');
else
fprintf(fp, "#err");
}
@ -327,7 +342,9 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
bi_foreach_src(ins, s) {
bi_print_src(fp, ins, s);
if (ins->src[s] && !(ins->src[s] & (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO))) {
if (ins->src[s] &&
!(ins->src[s] &
(BIR_INDEX_CONSTANT | BIR_INDEX_ZERO | BIR_INDEX_FAU))) {
pan_print_alu_type(ins->src_types[s], fp);
bi_print_swizzle(ins, s, fp);
}

View file

@ -536,12 +536,26 @@ bi_remove_instruction(bi_instruction *ins)
#define BIR_INDEX_ZERO (1 << 28)
#define BIR_INDEX_PASS (1 << 27)
#define BIR_INDEX_BLEND (1 << 26)
#define BIR_INDEX_FAU (1 << 25)
enum bir_fau {
BIR_FAU_ZERO = 0,
BIR_FAU_LANE_ID = 1,
BIR_FAU_WRAP_ID = 2,
BIR_FAU_CORE_ID = 3,
BIR_FAU_FB_EXTENT = 4,
BIR_FAU_ATEST_PARAM = 5,
BIR_FAU_SAMPLE_POS_ARRAY = 6,
BIR_FAU_TYPE_MASK = 15,
BIR_FAU_HI = (1 << 8),
};
/* Keep me synced please so we can check src & BIR_SPECIAL */
#define BIR_SPECIAL (BIR_INDEX_REGISTER | BIR_INDEX_UNIFORM | \
BIR_INDEX_CONSTANT | BIR_INDEX_ZERO | \
BIR_INDEX_PASS | BIR_INDEX_BLEND)
BIR_INDEX_PASS | BIR_INDEX_BLEND | \
BIR_INDEX_FAU)
static inline unsigned
bi_max_temp(bi_context *ctx)