From: Boris Brezillon Date: Mon, 12 Oct 2020 09:19:45 +0000 (+0200) Subject: pan/bi: Rework blend descriptor access handling X-Git-Tag: upstream/21.0.0~3692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16179c89d118144b4435d9ad30e67d5fb7d923ef;p=platform%2Fupstream%2Fmesa.git pan/bi: Rework blend descriptor access handling The current logic assumes blend descriptors are always retrieved from the blend descriptor slots present in the FAU RAM, but this assumption no longer stands when we add blend shaders to the mix. In that case we need to use an 'opaque blend' whose descriptor is passed through embedded constants. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 1d33bed..310216f 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -124,12 +124,6 @@ bi_assign_fau_idx_single(bi_registers *regs, if (!ins) return assigned; - if (ins->type == BI_BLEND) { - assert(!assigned); - regs->fau_idx = 0x8; - return true; - } - if (ins->type == BI_BRANCH && clause->branch_constant) { /* By convention branch constant is last */ unsigned idx = clause->constant_count - 1; @@ -186,6 +180,18 @@ bi_assign_fau_idx_single(bi_registers *regs, assigned = true; } else if (ins->src[s] & BIR_INDEX_ZERO && fast_zero) { ins->src[s] = BIR_INDEX_PASS | BIFROST_SRC_STAGE; + } else if (ins->src[s] & BIR_INDEX_BLEND) { + unsigned rt = ins->blend_location; + + assert(rt <= 7); + assert((ins->src[s] & ~BIR_SPECIAL) == BIFROST_SRC_FAU_HI || + (ins->src[s] & ~BIR_SPECIAL) == BIFROST_SRC_FAU_LO); + ins->src[s] = BIR_INDEX_PASS | (ins->src[s] & ~BIR_SPECIAL); + if (assigned && regs->fau_idx != (8 | rt)) + unreachable("Mismatched FAU index"); + + regs->fau_idx = 8 | rt; + assigned = true; } else if (s & BIR_INDEX_UNIFORM) { unreachable("Push uniforms not implemented yet"); } diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 509f9a3..17a9d6c 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -158,8 +158,8 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr) pan_src_index(&instr->src[0]), BIR_INDEX_REGISTER | 60 /* Can this be arbitrary? */, /* Blend descriptor */ - BIR_INDEX_PASS | BIFROST_SRC_FAU_LO, - BIR_INDEX_PASS | BIFROST_SRC_FAU_HI, + BIR_INDEX_BLEND | BIFROST_SRC_FAU_LO, + BIR_INDEX_BLEND | BIFROST_SRC_FAU_HI, }, .src_types = { nir_intrinsic_src_type(instr), diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index bfc58ae..350a0d4 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -514,11 +514,13 @@ bi_remove_instruction(bi_instruction *ins) #define BIR_INDEX_CONSTANT (1 << 29) #define BIR_INDEX_ZERO (1 << 28) #define BIR_INDEX_PASS (1 << 27) +#define BIR_INDEX_BLEND (1 << 26) /* 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)) +#define BIR_SPECIAL (BIR_INDEX_REGISTER | BIR_INDEX_UNIFORM | \ + BIR_INDEX_CONSTANT | BIR_INDEX_ZERO | \ + BIR_INDEX_PASS | BIR_INDEX_BLEND) static inline unsigned bi_max_temp(bi_context *ctx)