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>
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index e95e414..e481bbb 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -271,7 +271,7 @@
/* 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 @@
*/
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 @@
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];
}
}
}
diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c
index 05afc87..3121ff5 100644
--- a/src/panfrost/lib/decode.c
+++ b/src/panfrost/lib/decode.c
@@ -497,10 +497,10 @@
{
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
diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml
index 01eea63..8387b46 100644
--- a/src/panfrost/lib/midgard.xml
+++ b/src/panfrost/lib/midgard.xml
@@ -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">