From: "Dingchen (David) Zhang" <[email protected]>

[why]
It is possible that the commit from userspace to cause link stream
disable and hdcp auth reset when the HDCP has been enabled at the
moment. We'd expect the CP prop back to DESIRED from ENABLED.

[how]
In the helper of hdcp display removal, we check and change the CP prop
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]>
Reviewed-by: Dingchen Zhang <[email protected]>
Acked-by: Aurabindo Pillai <[email protected]>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index 616f5b1ea3a8..50f6b3a86931 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -160,6 +160,7 @@ static void link_lock(struct hdcp_workqueue *work, bool 
lock)
                        mutex_unlock(&work[i].mutex);
        }
 }
+
 void hdcp_update_display(struct hdcp_workqueue *hdcp_work,
                         unsigned int link_index,
                         struct amdgpu_dm_connector *aconnector,
@@ -222,10 +223,22 @@ static void hdcp_remove_display(struct hdcp_workqueue 
*hdcp_work,
                         struct amdgpu_dm_connector *aconnector)
 {
        struct hdcp_workqueue *hdcp_w = &hdcp_work[link_index];
+       struct drm_connector_state *conn_state = aconnector->base.state;
 
        mutex_lock(&hdcp_w->mutex);
        hdcp_w->aconnector = aconnector;
 
+       /* the removal of display will invoke auth reset -> hdcp destroy and
+        * we'd expect the CP prop changed back to DESIRED if at the time 
ENABLED.
+        * the CP prop change should occur before the element removed from 
linked list.
+        */
+       if (conn_state && conn_state->content_protection == 
DRM_MODE_CONTENT_PROTECTION_ENABLED) {
+               conn_state->content_protection = 
DRM_MODE_CONTENT_PROTECTION_DESIRED;
+
+               pr_debug("[HDCP_DM] display %d, CP 2 -> 1, type %u, DPMS %u\n",
+                        aconnector->base.index, conn_state->hdcp_content_type, 
aconnector->base.dpms);
+       }
+
        mod_hdcp_remove_display(&hdcp_w->hdcp, aconnector->base.index, 
&hdcp_w->output);
 
        process_output(hdcp_w);
-- 
2.31.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to