aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0834-drm-amd-amdgpu-resume-displays-after-cursor-pin.patch
blob: 36a6514c9279e0717a63e3128f6ef87afab38791 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From ab819a7405fb30117339ce7245050bb3b3a935f3 Mon Sep 17 00:00:00 2001
From: Eric Yang <eric.yang2@amd.com>
Date: Fri, 26 Feb 2016 11:27:34 -0500
Subject: [PATCH 0834/1110] drm/amd/amdgpu: resume displays after cursor pin

This will prevent cursor corruption on resume from
S3 by turning on displays after cursor buffer pin.

Signed-off-by: Eric Yang <eric.yang2@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  8 ++++++++
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c | 16 ++++++++++++----
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index d34b64e..1b22de0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2433,5 +2433,11 @@ struct amdgpu_bo_va_mapping *
 amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
 		       uint64_t addr, struct amdgpu_bo **bo);
 
+#if defined(CONFIG_DRM_AMD_DAL)
+int amdgpu_dm_display_resume(struct amdgpu_device *adev );
+#else
+static inline int amdgpu_dm_display_resume(struct amdgpu_device *adev) { return 0; }
+#endif
+
 #include "amdgpu_object.h"
 #endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 8965358..356e2ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1860,6 +1860,14 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
 				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
 			}
 			drm_modeset_unlock_all(dev);
+		} else {
+			/*
+			 * There is no equivalent atomic helper to turn on
+			 * display, so we defined our own function for this,
+			 * once suspend resume is supported by the atomic
+			 * framework this will be reworked
+			 */
+			amdgpu_dm_display_resume(adev);
 		}
 	}
 
diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
index 7f6325c..7c3a683 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
@@ -575,11 +575,7 @@ err:
 static int dm_resume(void *handle)
 {
 	struct amdgpu_device *adev = handle;
-	struct drm_device *ddev = adev->ddev;
 	struct amdgpu_display_manager *dm = &adev->dm;
-	struct amdgpu_connector *aconnector;
-	struct drm_connector *connector;
-	int ret = 0;
 
 	/* power on hardware */
 	dc_set_power_state(
@@ -587,6 +583,17 @@ static int dm_resume(void *handle)
 		DC_ACPI_CM_POWER_STATE_D0,
 		DC_VIDEO_POWER_ON);
 
+	return 0;
+}
+
+int amdgpu_dm_display_resume(struct amdgpu_device *adev )
+{
+	struct drm_device *ddev = adev->ddev;
+	struct amdgpu_display_manager *dm = &adev->dm;
+	struct amdgpu_connector *aconnector;
+	struct drm_connector *connector;
+	int ret = 0;
+
 	/* Do detection*/
 	list_for_each_entry(connector,
 			&ddev->mode_config.connector_list, head) {
@@ -610,6 +617,7 @@ static int dm_resume(void *handle)
 
 	return ret;
 }
+
 const struct amd_ip_funcs amdgpu_dm_funcs = {
 	.early_init = dm_early_init,
 	.late_init = NULL,
-- 
2.7.4