aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2612-drm-amd-display-Unify-DRM-state-variable-namings.patch
blob: 351f9c9f289908d937f89b127e6eeb831031c79b (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
From 31847dcbf666c68fc453a3276ca6fae2f31ea1fb Mon Sep 17 00:00:00 2001
From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Date: Thu, 12 Oct 2017 11:51:35 -0400
Subject: [PATCH 2612/4131] drm/amd/display: Unify DRM state variable namings.

Use new_*_state and old_*_state for their respective new/old DRM object
states.

Change-Id: I4b264f73d86d2793d68ceaa8e3deec0fa254ad2a
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 80 +++++++++++------------
 1 file changed, 40 insertions(+), 40 deletions(-)

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 09f7132..7ca62f0 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -608,12 +608,12 @@ amdgpu_dm_find_first_crtc_matching_connector(struct drm_atomic_state *state,
 					     struct drm_crtc *crtc)
 {
 	uint32_t i;
-	struct drm_connector_state *conn_state;
+	struct drm_connector_state *new_con_state;
 	struct drm_connector *connector;
 	struct drm_crtc *crtc_from_state;
 
-	for_each_new_connector_in_state(state, connector, conn_state, i) {
-		crtc_from_state = conn_state->crtc;
+	for_each_new_connector_in_state(state, connector, new_con_state, i) {
+		crtc_from_state = new_con_state->crtc;
 
 		if (crtc_from_state == crtc)
 			return to_amdgpu_dm_connector(connector);
@@ -640,7 +640,7 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
 	struct amdgpu_dm_connector *aconnector;
 	struct drm_connector *connector;
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *crtc_state;
+	struct drm_crtc_state *new_crtc_state;
 	int ret = 0;
 	int i;
 
@@ -676,8 +676,8 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
 	}
 
 	/* Force mode set in atomic comit */
-	for_each_new_crtc_in_state(adev->dm.cached_state, crtc, crtc_state, i)
-			crtc_state->active_changed = true;
+	for_each_new_crtc_in_state(adev->dm.cached_state, crtc, new_crtc_state, i)
+		new_crtc_state->active_changed = true;
 
 	ret = drm_atomic_helper_resume(ddev, adev->dm.cached_state);
 
@@ -4128,7 +4128,7 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,
 				   bool nonblock)
 {
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *old_crtc_state, *new_state;
+	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
 	struct amdgpu_device *adev = dev->dev_private;
 	int i;
 
@@ -4139,11 +4139,11 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,
 	 * it will update crtc->dm_crtc_state->stream pointer which is used in
 	 * the ISRs.
 	 */
-	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_state, i) {
+	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
 		struct dm_crtc_state *old_acrtc_state = to_dm_crtc_state(old_crtc_state);
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
 
-		if (drm_atomic_crtc_needs_modeset(new_state) && old_acrtc_state->stream)
+		if (drm_atomic_crtc_needs_modeset(new_crtc_state) && old_acrtc_state->stream)
 			manage_dm_interrupts(adev, acrtc, false);
 	}
 	/* Add check here for SoC's that support hardware cursor plane, to
@@ -4169,7 +4169,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 	unsigned long flags;
 	bool wait_for_vblank = true;
 	struct drm_connector *connector;
-	struct drm_connector_state *old_conn_state, *new_con_state;
+	struct drm_connector_state *old_con_state, *new_con_state;
 	struct dm_crtc_state *old_acrtc_state, *new_acrtc_state;
 
 	drm_atomic_helper_update_legacy_modeset_state(dev, state);
@@ -4336,9 +4336,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 	}
 
 	/* Handle scaling and undersacn changes*/
-	for_each_oldnew_connector_in_state(state, connector, old_conn_state, new_con_state, i) {
+	for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) {
 		struct dm_connector_state *con_new_state = to_dm_connector_state(new_con_state);
-		struct dm_connector_state *con_old_state = to_dm_connector_state(old_conn_state);
+		struct dm_connector_state *con_old_state = to_dm_connector_state(old_con_state);
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(con_new_state->base.crtc);
 		struct dc_stream_status *status = NULL;
 
@@ -4570,7 +4570,7 @@ static int dm_update_crtcs_state(struct dc *dc,
 				 bool *lock_and_validation_needed)
 {
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *old_crtc_state, *crtc_state;
+	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
 	int i;
 	struct dm_crtc_state *old_acrtc_state, *new_acrtc_state;
 	struct dm_atomic_state *dm_state = to_dm_atomic_state(state);
@@ -4579,16 +4579,16 @@ static int dm_update_crtcs_state(struct dc *dc,
 
 	/*TODO Move this code into dm_crtc_atomic_check once we get rid of dc_validation_set */
 	/* update changed items */
-	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) {
+	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
 		struct amdgpu_crtc *acrtc = NULL;
 		struct amdgpu_dm_connector *aconnector = NULL;
-		struct drm_connector_state *conn_state = NULL;
+		struct drm_connector_state *new_con_state = NULL;
 		struct dm_connector_state *dm_conn_state = NULL;
 
 		new_stream = NULL;
 
 		old_acrtc_state = to_dm_crtc_state(old_crtc_state);
-		new_acrtc_state = to_dm_crtc_state(crtc_state);
+		new_acrtc_state = to_dm_crtc_state(new_crtc_state);
 		acrtc = to_amdgpu_crtc(crtc);
 
 		aconnector = amdgpu_dm_find_first_crtc_matching_connector(state, crtc);
@@ -4596,18 +4596,18 @@ static int dm_update_crtcs_state(struct dc *dc,
 		/* TODO This hack should go away */
 		if (aconnector && enable) {
 			// Make sure fake sink is created in plug-in scenario
-			conn_state = drm_atomic_get_connector_state(state,
+			new_con_state = drm_atomic_get_connector_state(state,
 								    &aconnector->base);
 
-			if (IS_ERR(conn_state)) {
-				ret = PTR_ERR_OR_ZERO(conn_state);
+			if (IS_ERR(new_con_state)) {
+				ret = PTR_ERR_OR_ZERO(new_con_state);
 				break;
 			}
 
-			dm_conn_state = to_dm_connector_state(conn_state);
+			dm_conn_state = to_dm_connector_state(new_con_state);
 
 			new_stream = create_stream_for_sink(aconnector,
-							    &crtc_state->mode,
+							    &new_crtc_state->mode,
 							    dm_conn_state);
 
 			/*
@@ -4627,14 +4627,14 @@ static int dm_update_crtcs_state(struct dc *dc,
 		if (dc_is_stream_unchanged(new_stream, old_acrtc_state->stream) &&
 				dc_is_stream_scaling_unchanged(new_stream, old_acrtc_state->stream)) {
 
-			crtc_state->mode_changed = false;
+			new_crtc_state->mode_changed = false;
 
 			DRM_DEBUG_DRIVER("Mode change not required, setting mode_changed to %d",
-				         crtc_state->mode_changed);
+					 new_crtc_state->mode_changed);
 		}
 
 
-		if (!drm_atomic_crtc_needs_modeset(crtc_state))
+		if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
 			goto next_crtc;
 
 #if !defined(OS_NAME_RHEL_7_2)
@@ -4643,12 +4643,12 @@ static int dm_update_crtcs_state(struct dc *dc,
 			"planes_changed:%d, mode_changed:%d,active_changed:%d,"
 			"connectors_changed:%d\n",
 			acrtc->crtc_id,
-			crtc_state->enable,
-			crtc_state->active,
-			crtc_state->planes_changed,
-			crtc_state->mode_changed,
-			crtc_state->active_changed,
-			crtc_state->connectors_changed);
+			new_crtc_state->enable,
+			new_crtc_state->active,
+			new_crtc_state->planes_changed,
+			new_crtc_state->mode_changed,
+			new_crtc_state->active_changed,
+			new_crtc_state->connectors_changed);
 #endif
 
 		/* Remove stream for any changed/disabled CRTC */
@@ -4683,10 +4683,10 @@ static int dm_update_crtcs_state(struct dc *dc,
 			if (!aconnector || (!aconnector->dc_sink && aconnector->mst_port))
 				goto next_crtc;
 
-			if (modereset_required(crtc_state))
+			if (modereset_required(new_crtc_state))
 				goto next_crtc;
 
-			if (modeset_required(crtc_state, new_stream,
+			if (modeset_required(new_crtc_state, new_stream,
 					     old_acrtc_state->stream)) {
 
 				WARN_ON(new_acrtc_state->stream);
@@ -4869,9 +4869,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 	struct dc *dc = adev->dm.dc;
 	struct dm_atomic_state *dm_state = to_dm_atomic_state(state);
 	struct drm_connector *connector;
-	struct drm_connector_state *old_con_state, *conn_state;
+	struct drm_connector_state *old_con_state, *new_con_state;
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *old_crtc_state, *crtc_state;
+	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
 
 	/*
 	 * This bool will be set for true for any modeset/reset
@@ -4892,8 +4892,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 	 * we should not add it to list of affected planes.
 	 */
 	if (state->legacy_cursor_update) {
-		for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
-			if (crtc_state->color_mgmt_changed) {
+		for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+			if (new_crtc_state->color_mgmt_changed) {
 				ret = drm_atomic_add_affected_planes(state, crtc);
 				if (ret)
 					goto fail;
@@ -4904,9 +4904,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 		for_each_crtc_in_state(state, crtc, crtc_state, i) {
 			old_crtc_state = crtc->state;
 #else
-		for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) {
+		for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
 #endif
-			if (!crtc_state->enable)
+			if (!new_crtc_state->enable)
 				continue;
 
 			ret = drm_atomic_add_affected_connectors(state, crtc);
@@ -4957,9 +4957,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 	 * new stream into context w\o causing full reset. Need to
 	 * decide how to handle.
 	 */
-	for_each_oldnew_connector_in_state(state, connector, old_con_state, conn_state, i) {
+	for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) {
 		struct dm_connector_state *con_old_state = to_dm_connector_state(old_con_state);
-		struct dm_connector_state *con_new_state = to_dm_connector_state(conn_state);
+		struct dm_connector_state *con_new_state = to_dm_connector_state(new_con_state);
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(con_new_state->base.crtc);
 
 		/* Skip any modesets/resets */
-- 
2.7.4