Skip to content

Commit 376a33c

Browse files
surajk8tursulin
authored andcommitted
drm/i915/hdcp: Fix when the first read and write are retried
Make sure that the first read/write in hdcp2_authentication_key_exchange are only retried when we have either DP/DPMST encoder connected, since we do this to give docks and dp encoders some extra time to get their HDCP DPCD registers ready only for DP/DPMST encoders as this issue is only observed here no need to burden other encoders with extra retries as this causes the HDMI connector to have some other timing issue and fails HDCP authentication. --v2 -Add intent of patch [Chaitanya] -Add reasoning for loop [Jani] -Make sure we forfiet the 50ms wait for non DP/DPMST encoders. --v3 -Remove the is_dp_encoder check [Jani/Chaitanya] -Make the commit message more clearer [Jani] Fixes: 9d5a05f ("drm/i915/hdcp: Retry first read and writes to downstream") Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241104035951.517837-1-suraj.kandpal@intel.com (cherry picked from commit 4449955) Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
1 parent a163b89 commit 376a33c

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

drivers/gpu/drm/i915/display/intel_hdcp.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,8 @@ static int hdcp2_deauthenticate_port(struct intel_connector *connector)
15031503
static int hdcp2_authentication_key_exchange(struct intel_connector *connector)
15041504
{
15051505
struct intel_display *display = to_intel_display(connector);
1506+
struct intel_digital_port *dig_port =
1507+
intel_attached_dig_port(connector);
15061508
struct intel_hdcp *hdcp = &connector->hdcp;
15071509
union {
15081510
struct hdcp2_ake_init ake_init;
@@ -1513,30 +1515,36 @@ static int hdcp2_authentication_key_exchange(struct intel_connector *connector)
15131515
} msgs;
15141516
const struct intel_hdcp_shim *shim = hdcp->shim;
15151517
size_t size;
1516-
int ret, i;
1518+
int ret, i, max_retries;
15171519

15181520
/* Init for seq_num */
15191521
hdcp->seq_num_v = 0;
15201522
hdcp->seq_num_m = 0;
15211523

1524+
if (intel_encoder_is_dp(&dig_port->base) ||
1525+
intel_encoder_is_mst(&dig_port->base))
1526+
max_retries = 10;
1527+
else
1528+
max_retries = 1;
1529+
15221530
ret = hdcp2_prepare_ake_init(connector, &msgs.ake_init);
15231531
if (ret < 0)
15241532
return ret;
15251533

15261534
/*
15271535
* Retry the first read and write to downstream at least 10 times
1528-
* with a 50ms delay if not hdcp2 capable(dock decides to stop advertising
1529-
* hdcp2 capability for some reason). The reason being that
1530-
* during suspend resume dock usually keeps the HDCP2 registers inaccesible
1531-
* causing AUX error. This wouldn't be a big problem if the userspace
1532-
* just kept retrying with some delay while it continues to play low
1533-
* value content but most userpace applications end up throwing an error
1534-
* when it receives one from KMD. This makes sure we give the dock
1535-
* and the sink devices to complete its power cycle and then try HDCP
1536-
* authentication. The values of 10 and delay of 50ms was decided based
1537-
* on multiple trial and errors.
1536+
* with a 50ms delay if not hdcp2 capable for DP/DPMST encoders
1537+
* (dock decides to stop advertising hdcp2 capability for some reason).
1538+
* The reason being that during suspend resume dock usually keeps the
1539+
* HDCP2 registers inaccesible causing AUX error. This wouldn't be a
1540+
* big problem if the userspace just kept retrying with some delay while
1541+
* it continues to play low value content but most userpace applications
1542+
* end up throwing an error when it receives one from KMD. This makes
1543+
* sure we give the dock and the sink devices to complete its power cycle
1544+
* and then try HDCP authentication. The values of 10 and delay of 50ms
1545+
* was decided based on multiple trial and errors.
15381546
*/
1539-
for (i = 0; i < 10; i++) {
1547+
for (i = 0; i < max_retries; i++) {
15401548
if (!intel_hdcp2_get_capability(connector)) {
15411549
msleep(50);
15421550
continue;

0 commit comments

Comments
 (0)