panfrost: Fix the reads_dest prototype

Takes too much state, only pass what we need.

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>
(cherry picked from commit a0592066b0)
This commit is contained in:
Alyssa Rosenzweig 2021-05-14 09:47:37 -04:00 committed by Eric Engestrom
parent fe5b1ad32d
commit fd3dc85507
4 changed files with 17 additions and 21 deletions

View file

@ -2317,7 +2317,7 @@
"description": "panfrost: Fix the reads_dest prototype",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "93824b6451a4cc3eece1d7afa77e9a440ee41ee3"
},

View file

@ -154,7 +154,7 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
/* First, we'll try fixed function, matching equation and constant */
if (pan_blend_can_fixed_function(dev, &pan_blend, rti)) {
struct panfrost_blend_final final = {
.load_dest = pan_blend_reads_dest(&pan_blend, rti),
.load_dest = pan_blend_reads_dest(pan_blend.rts[rti].equation),
.equation.constant = pan_blend_get_constant(dev, &pan_blend, rti),
.opaque = pan_blend_is_opaque(&pan_blend, rti),
.no_colour = pan_blend.rts[rti].equation.color_mask == 0,
@ -191,7 +191,8 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
.first_tag = shader->first_tag,
.gpu = (*bo)->ptr.gpu + *shader_offset,
},
.load_dest = pan_blend_reads_dest(&pan_blend, rti),
.load_dest = pan_blend.logicop_enable ||
pan_blend_reads_dest(pan_blend.rts[rti].equation),
};
*shader_offset += shader->binary.size;

View file

@ -304,25 +304,20 @@ is_dest_factor(enum blend_factor factor, bool alpha)
(factor == BLEND_FACTOR_SRC_ALPHA_SATURATE && !alpha);
}
/* Determines if a blend equation reads back the destination. This can occur by
* explicitly referencing the destination in the blend equation, or by using a
* partial writemask. */
bool
pan_blend_reads_dest(const struct pan_blend_state *state, unsigned rt)
pan_blend_reads_dest(const struct pan_blend_equation equation)
{
const struct pan_blend_rt_state *rt_state = &state->rts[rt];
if (state->logicop_enable ||
(rt_state->equation.color_mask &&
rt_state->equation.color_mask != 0xF))
return true;
if (is_dest_factor(rt_state->equation.rgb_src_factor, false) ||
is_dest_factor(rt_state->equation.alpha_src_factor, true) ||
rt_state->equation.rgb_dst_factor != BLEND_FACTOR_ZERO ||
rt_state->equation.rgb_invert_dst_factor ||
rt_state->equation.alpha_dst_factor != BLEND_FACTOR_ZERO ||
rt_state->equation.alpha_invert_dst_factor)
return true;
return false;
return (equation.color_mask && equation.color_mask != 0xF) ||
is_dest_factor(equation.rgb_src_factor, false) ||
is_dest_factor(equation.alpha_src_factor, true) ||
equation.rgb_dst_factor != BLEND_FACTOR_ZERO ||
equation.rgb_invert_dst_factor ||
equation.alpha_dst_factor != BLEND_FACTOR_ZERO ||
equation.alpha_invert_dst_factor;
}
/* Create the descriptor for a fixed blend mode given the corresponding Gallium

View file

@ -96,7 +96,7 @@ struct pan_blend_shader {
};
bool
pan_blend_reads_dest(const struct pan_blend_state *state, unsigned rt);
pan_blend_reads_dest(const struct pan_blend_equation eq);
bool
pan_blend_can_fixed_function(const struct panfrost_device *dev,