From: Ramalingam C <ramalingam.c@intel.com>
To: Sean Paul <sean@poorly.run>
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
Sean Paul <seanpaul@chromium.org>,
dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 06/12] drm/i915: Factor out hdcp->value assignments
Date: Fri, 13 Dec 2019 16:41:44 +0530 [thread overview]
Message-ID: <20191213111144.GG3829@intel.com> (raw)
In-Reply-To: <20191212190230.188505-7-sean@poorly.run>
On 2019-12-12 at 14:02:24 -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
>
> This is a bit of housecleaning for a future patch. Instead of sprinkling
> hdcp->value assignments and prop_work scheduling everywhere, introduce a
> function to do it for us.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> Link: https://patchwork.freedesktop.org/patch/msgid/20191203173638.94919-7-sean@poorly.run #v1
LGTM.
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
>
> Changes in v2:
> -None
> ---
> drivers/gpu/drm/i915/display/intel_hdcp.c | 67 ++++++++++++++++-------
> 1 file changed, 46 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index f8d56d3b2ddb..798e7e1a19fc 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -852,6 +852,21 @@ struct intel_connector *intel_hdcp_to_connector(struct intel_hdcp *hdcp)
> return container_of(hdcp, struct intel_connector, hdcp);
> }
>
> +static void intel_hdcp_update_value(struct intel_connector *connector,
> + u64 value, bool update_property)
> +{
> + struct intel_hdcp *hdcp = &connector->hdcp;
> +
> + WARN_ON(!mutex_is_locked(&hdcp->mutex));
> +
> + if (hdcp->value == value)
> + return;
> +
> + hdcp->value = value;
> + if (update_property)
> + schedule_work(&hdcp->prop_work);
> +}
> +
> /* Implements Part 3 of the HDCP authorization procedure */
> static int intel_hdcp_check_link(struct intel_connector *connector)
> {
> @@ -878,15 +893,16 @@ static int intel_hdcp_check_link(struct intel_connector *connector)
> I915_READ(HDCP_STATUS(dev_priv, cpu_transcoder,
> port)));
> ret = -ENXIO;
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_DESIRED,
> + true);
> goto out;
> }
>
> if (hdcp->shim->check_link(intel_dig_port)) {
> if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_ENABLED, true);
> }
> goto out;
> }
> @@ -897,16 +913,18 @@ static int intel_hdcp_check_link(struct intel_connector *connector)
> ret = _intel_hdcp_disable(connector);
> if (ret) {
> DRM_ERROR("Failed to disable hdcp (%d)\n", ret);
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_DESIRED,
> + true);
> goto out;
> }
>
> ret = _intel_hdcp_enable(connector);
> if (ret) {
> DRM_ERROR("Failed to enable hdcp (%d)\n", ret);
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_DESIRED,
> + true);
> goto out;
> }
>
> @@ -1716,16 +1734,18 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
> I915_READ(HDCP2_STATUS(dev_priv, cpu_transcoder,
> port)));
> ret = -ENXIO;
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_DESIRED,
> + true);
> goto out;
> }
>
> ret = hdcp->shim->check_2_2_link(intel_dig_port);
> if (ret == HDCP_LINK_PROTECTED) {
> if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_ENABLED,
> + true);
> }
> goto out;
> }
> @@ -1737,8 +1757,9 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
> DRM_DEBUG_KMS("HDCP2.2 Downstream topology change\n");
> ret = hdcp2_authenticate_repeater_topology(connector);
> if (!ret) {
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_ENABLED,
> + true);
> goto out;
> }
> DRM_DEBUG_KMS("[%s:%d] Repeater topology auth failed.(%d)\n",
> @@ -1753,8 +1774,8 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
> if (ret) {
> DRM_ERROR("[%s:%d] Failed to disable hdcp2.2 (%d)\n",
> connector->base.name, connector->base.base.id, ret);
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_DESIRED, true);
> goto out;
> }
>
> @@ -1763,8 +1784,9 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
> DRM_DEBUG_KMS("[%s:%d] Failed to enable hdcp2.2 (%d)\n",
> connector->base.name, connector->base.base.id,
> ret);
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_DESIRED,
> + true);
> goto out;
> }
>
> @@ -2004,8 +2026,9 @@ int intel_hdcp_enable(struct intel_connector *connector,
>
> if (!ret) {
> schedule_delayed_work(&hdcp->check_work, check_link_interval);
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
> - schedule_work(&hdcp->prop_work);
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_ENABLED,
> + true);
> }
>
> mutex_unlock(&hdcp->mutex);
> @@ -2023,7 +2046,9 @@ int intel_hdcp_disable(struct intel_connector *connector)
> mutex_lock(&hdcp->mutex);
>
> if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
> + intel_hdcp_update_value(connector,
> + DRM_MODE_CONTENT_PROTECTION_UNDESIRED,
> + false);
> if (hdcp->hdcp2_encrypted)
> ret = _intel_hdcp2_disable(connector);
> else if (hdcp->hdcp_encrypted)
> --
> Sean Paul, Software Engineer, Google / Chromium OS
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-12-13 20:39 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 19:02 [Intel-gfx] [PATCH v2 00/12] drm/i915: Add support for HDCP 1.4 over MST connectors Sean Paul
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 01/12] drm/i915: Fix sha_text population code Sean Paul
2019-12-13 10:20 ` Ramalingam C
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 02/12] drm/i915: Clear the repeater bit on HDCP disable Sean Paul
2019-12-13 10:29 ` Ramalingam C
2019-12-13 19:07 ` Sean Paul
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 03/12] drm/i915: WARN if HDCP signalling is enabled upon disable Sean Paul
2019-12-13 10:37 ` Ramalingam C
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 04/12] drm/i915: Intercept Aksv writes in the aux hooks Sean Paul
2019-12-13 10:52 ` Ramalingam C
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 05/12] drm/i915: Use the cpu_transcoder in intel_hdcp to toggle HDCP signalling Sean Paul
2019-12-13 10:43 ` Ramalingam C
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 06/12] drm/i915: Factor out hdcp->value assignments Sean Paul
2019-12-13 11:11 ` Ramalingam C [this message]
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 07/12] drm/i915: Protect workers against disappearing connectors Sean Paul
2019-12-13 11:10 ` Ramalingam C
2019-12-13 19:04 ` Sean Paul
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 08/12] drm/i915: Don't fully disable HDCP on a port if multiple pipes are using it Sean Paul
2019-12-13 11:58 ` Ramalingam C
2019-12-13 19:03 ` Sean Paul
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 09/12] drm/i915: Support DP MST in enc_to_dig_port() function Sean Paul
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 10/12] drm/i915: Use ddi_update_pipe in intel_dp_mst Sean Paul
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 11/12] drm/i915: Expose HDCP shim functions from dp for use by dp_mst Sean Paul
2019-12-13 11:25 ` Ville Syrjälä
2019-12-13 11:59 ` Jani Nikula
2019-12-12 19:02 ` [Intel-gfx] [PATCH v2 12/12] drm/i915: Add HDCP 1.4 support for MST connectors Sean Paul
2019-12-12 21:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add support for HDCP 1.4 over MST connectors (rev2) Patchwork
2019-12-12 21:34 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2019-12-12 22:50 ` Sean Paul
2019-12-12 22:55 ` Chris Wilson
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=20191213111144.GG3829@intel.com \
--to=ramalingam.c@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=sean@poorly.run \
--cc=seanpaul@chromium.org \
/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;
as well as URLs for NNTP newsgroup(s).