diff mbox series

[3/3] drm/amd/display: fix a crash caused by hot plugging on certain MST hubs

Message ID 20220923205234.207628-3-hamza.mahfooz@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/amd/display: fix HDCP drm prop update for MST | expand

Commit Message

Hamza Mahfooz Sept. 23, 2022, 8:52 p.m. UTC
Currently we aren't considering the mode_changed property of struct
drm_crtc_state, which can mean that we might not update the display when
it is otherwise necessary, and cause a crash. So, consider mode_changed
in is_content_protection_different().

Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8d8788792f7d..78bd1a5099f1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7222,9 +7222,11 @@  is_scaling_state_different(const struct dm_connector_state *dm_state,
 }
 
 #ifdef CONFIG_DRM_AMD_DC_HDCP
-static bool is_content_protection_different(struct drm_connector_state *state,
+static bool is_content_protection_different(const struct drm_crtc_state *crtc_state,
+					    struct drm_connector_state *state,
 					    const struct drm_connector_state *old_state,
-					    const struct drm_connector *connector, struct hdcp_workqueue *hdcp_w)
+					    const struct drm_connector *connector,
+					    struct hdcp_workqueue *hdcp_w)
 {
 	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
 	struct dm_connector_state *dm_con_state = to_dm_connector_state(connector->state);
@@ -7289,7 +7291,9 @@  static bool is_content_protection_different(struct drm_connector_state *state,
 	 *		ENABLED -> ENABLED
 	 */
 	if (old_state->content_protection == state->content_protection)
-		return false;
+		return state->content_protection >=
+			DRM_MODE_CONTENT_PROTECTION_DESIRED &&
+			crtc_state && crtc_state->mode_changed;
 
 	/*
 	 * Handles:	UNDESIRED -> DESIRED
@@ -8171,7 +8175,8 @@  static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 			continue;
 		}
 
-		if (is_content_protection_different(new_con_state,
+		if (is_content_protection_different(new_crtc_state,
+						    new_con_state,
 						    old_con_state,
 						    connector,
 						    adev->dm.hdcp_workqueue)) {