From: Daniel Vetter <daniel@ffwll.ch>
To: Ramalingam C <ramalingam.c@intel.com>
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 10/10] drm/i915: uevent for HDCP status change
Date: Wed, 27 Mar 2019 18:47:55 +0100 [thread overview]
Message-ID: <20190327174755.GO2665@phenom.ffwll.local> (raw)
In-Reply-To: <20190327143739.GA18417@intel.com>
On Wed, Mar 27, 2019 at 08:07:39PM +0530, Ramalingam C wrote:
> On 2019-03-27 at 12:06:39 +0100, Daniel Vetter wrote:
> > On Fri, Mar 22, 2019 at 06:14:48AM +0530, Ramalingam C wrote:
> > > Invoking the uevent generator for the content protection property state
> > > change of a connector. This helps the userspace to detect the new state
> > > change without polling the property val.
> > >
> > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> > > ---
> > > drivers/gpu/drm/i915/intel_hdcp.c | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> > > index 1eea553cdf81..1c38026f4de7 100644
> > > --- a/drivers/gpu/drm/i915/intel_hdcp.c
> > > +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> > > @@ -8,6 +8,7 @@
> > >
> > > #include <drm/drm_hdcp.h>
> > > #include <drm/i915_component.h>
> > > +#include <drm/drm_sysfs.h>
> > > #include <linux/i2c.h>
> > > #include <linux/random.h>
> > > #include <linux/component.h>
> > > @@ -19,6 +20,14 @@
> > > #define ENCRYPT_STATUS_CHANGE_TIMEOUT_MS 50
> > > #define HDCP2_LC_RETRY_CNT 3
> > >
> > > +static inline
> > > +void intel_hdcp_state_change_event(struct drm_connector *connector)
> > > +{
> > > + struct drm_property *property = connector->content_protection_property;
> > > +
> > > + drm_sysfs_connector_status_event(connector, property);
> > > +}
> > > +
> > > static
> > > bool intel_hdcp_is_ksv_valid(u8 *ksv)
> > > {
> > > @@ -943,6 +952,7 @@ static void intel_hdcp_prop_work(struct work_struct *work)
> > > if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> > > state = connector->base.state;
> > > state->content_protection = hdcp->value;
> > > + intel_hdcp_state_change_event(&connector->base);
> >
> > I think it'd be good to have a helper to update both
> > state->content_protection and send out the event.
> but adding this in intel_hdcp_prop_work also does the same. Do you
> suggest we need to move the intel_hdcp_state_change out of prop_work and
> put both of them in a wrapper?
Yeah something like:
drm_hdcp_update_content_protecion()
{
assert_lock_held(dev->mode_config.connnection_mutex);
state->content_protection = hdcp->value;
drm_sysfs_connector_status_event(&connector->base,
dev->mode_config.content_protection_prop);
}
And then use that instead of both the assignement and the call to send out
the event in intel_hdcp_prop_work().
>
> > Locking is a bit
> > complicated, so we also need a lockdep assert to make sure
> > dev->mode_config.connection_mutex is held.
> in intel_hdcp_state_change ?
> >
> > That way I hope that any update in the property will actually result in
> > the event being sent out, and not accidentally forgotten.
> >
> > > }
> > >
> > > mutex_unlock(&hdcp->mutex);
> > > @@ -2206,6 +2216,7 @@ int intel_hdcp_disable(struct intel_connector *connector)
> > > ret = _intel_hdcp2_disable(connector);
> > > else if (hdcp->hdcp_encrypted)
> > > ret = _intel_hdcp_disable(connector);
> > > + intel_hdcp_state_change_event(&connector->base);
> >
> > Why do we need this here? We don't update the property here ...
> Change is requested from the userspace. So we dont update the property
> state in conn_state. But in rethinking over it, only when kernel
> triggers the change of property state we need the uevent. So we dont
> need it here as it is triggered from the userspace.
Yeah, I think that makes sense. Otherwise we might end up in some funny
loop:
1. userspace updates property
2. kernel sends out uevent
3. userspace handles uevent, again resets property, goto 2
Or something silly like that :-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2019-03-27 17:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 0:44 [PATCH v3 00/10] HDCP2.2 Phase II Ramalingam C
2019-03-22 0:44 ` [PATCH v3 01/10] drm/i915: debugfs: HDCP2.2 capability read Ramalingam C
2019-03-27 9:51 ` Daniel Vetter
2019-03-22 0:44 ` [PATCH v3 02/10] drm: Add Content protection type property Ramalingam C
2019-03-27 9:56 ` Daniel Vetter
2019-03-27 13:34 ` Ramalingam C
2019-03-22 0:44 ` [PATCH v3 03/10] drm/i915: Attach content " Ramalingam C
2019-03-27 10:00 ` Daniel Vetter
2019-03-27 13:39 ` Ramalingam C
2019-03-22 0:44 ` [PATCH v3 04/10] drm/i915: HDCP SRM parsing and revocation check Ramalingam C
2019-03-27 10:16 ` Daniel Vetter
2019-03-27 13:48 ` Ramalingam C
2019-03-22 0:44 ` [PATCH v3 05/10] drm/i915/sysfs: Node for hdcp srm Ramalingam C
2019-03-22 0:44 ` [PATCH v3 06/10] drm: Add CP downstream_info property Ramalingam C
2019-03-27 10:25 ` Daniel Vetter
2019-03-27 14:00 ` Ramalingam C
2019-03-27 14:22 ` Daniel Vetter
2019-03-22 0:44 ` [PATCH v3 07/10] drm/i915: Populate downstream info for HDCP1.4 Ramalingam C
2019-03-27 10:28 ` Daniel Vetter
2019-03-22 0:44 ` [PATCH v3 08/10] drm/i915: Populate downstream info for HDCP2.2 Ramalingam C
2019-03-27 10:31 ` Daniel Vetter
2019-03-27 14:49 ` Ramalingam C
2019-03-27 17:44 ` Daniel Vetter
2019-03-22 0:44 ` [PATCH v3 09/10] drm: uevent for connector status change Ramalingam C
2019-03-27 11:00 ` Daniel Vetter
2019-03-27 11:01 ` Daniel Vetter
2019-03-27 14:40 ` Ramalingam C
2019-03-22 0:44 ` [PATCH v3 10/10] drm/i915: uevent for HDCP " Ramalingam C
2019-03-27 11:06 ` Daniel Vetter
2019-03-27 14:37 ` Ramalingam C
2019-03-27 17:47 ` Daniel Vetter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190327174755.GO2665@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ramalingam.c@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox