Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758499AbeAIN7S (ORCPT + 1 other); Tue, 9 Jan 2018 08:59:18 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:57661 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755870AbeAIN7P (ORCPT ); Tue, 9 Jan 2018 08:59:15 -0500 Date: Tue, 9 Jan 2018 14:59:13 +0100 From: Maxime Ripard To: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, Chen-Yu Tsai , Daniel Vetter , Jani Nikula , Sean Paul , Thomas Petazzoni , Boris Brezillon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl Subject: Re: [PATCH 06/19] drm/blend: Add a generic alpha property Message-ID: <20180109135913.wgyfvdfdffigxcll@flea> References: <5c765fc730d75cb362dc37bcdb3b3aeacc7bdb30.1515494838.git-series.maxime.ripard@free-electrons.com> <2691997.qmgyvrLtFu@avalon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="djbzxqepco2exv3j" Content-Disposition: inline In-Reply-To: <2691997.qmgyvrLtFu@avalon> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: --djbzxqepco2exv3j Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Laurent, On Tue, Jan 09, 2018 at 02:34:47PM +0200, Laurent Pinchart wrote: > > Some drivers duplicate the logic to create a property to store a per-pl= ane > > alpha. > >=20 > > Let's create a helper in order to move that to the core. > >=20 > > Cc: Boris Brezillon > > Cc: Laurent Pinchart > > Signed-off-by: Maxime Ripard > > --- > > Documentation/gpu/kms-properties.csv | 2 +- > > drivers/gpu/drm/drm_atomic.c | 4 ++++- > > drivers/gpu/drm/drm_atomic_helper.c | 1 +- > > drivers/gpu/drm/drm_blend.c | 32 ++++++++++++++++++++++++++++= +- > > include/drm/drm_blend.h | 1 +- > > include/drm/drm_plane.h | 6 +++++- > > 6 files changed, 45 insertions(+), 1 deletion(-) > >=20 > > diff --git a/Documentation/gpu/kms-properties.csv > > b/Documentation/gpu/kms-properties.csv index 927b65e14219..a3c3969c1992 > > 100644 > > --- a/Documentation/gpu/kms-properties.csv > > +++ b/Documentation/gpu/kms-properties.csv > > @@ -99,5 +99,5 @@ radeon,DVI-I,=E2=80=9Ccoherent=E2=80=9D,RANGE,"Min=3D= 0, Max=3D1",Connector,TBD > > ,,"""underscan vborder""",RANGE,"Min=3D0, Max=3D128",Connector,TBD > > ,Audio,=E2=80=9Caudio=E2=80=9D,ENUM,"{ ""off"", ""on"", ""auto"" }",Co= nnector,TBD > > ,FMT Dithering,=E2=80=9Cdither=E2=80=9D,ENUM,"{ ""off"", ""on"" }",Con= nector,TBD > > -rcar-du,Generic,"""alpha""",RANGE,"Min=3D0, Max=3D255",Plane,TBD > > +,,"""alpha""",RANGE,"Min=3D0, Max=3D255",Plane,Opacity of the plane fr= om > > transparent (0) to opaque (255) ,,"""colorkey""",RANGE,"Min=3D0, > > Max=3D0x01ffffff",Plane,TBD >=20 > I think more documentation is needed. You should explain how the property= =20 > operates and which formats it is applicable to. For instance you need to= =20 > clarify what happens for format that contain an alpha component. That's a very good point, and I'm not quite sure what should happen in the first place :) Should we forbid that configuration? > > /** > > + * drm_plane_create_alpha_property - create a new alpha property > > + * @plane: drm plane > > + * @alpha: initial value of alpha, from 0 (transparent) to 255 (opaque) >=20 > Do you have a use case for initializing the alpha value to something else= than=20 > fully opaque ? I don't, but thought it might be useful. Maybe it isn't, in which case I'm totally fine with it getting away. > > + * This function initializes a generic, mutable, alpha property and > > + * enables support for it in the DRM core. > > + * > > + * Drivers can then attach this property to their plane to enable > > + * support for configurable plane alpha. >=20 > The function attaches the property to the plane, is the > documentation outdated ? Yes, I'll fix it. > > + * Returns: > > + * 0 on success, negative error code on failure. > > + */ > > +int drm_plane_create_alpha_property(struct drm_plane *plane, u8 alpha) > > +{ > > + struct drm_property *prop; > > + > > + prop =3D drm_property_create_range(plane->dev, 0, "alpha", 0, 255); >=20 > Do you think the 0-255 range will fit all use cases ? This is kind of the same discussion we're having with Daniel, but are there hardware or formats with an alpha component wider than 255? Thanks! Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --djbzxqepco2exv3j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlpUyrEACgkQ0rTAlCFN r3SqXw//ZnsmUspU041Y2y5c4aGgpOeCmF5GHDQOggZIYVsZb1PDw9ZqWKamcLV6 zAwP1cMFGk5d8FCAgRuKHBd/0rZHkYoyRZGpXveyzP5jjp4MdAluxO5vp1XDT/wg zo5ZbWkCIwY8nGoAU7fjaoLUMpFxvdIabMYW4wajQxo9c/qTddBNlrURK0da2Qau z6tRUggX/T+3HDBKgWzJDRvUJ3H3Mq9MbQR0D3rDbDdDmrP5jKr62bf7mGps0CHO vttvGb6mDBdJL6wCMRCz8GMpQup70lEeCaQ8FXjPUKs3wyhsT26fZ1686p21GPAu p/nZxDCArkULfNVYlCNXxeFUX3/QqA2cm6tVk/7lAoSOeoIKzU6DcUlEdqw/h+6t vxblHMIewIog5AuJMcFG0eW6d2fPQIulcG/mhvjs60Bp0MMHOmxWWZoVcRmr1bPH T0cZgZ9EdZJqLKZbcSYf2aSkpK7Tl6A3B2Sk8dUIlVGAYOij2s4Bg7aFJwlavJjg w26xRjM4WtCpijIyjGZS4MuhLNOvDFCi1nckkh26T7ZnBmvmK+eylSgEZN1oFkuH a+hsdfhCl1sLzArTnaxMAue3roARkm4AXQw86yjhhBh+xtaYXAo4ByC3ue7KnjvE gSwPjyReYzLiAmKTZE2xvWuM/GXcFE/g5nuVYN8sPlfovCDtIbA= =F146 -----END PGP SIGNATURE----- --djbzxqepco2exv3j--