panfrost: Add a "Bifrost Internal Blend" descriptor

This descriptor can be passed directly as a constant to the bifrost
BLEND instruction and we'll need to pass this information to blend
shaders. Let's extract the "Bifrost Internal Blend" descriptor from the
"Bifrost Blend Overlay" definition.

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:
Boris Brezillon 2020-10-12 14:16:53 +02:00
parent e6186c2042
commit 8d707cd918
3 changed files with 19 additions and 14 deletions

View File

@ -271,7 +271,7 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
/* Disable blending for depth-only */
pan_pack(rts, BLEND, cfg) {
cfg.enable = false;
cfg.bifrost.mode = MALI_BIFROST_BLEND_MODE_OFF;
cfg.bifrost.internal.mode = MALI_BIFROST_BLEND_MODE_OFF;
}
return;
}
@ -296,8 +296,8 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
*/
assert((blend[i].shader.gpu & (0xffffffffull << 32)) ==
(fs->bo->gpu & (0xffffffffull << 32)));
cfg.bifrost.shader.pc = (u32)blend[i].shader.gpu;
cfg.bifrost.mode = MALI_BIFROST_BLEND_MODE_SHADER;
cfg.bifrost.internal.shader.pc = (u32)blend[i].shader.gpu;
cfg.bifrost.internal.mode = MALI_BIFROST_BLEND_MODE_SHADER;
} else {
enum pipe_format format = batch->key.cbufs[i]->format;
const struct util_format_description *format_desc;
@ -316,18 +316,19 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
cfg.bifrost.constant = constant;
if (blend[i].opaque)
cfg.bifrost.mode = MALI_BIFROST_BLEND_MODE_OPAQUE;
cfg.bifrost.internal.mode = MALI_BIFROST_BLEND_MODE_OPAQUE;
else
cfg.bifrost.mode = MALI_BIFROST_BLEND_MODE_FIXED_FUNCTION;
cfg.bifrost.internal.mode = MALI_BIFROST_BLEND_MODE_FIXED_FUNCTION;
cfg.bifrost.fixed_function.num_comps = format_desc->nr_channels;
cfg.bifrost.fixed_function.conversion.memory_format.format =
cfg.bifrost.internal.fixed_function.num_comps = format_desc->nr_channels;
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
panfrost_format_to_bifrost_blend(format_desc);
if (dev->quirks & HAS_SWIZZLES) {
cfg.bifrost.fixed_function.conversion.memory_format.swizzle =
cfg.bifrost.internal.fixed_function.conversion.memory_format.swizzle =
panfrost_get_default_swizzle(4);
}
cfg.bifrost.fixed_function.conversion.register_format = fs->blend_types[i];
cfg.bifrost.internal.fixed_function.conversion.register_format =
fs->blend_types[i];
}
}
}

View File

@ -497,10 +497,10 @@ pandecode_bifrost_blend(void *descs, int job_no, int rt_no, mali_ptr frag_shader
{
pan_unpack(descs + (rt_no * MALI_BLEND_LENGTH), BLEND, b);
DUMP_UNPACKED(BLEND, b, "Blend RT %d:\n", rt_no);
if (b.bifrost.mode != MALI_BIFROST_BLEND_MODE_SHADER)
if (b.bifrost.internal.mode != MALI_BIFROST_BLEND_MODE_SHADER)
return 0;
return (frag_shader & 0xFFFFFFFF00000000ULL) | b.bifrost.shader.pc;
return (frag_shader & 0xFFFFFFFF00000000ULL) | b.bifrost.internal.shader.pc;
}
static mali_ptr

View File

@ -451,12 +451,16 @@
<field name="Conversion" size="32" start="1:0" type="Bifrost Internal Conversion"/>
</struct>
<struct name="Bifrost Internal Blend">
<field name="Mode" size="2" start="0:0" type="Bifrost Blend Mode"/>
<field name="Shader" size="64" start="0:0" type="Bifrost Blend Shader"/>
<field name="Fixed-Function" size="64" start="0:0" type="Bifrost Blend Fixed-Function"/>
</struct>
<struct name="Bifrost Blend Overlay" no-direct-packing="true">
<field name="Constant" size="16" start="0:16" type="uint"/>
<field name="Equation" size="32" start="1:0" type="Blend Equation"/>
<field name="Mode" size="2" start="2:0" type="Bifrost Blend Mode"/>
<field name="Shader" size="64" start="2:0" type="Bifrost Blend Shader"/>
<field name="Fixed-Function" size="64" start="2:0" type="Bifrost Blend Fixed-Function"/>
<field name="Internal" size="64" start="2:0" type="Bifrost Internal Blend"/>
</struct>
<struct name="Blend" size="4">