From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Paalanen Subject: Re: [PATCH v7 10/11] drm/hdcp: update content protection property with uevent Date: Thu, 4 Jul 2019 14:14:19 +0300 Message-ID: <20190704141419.145ff9bf@eldfell.localdomain> References: <20190507162745.25600-1-ramalingam.c@intel.com> <20190507162745.25600-11-ramalingam.c@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1654658962==" Return-path: In-Reply-To: <20190507162745.25600-11-ramalingam.c@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ramalingam C Cc: daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1654658962== Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/6iW7AgD5amer1q.e7w=SzqB"; protocol="application/pgp-signature" --Sig_/6iW7AgD5amer1q.e7w=SzqB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 7 May 2019 21:57:44 +0530 Ramalingam C wrote: > drm function is defined and exported to update a connector's > content protection property state and to generate a uevent along > with it. >=20 > Need ACK for the uevent from userspace consumer. >=20 > v2: > Update only when state is different from old one. > v3: > KDoc is added [Daniel] >=20 > Signed-off-by: Ramalingam C > Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_hdcp.c | 32 ++++++++++++++++++++++++++++++++ > include/drm/drm_hdcp.h | 2 ++ > 2 files changed, 34 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c > index 75402463466b..f29b7abda51f 100644 > --- a/drivers/gpu/drm/drm_hdcp.c > +++ b/drivers/gpu/drm/drm_hdcp.c > @@ -372,6 +372,10 @@ DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name, > * > * The content protection will be set to &drm_connector_state.content_pr= otection > * > + * When kernel triggered content protection state change like DESIRED->E= NABLED > + * and ENABLED->DESIRED, will use drm_hdcp_update_content_protection() t= o update > + * the content protection state of a connector. > + * > * Returns: > * Zero on success, negative errno on failure. > */ > @@ -412,3 +416,31 @@ int drm_connector_attach_content_protection_property( > return 0; > } > EXPORT_SYMBOL(drm_connector_attach_content_protection_property); > + > +/** > + * drm_hdcp_update_content_protection - Updates the content protection s= tate > + * of a connector > + * > + * @connector: drm_connector on which content protection state needs an = update > + * @val: New state of the content protection property > + * > + * This function can be used by display drivers, to update the kernel tr= iggered > + * content protection state change of a drm_connector. This function upd= ate the > + * new state of the property into the connector's state and generate an = uevent > + * to notify the userspace. > + */ > +void drm_hdcp_update_content_protection(struct drm_connector *connector, > + u64 val) > +{ Hi, don't you need to ensure that 'val' cannot be UNDESIRED? > + struct drm_device *dev =3D connector->dev; > + struct drm_connector_state *state =3D connector->state; > + > + WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); > + if (state->content_protection =3D=3D val) > + return; > + > + state->content_protection =3D val; > + drm_sysfs_connector_status_event(connector, > + dev->mode_config.content_protection_property); > +} > +EXPORT_SYMBOL(drm_hdcp_update_content_protection); > diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h > index 2970abdfaf12..dd864ac9ce85 100644 > --- a/include/drm/drm_hdcp.h > +++ b/include/drm/drm_hdcp.h > @@ -292,4 +292,6 @@ bool drm_hdcp_check_ksvs_revoked(struct drm_device *d= ev, > u8 *ksvs, u32 ksv_count); > int drm_connector_attach_content_protection_property( > struct drm_connector *connector, bool hdcp_content_type); > +void drm_hdcp_update_content_protection(struct drm_connector *connector, > + u64 val); > #endif This patch is missing all UAPI documentation. Particularly important is the detail that the kernel will not send an event corresponding to userspace explicitly setting "Content Protection" to "Undesired". That is what you explained to me in the Weston MR !48, but I don't actually see it in the code here. It would be best to enforce that in the shared DRM code. Thanks, pq --Sig_/6iW7AgD5amer1q.e7w=SzqB Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAl0d34sACgkQI1/ltBGq qqcd6g//dvwyW1qJd9Qk+hlLA9IkBXo7D1apzweMjXaEQ1Vzg7AwbwTo7c5oVp9n pw6aY0ueCnf6KnVq/cXS6TbJ3WjeioQJjc7DfGnITF7psMen34XrYnRnV7y1lPQb QSOhi6W3xKOp81054SO1LmqKaF4+Q3CQ0ug3o2XtS6MQviJyf8r/TZ0cgPUYa/nW ufOL8ellMcDCTTNlcxYmAH+JbDAlqD/ErApQ9sTmCnKKRpRaTxu1GNcJYuEIojby wuOztQNBociN75GFliN/iHA18596WLErJKHOlRy5qulZQr8cd3uCUhoeMdoPPRq8 4mxi8I5ShivWUl9Pn2ATSQlwEbIxdzYfyeifWpzvL7oh5QjYvpSEFavrt/7XNcxd +vKu4a5lCXc89dt9HzEtvQtdpFd1qsyINm5kK4Zccs27yYAmbSJ2rBAa3a3qsQ/R lpmnfCq22last+By2YEP3lxnDdCglBIOWQ7+07C5EJ8yT8hcIuAWid9KWmNUEFN7 R5Sb0fA3e9iAkEIp2tCLbVYX9XDn14UV7gShZpVUf1O82yRy+6Z4Nh6LCjZ/DRU4 fj1v8p3pjGw1Fjwwx9M+sMwlo5/7E8DND4BrEMXTsC+FjE2JlMCaZf6TVzRrKcqx QWVG/v97QrnQPrqi40SLTe+8oIu7GPqn0k28GTWvUg1uBMrgF/o= =KRkF -----END PGP SIGNATURE----- --Sig_/6iW7AgD5amer1q.e7w=SzqB-- --===============1654658962== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4 --===============1654658962==--