panfrost: Translate fixed-function blend at CSO create

Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
This commit is contained in:
Alyssa Rosenzweig
2021-05-14 13:22:47 -04:00
committed by Marge Bot
parent 3943adbd91
commit ffeeda3414
3 changed files with 11 additions and 6 deletions

View File

@@ -115,6 +115,13 @@ panfrost_create_blend_state(struct pipe_context *pipe,
};
so->pan.rts[c].equation = equation;
/* Converting equations to Mali style is expensive, do it at
* CSO create time instead of draw-time */
if (so->info[c].fixed_function) {
pan_blend_to_fixed_function_equation(equation,
&so->equation[c]);
}
}
return so;
@@ -165,7 +172,6 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
sizeof(pan_blend.constants));
/* First, we'll try fixed function, matching equation and constant */
const struct pan_blend_equation eq = pan_blend.rts[rti].equation;
bool ff = blend->info[rti].fixed_function;
/* Not all formats are blendable, check if this one is */
@@ -182,7 +188,6 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
ctx->blend_color.color),
};
pan_blend_to_fixed_function_equation(eq, &final.equation.equation);
return final;
}

View File

@@ -65,7 +65,6 @@ struct panfrost_blend_shader_final {
};
struct panfrost_blend_equation_final {
struct MALI_BLEND_EQUATION equation;
float constant;
};
@@ -81,6 +80,7 @@ struct panfrost_blend_state {
struct pipe_blend_state base;
struct pan_blend_state pan;
struct pan_blend_info info[PIPE_MAX_COLOR_BUFS];
struct MALI_BLEND_EQUATION equation[PIPE_MAX_COLOR_BUFS];
};
/* Container for a final blend state, specialized to constants and a

View File

@@ -364,7 +364,7 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
for (unsigned i = 0; i < format_desc->nr_channels; i++)
chan_size = MAX2(format_desc->channel[0].size, chan_size);
cfg.bifrost.equation = blend[i].equation.equation;
cfg.bifrost.equation = so->equation[i];
/* Fixed point constant */
u16 constant = blend[i].equation.constant * ((1 << chan_size) - 1);
@@ -431,7 +431,7 @@ panfrost_emit_midgard_blend(struct panfrost_batch *batch,
if (blend[i].is_shader) {
cfg.midgard.shader_pc = blend[i].shader.gpu | blend[i].shader.first_tag;
} else {
cfg.midgard.equation = blend[i].equation.equation;
cfg.midgard.equation = ctx->blend->equation[i];
cfg.midgard.constant = blend[i].equation.constant;
}
}
@@ -569,7 +569,7 @@ panfrost_prepare_midgard_fs_state(struct panfrost_context *ctx,
state->sfbd_blend_shader = blend[0].shader.gpu |
blend[0].shader.first_tag;
} else {
state->sfbd_blend_equation = blend[0].equation.equation;
state->sfbd_blend_equation = so->equation[0];
state->sfbd_blend_constant = blend[0].equation.constant;
}
} else if (dev->quirks & MIDGARD_SFBD) {