Re: [PATCH 2/4] drm/i915/hdcp: Propagate aux info in DP HDCP functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Kandpal, Suraj <suraj.kandpal@xxxxxxxxx>
> Sent: Thursday, August 10, 2023 1:18 PM
> To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Nautiyal, Ankit K <ankit.k.nautiyal@xxxxxxxxx>; uma.shakar@xxxxxxxxx;
> Murthy, Arun R <arun.r.murthy@xxxxxxxxx>; Kandpal, Suraj
> <suraj.kandpal@xxxxxxxxx>
> Subject: [PATCH 2/4] drm/i915/hdcp: Propagate aux info in DP HDCP
> functions
> 
> We were propagating dig_port info to dp hdcp2 specific functions.
> Let us clean that up and send drm_dp_aux instead n functions:
Typo.
Its not a good convention to pass the drm_dp core struct in i915 functions.
We have been using i915 wrapper functions for this. Feel its better to
continue the same convention. On the other hand, intel_dp can help in
getting the drm_dp_aux.

> intel_dp_hdcp2_wait_for_msg, get_receiver_id_list_rx_info,
> intel_dp_hdcp2_read_rx_status this optimises mst scenarios where aux ends
> up being remote and not stored in dig_port.
Can this sentence be broken?

Thanks and Regards,
Arun R Murthy
--------------------

> 
> Signed-off-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 43 ++++++++++++--------
>  1 file changed, 25 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> index 6cd42363837a..5304aa73b23f 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> @@ -331,13 +331,13 @@ static const struct hdcp2_dp_msg_data
> hdcp2_dp_msg_data[] = {  };
> 
>  static int
> -intel_dp_hdcp2_read_rx_status(struct intel_digital_port *dig_port,
> +intel_dp_hdcp2_read_rx_status(struct drm_i915_private *i915,
> +			      struct drm_dp_aux *aux,
>  			      u8 *rx_status)
>  {
> -	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
>  	ssize_t ret;
> 
> -	ret = drm_dp_dpcd_read(&dig_port->dp.aux,
> +	ret = drm_dp_dpcd_read(aux,
>  			       DP_HDCP_2_2_REG_RXSTATUS_OFFSET,
> rx_status,
>  			       HDCP_2_2_DP_RXSTATUS_LEN);
>  	if (ret != HDCP_2_2_DP_RXSTATUS_LEN) { @@ -350,14 +350,15 @@
> intel_dp_hdcp2_read_rx_status(struct intel_digital_port *dig_port,  }
> 
>  static
> -int hdcp2_detect_msg_availability(struct intel_digital_port *dig_port,
> +int hdcp2_detect_msg_availability(struct drm_i915_private *i915,
> +				  struct drm_dp_aux *aux,
>  				  u8 msg_id, bool *msg_ready)
>  {
>  	u8 rx_status;
>  	int ret;
> 
>  	*msg_ready = false;
> -	ret = intel_dp_hdcp2_read_rx_status(dig_port, &rx_status);
> +	ret = intel_dp_hdcp2_read_rx_status(i915, aux, &rx_status);
>  	if (ret < 0)
>  		return ret;
> 
> @@ -383,12 +384,10 @@ int hdcp2_detect_msg_availability(struct
> intel_digital_port *dig_port,  }
> 
>  static ssize_t
> -intel_dp_hdcp2_wait_for_msg(struct intel_digital_port *dig_port,
> +intel_dp_hdcp2_wait_for_msg(struct drm_i915_private *i915, struct
> drm_dp_aux *aux,
> +			    struct intel_hdcp *hdcp,
>  			    const struct hdcp2_dp_msg_data
> *hdcp2_msg_data)  {
> -	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
> -	struct intel_dp *dp = &dig_port->dp;
> -	struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;
>  	u8 msg_id = hdcp2_msg_data->msg_id;
>  	int ret, timeout;
>  	bool msg_ready = false;
> @@ -411,7 +410,7 @@ intel_dp_hdcp2_wait_for_msg(struct
> intel_digital_port *dig_port,
>  		 * the timeout at wait for CP_IRQ.
>  		 */
>  		intel_dp_hdcp_wait_for_cp_irq(hdcp, timeout);
> -		ret = hdcp2_detect_msg_availability(dig_port,
> +		ret = hdcp2_detect_msg_availability(i915, aux,
>  						    msg_id, &msg_ready);
>  		if (!msg_ready)
>  			ret = -ETIMEDOUT;
> @@ -445,6 +444,7 @@ int intel_dp_hdcp2_write_msg(struct intel_connector
> *connector,
>  	u8 *byte = buf;
>  	ssize_t ret, bytes_to_write, len;
>  	const struct hdcp2_dp_msg_data *hdcp2_msg_data;
> +	struct drm_dp_aux *aux;
> 
>  	hdcp2_msg_data = get_hdcp2_dp_msg_data(*byte);
>  	if (!hdcp2_msg_data)
> @@ -452,6 +452,8 @@ int intel_dp_hdcp2_write_msg(struct intel_connector
> *connector,
> 
>  	offset = hdcp2_msg_data->offset;
> 
> +	aux = &dig_port->dp.aux;
> +
>  	/* No msg_id in DP HDCP2.2 msgs */
>  	bytes_to_write = size - 1;
>  	byte++;
> @@ -460,7 +462,7 @@ int intel_dp_hdcp2_write_msg(struct intel_connector
> *connector,
>  		len = bytes_to_write > DP_AUX_MAX_PAYLOAD_BYTES ?
>  				DP_AUX_MAX_PAYLOAD_BYTES :
> bytes_to_write;
> 
> -		ret = drm_dp_dpcd_write(&dig_port->dp.aux,
> +		ret = drm_dp_dpcd_write(aux,
>  					offset, (void *)byte, len);
>  		if (ret < 0)
>  			return ret;
> @@ -474,12 +476,12 @@ int intel_dp_hdcp2_write_msg(struct
> intel_connector *connector,  }
> 
>  static
> -ssize_t get_receiver_id_list_rx_info(struct intel_digital_port *dig_port, u32
> *dev_cnt, u8 *byte)
> +ssize_t get_receiver_id_list_rx_info(struct drm_dp_aux *aux, u32
> +*dev_cnt, u8 *byte)
>  {
>  	ssize_t ret;
>  	u8 *rx_info = byte;
> 
> -	ret = drm_dp_dpcd_read(&dig_port->dp.aux,
> +	ret = drm_dp_dpcd_read(aux,
>  			       DP_HDCP_2_2_REG_RXINFO_OFFSET,
>  			       (void *)rx_info, HDCP_2_2_RXINFO_LEN);
>  	if (ret != HDCP_2_2_RXINFO_LEN)
> @@ -501,7 +503,8 @@ int intel_dp_hdcp2_read_msg(struct intel_connector
> *connector,
>  	struct intel_digital_port *dig_port =
> intel_attached_dig_port(connector);
>  	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
>  	struct intel_dp *dp = &dig_port->dp;
> -	struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;
> +	struct intel_hdcp *hdcp = &connector->hdcp;
> +	struct drm_dp_aux *aux;
>  	unsigned int offset;
>  	u8 *byte = buf;
>  	ssize_t ret, bytes_to_recv, len;
> @@ -515,7 +518,9 @@ int intel_dp_hdcp2_read_msg(struct intel_connector
> *connector,
>  		return -EINVAL;
>  	offset = hdcp2_msg_data->offset;
> 
> -	ret = intel_dp_hdcp2_wait_for_msg(dig_port, hdcp2_msg_data);
> +	aux = &dp->aux;
> +
> +	ret = intel_dp_hdcp2_wait_for_msg(i915, aux, hdcp,
> hdcp2_msg_data);
>  	if (ret < 0)
>  		return ret;
> 
> @@ -525,7 +530,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector
> *connector,
>  	byte++;
> 
>  	if (msg_id == HDCP_2_2_REP_SEND_RECVID_LIST) {
> -		ret = get_receiver_id_list_rx_info(dig_port, &dev_cnt, byte);
> +		ret = get_receiver_id_list_rx_info(aux, &dev_cnt, byte);
>  		if (ret < 0)
>  			return ret;
> 
> @@ -547,7 +552,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector
> *connector,
>  			msg_end = ktime_add_ms(ktime_get_raw(),
>  					       hdcp2_msg_data-
> >msg_read_timeout);
> 
> -		ret = drm_dp_dpcd_read(&dig_port->dp.aux, offset,
> +		ret = drm_dp_dpcd_read(aux, offset,
>  				       (void *)byte, len);
>  		if (ret < 0) {
>  			drm_dbg_kms(&i915->drm, "msg_id %d, ret %zd\n",
> @@ -606,10 +611,12 @@ static  int intel_dp_hdcp2_check_link(struct
> intel_digital_port *dig_port,
>  			      struct intel_connector *connector)  {
> +	struct drm_i915_private *i915 = to_i915(connector->base.dev);
>  	u8 rx_status;
>  	int ret;
> 
> -	ret = intel_dp_hdcp2_read_rx_status(dig_port, &rx_status);
> +	ret = intel_dp_hdcp2_read_rx_status(i915, &dig_port->dp.aux,
> +					    &rx_status);
>  	if (ret)
>  		return ret;
> 
> --
> 2.25.1





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux