for (unsigned i = 0; i < rt_count; ++i) {
unsigned flags = 0;
- if (!blend[i].no_colour) {
- flags = 0x200;
+ pan_pack(&flags, BLEND_FLAGS, cfg) {
+ if (blend[i].no_colour)
+ break;
+
batch->draws |= (PIPE_CLEAR_COLOR0 << i);
- bool is_srgb = util_format_is_srgb(batch->key.cbufs[i]->format);
+ cfg.srgb = util_format_is_srgb(batch->key.cbufs[i]->format);
+ cfg.load_destination = !blend[i].no_blending; /* XXX */
+ cfg.dither_disable = !batch->ctx->blend->base.dither;
- SET_BIT(flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
- SET_BIT(flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
- SET_BIT(flags, MALI_BLEND_SRGB, is_srgb);
- SET_BIT(flags, MALI_BLEND_NO_DITHER, !batch->ctx->blend->base.dither);
+ if (!(dev->quirks & IS_BIFROST))
+ cfg.midgard_blend_shader = blend[i].is_shader;
}
if (dev->quirks & IS_BIFROST) {
brts[i].shader_type = fs->blend_types[i];
}
} else {
- mrts[i].flags = flags;
+ memcpy(&mrts[i].flags, &flags, sizeof(flags));
if (blend[i].is_shader) {
mrts[i].blend.shader = blend[i].shader.gpu | blend[i].shader.first_tag;
};
};
-/* We need to load the tilebuffer to blend (i.e. the destination factor is not
- * ZERO) */
-
-#define MALI_BLEND_LOAD_TIB (0x1)
-
-/* A blend shader is used to blend this render target */
-#define MALI_BLEND_MRT_SHADER (0x2)
-
-/* On MRT Midgard systems (using an MFBD), each render target gets its own
- * blend descriptor */
-
-#define MALI_BLEND_SRGB (0x400)
-
-/* Dithering is specified here for MFBD, otherwise NO_DITHER for SFBD */
-#define MALI_BLEND_NO_DITHER (0x800)
-
struct midgard_blend_rt {
- /* Flags base value of 0x200 to enable the render target.
- * OR with 0x1 for blending (anything other than REPLACE).
- * OR with 0x2 for programmable blending
- * OR with MALI_BLEND_SRGB for implicit sRGB
- */
-
- u64 flags;
+ struct mali_blend_flags_packed flags;
+ u32 zero;
union midgard_blend blend;
} __attribute__((packed));
((struct midgard_blend_rt *) descs) + rt_no;
/* Flags determine presence of blend shader */
- bool is_shader = (b->flags & 0xF) >= 0x2;
+ bool is_shader = b->flags.opaque[0] & 0x2;
pandecode_log("struct midgard_blend_rt blend_rt_%d_%d = {\n", job_no, rt_no);
pandecode_indent++;
- pandecode_prop("flags = 0x%" PRIx64, b->flags);
+ DUMP_CL("Flags", BLEND_FLAGS, &b->flags, 2);
union midgard_blend blend = b->blend;
mali_ptr shader = pandecode_midgard_blend(&blend, is_shader);
<field name="Divisor" size="32" start="3:0" type="uint"/>
</struct>
+ <struct name="Blend Flags" size="1">
+ <field name="Load destination" size="1" start="0" type="bool" default="false"/>
+ <field name="Midgard blend shader" size="1" start="1" type="bool" default="false"/>
+ <field name="Enable" size="1" start="9" type="bool" default="true"/>
+ <field name="sRGB" size="1" start="10" type="bool" default="false"/>
+ <field name="Dither disable" size="1" start="11" type="bool" default="false"/>
+ </struct>
+
<struct name="Midgard Sampler">
<field name="Magnify Nearest" size="1" start="0" type="bool" default="true"/>
<field name="Minify Nearest" size="1" start="1" type="bool" default="true"/>
if (loc == (FRAG_RESULT_DATA0 + i)) {
struct midgard_blend_rt blend_rt = {
- .flags = 0x200 | MALI_BLEND_NO_DITHER,
.blend = replace,
};
- if (util_format_is_srgb(image->format))
- blend_rt.flags |= MALI_BLEND_SRGB;
+ unsigned flags = 0;
+ pan_pack(&flags, BLEND_FLAGS, cfg) {
+ cfg.dither_disable = true;
+ cfg.srgb = util_format_is_srgb(image->format);
+ cfg.midgard_blend_shader = blend_shader;
+ }
+ blend_rt.flags.opaque[0] = flags;
- if (blend_shader) {
- blend_rt.flags |= MALI_BLEND_MRT_SHADER;
+ if (blend_shader)
blend_rt.blend.shader = blend_shader;
- }
memcpy(dest, &blend_rt, sizeof(struct midgard_blend_rt));
} else {