Skip to content

drm/vc4: hvs6: Fix plane alpha with Pre-multiplied and None blend modes - #7703

Open
popcornmix wants to merge 2 commits into
raspberrypi:rpi-6.18.yfrom
popcornmix:issue7700
Open

popcornmix wants to merge 2 commits into
raspberrypi:rpi-6.18.yfrom
popcornmix:issue7700

Conversation

@popcornmix

Copy link
Copy Markdown
Collaborator

Two plane alpha bugs on BCM2712:

  • D0: "Pre-multiplied" on a format with no alpha channel set ALPHA_PREMULT, so the plane was added unfaded on top of the planes below.
  • C1 and D0: "None" on a format with an alpha channel applied the plane alpha twice (0.5 blended as 0.25).

Tested by capturing through writeback on Pi 500 (D0, 7.3 kernel) and Pi 5 (C1, 6.18.57 kernel): with plane alpha 0.5, every blend mode on XRGB8888 and on ARGB8888 (pixel alpha 0xff, 0x80, 0x00) now matches the formulas in drm_blend.c.

Fixes #7700

…alpha

On BCM2712 D0, a format with no alpha channel takes its alpha from the
plane alpha property (ALPHA_MASK_FIXED). With the default
"Pre-multiplied" blend mode the ALPHA_PREMULT flag was still set, so
the HVS treated the colour as already multiplied by the plane alpha and
added it unscaled on top of the planes below.

The KMS blend modes are all equivalent when there is no pixel alpha,
so only set ALPHA_PREMULT when the format has an alpha channel, as the
other generations already do.

Fixes: raspberrypi#7700
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
With the "None" pixel blend mode the HVS takes the plane alpha property
as a fixed alpha. For a format with an alpha channel ALPHA_MIX was also
set, multiplying the plane alpha in a second time, so a plane alpha of
0.5 blended at 0.25. Seen on both BCM2712 C1 and D0.

Don't set ALPHA_MIX when the blend mode is "None".

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vc4: Pre-multiplied plane blend drops plane alpha on formats with no alpha channel

1 participant