From 7f2ea2a433cc7eed8f4b55a2ad3a3f14f995a41a Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 7 Oct 2020 14:37:56 +0200 Subject: [PATCH] panfrost: Fix fixed-function blend on Mali v6 Mali v6 (G72) doesn't support constants in blend equations, let's use a shader in that case. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_blend_cso.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index e5d27037ac8..4378b4d00e8 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -103,8 +103,10 @@ static void * panfrost_create_blend_state(struct pipe_context *pipe, const struct pipe_blend_state *blend) { + struct panfrost_device *dev = pan_device(pipe->screen); struct panfrost_context *ctx = pan_context(pipe); struct panfrost_blend_state *so = rzalloc(ctx, struct panfrost_blend_state); + unsigned version = dev->gpu_id >> 12; so->base = *blend; /* TODO: The following features are not yet implemented */ @@ -129,6 +131,10 @@ panfrost_create_blend_state(struct pipe_context *pipe, &rt->equation, &rt->constant_mask); + /* v6 doesn't support blend constants in FF blend equations. */ + if (rt->has_fixed_function && version == 6 && rt->constant_mask) + rt->has_fixed_function = false; + if (rt->has_fixed_function) { rt->opaque = pipe.rgb_src_factor == PIPE_BLENDFACTOR_ONE && pipe.rgb_dst_factor == PIPE_BLENDFACTOR_ZERO &&