diff options
author | Eric Anholt <[email protected]> | 2018-10-30 12:17:00 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-11-01 13:56:30 -0700 |
commit | 4e1b163eeda4d611383a6d36c5702af4fc80b85c (patch) | |
tree | 795c4f15776d1fde28c8c42eaba3bf86745c54f1 /src | |
parent | 4018eb04e8a5c8f049bec950561e5e139181f23a (diff) |
v3d: Update the TLB config for depth writes on V3D 4.2.
Fixes 311 piglit cases on the simulator.
Diffstat (limited to 'src')
-rw-r--r-- | src/broadcom/compiler/nir_to_vir.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index bb41c1be971..57be43d7245 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -896,6 +896,8 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr) #define TLB_TYPE_DEPTH ((2 << 6) | (0 << 4)) #define TLB_DEPTH_TYPE_INVARIANT (0 << 2) /* Unmodified sideband input used */ #define TLB_DEPTH_TYPE_PER_PIXEL (1 << 2) /* QPU result used */ +#define TLB_V42_DEPTH_TYPE_INVARIANT (0 << 3) /* Unmodified sideband input used */ +#define TLB_V42_DEPTH_TYPE_PER_PIXEL (1 << 3) /* QPU result used */ /* Stencil is a single 32-bit write. */ #define TLB_TYPE_STENCIL_ALPHA ((2 << 6) | (1 << 4)) @@ -929,12 +931,16 @@ emit_frag_end(struct v3d_compile *c) struct qinst *inst = vir_MOV_dest(c, vir_reg(QFILE_TLBU, 0), c->outputs[c->output_position_index]); + uint8_t tlb_specifier = TLB_TYPE_DEPTH; + + if (c->devinfo->ver >= 42) { + tlb_specifier |= (TLB_V42_DEPTH_TYPE_PER_PIXEL | + TLB_SAMPLE_MODE_PER_PIXEL); + } else + tlb_specifier |= TLB_DEPTH_TYPE_PER_PIXEL; inst->src[vir_get_implicit_uniform_src(inst)] = - vir_uniform_ui(c, - TLB_TYPE_DEPTH | - TLB_DEPTH_TYPE_PER_PIXEL | - 0xffffff00); + vir_uniform_ui(c, tlb_specifier | 0xffffff00); } else if (c->s->info.fs.uses_discard || c->fs_key->sample_alpha_to_coverage || !has_any_tlb_color_write) { @@ -951,12 +957,20 @@ emit_frag_end(struct v3d_compile *c) struct qinst *inst = vir_MOV_dest(c, vir_reg(QFILE_TLBU, 0), vir_reg(QFILE_NULL, 0)); + uint8_t tlb_specifier = TLB_TYPE_DEPTH; + + if (c->devinfo->ver >= 42) { + /* The spec says the PER_PIXEL flag is ignored for + * invariant writes, but the simulator demands it. + */ + tlb_specifier |= (TLB_V42_DEPTH_TYPE_INVARIANT | + TLB_SAMPLE_MODE_PER_PIXEL); + } else { + tlb_specifier |= TLB_DEPTH_TYPE_INVARIANT; + } inst->src[vir_get_implicit_uniform_src(inst)] = - vir_uniform_ui(c, - TLB_TYPE_DEPTH | - TLB_DEPTH_TYPE_INVARIANT | - 0xffffff00); + vir_uniform_ui(c, tlb_specifier | 0xffffff00); } /* XXX: Performance improvement: Merge Z write and color writes TLB |