mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-06 20:50:31 +01:00
pan/bi: Add load_output support
This is mapped to the LD_TILE instruction. Note that multi-sample RTs are not supported yet. 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/7151>
This commit is contained in:
parent
c7748968ba
commit
8da0a1d5fd
7 changed files with 63 additions and 0 deletions
|
|
@ -831,6 +831,8 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_s
|
|||
}
|
||||
case BI_LOAD_VAR_ADDRESS:
|
||||
return pan_pack_add_lea_attr_imm(clause, bundle.add, regs);
|
||||
case BI_LOAD_TILE:
|
||||
return pan_pack_add_ld_tile(clause, bundle.add, regs);
|
||||
case BI_MINMAX:
|
||||
if (bundle.add->op.minmax == BI_MINMAX_MIN) {
|
||||
if (bundle.add->dest_type == nir_type_float32)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ bi_class_name(enum bi_class cl)
|
|||
case BI_LOAD_ATTR: return "load_attr";
|
||||
case BI_LOAD_VAR: return "load_var";
|
||||
case BI_LOAD_VAR_ADDRESS: return "load_var_address";
|
||||
case BI_LOAD_TILE: return "load_tile";
|
||||
case BI_MINMAX: return "minmax";
|
||||
case BI_MOV: return "mov";
|
||||
case BI_SELECT: return "select";
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ bi_message_type_for_ins(bi_instruction *ins)
|
|||
case BI_BLEND:
|
||||
return BIFROST_MESSAGE_BLEND;
|
||||
|
||||
case BI_LOAD_TILE:
|
||||
return BIFROST_MESSAGE_TILE;
|
||||
|
||||
case BI_ATEST:
|
||||
return BIFROST_MESSAGE_ATEST;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
|
|||
[BI_LOAD_ATTR] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_LOAD_VAR] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_LOAD_VAR_ADDRESS] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_LOAD_TILE] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_MINMAX] = BI_SCHED_ADD | BI_NO_ABS_ABS_FP16_FMA | BI_MODS,
|
||||
[BI_MOV] = BI_SCHED_ALL,
|
||||
[BI_FMOV] = BI_MODS | BI_SCHED_ALL,
|
||||
|
|
|
|||
|
|
@ -540,4 +540,15 @@ struct bifrost_texture_operation {
|
|||
unsigned mask : 4;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define BIFROST_MEGA_SAMPLE 128
|
||||
#define BIFROST_ALL_SAMPLES 255
|
||||
#define BIFROST_CURRENT_PIXEL 255
|
||||
|
||||
struct bifrost_pixel_indices {
|
||||
unsigned sample : 8;
|
||||
unsigned rt : 8;
|
||||
unsigned x : 8;
|
||||
unsigned y : 8;
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -104,6 +104,46 @@ bi_load(enum bi_class T, nir_intrinsic_instr *instr)
|
|||
return load;
|
||||
}
|
||||
|
||||
static void
|
||||
bi_emit_ld_output(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
{
|
||||
assert(ctx->is_blend);
|
||||
|
||||
bi_instruction ins = {
|
||||
.type = BI_LOAD_TILE,
|
||||
.vector_channels = instr->num_components,
|
||||
.dest = pan_dest_index(&instr->dest),
|
||||
.dest_type = nir_type_float16,
|
||||
.src = {
|
||||
/* PixelIndices */
|
||||
BIR_INDEX_CONSTANT,
|
||||
/* PixelCoverage: we simply pass r60 which contains the cumulative
|
||||
* coverage bitmap
|
||||
*/
|
||||
BIR_INDEX_REGISTER | 60,
|
||||
/* InternalConversionDescriptor (see src/panfrost/lib/midgard.xml for more
|
||||
* details)
|
||||
*/
|
||||
BIR_INDEX_CONSTANT | 32
|
||||
},
|
||||
.src_types = { nir_type_uint32, nir_type_uint32, nir_type_uint32 },
|
||||
};
|
||||
|
||||
/* We want to load the current pixel.
|
||||
* FIXME: The sample to load is currently hardcoded to 0. This should
|
||||
* be addressed for multi-sample FBs.
|
||||
*/
|
||||
struct bifrost_pixel_indices pix = {
|
||||
.y = BIFROST_CURRENT_PIXEL,
|
||||
};
|
||||
memcpy(&ins.constant.u64, &pix, sizeof(pix));
|
||||
|
||||
/* Only keep the conversion part of the blend descriptor. */
|
||||
ins.constant.u64 |= ctx->blend_desc & 0xffffffff00000000ULL;
|
||||
|
||||
bi_emit(ctx, ins);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_emit_ld_vary(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
{
|
||||
|
|
@ -488,6 +528,10 @@ emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr)
|
|||
bi_emit_sysval(ctx, &instr->instr, 1, 8);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_output:
|
||||
bi_emit_ld_output(ctx, instr);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_viewport_scale:
|
||||
case nir_intrinsic_load_viewport_offset:
|
||||
case nir_intrinsic_load_num_work_groups:
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ enum bi_class {
|
|||
BI_LOAD_ATTR,
|
||||
BI_LOAD_VAR,
|
||||
BI_LOAD_VAR_ADDRESS,
|
||||
BI_LOAD_TILE,
|
||||
BI_MINMAX,
|
||||
BI_MOV,
|
||||
BI_REDUCE_FMA,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue