From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Paalanen Subject: Re: [PATCH v9 4/6] drm/hdcp: update content protection property with uevent Date: Tue, 9 Jul 2019 17:39:43 +0300 Message-ID: <20190709173943.2981a5de@eldfell.localdomain> References: <20190708112116.1780-1-ramalingam.c@intel.com> <20190708112116.1780-5-ramalingam.c@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1448215977==" Return-path: In-Reply-To: <20190708112116.1780-5-ramalingam.c@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Ramalingam C Cc: intel-gfx , dri-devel List-Id: dri-devel@lists.freedesktop.org --===============1448215977== Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/Qx.9wJCymW_r55VRIZzzP=Z"; protocol="application/pgp-signature" --Sig_/Qx.9wJCymW_r55VRIZzzP=Z Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 8 Jul 2019 16:51:14 +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] > v4: > KDoc is extended bit more [pekka] > v5: > Uevent usage is documented at kdoc of "Content Protection" also > [pekka] >=20 > Signed-off-by: Ramalingam C > Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_connector.c | 17 +++++++++++++---- > drivers/gpu/drm/drm_hdcp.c | 34 +++++++++++++++++++++++++++++++++ > include/drm/drm_hdcp.h | 2 ++ > 3 files changed, 49 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connec= tor.c > index 732f6645643d..6de906ef10b3 100644 > --- a/drivers/gpu/drm/drm_connector.c > +++ b/drivers/gpu/drm/drm_connector.c > @@ -947,10 +947,19 @@ static const struct drm_prop_enum_list hdmi_colorsp= aces[] =3D { > * - If the state is DESIRED, kernel should attempt to re-authenticate t= he > * link whenever possible. This includes across disable/enable, dpms, > * hotplug, downstream device changes, link status failures, etc.. > - * - Userspace is responsible for polling the property to determine when > - * the value transitions from ENABLED to DESIRED. This signifies the l= ink > - * is no longer protected and userspace should take appropriate action > - * (whatever that might be). > + * - Kernel sends uevent with the connector id and property id through > + * @drm_hdcp_update_content_protection, upon below kernel triggered > + * scenarios: > + * DESIRED -> ENABLED (authentication success) > + * ENABLED -> DESIRED (termination of authentication) > + * - Please note no uevents for userspace triggered property state chang= es, > + * which can't fail such as > + * DESIRED/ENABLED -> UNDESIRED > + * UNDESIRED -> DESIRED > + * - Userspace is responsible for polling the property or listen to ueve= nts > + * to determine when the value transitions from ENABLED to DESIRED. > + * This signifies the link is no longer protected and userspace should > + * take appropriate action (whatever that might be). Yes! This doc is exactly what I hoped to see. Good job. This is also exactly how https://gitlab.freedesktop.org/wayland/weston/merge_requests/48 deals with this in userspace. That MR still has some open issues, but I think nothing related to the uevent. Thanks, pq > * > * HDCP Content Type: > * This Enum property is used by the userspace to declare the content ty= pe > diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c > index ce235fd1c844..77433ee3d652 100644 > --- a/drivers/gpu/drm/drm_hdcp.c > +++ b/drivers/gpu/drm/drm_hdcp.c > @@ -374,6 +374,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. > */ > @@ -414,3 +418,33 @@ 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 changes of a drm_connector such as DESIRED->= ENABLED > + * and ENABLED->DESIRED. No uevent for DESIRED->UNDESIRED or ENABLED->UN= DESIRED, > + * as userspace is triggering such state change and kernel performs it w= ithout > + * fail.This function update the new state of the property into the conn= ector's > + * state and generate an uevent to notify the userspace. > + */ > +void drm_hdcp_update_content_protection(struct drm_connector *connector, > + u64 val) > +{ > + 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 --Sig_/Qx.9wJCymW_r55VRIZzzP=Z Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAl0kpy8ACgkQI1/ltBGq qqdYkQ//YeP+JwQPZeFD17cZ26ZfGzgiSy9WhBbYbXqMf5X/lQrf1wgKAEABhXZA tQ04U+GJfV7WAiiadhQaIckr/LbKb1V9Vqu/4NLqKnzrN2zUWgKM6GuB77EdNC4D 1EcP3Wt6I+qwq3n1MEPf4FJjVvef5TowT4xuUd01WWt0raJKSyzW7wwGKQsqDiWC vbJZZS4zJhxR4qKZhqBh3ofYgEbvRPYQWb28mc/d/zqKb+i1isZw3FlXae5kXnKH /6lKXKLFnSb/+lGqZJo7gComNdWa9KB3y543pvRGowP2x/e7XVuWVWr9dtHqGkgL 8O1M5NOFFqVTsf1ohcYCszOEkj8KF7lHq4xqgs8aBvvD2LTCHEIm06FYCaNdIYrW Szby6MV0TmYUYajPBaBs+TYgPIs0CZQmkKK41pnYGn3XocEKF1mVE9F5bM0v5ym9 ywjSHoHX2smb6teg7BEFkZ10GWunQ6SyJGKlzcAiJ8rl7W10AVglnQavMLtpW2iB 0wrOHK8z+4aUUYRADMOs5IEvCUMVZFlB8dlpnoovsJj5YoNKr0tEEjmREt/s4KHQ gx7OGlqY8ho6nmGpEnlEV5Jrosn03kXRgZrUQW6R6eqncSwUMvWDl2TWUfa7D2+C o7jOnxzltBqb+QKpVN8/l+ePGmY0/PbesnsMOggaylBqOnby4Lk= =tNuG -----END PGP SIGNATURE----- --Sig_/Qx.9wJCymW_r55VRIZzzP=Z-- --===============1448215977== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs --===============1448215977==--