Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4443370pxj; Mon, 21 Jun 2021 23:47:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyg+4Cnwyq3nSOMQ3Kp+VOIL31jhDS5Mt3lD77P00GL/5eKTQgRwsmFFt6sa6age4L2+wbd X-Received: by 2002:a05:6e02:1068:: with SMTP id q8mr1605635ilj.194.1624344463079; Mon, 21 Jun 2021 23:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624344463; cv=none; d=google.com; s=arc-20160816; b=nIl5PGi9qI7GHLb4om8ki16BCs5tuwh+Fd4wBp7ODWXGiNPQKouvyp/nLq7sh1K5yy 95OrZmc8G7b1YNg3O/QNVUR4tcmxqYFXxNtRQlUpSNYs11SIO4RY89Lw4fA8dJLpsDLA HT2eTOgkvsfQH7C38fD5i8wtiQiCoGNORKsvBxNFZHZ51yVRIKCXSGqZlgQMY6qR2/u2 Udc06kw/zSklCFNcvyZ37dmF/Xgju4PQKqdEjC/WRauvDl5xglwCcgbGCmOrc0UMF5kw ECbCCl6O2O3cx2L16o1n614t5YZd3nSD+VeygVH0jWYX2y/a7JB9TcK7IyAyrTcNIP24 h+Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=5qnWo/SzLWfySyvC7Oz1YEdmg8IJi0qS1OM10gavIVM=; b=LAARQpRJf7s+LIewOCMcp7K8rFDwJN3D1mQBYQuKMWAML/DjDumgQbJVmJJQmEhCrb K3QnFYXXY04O7aEYXLLDq/O6arbZzNKsk9S6UAm4azYjYa+mTxanTyt2gursAZiy2VIS KdTT7L6MZT1yrB9o5CjWX+srj2CCybe3HN6hvVaor9kWZIkr/wSUSdAlOAII0lVh0+t0 6Ab3r4QXnYSyc/nYh/V6wGJtlO29LamCAW8a/Ngwhlrgl6URI0P0AlHcYnR3mDMvysvK 15tgASLsn5CHOVkWuRjcr5zJI29lA0c5xyz59TjtauFbSK0dH/o2az8ujwFWG7t093j6 j5cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qGOTF9AN; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si14211554ilj.66.2021.06.21.23.47.30; Mon, 21 Jun 2021 23:47:43 -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=@gmail.com header.s=20161025 header.b=qGOTF9AN; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbhFVGtI (ORCPT + 99 others); Tue, 22 Jun 2021 02:49:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbhFVGtI (ORCPT ); Tue, 22 Jun 2021 02:49:08 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B630C061574 for ; Mon, 21 Jun 2021 23:46:52 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id a16so7065357ljq.3 for ; Mon, 21 Jun 2021 23:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version; bh=5qnWo/SzLWfySyvC7Oz1YEdmg8IJi0qS1OM10gavIVM=; b=qGOTF9ANdk9jqKq5x7XngP9yQf1BKuIkfVRzBYSYS5hJiOFL5O92U9pRYalQKJuJgu kpM8d53zaRFQ59zEF5mJIbuDAcnRilSR0o23nMwA9e+qCMYFQU3Ta+L+lzN5I1mzc9Wt UZ5madbcX7Avcr3Yk2+VWAw66Yzvb1Xy2FD7ad6A1zZamYs5qp0Km2uhFxZaYEwemkv7 in46kB4yCHhILncBQzG1lAWNlsrmQjA8913muxB9+Sa/842sFDcYKbeOJOGXmBNfNGkg E81gX0B3lIjZwqBY/91/QxaTMDixTHaEGg0HQ8CF0oEzuAN68Hq9n31l5KStk/n6ZNp6 fK7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version; bh=5qnWo/SzLWfySyvC7Oz1YEdmg8IJi0qS1OM10gavIVM=; b=b9m4LxASHAR4DMEgA4kaOEobtKToNfqwcJYovA9yOfUEwXki/UCMM+AEfNImbfrujb qvNfz928TFKSy4rG36EhjTChiE19SeVSngRtLGbDgXAiecKoGU4rbjzGP4SxOiEC5y23 24Xyab9NDBQha6ibpa7CXKBbnrd8yo6bEz7D90Uu/PO/Gzwr71irK4PzsYHq+DreSmMM R0+OegPl60zaVKAevDQdgWuekj//auAVvQUJ5VzV1u+LrQdVZpdUTXREsbUu8F6vCZhs cHxDpCYzu73Kpicp7u4JxrCa6V+M82WqQ898/mXOqy4NlkDVUnnADGkeYD++KB2n0yRI A6/g== X-Gm-Message-State: AOAM532B01+VbATMxSiCQpLOMI99Yeg2WCL7B+ZJTZV0qGV/mg+s+7vs B7gy8/HhBD1LpYSSK6fjSeg= X-Received: by 2002:a2e:9f45:: with SMTP id v5mr1826207ljk.171.1624344410861; Mon, 21 Jun 2021 23:46:50 -0700 (PDT) Received: from eldfell ([194.136.85.206]) by smtp.gmail.com with ESMTPSA id t7sm2101366lfe.172.2021.06.21.23.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 23:46:50 -0700 (PDT) Date: Tue, 22 Jun 2021 09:46:39 +0300 From: Pekka Paalanen 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, mripard@kernel.org, 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 v4 03/17] drm/uAPI: Add "active bpc" as feedback channel for "max bpc" drm property Message-ID: <20210622094639.4f41003b@eldfell> In-Reply-To: <20210618091116.14428-4-wse@tuxedocomputers.com> References: <20210618091116.14428-1-wse@tuxedocomputers.com> <20210618091116.14428-4-wse@tuxedocomputers.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/9B79vWVpJMlAP_qOfW3sima"; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/9B79vWVpJMlAP_qOfW3sima Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 18 Jun 2021 11:11:02 +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. >=20 > While "max bpc" can be used to change the color depth, there was no way to > 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 what 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 being available. >=20 > Signed-off-by: Werner Sembach > --- > drivers/gpu/drm/drm_connector.c | 51 +++++++++++++++++++++++++++++++++ > include/drm/drm_connector.h | 8 ++++++ > 2 files changed, 59 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connec= tor.c > index da39e7ff6965..943f6b61053b 100644 > --- a/drivers/gpu/drm/drm_connector.c > +++ b/drivers/gpu/drm/drm_connector.c > @@ -1197,6 +1197,14 @@ 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 tells userspace the pixel color bit dep= th > + * actually used by the hardware display engine on "the cable" on a > + * connector. The chosen value depends on hardware capabilities, both > + * display engine and connected monitor, and the "max bpc" property. > + * Drivers shall use drm_connector_attach_active_bpc_property() to insta= ll > + * this property. > + * > * Connectors also have one standardized atomic property: > * > * CRTC_ID: > @@ -2152,6 +2160,49 @@ 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; > + > + if (!connector->active_bpc_property) { > + prop =3D drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE, "acti= ve bpc", > + min, max); > + if (!prop) > + return -ENOMEM; > + > + connector->active_bpc_property =3D prop; > + drm_object_attach_property(&connector->base, prop, 0); > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_connector_attach_active_bpc_property); > + > +/** > + * drm_connector_set_active_bpc_property - sets the active bits per colo= r property for a connector > + * @connector: drm connector > + * @active_bpc: bits per color for the connector currently active on "th= e cable" > + * > + * Should be used by atomic drivers to update the active bits per color = over a connector. > + */ > +void drm_connector_set_active_bpc_property(struct drm_connector *connect= or, int active_bpc) > +{ > + drm_object_property_set_value(&connector->base, connector->active_bpc_p= roperty, active_bpc); > +} > +EXPORT_SYMBOL(drm_connector_set_active_bpc_property); > + > /** > * drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPU= T_METADA" property > * @connector: connector to attach the property on. > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index 714d1a01c065..eee86de62a5f 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -1380,6 +1380,12 @@ struct drm_connector { > */ > struct drm_property *max_bpc_property; > =20 > + /** > + * @active_bpc_property: Default connector property for the active bpc > + * to be driven out of the connector. > + */ > + struct drm_property *active_bpc_property; > + > #define DRM_CONNECTOR_POLL_HPD (1 << 0) > #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) > #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) > @@ -1702,6 +1708,8 @@ int drm_connector_set_panel_orientation_with_quirk( > int width, int height); > int drm_connector_attach_max_bpc_property(struct drm_connector *connecto= r, > int min, int max); > +int drm_connector_attach_active_bpc_property(struct drm_connector *conne= ctor, int min, int max); > +void drm_connector_set_active_bpc_property(struct drm_connector *connect= or, int active_bpc); > =20 > /** > * struct drm_tile_group - Tile group metadata Acked-by: Pekka Paalanen Thanks, pq --Sig_/9B79vWVpJMlAP_qOfW3sima Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAmDRh08ACgkQI1/ltBGq qqefDxAAnTLRWiJXKt324iuUjpCGVbdJKhpZM0IKnG4RtItTZyLGLQgUzh95qRiN g3YnCGoMa3pxgSgMtq3j+PidIdjquAEfJs351qFJtIxuPjNrfWM0GBRmUQFQdauq 2xyUju8k8LaqBiasR8ulgGGZYbOWfqgcZh6GamzsSU/39wec6Pmlx7Ehoa2cYjBp sL9fc7aemSh2igjWhIOdB53hB1r5DUAaDWqLxVuSQrKZnDlheDlbydbcVxfy6hG/ J71k/4sPopKcVzi0/o3wRs8jRIulvQC9f3+PVm84XeVuOWwsgR7euepL/ZImBmiw 1UwvLB4Q50ZAbKa4bi3VxC6E9taIjnc3LTvyM1wlMFyb3mWBgd549rMImyVdQfHf /Sol9zzE3BY81fo61KJ+4QIU/6S2uE2KIIpYBDKQm0k7CRscwRUXvnSOgGlY1uSZ uAkOck8vbxbUfZl5AGRKIA5ybHrtC6TqQJQ9fLS2naCo4s2zN8U30od21Gt0s7tC 5uLTqGoKMUSb/8UigJyIZGz3enuTegtUf+LcANyzZstCjGj1IIbN/HbvgWFIC3cz L+EcnH9b9unBCpndvaMt0CzSGkEZmIXVCpCQYmr4OIV3xpngl5liayo6+BvhWUWt ok+4G8SrDoVM59h9MrEiTpOcFScFQB1dB+zThRWUd1r27nxZGnM= =nxUW -----END PGP SIGNATURE----- --Sig_/9B79vWVpJMlAP_qOfW3sima--