};
struct panfrost_blend_equation_final {
- struct mali_blend_equation *equation;
+ struct mali_blend_equation_packed equation;
float constant;
};
* fixed-function configuration for this blend state */
bool has_fixed_function;
- struct mali_blend_equation equation;
+ struct mali_blend_equation_packed equation;
/* Mask of blend color components read */
unsigned constant_mask;
&rt->equation,
&rt->constant_mask);
- if (rt->has_fixed_function) {
- rt->opaque =
- (rt->equation.rgb_mode == 0x122) &&
- (rt->equation.alpha_mode == 0x122) &&
- (rt->equation.color_mask == 0xf);
- }
+ if (rt->has_fixed_function)
+ rt->opaque = (rt->equation.opaque[0] == 0xf0122122);
rt->load_dest = util_blend_uses_dest(pipe)
|| pipe.colormask != 0xF;
rt->constant_mask)) {
struct panfrost_blend_final final = {
.equation = {
- .equation = &rt->equation,
+ .equation = rt->equation,
.constant = constant
},
.load_dest = rt->load_dest,
.opaque = rt->opaque,
- .no_colour = (rt->equation.color_mask == 0x0)
+ .no_colour = rt->no_colour
};
return final;
bool
panfrost_make_fixed_blend_mode(
struct pipe_rt_blend_state blend,
- struct mali_blend_equation *out,
+ struct mali_blend_equation_packed *out,
unsigned *constant_mask)
{
- /* Gallium and Mali represent colour masks identically. XXX: Static
- * assert for future proof */
-
- out->color_mask = blend.colormask;
-
/* If no blending is enabled, default back on `replace` mode */
if (!blend.blend_enable) {
- out->rgb_mode = 0x122;
- out->alpha_mode = 0x122;
+ pan_pack(out, BLEND_EQUATION, cfg) {
+ cfg.color_mask = blend.colormask;
+ cfg.rgb_mode = cfg.alpha_mode = 0x122;
+ }
+
return true;
}
&alpha_mode))
return false;
- out->rgb_mode = rgb_mode;
- out->alpha_mode = alpha_mode;
+ pan_pack(out, BLEND_EQUATION, cfg) {
+ cfg.color_mask = blend.colormask;
+ cfg.rgb_mode = rgb_mode;
+ cfg.alpha_mode = alpha_mode;
+ }
return true;
}
bool
panfrost_make_fixed_blend_mode(
const struct pipe_rt_blend_state blend,
- struct mali_blend_equation *out,
+ struct mali_blend_equation_packed *out,
unsigned *constant_mask);
bool
blend[0].is_shader);
if (!blend[0].is_shader) {
- fragmeta->blend.equation = *blend[0].equation.equation;
+ fragmeta->blend.equation = blend[0].equation.equation;
fragmeta->blend.constant = blend[0].equation.constant;
}
const struct util_format_description *format_desc;
format_desc = util_format_description(format);
- brts[i].equation = *blend[i].equation.equation;
+ brts[i].equation = blend[i].equation.equation;
/* TODO: this is a bit more complicated */
brts[i].constant = blend[i].equation.constant;
if (blend[i].is_shader) {
mrts[i].blend.shader = blend[i].shader.gpu | blend[i].shader.first_tag;
} else {
- mrts[i].blend.equation = *blend[i].equation.equation;
+ mrts[i].blend.equation = blend[i].equation.equation;
mrts[i].blend.constant = blend[i].equation.constant;
}
}
unsigned complement_dominant : 1;
} __attribute__((packed));
-struct mali_blend_equation {
- /* Of type mali_blend_mode */
- unsigned rgb_mode : 12;
- unsigned alpha_mode : 12;
-
- unsigned zero1 : 4;
-
- /* Corresponds to MALI_MASK_* above and glColorMask arguments */
-
- unsigned color_mask : 4;
-} __attribute__((packed));
-
/* Compressed per-pixel formats. Each of these formats expands to one to four
* floating-point or integer numbers, as defined by the OpenGL specification.
* There are various places in OpenGL where the user can specify a compressed
mali_ptr shader;
struct {
- struct mali_blend_equation equation;
+ struct mali_blend_equation_packed equation;
float constant;
};
};
*/
u16 constant;
- struct mali_blend_equation equation;
+ struct mali_blend_equation_packed equation;
/*
* - 0x19 normally
};
#undef FLAG_INFO
-#define FLAG_INFO(flag) { MALI_MASK_##flag, "MALI_MASK_" #flag }
-static const struct pandecode_flag_info mask_flag_info[] = {
- FLAG_INFO(R),
- FLAG_INFO(G),
- FLAG_INFO(B),
- FLAG_INFO(A),
- {}
-};
-#undef FLAG_INFO
-
#define FLAG_INFO(flag) { MALI_##flag, "MALI_" #flag }
static const struct pandecode_flag_info u3_flag_info[] = {
FLAG_INFO(HAS_MSAA),
return shader_ptr;
}
-static void
-pandecode_blend_equation(const struct mali_blend_equation *blend)
-{
- if (blend->zero1)
- pandecode_msg("XXX: blend zero tripped: %X\n", blend->zero1);
-
- pandecode_log(".equation = {\n");
- pandecode_indent++;
-
- pandecode_prop("rgb_mode = 0x%X", blend->rgb_mode);
- pandecode_prop("alpha_mode = 0x%X", blend->alpha_mode);
-
- pandecode_log(".color_mask = ");
- pandecode_log_decoded_flags(mask_flag_info, blend->color_mask);
- pandecode_log_cont(",\n");
-
- pandecode_indent--;
- pandecode_log("},\n");
-}
-
/* Decodes a Bifrost blend constant. See the notes in bifrost_blend_rt */
static unsigned
b->constant, decode_bifrost_constant(b->constant));
/* TODO figure out blend shader enable bit */
- pandecode_blend_equation(&b->equation);
+ DUMP_CL("Equation", BLEND_EQUATION, &b->equation, 2);
pandecode_prop("unk2 = 0x%" PRIx16, b->unk2);
pandecode_prop("index = 0x%" PRIx16, b->index);
if (is_shader) {
pandecode_shader_address("shader", blend->shader);
} else {
- pandecode_blend_equation(&blend->equation);
+ DUMP_CL("Equation", BLEND_EQUATION, &blend->equation, 2);
pandecode_prop("constant = %f", blend->constant);
}
<field name="Divisor" size="32" start="3:0" type="uint"/>
</struct>
+ <struct name="Blend Equation" size="1">
+ <field name="RGB Mode" size="12" start="0" type="uint"/>
+ <field name="Alpha Mode" size="12" start="12" type="uint"/>
+ <field name="Color mask" size="4" start="28" type="uint" default="15"/>
+ </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"/>
cfg.depth_pass = MALI_STENCIL_OP_REPLACE;
};
+ struct mali_blend_equation_packed eq;
+
+ pan_pack(&eq, BLEND_EQUATION, cfg) {
+ cfg.rgb_mode = 0x122;
+ cfg.alpha_mode = 0x122;
+
+ if (loc < FRAG_RESULT_DATA0)
+ cfg.color_mask = 0x0;
+ }
+
union midgard_blend replace = {
- .equation = {
- .rgb_mode = 0x122,
- .alpha_mode = 0x122,
- .color_mask = MALI_MASK_R | MALI_MASK_G | MALI_MASK_B | MALI_MASK_A,
- }
+ .equation = eq
};
if (blend_shader)
if (pool->dev->quirks & MIDGARD_SFBD) {
shader_meta.unknown2_4 |= (0x10 | MALI_NO_DITHER);
shader_meta.blend = replace;
-
- if (loc < FRAG_RESULT_DATA0)
- shader_meta.blend.equation.color_mask = 0x0;
}
if (loc == FRAG_RESULT_DEPTH) {