HDCP Type1 MST fixes
Subsystems (3)
cover HDCP Type1 MST fixes
We were seeing a blank screen whenever Type1 content was played. This was due to extra timing which was taken as we had moved to remote read and writes previously for MST scenario, which in turn was done as we were not able to do direct read and writes to the immediate downstream device.
The correct flow should be that we talk only to the immediate downstream device and the rest needs to be taken care by that device. With this patch series we move back to direct reads and writes, fix the fastset setting because of which direct reads and writes to HDCP related DPCD register stopped working, derive hdcp structure correctly and increase robustability if rxcaps HDCP capability reporting.
Suraj Kandpal (10):
drm/i915/hdcp: Move to direct reads for HDCP drm/i915/hdcp: Move source hdcp2 checks into its own function drm/i915/hdcp: Refactor intel_dp_hdcp2_capable drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function drm/i915/hdcp: Add new remote capability check shim function drm/i915/hdcp: HDCP Capability for the downstream device drm/i915/hdcp: Remove additional timing for reading mst hdcp message drm/i915/hdcp: Extract hdcp structure from correct connector drm/i915/hdcp: Allocate stream id after HDCP AKE stage drm/i915/hdcp: Read Rxcaps for robustibility
.../drm/i915/display/intel_display_debugfs.c | 26 ++- .../drm/i915/display/intel_display_types.h | 5 + drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 116 ++++++++----- drivers/gpu/drm/i915/display/intel_hdcp.c | 160 ++++++++++-------- drivers/gpu/drm/i915/display/intel_hdcp.h | 3 + 5 files changed, 191 insertions(+), 119 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/10 drm/i915/hdcp: Move to direct reads for HDCP
Even for MST scenarios we need to do direct reads only on the immediate downstream device the rest of the authentication is taken care by that device. Remote reads will only be used to check capability of the monitors in MST topology.
--v2
-Add fixes tag [Ankit]
-Derive aux where needed rather than through a function [Ankit]
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 31 ++++++-------------- 1 file changed, 9 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +9 -22
@@ -330,23 +330,13 @@ static const struct hdcp2_dp_msg_data hdcp2_dp_msg_data[] = { 0, 0 }, }; -static struct drm_dp_aux * -intel_dp_hdcp_get_aux (struct intel_connector *connector) -{ -struct intel_digital_port *dig_port =intel_attached_dig_port (connector); - -if (intel_encoder_is_mst (connector->encoder)) -return &connector->port->aux; -else -return &dig_port->dp.aux; -} -static int intel_dp_hdcp2_read_rx_status (struct intel_connector *connector,u8 *rx_status) {struct drm_i915_private *i915 =to_i915 (connector->base.dev); -struct drm_dp_aux *aux =intel_dp_hdcp_get_aux (connector); +struct intel_digital_port *dig_port =intel_attached_dig_port (connector); +struct drm_dp_aux *aux = &dig_port->dp.aux;ssize_t ret; ret = drm_dp_dpcd_read(aux,
@@ -454,8 +444,9 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector,unsigned int offset;u8 *byte = buf;ssize_t ret, bytes_to_write, len; +struct intel_digital_port *dig_port =intel_attached_dig_port (connector); +struct drm_dp_aux *aux = &dig_port->dp.aux;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)
@@ -463,8 +454,6 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector, offset = hdcp2_msg_data->offset; - aux =intel_dp_hdcp_get_aux (connector); -/* No msg_id in DP HDCP2.2 msgs */ bytes_to_write = size -1 ; byte++;
@@ -490,7 +479,8 @@ staticssize_t get_receiver_id_list_rx_info (struct intel_connector *connector,u32 *dev_cnt,u8 *byte) { -struct drm_dp_aux *aux =intel_dp_hdcp_get_aux (connector); +struct intel_digital_port *dig_port =intel_attached_dig_port (connector); +struct drm_dp_aux *aux = &dig_port->dp.aux;ssize_t ret;u8 *rx_info = byte;
@@ -516,7 +506,7 @@ 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_hdcp *hdcp = &connector->hdcp; -struct drm_dp_aux *aux; +struct drm_dp_aux *aux = &dig_port->dp.aux;unsigned int offset;u8 *byte = buf;ssize_t ret, bytes_to_recv, len;
@@ -530,8 +520,6 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector,return -EINVAL ; offset = hdcp2_msg_data->offset; - aux =intel_dp_hdcp_get_aux (connector); - ret =intel_dp_hdcp2_wait_for_msg (connector, hdcp2_msg_data);if (ret <0 )return ret;
@@ -651,12 +639,11 @@ staticint intel_dp_hdcp2_capable (struct intel_connector *connector,bool *capable) { -struct drm_dp_aux *aux; +struct intel_digital_port *dig_port =intel_attached_dig_port (connector); +struct drm_dp_aux *aux = &dig_port->dp.aux;u8 rx_caps[3 ];int ret; - aux =intel_dp_hdcp_get_aux (connector); - *capable = false; ret = drm_dp_dpcd_read(aux, DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
Signature · 1 line
2.25.1
PATCH 2/10 drm/i915/hdcp: Move source hdcp2 checks into its own function
In reply to Suraj KandpalMove checks on the source side for HDCP2.2 into its own function so that they can be used in the HDCP remote capability check function.
--- drivers/gpu/drm/i915/display/intel_hdcp.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +17 -3
@@ -160,12 +160,14 @@ bool intel_hdcp_capable(struct intel_connector *connector)return capable; } -/* Is HDCP2.2 capable on Platform and Sink */ -bool intel_hdcp2_capable (struct intel_connector *connector) +/* +* Check if the source has all the building blocks ready to make +* HDCP 2.2 work +*/ +static bool intel_hdcp2_prerequisite (struct intel_connector *connector) {struct drm_i915_private *i915 =to_i915 (connector->base.dev);struct intel_hdcp *hdcp = &connector->hdcp; -bool capable = false;/* I915 support for HDCP2.2 */ if (!hdcp->hdcp2_supported)
@@ -185,6 +187,18 @@ bool intel_hdcp2_capable(struct intel_connector *connector) }mutex_unlock (&i915->display.hdcp.hdcp_mutex); +return true; +} + +/* Is HDCP2.2 capable on Platform and Sink */ +bool intel_hdcp2_capable (struct intel_connector *connector) +{ +struct intel_hdcp *hdcp = &connector->hdcp; +bool capable = false; + +if (!intel_hdcp2_prerequisite (connector)) +return false; +/* Sink's capability for HDCP2.2 */ hdcp->shim->hdcp_2_2_capable (connector, &capable);
Signature · 1 line
2.25.1
PATCH 3/10 drm/i915/hdcp: Refactor intel_dp_hdcp2_capable
In reply to Suraj KandpalBreak intel_dp_hdcp2_capable so that the common the code can be reused for the remote capability check.
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +12 -2
@@ -636,8 +636,8 @@ int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port, }static -int intel_dp_hdcp2_capable (struct intel_connector *connector, -bool *capable) +int _intel_dp_hdcp2_capable (struct drm_dp_aux *aux, +bool *capable) {struct intel_digital_port *dig_port =intel_attached_dig_port (connector);struct drm_dp_aux *aux = &dig_port->dp.aux;
@@ -658,6 +658,16 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector,return 0 ; } +static +int intel_dp_hdcp2_capable (struct intel_connector *connector, +bool *capable) +{ +struct intel_digital_port *dig_port =intel_attached_dig_port (connector); +struct drm_dp_aux *aux = &dig_port->dp.aux; + +return _intel_dp_hdcp2_capable (aux, capable); +} +static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .write_an_aksv = intel_dp_hdcp_write_an_aksv, .read_bksv = intel_dp_hdcp_read_bksv,
Signature · 1 line
2.25.1
PATCH 4/10 drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function
In reply to Suraj KandpalPass drm_dp_aux to intel_dp_hdcp_read_bcaps function so as to aid in reading the bcaps for the remote monitor later on.
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +5 -7
@@ -122,13 +122,13 @@ static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *dig_port, }static -int intel_dp_hdcp_read_bcaps (struct intel_digital_port *dig_port, +int intel_dp_hdcp_read_bcaps (struct drm_dp_aux *aux,u8 *bcaps) { -struct drm_i915_private *i915 =to_i915 (dig_port->base.base.dev); +struct drm_i915_private *i915 =to_i915 (aux->crtc->dev);ssize_t ret; - ret =drm_dp_dpcd_read (&dig_port->dp.aux,DP_AUX_HDCP_BCAPS , + ret =drm_dp_dpcd_read (aux,DP_AUX_HDCP_BCAPS , bcaps,1 );if (ret !=1 ) { drm_dbg_kms(&i915->drm,
@@ -146,7 +146,7 @@ int intel_dp_hdcp_repeater_present(struct intel_digital_port *dig_port,ssize_t ret;u8 bcaps; - ret =intel_dp_hdcp_read_bcaps (dig_port, &bcaps); + ret =intel_dp_hdcp_read_bcaps (&dig_port->dp.aux, &bcaps);if (ret)return ret;
@@ -271,7 +271,7 @@ int intel_dp_hdcp_capable(struct intel_digital_port *dig_port,ssize_t ret;u8 bcaps; - ret =intel_dp_hdcp_read_bcaps (dig_port, &bcaps); + ret =intel_dp_hdcp_read_bcaps (&dig_port->dp.aux, &bcaps);if (ret)return ret;
@@ -639,8 +639,6 @@ staticint _intel_dp_hdcp2_capable (struct drm_dp_aux *aux,bool *capable) { -struct intel_digital_port *dig_port =intel_attached_dig_port (connector); -struct drm_dp_aux *aux = &dig_port->dp.aux;u8 rx_caps[3 ];int ret;
Signature · 1 line
2.25.1
PATCH 5/10 drm/i915/hdcp: Add new remote capability check shim function
In reply to Suraj KandpalCreate a remote HDCP capability shim function which can read the remote monitor HDCP capability when in MST configuration.
--- .../drm/i915/display/intel_display_types.h | 4 ++++ drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 22 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp.c | 16 ++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp.h | 3 +++ 4 files changed, 45 insertions(+)
drivers/gpu/drm/i915/display/intel_display_types.h +4 -0
@@ -532,6 +532,10 @@ struct intel_hdcp_shim {/* HDCP2.2 Link Integrity Check */ int (*check_2_2_link)(struct intel_digital_port *dig_port,struct intel_connector *connector); + +/* HDCP remote sink cap */ +int (*remote_hdcp_cap)(struct intel_connector *connector, +bool *hdcp_capable,bool *hdcp2_capable); };struct intel_hdcp {
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +22 -0
@@ -666,6 +666,27 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector,return _intel_dp_hdcp2_capable (aux, capable); } +static +int intel_dp_hdcp_remote_cap (struct intel_connector *connector, +bool *hdcp_capable,bool *hdcp2_capable) +{ +struct drm_dp_aux *aux = &connector->port->aux; +u8 bcaps; +int ret; + + ret =_intel_dp_hdcp2_capable (aux, hdcp2_capable); +if (ret) +return ret; + + ret =intel_dp_hdcp_read_bcaps (aux, &bcaps); +if (ret) +return ret; + + *hdcp_capable = bcaps &DP_BCAPS_HDCP_CAPABLE ; + +return 0 ; +} +static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .write_an_aksv = intel_dp_hdcp_write_an_aksv, .read_bksv = intel_dp_hdcp_read_bksv,
@@ -683,6 +704,7 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .config_stream_type = intel_dp_hdcp2_config_stream_type, .check_2_2_link = intel_dp_hdcp2_check_link, .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .remote_hdcp_cap = intel_dp_hdcp_remote_cap, .protocol = HDCP_PROTOCOL_DP, };
drivers/gpu/drm/i915/display/intel_hdcp.c +16 -0
@@ -205,6 +205,22 @@ bool intel_hdcp2_capable(struct intel_connector *connector)return capable; } +void intel_hdcp_remote_cap (struct intel_connector *connector, +bool *hdcp_capable, +bool *hdcp2_capable) +{ +struct intel_hdcp *hdcp = &connector->hdcp; + +/* Remote Sink's capability for HDCP */ +if (!hdcp->shim->remote_hdcp_cap) +return ; + + hdcp->shim->remote_hdcp_cap (connector, hdcp_capable, hdcp2_capable); + +if (intel_hdcp2_prerequisite (connector)) + *hdcp2_capable = false; +} +static bool intel_hdcp_in_use (struct drm_i915_private *i915,enum transcoder cpu_transcoder,enum port port) {
drivers/gpu/drm/i915/display/intel_hdcp.h +3 -0
@@ -40,6 +40,9 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,bool is_hdcp_supported (struct drm_i915_private *i915,enum port port);bool intel_hdcp_capable (struct intel_connector *connector);bool intel_hdcp2_capable (struct intel_connector *connector); +void intel_hdcp_remote_cap (struct intel_connector *connector, +bool *hdcp_capable, +bool *hdcp2_capable);void intel_hdcp_component_init (struct drm_i915_private *i915);void intel_hdcp_component_fini (struct drm_i915_private *i915);void intel_hdcp_cleanup (struct intel_connector *connector);
Signature · 1 line
2.25.1
PATCH 6/10 drm/i915/hdcp: HDCP Capability for the downstream device
In reply to Suraj KandpalCurrently we are only checking capability of remote device and not immediate downstream device but during capability check we need are concerned with only the HDCP capability of downstream device. During i915_display_info reporting we need HDCP Capability for both the monitors and downstream branch device if any this patch adds that.
--v2
-Use MST Hub HDCP version [Ankit]
--v3
-Redefined how we seprate remote and direct read to make sure HDMI shim functions are not touched [Ankit]
--- .../drm/i915/display/intel_display_debugfs.c | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_display_debugfs.c +21 -5
@@ -188,7 +188,8 @@ static void intel_panel_info(struct seq_file *m, }static void intel_hdcp_info (struct seq_file *m, -struct intel_connector *intel_connector) +struct intel_connector *intel_connector, +bool remote_req) {bool hdcp_cap, hdcp2_cap;
@@ -197,8 +198,13 @@ static void intel_hdcp_info(struct seq_file *m, goto out; } - hdcp_cap =intel_hdcp_capable (intel_connector); - hdcp2_cap =intel_hdcp2_capable (intel_connector); +if (remote_req) { +intel_hdcp_remote_cap (intel_connector, &hdcp_cap, + &hdcp2_cap); + }else { + hdcp_cap =intel_hdcp_capable (intel_connector); + hdcp2_cap =intel_hdcp2_capable (intel_connector); + }if (hdcp_cap)seq_puts (m,"HDCP1.4 " );
@@ -285,7 +291,12 @@ static void intel_connector_info(struct seq_file *m, }seq_puts (m,"\tHDCP version: " ); -intel_hdcp_info (m, intel_connector); +intel_hdcp_info (m, intel_connector, true); + +if (intel_encoder_is_mst (encoder)) { +seq_puts (m,"\tMST Hub HDCP version: " ); +intel_hdcp_info (m, intel_connector, false); + }seq_printf (m,"\tmax bpc: %u\n" , connector->display_info.bpc);
@@ -1131,7 +1142,12 @@ static int i915_hdcp_sink_capability_show(struct seq_file *m, void *data)seq_printf (m,"%s:%d HDCP version: " , connector->base.name, connector->base.base.id); -intel_hdcp_info (m, connector); +intel_hdcp_info (m, connector, true); + +if (intel_encoder_is_mst (connector->encoder)) { +seq_puts (m,"\tMST Hub HDCP version: " ); +intel_hdcp_info (m, connector, false); + } out:drm_modeset_unlock (&i915->drm.mode_config.connection_mutex);
Signature · 1 line
2.25.1
PATCH 7/10 drm/i915/hdcp: Remove additional timing for reading mst hdcp message
In reply to Suraj KandpalNow that we have moved back to direct reads the additional timing is not required hence this can be removed.
--v2
-Add Fixes tag [Ankit]
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +2 -7
@@ -549,13 +549,8 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector,/* Entire msg read timeout since initiate of msg read */ if (bytes_to_recv == size -1 && hdcp2_msg_data->msg_read_timeout >0 ) { -if (intel_encoder_is_mst (connector->encoder)) - msg_end =ktime_add_ms (ktime_get_raw (), - hdcp2_msg_data->msg_read_timeout * - connector->port->parent->num_ports); -else - msg_end =ktime_add_ms (ktime_get_raw (), - hdcp2_msg_data->msg_read_timeout); + msg_end =ktime_add_ms (ktime_get_raw (), + hdcp2_msg_data->msg_read_timeout); } ret = drm_dp_dpcd_read(aux, offset,
Signature · 1 line
2.25.1
PATCH 8/10 drm/i915/hdcp: Extract hdcp structure from correct connector
In reply to Suraj KandpalCurrently intel_hdcp is not being extracted from primary connector this patch fixes that.
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +5 -2
@@ -389,7 +389,9 @@ intel_dp_hdcp2_wait_for_msg(struct intel_connector *connector, const struct hdcp2_dp_msg_data *hdcp2_msg_data) {struct drm_i915_private *i915 =to_i915 (connector->base.dev); -struct intel_hdcp *hdcp = &connector->hdcp; +struct intel_digital_port *dig_port =intel_attached_dig_port (connector); +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;
@@ -505,8 +507,9 @@ 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_hdcp *hdcp = &connector->hdcp;struct drm_dp_aux *aux = &dig_port->dp.aux; +struct intel_dp *dp = &dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;unsigned int offset;u8 *byte = buf;ssize_t ret, bytes_to_recv, len;
Signature · 1 line
2.25.1
PATCH 9/10 drm/i915/hdcp: Allocate stream id after HDCP AKE stage
In reply to Suraj KandpalAllocate stream id after HDCP AKE stage and not before so that it can also be done during link integrity check.
Right now for MST scenarios LIC fails after hdcp enablement for this reason.
--- .../drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_hdcp.c | 124 ++++++++---------- 2 files changed, 59 insertions(+), 66 deletions(-)
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
@@ -545,6 +545,7 @@ struct intel_hdcp {u64 value;struct delayed_work check_work;struct work_struct prop_work; +struct drm_modeset_acquire_ctx *acquire_ctx;/* HDCP1.4 Encryption status */ bool hdcp_encrypted;
drivers/gpu/drm/i915/display/intel_hdcp.c +58 -66
191 lines not on this page · raw message
Signature · 1 line
2.25.1