Skip to content

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

Closed

Description

@mricher-git

Describe the bug

On Pi 5 (VC4_GEN_6_D), pixel blend mode = Pre-multiplied does not multiply the pixel color by the plane alpha property when the framebuffer has no alpha channel. Coverage and None do. The result is a solid picture at any plane alpha below opaque.

drivers/gpu/drm/drm_blend.c says a format with no alpha channel has fg.alpha of 1.0, and that all three blend modes are then the same equation. Each equation multiplies fg.rgb by plane_alpha. The same file says framebuffer pixels are not already multiplied by the plane alpha.

Source: https://github.com/raspberrypi/linux/blob/rpi-6.18.y/drivers/gpu/drm/drm_blend.c#L182-L186

"fg.alpha":
 *		 Alpha component value from the plane's pixel. If the plane's
 *		 pixel format has no alpha component, then this is assumed to be
 *		 1.0. In these cases, this property has no effect, as all three
 *		 equations become equivalent.

VC4_GEN_6_D in vc4_hvs5_get_alpha_blend_mode() sets SCALER5_CTL2_ALPHA_PREMULT only for DRM_MODE_BLEND_PREMULTI. For a format with no alpha channel, vc4_hvs6_get_alpha_mask_mode() sources alpha from the plane alpha property (SCALER6D_CTL0_ALPHA_MASK_FIXED), and mix_plane_alpha stays off. SCALER5_CTL2_ALPHA_PREMULT tells the HVS the color was already multiplied by that alpha. It was not, so plane_alpha * fg.rgb is dropped and the color stays solid.

Coverage and None leave SCALER5_CTL2_ALPHA_PREMULT clear, so the HVS multiplies the color by the plane alpha.

Seen on rpi-6.18.y:

  • drivers/gpu/drm/drm_blend.c lines 104-105 and 159-186
  • drivers/gpu/drm/vc4/vc4_plane.c vc4_hvs5_get_alpha_blend_mode() VC4_GEN_6_D case, and vc4_hvs6_get_alpha_mask_mode()

Property values on this kernel: Pre-multiplied=0, Coverage=1, None=2.

Steps to reproduce the behaviour

Put a white buffer with no alpha channel on an overlay plane at half opacity. kmssink looks up pixel-blend-mode. The default mode is Pre-multiplied.
gst-launch-1.0 videotestsrc pattern=white ! videoconvert ! kmssink plane-id=107 plane-properties='properties,alpha=(uint)32768'

The plane stays white.
gst-launch-1.0 videotestsrc pattern=white ! videoconvert ! kmssink plane-id=107 plane-properties='properties,alpha=(uint)32768,pixel-blend-mode=1'
gst-launch-1.0 videotestsrc pattern=white ! videoconvert ! kmssink plane-id=107 plane-properties='properties,alpha=(uint)32768,pixel-blend-mode=2'

Work as expected.
Coverage and None fade the white to 50%. Pre-multiplied returns it to solid white.

The same plane alpha on BGRA (alpha byte 255) fades under Pre-multiplied, because that format has an alpha channel and takes the per-pixel mix path.

Expected behaviour

At plane alpha 32768, all three modes show 50% white. drm_blend.c says the modes are equivalent when the format has no alpha channel.

Actual behaviour

Pre-multiplied stays 100% white. Coverage and None fade.

Device (s)

Raspberry Pi 5

System

Linux pi5-eledii 6.18.50+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.18.50-1+rpt1 (2026-09-11) aarch64 GNU/Linux
vcgencmd version
2026/05/26 16:01:25
Copyright (c) 2012 Broadcom
version 086b83e3 (release) (embedded)

Logs

No response

Additional context

No response

Activity

  1. popcornmix commented on Oct 21, 2026

    @popcornmix
    Collaborator

    Can you test #7703

  2. mricher-git commented on Oct 21, 2026

    @mricher-git
    Author

    Tested and it address the issue we were having. Quite the turn around time, many thanks! 🚀.

    Would you mind providing some insight on what the typical cycle length is for this type of fix to make it into the apt repo. TIA.

  3. popcornmix commented on Oct 21, 2026

    @popcornmix
    Collaborator

    The kernel gets bumped in apt every couple of months typically, usually prompted by fixes for significant bugs or security, support for upcoming product, and new sdcard image releases. We don't currently have one scheduled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions