[PATCH] drm/vc4: Ignore alpha on primary plane

Stefan Schake stschake at gmail.com
Mon Mar 5 17:55:30 PST 2018


On Mon, Mar 5, 2018 at 10:15 PM, Eric Anholt <eric at anholt.net> wrote:
> Stefan Schake <stschake at gmail.com> writes:
>
>> We allow alpha formats on the primary plane but a partially transparent
>> framebuffer will cause a corrupted display. With this change black pixels
>> are output instead, in line with the behavior for other DRM drivers.
>>
>> Signed-off-by: Stefan Schake <stschake at gmail.com>
>> ---
>> Test program is available at https://github.com/stschake/vc4-alpha-test
>
> How about this as a suggestion for a patch series:
>
> vc4_plane_mode_set() sets ALPHA_PREMULT (POS2 bit 29) if alpha is
> enabled.
>
> vc4_plane_mode_set() sets a new vc4_plane->needs_bg_fill boolean to
> (format->has_alpha || !covers_screen) where covers_screenis the
> can_position logic from drm_atomic_helper.c
>
> vc4_crtc_atomic_flush() updates DISPBKGND to enable background fill
> (before vc4_crtc_update_dlist()) if the first plane has needs_bg_fill
> set.
>
> vc4_plane_mode_set() strips off the alpha blend bits if
> !vc4_plane->needs_bg_fill.
>
> This lets us keep avoiding the background fill cost in the normal case,
> and fixes the case where the "primary" plane doesn't cover the screen.
> It doesn't get the background fill turned back off if you transition
> away from primary not covering the screen, but that seems unlikely and
> harder to handle (since you would need to wait for the flip to be done
> before disabling).

I've sent out the series:

https://patchwork.freedesktop.org/series/39411/

I don't think we need the final change since

!needs_bg_fill <=> !(has_alpha||!covers_screen) <=> covers_screen && !has_alpha

so we shouldn't be setting the alpha blend bits in the first place.

Thanks,
Stefan



More information about the linux-rpi-kernel mailing list