aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0881-drm-amd-dal-merge-same-map_clock_resources.patch
blob: f1c4e6a9e7089c0c3a3d4106002c67261ab5d324 (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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
From 7d7df856a24ba94a4fb4b6c83dd410ac0f671f2d Mon Sep 17 00:00:00 2001
From: Mykola Lysenko <Mykola.Lysenko@amd.com>
Date: Mon, 7 Mar 2016 00:18:44 -0500
Subject: [PATCH 0881/1110] drm/amd/dal: merge same map_clock_resources

This is the follow-up change for clock sources clean-up

Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc_resource.c      | 55 +++++++++++++++++++
 .../gpu/drm/amd/dal/dc/dce100/dce100_resource.c    | 62 +---------------------
 .../gpu/drm/amd/dal/dc/dce110/dce110_resource.c    | 56 +------------------
 drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c  | 55 +------------------
 drivers/gpu/drm/amd/dal/dc/inc/resource.h          |  4 ++
 5 files changed, 62 insertions(+), 170 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_resource.c b/drivers/gpu/drm/amd/dal/dc/core/dc_resource.c
index ba163c3..5f3b702 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_resource.c
@@ -1217,3 +1217,58 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
 	translate_info_frame(&info_frame,
 			&pipe_ctx->encoder_info_frame);
 }
+
+enum dc_status resource_map_clock_resources(
+		const struct core_dc *dc,
+		struct validate_context *context)
+{
+	uint8_t i, j, k;
+
+	/* acquire new resources */
+	for (i = 0; i < context->target_count; i++) {
+		struct core_target *target = context->targets[i];
+
+		if (context->target_flags[i].unchanged)
+			continue;
+
+		for (j = 0; j < target->public.stream_count; j++) {
+			struct core_stream *stream =
+				DC_STREAM_TO_CORE(target->public.streams[j]);
+
+			for (k = 0; k < MAX_PIPES; k++) {
+				struct pipe_ctx *pipe_ctx =
+					&context->res_ctx.pipe_ctx[k];
+
+				if (context->res_ctx.pipe_ctx[k].stream != stream)
+					continue;
+
+				if (dc_is_dp_signal(pipe_ctx->signal)
+					|| pipe_ctx->signal == SIGNAL_TYPE_VIRTUAL)
+					pipe_ctx->clock_source =
+						context->res_ctx.pool.dp_clock_source;
+				else {
+					pipe_ctx->clock_source =
+						resource_find_used_clk_src_for_sharing(
+							&context->res_ctx,
+							pipe_ctx);
+
+					if (pipe_ctx->clock_source == NULL)
+						pipe_ctx->clock_source =
+							dc_resource_find_first_free_pll(&context->res_ctx);
+				}
+
+				if (pipe_ctx->clock_source == NULL)
+					return DC_NO_CLOCK_SOURCE_RESOURCE;
+
+				resource_reference_clock_source(
+						&context->res_ctx,
+						pipe_ctx->clock_source);
+
+				/* only one cs per stream regardless of mpo */
+				break;
+			}
+		}
+	}
+
+	return DC_OK;
+}
diff --git a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
index f6b9cb8..6b8ae77 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
@@ -788,66 +788,6 @@ static void set_target_unchanged(
 	}
 }
 
-static enum dc_status map_clock_resources(
-		const struct core_dc *dc,
-		struct validate_context *context)
-{
-	uint8_t i, j, k;
-
-	/* acquire new resources */
-	for (i = 0; i < context->target_count; i++) {
-		struct core_target *target = context->targets[i];
-
-		if (context->target_flags[i].unchanged)
-			continue;
-
-		for (j = 0; j < target->public.stream_count; j++) {
-			struct core_stream *stream =
-				DC_STREAM_TO_CORE(target->public.streams[j]);
-
-			for (k = 0; k < MAX_PIPES; k++) {
-				struct pipe_ctx *pipe_ctx =
-					&context->res_ctx.pipe_ctx[k];
-
-				if (context->res_ctx.pipe_ctx[k].stream != stream)
-					continue;
-
-				/*
-				 * in this case if external clock source is not
-				 * available for DP, it will pick-up first
-				 * available pll from find_first_free_pll
-				 */
-				if (dc_is_dp_signal(pipe_ctx->signal)
-					|| pipe_ctx->signal == SIGNAL_TYPE_VIRTUAL)
-					pipe_ctx->clock_source =
-						context->res_ctx.pool.dp_clock_source;
-				else {
-					pipe_ctx->clock_source =
-						resource_find_used_clk_src_for_sharing(
-							&context->res_ctx,
-							pipe_ctx);
-
-					if (pipe_ctx->clock_source == NULL)
-						pipe_ctx->clock_source =
-							dc_resource_find_first_free_pll(&context->res_ctx);
-				}
-
-				if (pipe_ctx->clock_source == NULL)
-					return DC_NO_CLOCK_SOURCE_RESOURCE;
-
-				resource_reference_clock_source(
-						&context->res_ctx,
-						pipe_ctx->clock_source);
-
-				/* only one cs per stream regardless of mpo */
-				break;
-			}
-		}
-	}
-
-	return DC_OK;
-}
-
 enum dc_status dce100_validate_with_context(
 		const struct core_dc *dc,
 		const struct dc_validation_set set[],
@@ -895,7 +835,7 @@ enum dc_status dce100_validate_with_context(
 	result = resource_map_pool_resources(dc, context);
 
 	if (result == DC_OK)
-		result = map_clock_resources(dc, context);
+		result = resource_map_clock_resources(dc, context);
 
 	if (result == DC_OK)
 		result = validate_mapped_resource(dc, context);
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
index 66b7014..b39e2af 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
@@ -915,60 +915,6 @@ static void set_target_unchanged(
 	}
 }
 
-static enum dc_status map_clock_resources(
-		const struct core_dc *dc,
-		struct validate_context *context)
-{
-	uint8_t i, j, k;
-
-	/* acquire new resources */
-	for (i = 0; i < context->target_count; i++) {
-		struct core_target *target = context->targets[i];
-
-		if (context->target_flags[i].unchanged)
-			continue;
-
-		for (j = 0; j < target->public.stream_count; j++) {
-			struct core_stream *stream =
-				DC_STREAM_TO_CORE(target->public.streams[j]);
-
-			for (k = 0; k < MAX_PIPES; k++) {
-				struct pipe_ctx *pipe_ctx =
-					&context->res_ctx.pipe_ctx[k];
-
-				if (context->res_ctx.pipe_ctx[k].stream != stream)
-					continue;
-
-				if (dc_is_dp_signal(pipe_ctx->signal)
-					|| pipe_ctx->signal == SIGNAL_TYPE_VIRTUAL)
-					pipe_ctx->clock_source =
-						context->res_ctx.pool.dp_clock_source;
-				else {
-					pipe_ctx->clock_source =
-						resource_find_used_clk_src_for_sharing(
-							&context->res_ctx, pipe_ctx);
-
-					if (pipe_ctx->clock_source == NULL)
-						pipe_ctx->clock_source =
-							dc_resource_find_first_free_pll(&context->res_ctx);
-				}
-
-				if (pipe_ctx->clock_source == NULL)
-					return DC_NO_CLOCK_SOURCE_RESOURCE;
-
-				resource_reference_clock_source(
-						&context->res_ctx,
-						pipe_ctx->clock_source);
-
-				/* only one cs per stream regardless of mpo */
-				break;
-			}
-		}
-	}
-
-	return DC_OK;
-}
-
 enum dc_status dce110_validate_with_context(
 		const struct core_dc *dc,
 		const struct dc_validation_set set[],
@@ -1016,7 +962,7 @@ enum dc_status dce110_validate_with_context(
 	result = resource_map_pool_resources(dc, context);
 
 	if (result == DC_OK)
-		result = map_clock_resources(dc, context);
+		result = resource_map_clock_resources(dc, context);
 
 	if (result == DC_OK)
 		result = validate_mapped_resource(dc, context);
diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
index 864f32a..3b70643 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
@@ -905,59 +905,6 @@ static void set_target_unchanged(
 	}
 }
 
-static enum dc_status map_clock_resources(
-		const struct core_dc *dc,
-		struct validate_context *context)
-{
-	uint8_t i, j, k;
-
-	/* acquire new resources */
-	for (i = 0; i < context->target_count; i++) {
-		struct core_target *target = context->targets[i];
-
-		if (context->target_flags[i].unchanged)
-			continue;
-
-		for (j = 0; j < target->public.stream_count; j++) {
-			struct core_stream *stream =
-				DC_STREAM_TO_CORE(target->public.streams[j]);
-
-			for (k = 0; k < MAX_PIPES; k++) {
-				struct pipe_ctx *pipe_ctx =
-					&context->res_ctx.pipe_ctx[k];
-
-				if (context->res_ctx.pipe_ctx[k].stream != stream)
-					continue;
-
-				if (dc_is_dp_signal(pipe_ctx->signal)
-					|| pipe_ctx->signal == SIGNAL_TYPE_VIRTUAL)
-					pipe_ctx->clock_source = context->res_ctx.pool.dp_clock_source;
-				else {
-					pipe_ctx->clock_source =
-						resource_find_used_clk_src_for_sharing(
-							&context->res_ctx, pipe_ctx);
-
-					if (pipe_ctx->clock_source == NULL)
-						pipe_ctx->clock_source =
-							dc_resource_find_first_free_pll(&context->res_ctx);
-				}
-
-				if (pipe_ctx->clock_source == NULL)
-					return DC_NO_CLOCK_SOURCE_RESOURCE;
-
-				resource_reference_clock_source(
-						&context->res_ctx,
-						pipe_ctx->clock_source);
-
-				/* only one cs per stream regardless of mpo */
-				break;
-			}
-		}
-	}
-
-	return DC_OK;
-}
-
 enum dc_status dce80_validate_with_context(
 		const struct core_dc *dc,
 		const struct dc_validation_set set[],
@@ -1005,7 +952,7 @@ enum dc_status dce80_validate_with_context(
 	result = resource_map_pool_resources(dc, context);
 
 	if (result == DC_OK)
-		result = map_clock_resources(dc, context);
+		result = resource_map_clock_resources(dc, context);
 
 	if (result == DC_OK)
 		result = validate_mapped_resource(dc, context);
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/resource.h b/drivers/gpu/drm/amd/dal/dc/inc/resource.h
index 45ee324..00843a4 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/resource.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/resource.h
@@ -88,5 +88,9 @@ void resource_validate_ctx_copy_construct(
 
 void resource_validate_ctx_destruct(struct validate_context *context);
 
+enum dc_status resource_map_clock_resources(
+		const struct core_dc *dc,
+		struct validate_context *context);
+
 
 #endif /* DRIVERS_GPU_DRM_AMD_DAL_DEV_DC_INC_RESOURCE_H_ */
-- 
2.7.4