[Intel-gfx] [PATCH] drm/i915/hdcp: Additional conditions to enable hdcp

Jani Nikula jani.nikula at linux.intel.com
Wed Oct 25 11:32:46 UTC 2023


On Wed, 25 Oct 2023, Suraj Kandpal <suraj.kandpal at intel.com> wrote:
> When we dock a monitor we end up with a enable and disable connector
> cycle but if hdcp content is running we get the userspace in
> enabled state and driver maintaing a undesired state which causes
> the content to stop playing and we only enabe hdcp if the userspace
> state in desired. This patch fixes that.
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c    | 14 ++++++++++++--
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 11 +++++++++--
>  2 files changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 9151d5add960..3dbf2d545f24 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3242,6 +3242,10 @@ static void intel_enable_ddi(struct intel_atomic_state *state,
>  			     const struct intel_crtc_state *crtc_state,
>  			     const struct drm_connector_state *conn_state)
>  {
> +	struct intel_connector *connector =
> +		to_intel_connector(conn_state->connector);
> +	struct intel_hdcp *hdcp = &connector->hdcp;
> +
>  	drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
>  
>  	if (!intel_crtc_is_bigjoiner_slave(crtc_state))
> @@ -3259,9 +3263,15 @@ static void intel_enable_ddi(struct intel_atomic_state *state,
>  	else
>  		intel_enable_ddi_dp(state, encoder, crtc_state, conn_state);
>  
> -	/* Enable hdcp if it's desired */
> +	/*
> +	 * Enable hdcp if it's desired or if userspace is enabled and
> +	 * driver set its state to undesired
> +	 */
>  	if (conn_state->content_protection ==
> -	    DRM_MODE_CONTENT_PROTECTION_DESIRED)
> +	    DRM_MODE_CONTENT_PROTECTION_DESIRED ||
> +	    (conn_state->content_protection ==
> +	    DRM_MODE_CONTENT_PROTECTION_ENABLED && hdcp->value ==
> +	    DRM_MODE_CONTENT_PROTECTION_UNDESIRED))

Why don't we move all of this inside intel_hdcp.c to not pollute
intel_ddi.c with the logic?

>  		intel_hdcp_enable(state, encoder, crtc_state, conn_state);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 7b4628f4f124..008ff14fad18 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -788,6 +788,7 @@ static void intel_mst_enable_dp(struct intel_atomic_state *state,
>  	struct intel_digital_port *dig_port = intel_mst->primary;
>  	struct intel_dp *intel_dp = &dig_port->dp;
>  	struct intel_connector *connector = to_intel_connector(conn_state->connector);
> +	struct intel_hdcp *hdcp = &connector->hdcp;
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct drm_dp_mst_topology_state *mst_state =
>  		drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst_mgr);
> @@ -836,9 +837,15 @@ static void intel_mst_enable_dp(struct intel_atomic_state *state,
>  
>  	intel_audio_codec_enable(encoder, pipe_config, conn_state);
>  
> -	/* Enable hdcp if it's desired */
> +	/*
> +	 * Enable hdcp if it's desired or if userspace is enabled and
> +	 * driver set its state to undesired
> +	 */
>  	if (conn_state->content_protection ==
> -	    DRM_MODE_CONTENT_PROTECTION_DESIRED)
> +	    DRM_MODE_CONTENT_PROTECTION_DESIRED ||
> +	    (conn_state->content_protection ==
> +	    DRM_MODE_CONTENT_PROTECTION_ENABLED && hdcp->value ==
> +	    DRM_MODE_CONTENT_PROTECTION_UNDESIRED))

Ditto. This is just copy-paste here anyway.

>  		intel_hdcp_enable(state, encoder, pipe_config, conn_state);
>  }

-- 
Jani Nikula, Intel


More information about the Intel-gfx mailing list