aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/1000-drm-amd-dal-handle-the-case-we-cannot-restore-connec.patch
blob: 8b44d5cb99d8a0a1c5019a1f83b35c8209992092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 0e45b09c8a813c15d96701c3daa5436cc358111f Mon Sep 17 00:00:00 2001
From: Eric Yang <eric.yang2@amd.com>
Date: Fri, 1 Apr 2016 18:38:34 -0400
Subject: [PATCH 1000/1110] drm/amd/dal: handle the case we cannot restore
 connector state

If we unplug the last display and plug in a different one that does not
support the timing set on the previous display, we can fail in
dc_commit_targets, this was not properly handled and was causing a
crash

Signed-off-by: Eric Yang <eric.yang2@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index d2548b6..0e19f8d 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -2412,7 +2412,14 @@ void dm_restore_drm_connector_state(struct drm_device *dev, struct drm_connector
 		}
 
 		/* DC is optimized not to do anything if 'targets' didn't change. */
-		dc_commit_targets(dc, commit_targets, commit_targets_count);
+		if (!dc_commit_targets(dc, commit_targets,
+				commit_targets_count)) {
+			DRM_INFO("Failed to restore connector state!\n");
+			dc_target_release(disconnected_acrtc->target);
+			disconnected_acrtc->target = NULL;
+			disconnected_acrtc->enabled = false;
+			return;
+		}
 
 
 		dm_dc_surface_commit(dc, &disconnected_acrtc->base,
-- 
2.7.4