Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3056624pxj; Mon, 7 Jun 2021 00:42:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt010+wQgNW38nDWw531I4yi3a0W+Yc86pXA8pPfOYugyc5jz+RZfyA8Yc98A0bOfYMfFd X-Received: by 2002:a17:906:c211:: with SMTP id d17mr16798803ejz.247.1623051749625; Mon, 07 Jun 2021 00:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623051749; cv=none; d=google.com; s=arc-20160816; b=EVq2sIASN5ypxGLO0mULkGiJAiBUhAzd1Ag4cg+RalAygxS5OgGucftkJKsm8ScFQf 8TXuZkJiIg3ah2Kl2UccLNAdLROJHwk2qklH0wFBlrSEJIYbjPAzAdLj/KbtVIwANZuA xuYELHSwV7MNVa+8bjJkvtda0qVvn7sSQmGEFuk0oYvJxiAGTtgNuUz0MgPmMgqdpf6+ WzFfnclBYFWeBpQv3iwnnfYvc1rwn5/l3OSWXAHj4l82MYLD7Qnp0LP0hdDKRQ6tpI3w HKs96PJY8BuhOkNWQzUY/ofLcc8R26U8+ttWQ1g05ZdwSj1jtdyQTibZmN6frO53il3P YNkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=nq7E0TCtn3bqp2hAkNThKCjEhjjQ30HBjKbfLIDNz5Q=; b=fbsCIW1YLzuGNWOwWjnTyoaTkcl7Dc/4JOPpJj+XxqXvutHp9GRtVNW7qqsFpo+zkX m9NXVo3mDvFjjwnHztDYV1/Qoz/xp+elsPUq8kMlTsJohx1dIPNIKHNHIL4P3AVZMti7 Q2JegeQ1iiKpMT0rESeB/iLdkztKxrNuas2q6feN08/gnGwteTfclz+/uZ2hdnwOF/Ud A4rdeySgge0lwtPnWHxQHyCrl7UZFkclUni6JaOyeN3bl0Wd/hBqWviuZ4Heoa6OFueM VAgNbRoaf+9+TrXUPk8nxdIz7mKJGFMpbH8XhQqyLS6uRCr6WPGgX+IQW49LBbP9PT7G ml7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b="N/ZMqksN"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="A5eVwM3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id af16si11926110ejc.433.2021.06.07.00.42.06; Mon, 07 Jun 2021 00:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b="N/ZMqksN"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="A5eVwM3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbhFGHmd (ORCPT + 99 others); Mon, 7 Jun 2021 03:42:33 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:39617 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhFGHmc (ORCPT ); Mon, 7 Jun 2021 03:42:32 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 6B764580834; Mon, 7 Jun 2021 03:40:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 07 Jun 2021 03:40:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=nq7E0TCtn3bqp2hAkNThKCjEhjj Q30HBjKbfLIDNz5Q=; b=N/ZMqksN9XtxE/zJBMhC868H5VHJCkn7LmMr7eq/too 7YeVQXt7Sj6RYkCXVZEQmQ+PHp8vohwiZFne4Oa43g7mxWREK+3nFfL0SnHJ5O9l J3ebdpU/jIzTET+t6g6gIE2Z6FgysWb2R8OaRly8s3JdUOBqupfgFjflsDTZQua4 5Y1KZjn81/Rudk4sP76huOdp/fprF36mB4jUwGOPF0qehioDUHyYmhPiflvJfbME /gr45G3tZXBgTtZjajE1EuBKzjfOMsnfneBstMDb0cWtp7KcpzC+TZkhHaRgie++ 8su2NmckIhH9ROJ/U6kvRg+fDVGQGNTbA36QG3sLQZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=nq7E0T Ctn3bqp2hAkNThKCjEhjjQ30HBjKbfLIDNz5Q=; b=A5eVwM3/pJF3UwKbBWJngX uJbXb7+LWwiBgcpfBHvD5c6Vgs7R3N9ExoVud1JlS9oh2lMw0svAXfXqhxjtNaFz Km2A4cdfeZZvoVyACo9GpY3lXs7jSyCPbEs4hUv4nVB0Q0aR+cWAc4+zwYk5HeQj OF8tEw4WsllUT40R4KCkzWcEzXaWNvjtnp17ib8R0Va/Gdpe9Ju13L4Qj6ksFuZd wApHljX+ID3LXqLa6munYuj8YdJb7zypXZmykfijHI5dk+VeXxhD4HGVOSd3IbRH dPCoYCGMM0KjpVoX8h/4viT2nyRImpySoqiYqqGUp2RmepGOFtcVv2B8UdAXAGRw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtiedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeevveefffduveeitdegtefhhfetueffteefffdvheevvdehteethedvleff gfejvdenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggt hh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Jun 2021 03:40:38 -0400 (EDT) Date: Mon, 7 Jun 2021 09:40:37 +0200 From: Maxime Ripard To: Werner Sembach Cc: harry.wentland@amd.com, sunpeng.li@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, airlied@linux.ie, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, tzimmermann@suse.de, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org Subject: Re: [PATCH 2/4] drm/uAPI: Add "active bpc" as feedback channel for "max bpc" drm property Message-ID: <20210607074037.oxm7qbhcx7gsg6yd@gilmour> References: <20210604171723.10276-1-wse@tuxedocomputers.com> <20210604171723.10276-3-wse@tuxedocomputers.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p3wy26msisgyobg2" Content-Disposition: inline In-Reply-To: <20210604171723.10276-3-wse@tuxedocomputers.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --p3wy26msisgyobg2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Fri, Jun 04, 2021 at 07:17:21PM +0200, Werner Sembach wrote: > Add a new general drm property "active bpc" which can be used by graphic = drivers > to report the applied bit depth per pixel back to userspace. Just a heads up, we'll need an open source project that has accepted it before merging it. See https://www.kernel.org/doc/html/latest/gpu/drm-uapi.html#open-source-us= erspace-requirements > While "max bpc" can be used to change the color depth, there was no way t= o check > which one actually got used. While in theory the driver chooses the best/= highest > color depth within the max bpc setting a user might not be fully aware wh= at his > hardware is or isn't capable off. This is meant as a quick way to double = check > the setup. >=20 > In the future, automatic color calibration for screens might also depend = on this > information available. >=20 > Signed-off-by: Werner Sembach > --- > drivers/gpu/drm/drm_atomic_uapi.c | 2 ++ > drivers/gpu/drm/drm_connector.c | 40 +++++++++++++++++++++++++++++++ > include/drm/drm_connector.h | 15 ++++++++++++ > 3 files changed, 57 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atom= ic_uapi.c > index 268bb69c2e2f..7ae4e40936b5 100644 > --- a/drivers/gpu/drm/drm_atomic_uapi.c > +++ b/drivers/gpu/drm/drm_atomic_uapi.c > @@ -873,6 +873,8 @@ drm_atomic_connector_get_property(struct drm_connecto= r *connector, > *val =3D 0; > } else if (property =3D=3D connector->max_bpc_property) { > *val =3D state->max_requested_bpc; > + } else if (property =3D=3D connector->active_bpc_property) { > + *val =3D state->active_bpc; > } else if (connector->funcs->atomic_get_property) { > return connector->funcs->atomic_get_property(connector, > state, property, val); > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connec= tor.c > index 7631f76e7f34..5f42a5be5822 100644 > --- a/drivers/gpu/drm/drm_connector.c > +++ b/drivers/gpu/drm/drm_connector.c > @@ -1195,6 +1195,13 @@ static const struct drm_prop_enum_list dp_colorspa= ces[] =3D { > * drm_connector_attach_max_bpc_property() to create and attach the > * property to the connector during initialization. > * > + * active bpc: > + * This read-only range property is used by userspace check the bit depth > + * actually applied by the GPU driver after evaluation all hardware ^ display Depending on the system, the display component might have a GPU attached or not, and the GPU might have a display component or not. > + * capabilities and max bpc. Drivers to use the function > + * drm_connector_attach_active_bpc_property() to create and attach the > + * property to the connector during initialization. > + * > * Connectors also have one standardized atomic property: > * > * CRTC_ID: > @@ -2150,6 +2157,39 @@ int drm_connector_attach_max_bpc_property(struct d= rm_connector *connector, > } > EXPORT_SYMBOL(drm_connector_attach_max_bpc_property); > =20 > +/** > + * drm_connector_attach_active_bpc_property - attach "active bpc" proper= ty > + * @connector: connector to attach active bpc property on. > + * @min: The minimum bit depth supported by the connector. > + * @max: The maximum bit depth supported by the connector. > + * > + * This is used to check the applied bit depth on a connector. > + * > + * Returns: > + * Zero on success, negative errno on failure. > + */ > +int drm_connector_attach_active_bpc_property(struct drm_connector *conne= ctor, > + int min, int max) > +{ > + struct drm_device *dev =3D connector->dev; > + struct drm_property *prop; > + > + prop =3D connector->active_bpc_property; > + if (!prop) { > + prop =3D drm_property_create_range(dev, 0, "active bpc", min, max); > + if (!prop) > + return -ENOMEM; > + > + connector->active_bpc_property =3D prop; > + } > + > + drm_object_attach_property(&connector->base, prop, 0); > + connector->state->active_bpc =3D 0; I guess we want to default to 8? Maxime --p3wy26msisgyobg2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYL3NdQAKCRDj7w1vZxhR xW9iAQCqBVy+34/6/7fZGJk9fSwKmxPEOrt3Z64pKzVhYa+2XQEAxB7WeGQsnb8V xKwe4pgJJQ+NMocJbxmxYRV5QZGhYAQ= =O0Ys -----END PGP SIGNATURE----- --p3wy26msisgyobg2--