pan/midgard: Add blend shader selection bits for MRT

This is less complicated than previously thought. Note we have no way of
specifying the work register count for blend shaders; it must be
strictly less than the work register count of the corresponding fragment
shader (which is fine since we force the fragment shader to report a
count of 16 with a blend shader as a major hack until we get register
pressure down for blend shaders).

TODO: pandecode the flags.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-11-12 14:19:52 -05:00 committed by Tomeu Vizoso
parent e101af8671
commit fd81916ee5
3 changed files with 13 additions and 30 deletions

View file

@ -25,12 +25,6 @@ dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb_depth_component16
dEQP-GLES2.functional.fbo.render.shared_depthbuffer.rbo_rgb565_depth_component16 Fail
dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgba_depth_component16 Fail
dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgb_depth_component16 Fail
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.add_dst_color_one_minus_src_color Fail
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_alpha Fail
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_color Fail
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_one Fail
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_src_color_one_minus_src_alpha Fail
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_src_color_one_minus_src_color Fail
dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.6 Fail
dEQP-GLES2.functional.polygon_offset.default_render_with_units Fail
dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units Fail

View file

@ -1083,36 +1083,17 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
struct midgard_blend_rt rts[4];
for (unsigned i = 0; i < rt_count; ++i) {
unsigned blend_count = 0x200;
if (blend[i].is_shader) {
/* For a blend shader, the bottom nibble corresponds to
* the number of work registers used, which signals the
* -existence- of a blend shader */
assert(blend[i].shader.work_count >= 2);
blend_count |= MIN2(blend[i].shader.work_count, 3);
} else {
/* Otherwise, the bottom bit simply specifies if
* blending (anything other than REPLACE) is enabled */
if (!blend[i].no_blending)
blend_count |= 0x1;
}
rts[i].flags = 0x200;
bool is_srgb =
(ctx->pipe_framebuffer.nr_cbufs > i) &&
(ctx->pipe_framebuffer.cbufs[i]) &&
util_format_is_srgb(ctx->pipe_framebuffer.cbufs[i]->format);
rts[i].flags = blend_count;
if (is_srgb)
rts[i].flags |= MALI_BLEND_SRGB;
if (!ctx->blend->base.dither)
rts[i].flags |= MALI_BLEND_NO_DITHER;
SET_BIT(rts[i].flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
SET_BIT(rts[i].flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
SET_BIT(rts[i].flags, MALI_BLEND_SRGB, is_srgb);
SET_BIT(rts[i].flags, MALI_BLEND_NO_DITHER, !ctx->blend->base.dither);
/* TODO: sRGB in blend shaders is currently
* unimplemented. Contact me (Alyssa) if you're

View file

@ -417,6 +417,14 @@ union midgard_blend {
};
};
/* 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 */