Commit a09f8e29 authored by Isabel Zhang's avatar Isabel Zhang Committed by Alex Deucher

drm/amd/display: Move mod_hdcp_displays to mod_hdcp struct

[Why]
Reset connection is called before remove display in mod_hdcp. When
remove display is called, the display structure has been zeroed from
reset connection. Since no displays can be found, remove display does
not properly reset the hardware. This causes validation errors when
another display is plugged into a different port afterwards.

[How]
Moved displays structure out of connections structure. Displays
structure is now directly within mod_hdcp. Displays is no longer zeroed
when reset connection is called.
Signed-off-by: default avatarIsabel Zhang <isabel.zhang@amd.com>
Reviewed-by: default avatarWenjing Liu <Wenjing.Liu@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 834a9a9f
...@@ -52,8 +52,8 @@ static uint8_t is_cp_desired_hdcp1(struct mod_hdcp *hdcp) ...@@ -52,8 +52,8 @@ static uint8_t is_cp_desired_hdcp1(struct mod_hdcp *hdcp)
* hdcp is not desired * hdcp is not desired
*/ */
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) { for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
if (hdcp->connection.displays[i].state != MOD_HDCP_DISPLAY_INACTIVE && if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_INACTIVE &&
!hdcp->connection.displays[i].adjust.disable) { !hdcp->displays[i].adjust.disable) {
is_auth_needed = 1; is_auth_needed = 1;
break; break;
} }
...@@ -73,8 +73,8 @@ static uint8_t is_cp_desired_hdcp2(struct mod_hdcp *hdcp) ...@@ -73,8 +73,8 @@ static uint8_t is_cp_desired_hdcp2(struct mod_hdcp *hdcp)
* hdcp is not desired * hdcp is not desired
*/ */
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) { for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
if (hdcp->connection.displays[i].state != MOD_HDCP_DISPLAY_INACTIVE && if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_INACTIVE &&
!hdcp->connection.displays[i].adjust.disable) { !hdcp->displays[i].adjust.disable) {
is_auth_needed = 1; is_auth_needed = 1;
break; break;
} }
...@@ -373,8 +373,8 @@ enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp, ...@@ -373,8 +373,8 @@ enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp,
goto out; goto out;
display->state = MOD_HDCP_DISPLAY_INACTIVE; display->state = MOD_HDCP_DISPLAY_INACTIVE;
/* request authentication for remaining displays*/ /* request authentication when connection is not reset */
if (get_active_display_count(hdcp) > 0) if (current_state(hdcp) != HDCP_UNINITIALIZED)
callback_in_ms(hdcp->connection.link.adjust.auth_delay * 1000, callback_in_ms(hdcp->connection.link.adjust.auth_delay * 1000,
output); output);
out: out:
......
...@@ -165,7 +165,6 @@ struct mod_hdcp_auth_counters { ...@@ -165,7 +165,6 @@ struct mod_hdcp_auth_counters {
/* contains values per connection */ /* contains values per connection */
struct mod_hdcp_connection { struct mod_hdcp_connection {
struct mod_hdcp_link link; struct mod_hdcp_link link;
struct mod_hdcp_display displays[MAX_NUM_OF_DISPLAYS];
uint8_t is_repeater; uint8_t is_repeater;
uint8_t is_km_stored; uint8_t is_km_stored;
uint8_t is_hdcp1_revoked; uint8_t is_hdcp1_revoked;
...@@ -201,6 +200,8 @@ struct mod_hdcp { ...@@ -201,6 +200,8 @@ struct mod_hdcp {
struct mod_hdcp_config config; struct mod_hdcp_config config;
/* per connection */ /* per connection */
struct mod_hdcp_connection connection; struct mod_hdcp_connection connection;
/* per displays */
struct mod_hdcp_display displays[MAX_NUM_OF_DISPLAYS];
/* per authentication attempt */ /* per authentication attempt */
struct mod_hdcp_authentication auth; struct mod_hdcp_authentication auth;
/* per state in an authentication */ /* per state in an authentication */
...@@ -518,7 +519,7 @@ static inline uint8_t get_active_display_count(struct mod_hdcp *hdcp) ...@@ -518,7 +519,7 @@ static inline uint8_t get_active_display_count(struct mod_hdcp *hdcp)
uint8_t i; uint8_t i;
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (is_display_active(&hdcp->connection.displays[i])) if (is_display_active(&hdcp->displays[i]))
added_count++; added_count++;
return added_count; return added_count;
} }
...@@ -529,7 +530,7 @@ static inline uint8_t get_added_display_count(struct mod_hdcp *hdcp) ...@@ -529,7 +530,7 @@ static inline uint8_t get_added_display_count(struct mod_hdcp *hdcp)
uint8_t i; uint8_t i;
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (is_display_added(&hdcp->connection.displays[i])) if (is_display_added(&hdcp->displays[i]))
added_count++; added_count++;
return added_count; return added_count;
} }
...@@ -541,8 +542,8 @@ static inline struct mod_hdcp_display *get_first_added_display( ...@@ -541,8 +542,8 @@ static inline struct mod_hdcp_display *get_first_added_display(
struct mod_hdcp_display *display = NULL; struct mod_hdcp_display *display = NULL;
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (is_display_added(&hdcp->connection.displays[i])) { if (is_display_added(&hdcp->displays[i])) {
display = &hdcp->connection.displays[i]; display = &hdcp->displays[i];
break; break;
} }
return display; return display;
...@@ -555,9 +556,9 @@ static inline struct mod_hdcp_display *get_active_display_at_index( ...@@ -555,9 +556,9 @@ static inline struct mod_hdcp_display *get_active_display_at_index(
struct mod_hdcp_display *display = NULL; struct mod_hdcp_display *display = NULL;
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (hdcp->connection.displays[i].index == index && if (hdcp->displays[i].index == index &&
is_display_active(&hdcp->connection.displays[i])) { is_display_active(&hdcp->displays[i])) {
display = &hdcp->connection.displays[i]; display = &hdcp->displays[i];
break; break;
} }
return display; return display;
...@@ -570,8 +571,8 @@ static inline struct mod_hdcp_display *get_empty_display_container( ...@@ -570,8 +571,8 @@ static inline struct mod_hdcp_display *get_empty_display_container(
struct mod_hdcp_display *display = NULL; struct mod_hdcp_display *display = NULL;
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (!is_display_active(&hdcp->connection.displays[i])) { if (!is_display_active(&hdcp->displays[i])) {
display = &hdcp->connection.displays[i]; display = &hdcp->displays[i];
break; break;
} }
return display; return display;
......
...@@ -177,11 +177,11 @@ enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp) ...@@ -177,11 +177,11 @@ enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp)
HDCP_TOP_HDCP1_DESTROY_SESSION_TRACE(hdcp); HDCP_TOP_HDCP1_DESTROY_SESSION_TRACE(hdcp);
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (is_display_encryption_enabled( if (is_display_encryption_enabled(
&hdcp->connection.displays[i])) { &hdcp->displays[i])) {
hdcp->connection.displays[i].state = hdcp->displays[i].state =
MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED; MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED;
HDCP_HDCP1_DISABLED_TRACE(hdcp, HDCP_HDCP1_DISABLED_TRACE(hdcp,
hdcp->connection.displays[i].index); hdcp->displays[i].index);
} }
return MOD_HDCP_STATUS_SUCCESS; return MOD_HDCP_STATUS_SUCCESS;
...@@ -301,14 +301,14 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp ...@@ -301,14 +301,14 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) { for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
if (hdcp->connection.displays[i].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED || if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ||
hdcp->connection.displays[i].adjust.disable) hdcp->displays[i].adjust.disable)
continue; continue;
memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory)); memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
hdcp_cmd->in_msg.hdcp1_enable_dp_stream_encryption.session_handle = hdcp->auth.id; hdcp_cmd->in_msg.hdcp1_enable_dp_stream_encryption.session_handle = hdcp->auth.id;
hdcp_cmd->in_msg.hdcp1_enable_dp_stream_encryption.display_handle = hdcp->connection.displays[i].index; hdcp_cmd->in_msg.hdcp1_enable_dp_stream_encryption.display_handle = hdcp->displays[i].index;
hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP1_ENABLE_DP_STREAM_ENCRYPTION; hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP1_ENABLE_DP_STREAM_ENCRYPTION;
psp_hdcp_invoke(psp, hdcp_cmd->cmd_id); psp_hdcp_invoke(psp, hdcp_cmd->cmd_id);
...@@ -316,8 +316,8 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp ...@@ -316,8 +316,8 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp
if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS) if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS)
return MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE; return MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE;
hdcp->connection.displays[i].state = MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED; hdcp->displays[i].state = MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED;
HDCP_HDCP1_ENABLED_TRACE(hdcp, hdcp->connection.displays[i].index); HDCP_HDCP1_ENABLED_TRACE(hdcp, hdcp->displays[i].index);
} }
return MOD_HDCP_STATUS_SUCCESS; return MOD_HDCP_STATUS_SUCCESS;
...@@ -421,11 +421,11 @@ enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp) ...@@ -421,11 +421,11 @@ enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp)
HDCP_TOP_HDCP2_DESTROY_SESSION_TRACE(hdcp); HDCP_TOP_HDCP2_DESTROY_SESSION_TRACE(hdcp);
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
if (is_display_encryption_enabled( if (is_display_encryption_enabled(
&hdcp->connection.displays[i])) { &hdcp->displays[i])) {
hdcp->connection.displays[i].state = hdcp->displays[i].state =
MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED; MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED;
HDCP_HDCP2_DISABLED_TRACE(hdcp, HDCP_HDCP2_DISABLED_TRACE(hdcp,
hdcp->connection.displays[i].index); hdcp->displays[i].index);
} }
return MOD_HDCP_STATUS_SUCCESS; return MOD_HDCP_STATUS_SUCCESS;
...@@ -747,10 +747,10 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp ...@@ -747,10 +747,10 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) { for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
if (hdcp->connection.displays[i].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED || if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ||
hdcp->connection.displays[i].adjust.disable) hdcp->displays[i].adjust.disable)
continue; continue;
hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.display_handle = hdcp->connection.displays[i].index; hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.display_handle = hdcp->displays[i].index;
hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.session_handle = hdcp->auth.id; hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.session_handle = hdcp->auth.id;
hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP2_ENABLE_DP_STREAM_ENCRYPTION; hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP2_ENABLE_DP_STREAM_ENCRYPTION;
...@@ -759,8 +759,8 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp ...@@ -759,8 +759,8 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS) if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS)
break; break;
hdcp->connection.displays[i].state = MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED; hdcp->displays[i].state = MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED;
HDCP_HDCP2_ENABLED_TRACE(hdcp, hdcp->connection.displays[i].index); HDCP_HDCP2_ENABLED_TRACE(hdcp, hdcp->displays[i].index);
} }
return (hdcp_cmd->hdcp_status == TA_HDCP_STATUS__SUCCESS) ? MOD_HDCP_STATUS_SUCCESS return (hdcp_cmd->hdcp_status == TA_HDCP_STATUS__SUCCESS) ? MOD_HDCP_STATUS_SUCCESS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment