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

Eric Anholt eric at anholt.net
Mon Mar 5 21:15:39 UTC 2018


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).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180305/83fcdb6a/attachment.sig>


More information about the dri-devel mailing list