From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH v2] drm/vc4: Add support for plane alpha Date: Mon, 23 Apr 2018 11:27:57 -0700 Message-ID: <87sh7lhj6a.fsf@anholt.net> References: <20180421000954.18936-1-stschake@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0685941490==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id F133F6E0ED for ; Mon, 23 Apr 2018 18:27:59 +0000 (UTC) In-Reply-To: <20180421000954.18936-1-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 --===============0685941490== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Stefan Schake writes: > The HVS supports mixing fixed alpha with per-pixel alpha or > setting a fixed plane alpha in case there is no per-pixel information. > This allows us to support the generic DRM plane alpha property. > > Signed-off-by: Stefan Schake Applied to drm-misc-next. Thanks! > @@ -565,6 +567,13 @@ static int vc4_plane_mode_set(struct drm_plane *plan= e, > SCALER_POS1_SCL_HEIGHT)); > } >=20=20 > + /* Don't waste cycles mixing with plane alpha if the set alpha > + * is opaque or there is no per-pixel alpha information. > + * In any case we use the alpha property value as the fixed alpha. > + */ > + mix_plane_alpha =3D state->alpha !=3D DRM_BLEND_ALPHA_OPAQUE && > + fb->format->has_alpha; > + > /* Position Word 2: Source Image Size, Alpha */ > vc4_state->pos2_offset =3D vc4_state->dlist_count; > vc4_dlist_write(vc4_state, > @@ -572,6 +581,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane, > SCALER_POS2_ALPHA_MODE_PIPELINE : > SCALER_POS2_ALPHA_MODE_FIXED, > SCALER_POS2_ALPHA_MODE) | > + (mix_plane_alpha ? SCALER_POS2_ALPHA_MIX : 0) | > (fb->format->has_alpha ? SCALER_POS2_ALPHA_PREMULT : 0) | > VC4_SET_FIELD(vc4_state->src_w[0], SCALER_POS2_WIDTH) | > VC4_SET_FIELD(vc4_state->src_h[0], SCALER_POS2_HEIGHT)); In an interesting note from the docs, if you'd set SCALER_POS2_ALPHA_MIX with SCALER_POS2_ALPHA_MODE_FIXED, you'd get the fixed alpha squared! --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlreJa4ACgkQtdYpNtH8 nuhgEQ//QpNYT2nWULAIbbkMPm6v2LgfJu+JG81DcdBKe7dbjErhPBFNJGPBU6Oh 3m7AIfSNKCxhPAF8GrLphagltvS3LsWtzyaZTZZ+TTmLMvQxrzy5SJydYe94R8r+ f/PIDq0gK5L2OzV4oBdrbnGjV3XUIbAaHkTzP5YveRvR4RB5AlGVKCSDr95YLssL HlsG7NHiTe0ahXtI6KratBCGMAt2pHyWD+1JWZhu/AzTIM0fuMGw0oV3ukNiSgIR LjVAVB4k8e/cPBg3WgxB1iv/VdAR2sTAho2NgPr+8vPu20fmpHPxnbmDxW8GzZvA qhSlEvci8R3qrBSZEwBPsJ9sXOpjs8K7f9OrG9OLBDbTG45FTr3bG+aT/JL13Too +6GGJsLUTgAN6lf5huNVd9qPPbwC4dDu+U0C4oVeMDcaFbawBtgULeg+oKqi1iUt 1IdecASqfLs5HmMx3jfeZi5e8B5of9P19tKIa4qdwk1BQlvQB05wft7av9lewncK kxlHe056JBSn7c14IE5UkITiZhAZukeDrRvZwS+51pUee4D/oJ0VuAfwdP+00loo WgtCUnLk1Z1+OTaF+eZtZ1t12HnU6hXUe1l74ib8Y19eK28+yJjxp+Oxythg0Pdv cGhsLy20E2YBeFKKZn1a129NZ5nj5rD1QFqDS+vYSly8IAWm5a4= =QtVY -----END PGP SIGNATURE----- --=-=-=-- --===============0685941490== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0685941490==--