Skip to content

Commit caa18dd

Browse files
Dingchen (David) Zhangalexdeucher
authored andcommitted
drm/amd/display: force CP to DESIRED when removing display
[WHY] - Commit from userspace could cause link stream to disable and hdcp auth to reset when the HDCP has already been enabled at the moment. CP should fall back to DESIRED from ENABLED in such cases. - This change was previously reverted due to a regression caused, which has now been cleared. [HOW] In hdcp display removal, change CP to DESIRED if at the moment CP is ENABLED before the auth reset and removal of linked list element. Signed-off-by: Dingchen (David) Zhang <[email protected]> Signed-off-by: Qingqing Zhuo <[email protected]> Reviewed-by: Rodrigo Siqueira <[email protected]> Acked-by: Stylon Wang <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent c6323a2 commit caa18dd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,23 @@ static void hdcp_remove_display(struct hdcp_workqueue *hdcp_work,
222222
struct amdgpu_dm_connector *aconnector)
223223
{
224224
struct hdcp_workqueue *hdcp_w = &hdcp_work[link_index];
225+
struct drm_connector_state *conn_state = aconnector->base.state;
225226

226227
mutex_lock(&hdcp_w->mutex);
227228
hdcp_w->aconnector = aconnector;
228229

230+
/* the removal of display will invoke auth reset -> hdcp destroy and
231+
* we'd expect the Content Protection (CP) property changed back to
232+
* DESIRED if at the time ENABLED. CP property change should occur
233+
* before the element removed from linked list.
234+
*/
235+
if (conn_state && conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
236+
conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
237+
238+
DRM_DEBUG_DRIVER("[HDCP_DM] display %d, CP 2 -> 1, type %u, DPMS %u\n",
239+
aconnector->base.index, conn_state->hdcp_content_type, aconnector->base.dpms);
240+
}
241+
229242
mod_hdcp_remove_display(&hdcp_w->hdcp, aconnector->base.index, &hdcp_w->output);
230243

231244
process_output(hdcp_w);
@@ -469,7 +482,7 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
469482
link->adjust.hdcp1.disable = 0;
470483
conn_state = aconnector->base.state;
471484

472-
pr_debug("[HDCP_DM] display %d, CP %d, type %d\n", aconnector->base.index,
485+
DRM_DEBUG_DRIVER("[HDCP_DM] display %d, CP %d, type %d\n", aconnector->base.index,
473486
(!!aconnector->base.state) ? aconnector->base.state->content_protection : -1,
474487
(!!aconnector->base.state) ? aconnector->base.state->hdcp_content_type : -1);
475488

0 commit comments

Comments
 (0)