From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH] drm/vc4: Ignore alpha on primary plane Date: Mon, 05 Mar 2018 13:15:39 -0800 Message-ID: <87tvtuusuc.fsf@anholt.net> References: <1519950760-68447-1-git-send-email-stschake@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0688381920==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 1243A6E4A1 for ; Mon, 5 Mar 2018 21:15:41 +0000 (UTC) In-Reply-To: <1519950760-68447-1-git-send-email-stschake@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Stefan Schake List-Id: dri-devel@lists.freedesktop.org --===============0688381920== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Stefan Schake 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 > --- > 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). --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlqds3sACgkQtdYpNtH8 nuhAlBAAhgLxYfQC0FVnoRS+yPz7avi5HP4lD09ryeHKRo+dVacMaK9FBEDZWd2j rI02JAFZPxgf6acCortzsEd1TgExtEwGHZVxJ1U9KJh4pMH4VLrRQYKCMkVlN5ug HPwlIylV/JcAkIdtaW7GrDMOrN7+RuxDul0T5YHBVGXPMw/4+f77esTusYEWC9I9 d/vvux/i+XEolJx3UZ9+hiPR3Sn2vV4nHQ/M/ha/842c1VZ1Tvmzzh25UBxyKB41 KHwmaXRDJOlbl7UuqARdffodWkN0IVGVMxumBC88nLTEv/TE0OLAdItp5jtdrrNV b2YqirAqAtDQsQqsNFX0SvZwTS7VGERuA3hV1rcOIMKop555o3n2w/PtwGJGCC6W XRYTxvnKg4j7mZJse5dzaZAEg3BTc5VTcKaHo2LboTsaRN8SBXMtVfGgOlx7wCHt b685x+HQKpabs2kQMZN7ibY7MmoqIM1GG99wNi1PJm+NhbL8fc1PFoYUVW2dksso V3cnzRXQG/akPXSm1oQtKQO9ZLojU7KgJL7UrNOvK7jQPUFnA3aUUQbyuKr8sQ4O XeE5kXpxpD63aQXKtZolgVphL99iVOhugH5qdpgPsH6kmjynTMOlHNXGpdtl/3vF JWR8mn3/sUI/RGVROjk6O0akEmrxvSHURAuZkC7bsgYrG6/jM74= =cDfD -----END PGP SIGNATURE----- --=-=-=-- --===============0688381920== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0688381920==--