@@ -54,7 +54,7 @@ enum mod_hdcp_status mod_hdcp_remove_display_from_topology(
54
54
55
55
dtm_cmd = (struct ta_dtm_shared_memory * )psp -> dtm_context .dtm_shared_buf ;
56
56
57
- if (!display || !is_display_active (display ))
57
+ if (!display || !is_display_added (display ))
58
58
return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND ;
59
59
60
60
memset (dtm_cmd , 0 , sizeof (struct ta_dtm_shared_memory ));
@@ -73,21 +73,25 @@ enum mod_hdcp_status mod_hdcp_remove_display_from_topology(
73
73
HDCP_TOP_REMOVE_DISPLAY_TRACE (hdcp , display -> index );
74
74
75
75
return MOD_HDCP_STATUS_SUCCESS ;
76
- }
77
-
78
- enum mod_hdcp_status mod_hdcp_add_display_to_topology (
79
- struct mod_hdcp * hdcp , struct mod_hdcp_display * display )
76
+
77
+ }
78
+ enum mod_hdcp_status mod_hdcp_add_display_to_topology (struct mod_hdcp * hdcp ,
79
+ uint8_t index )
80
80
{
81
81
struct psp_context * psp = hdcp -> config .psp .handle ;
82
82
struct ta_dtm_shared_memory * dtm_cmd ;
83
+ struct mod_hdcp_display * display =
84
+ get_active_display_at_index (hdcp , index );
83
85
struct mod_hdcp_link * link = & hdcp -> connection .link ;
84
86
85
87
if (!psp -> dtm_context .dtm_initialized ) {
86
88
DRM_ERROR ("Failed to add display topology, DTM TA is not initialized." );
87
- display -> state = MOD_HDCP_DISPLAY_INACTIVE ;
88
89
return MOD_HDCP_STATUS_FAILURE ;
89
90
}
90
91
92
+ if (!display || is_display_added (display ))
93
+ return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE ;
94
+
91
95
dtm_cmd = (struct ta_dtm_shared_memory * )psp -> dtm_context .dtm_shared_buf ;
92
96
93
97
memset (dtm_cmd , 0 , sizeof (struct ta_dtm_shared_memory ));
@@ -109,11 +113,10 @@ enum mod_hdcp_status mod_hdcp_add_display_to_topology(
109
113
110
114
psp_dtm_invoke (psp , dtm_cmd -> cmd_id );
111
115
112
- if (dtm_cmd -> dtm_status != TA_DTM_STATUS__SUCCESS ) {
113
- display -> state = MOD_HDCP_DISPLAY_INACTIVE ;
116
+ if (dtm_cmd -> dtm_status != TA_DTM_STATUS__SUCCESS )
114
117
return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE ;
115
- }
116
118
119
+ display -> state = MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ;
117
120
HDCP_TOP_ADD_DISPLAY_TRACE (hdcp , display -> index );
118
121
119
122
return MOD_HDCP_STATUS_SUCCESS ;
@@ -123,7 +126,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp)
123
126
{
124
127
125
128
struct psp_context * psp = hdcp -> config .psp .handle ;
126
- struct mod_hdcp_display * display = get_first_active_display (hdcp );
129
+ struct mod_hdcp_display * display = get_first_added_display (hdcp );
127
130
struct ta_hdcp_shared_memory * hdcp_cmd ;
128
131
129
132
if (!psp -> hdcp_context .hdcp_initialized ) {
@@ -176,7 +179,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp)
176
179
if (is_display_encryption_enabled (
177
180
& hdcp -> displays [i ])) {
178
181
hdcp -> displays [i ].state =
179
- MOD_HDCP_DISPLAY_ACTIVE ;
182
+ MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ;
180
183
HDCP_HDCP1_DISABLED_TRACE (hdcp ,
181
184
hdcp -> displays [i ].index );
182
185
}
@@ -228,7 +231,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp *hdcp)
228
231
{
229
232
struct psp_context * psp = hdcp -> config .psp .handle ;
230
233
struct ta_hdcp_shared_memory * hdcp_cmd ;
231
- struct mod_hdcp_display * display = get_first_active_display (hdcp );
234
+ struct mod_hdcp_display * display = get_first_added_display (hdcp );
232
235
233
236
hdcp_cmd = (struct ta_hdcp_shared_memory * )psp -> hdcp_context .hdcp_shared_buf ;
234
237
memset (hdcp_cmd , 0 , sizeof (struct ta_hdcp_shared_memory ));
@@ -298,7 +301,8 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp
298
301
299
302
for (i = 0 ; i < MAX_NUM_OF_DISPLAYS ; i ++ ) {
300
303
301
- if (hdcp -> displays [i ].adjust .disable )
304
+ if (hdcp -> displays [i ].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ||
305
+ hdcp -> displays [i ].adjust .disable )
302
306
continue ;
303
307
304
308
memset (hdcp_cmd , 0 , sizeof (struct ta_hdcp_shared_memory ));
@@ -360,7 +364,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_create_session(struct mod_hdcp *hdcp)
360
364
{
361
365
struct psp_context * psp = hdcp -> config .psp .handle ;
362
366
struct ta_hdcp_shared_memory * hdcp_cmd ;
363
- struct mod_hdcp_display * display = get_first_active_display (hdcp );
367
+ struct mod_hdcp_display * display = get_first_added_display (hdcp );
364
368
365
369
if (!psp -> hdcp_context .hdcp_initialized ) {
366
370
DRM_ERROR ("Failed to create hdcp session, HDCP TA is not initialized" );
@@ -419,7 +423,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp)
419
423
if (is_display_encryption_enabled (
420
424
& hdcp -> displays [i ])) {
421
425
hdcp -> displays [i ].state =
422
- MOD_HDCP_DISPLAY_ACTIVE ;
426
+ MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ;
423
427
HDCP_HDCP2_DISABLED_TRACE (hdcp ,
424
428
hdcp -> displays [i ].index );
425
429
}
@@ -658,7 +662,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_encryption(struct mod_hdcp *hdcp)
658
662
{
659
663
struct psp_context * psp = hdcp -> config .psp .handle ;
660
664
struct ta_hdcp_shared_memory * hdcp_cmd ;
661
- struct mod_hdcp_display * display = get_first_active_display (hdcp );
665
+ struct mod_hdcp_display * display = get_first_added_display (hdcp );
662
666
663
667
hdcp_cmd = (struct ta_hdcp_shared_memory * )psp -> hdcp_context .hdcp_shared_buf ;
664
668
memset (hdcp_cmd , 0 , sizeof (struct ta_hdcp_shared_memory ));
@@ -743,7 +747,8 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
743
747
744
748
745
749
for (i = 0 ; i < MAX_NUM_OF_DISPLAYS ; i ++ ) {
746
- if (hdcp -> displays [i ].adjust .disable )
750
+ if (hdcp -> displays [i ].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ||
751
+ hdcp -> displays [i ].adjust .disable )
747
752
continue ;
748
753
hdcp_cmd -> in_msg .hdcp2_enable_dp_stream_encryption .display_handle = hdcp -> displays [i ].index ;
749
754
hdcp_cmd -> in_msg .hdcp2_enable_dp_stream_encryption .session_handle = hdcp -> auth .id ;
0 commit comments