aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0566-drm-amd-dal-Move-disabling-of-link-stream-to-dc_link.patch
blob: 41cd7e2d0bb1b8acda889a149e2435c645480fcf (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
From ab87ad6d7fa27c5910f4ed67f13cc76660cb9ea4 Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Wed, 2 Dec 2015 15:03:30 -0500
Subject: [PATCH 0566/1110] drm/amd/dal: Move disabling of link & stream to
 dc_link

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c          | 77 +++++++++++++++++++++-
 .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c    | 72 ++------------------
 drivers/gpu/drm/amd/dal/dc/inc/core_types.h        |  7 +-
 drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h      |  3 +
 4 files changed, 87 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
index f29aea7..ad890a5 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -983,7 +983,7 @@ static void enable_link_hdmi(struct core_stream *stream)
 }
 
 /****************************enable_link***********************************/
-enum dc_status core_link_enable(struct core_stream *stream)
+static enum dc_status enable_link(struct core_stream *stream)
 {
 	enum dc_status status;
 	switch (stream->signal) {
@@ -1020,7 +1020,7 @@ enum dc_status core_link_enable(struct core_stream *stream)
 	return status;
 }
 
-void core_link_disable(struct core_stream *stream)
+static void disable_link(struct core_stream *stream)
 {
 	/* TODO  dp_set_hw_test_pattern */
 	struct dc *dc = stream->ctx->dc;
@@ -1143,6 +1143,61 @@ static enum dc_status allocate_mst_payload(struct core_stream *stream)
 
 }
 
+static enum dc_status deallocate_mst_payload(struct core_stream *stream)
+{
+	struct core_link *link = stream->sink->link;
+	struct link_encoder *link_encoder = link->link_enc;
+	struct stream_encoder *stream_encoder = stream->stream_enc;
+	struct dp_mst_stream_allocation_table table = {0};
+	struct fixed31_32 avg_time_slots_per_mtp = dal_fixed31_32_from_int(0);
+	uint8_t i;
+	struct dc *dc = stream->ctx->dc;
+
+	/* deallocate_mst_payload is called before disable link. When mode or
+	 * disable/enable monitor, new stream is created which is not in link
+	 * stream[] yet. For this, payload is not allocated yet, so de-alloc
+	 * should not done. For new mode set, map_resources will get engine
+	 * for new stream, so stream_enc->id should be validated until here.
+	 */
+	if (link->enabled_stream_count == 0)
+		return DC_OK;
+
+	for (i = 0; i < link->enabled_stream_count; i++) {
+		if (link->enabled_streams[i] == stream)
+			break;
+	}
+	/* stream is not in link stream list */
+	if (i == link->enabled_stream_count)
+		return DC_OK;
+
+	/* slot X.Y */
+	dc->hwss.set_mst_bandwidth(
+		stream_encoder,
+		avg_time_slots_per_mtp);
+
+	/* TODO: which component is responsible for remove payload table? */
+	dc_helpers_dp_mst_write_payload_allocation_table(
+		stream->ctx,
+		&stream->public,
+		&table,
+		false);
+
+	dc->hwss.update_mst_stream_allocation_table(
+		link_encoder,
+		&table);
+
+	dc_helpers_dp_mst_poll_for_allocation_change_trigger(
+			stream->ctx,
+			&stream->public);
+
+	dc_helpers_dp_mst_send_payload_allocation(
+			stream->ctx,
+			&stream->public,
+			false);
+
+	return DC_OK;
+}
+
 void core_link_enable_stream(
 		struct core_link *link,
 		struct core_stream *stream)
@@ -1151,10 +1206,26 @@ void core_link_enable_stream(
 
 	dc->hwss.enable_stream(stream);
 
-	if (DC_OK != core_link_enable(stream)) {
+	if (DC_OK != enable_link(stream)) {
 			BREAK_TO_DEBUGGER();
 			return;
 	}
 	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
 		allocate_mst_payload(stream);
 }
+
+void core_link_disable_stream(
+		struct core_link *link,
+		struct core_stream *stream)
+{
+	struct dc *dc = stream->ctx->dc;
+
+	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
+		deallocate_mst_payload(stream);
+
+	dc->hwss.disable_stream(stream);
+
+	disable_link(stream);
+
+}
+
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
index fa71095..81935e5 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
@@ -774,60 +774,6 @@ static enum color_space get_output_color_space(
 	return color_space;
 }
 
-static enum dc_status deallocate_mst_payload(struct core_stream *stream)
-{
-	struct core_link *link = stream->sink->link;
-	struct link_encoder *link_encoder = link->link_enc;
-	struct stream_encoder *stream_encoder = stream->stream_enc;
-	struct dp_mst_stream_allocation_table table = {0};
-	struct fixed31_32 avg_time_slots_per_mtp = dal_fixed31_32_from_int(0);
-	uint8_t i;
-
-	/* deallocate_mst_payload is called before disable link. When mode or
-	 * disable/enable monitor, new stream is created which is not in link
-	 * stream[] yet. For this, payload is not allocated yet, so de-alloc
-	 * should not done. For new mode set, map_resources will get engine
-	 * for new stream, so stream_enc->id should be validated until here.
-	 */
-	if (link->enabled_stream_count == 0)
-		return DC_OK;
-
-	for (i = 0; i < link->enabled_stream_count; i++) {
-		if (link->enabled_streams[i] == stream)
-			break;
-	}
-	/* stream is not in link stream list */
-	if (i == link->enabled_stream_count)
-		return DC_OK;
-
-	/* slot X.Y */
-	dce110_stream_encoder_set_mst_bandwidth(
-		stream_encoder,
-		avg_time_slots_per_mtp);
-
-	/* TODO: which component is responsible for remove payload table? */
-	dc_helpers_dp_mst_write_payload_allocation_table(
-		stream->ctx,
-		&stream->public,
-		&table,
-		false);
-
-	dce110_link_encoder_update_mst_stream_allocation_table(
-		link_encoder,
-		&table);
-
-	dc_helpers_dp_mst_poll_for_allocation_change_trigger(
-			stream->ctx,
-			&stream->public);
-
-	dc_helpers_dp_mst_send_payload_allocation(
-			stream->ctx,
-			&stream->public,
-			false);
-
-	return DC_OK;
-}
-
 static enum dc_status apply_single_controller_ctx_to_hw(uint8_t controller_idx,
 		struct validate_context *context,
 		const struct dc *dc)
@@ -841,9 +787,8 @@ static enum dc_status apply_single_controller_ctx_to_hw(uint8_t controller_idx,
 	enum color_space color_space;
 
 	if (timing_changed) {
-
-		disable_stream(stream);
-		core_link_disable(stream);
+		core_link_disable_stream(
+				stream->sink->link, stream);
 
 		/*TODO: AUTO check if timing changed*/
 		if (false == dal_clock_source_program_pix_clk(
@@ -963,10 +908,7 @@ static void power_down_encoders(struct validate_context *context)
 		target = context->targets[i];
 		stream = DC_STREAM_TO_CORE(target->public.streams[0]);
 
-		if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
-			deallocate_mst_payload(stream);
-
-		core_link_disable(stream);
+		core_link_disable_stream(stream->sink->link, stream);
 	}
 }
 
@@ -1623,10 +1565,6 @@ static bool update_plane_address(
 static void reset_single_stream_hw_ctx(struct core_stream *stream,
 		struct validate_context *context)
 {
-	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
-		deallocate_mst_payload(stream);
-
-	disable_stream(stream);
 	if (stream->audio) {
 		dal_audio_disable_output(stream->audio,
 				stream->stream_enc->id,
@@ -1634,7 +1572,8 @@ static void reset_single_stream_hw_ctx(struct core_stream *stream,
 		stream->audio = NULL;
 	}
 
-	core_link_disable(stream);
+	core_link_disable_stream(stream->sink->link, stream);
+
 	dce110_timing_generator_blank_crtc(stream->tg);
 	dce110_timing_generator_disable_crtc(stream->tg);
 	dce110_mem_input_deallocate_dmif_buffer(stream->mi, context->target_count);
@@ -1798,6 +1737,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.enable_display_power_gating = dce110_enable_display_power_gating,
 	.program_bw = dce110_program_bw,
 	.enable_stream = enable_stream,
+	.disable_stream = disable_stream,
 	.update_mst_stream_allocation_table = dce110_link_encoder_update_mst_stream_allocation_table,
 	.set_mst_bandwidth = dce110_stream_encoder_set_mst_bandwidth
 };
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/core_types.h b/drivers/gpu/drm/amd/dal/dc/inc/core_types.h
index 299b13e..3781751 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/core_types.h
@@ -233,9 +233,6 @@ struct core_link {
 
 struct core_link *link_create(const struct link_init_data *init_params);
 void link_destroy(struct core_link **link);
-enum dc_status core_link_enable(struct core_stream *stream);
-
-void core_link_disable(struct core_stream *stream);
 
 enum dc_status dc_link_validate_mode_timing(
 		const struct core_sink *sink,
@@ -248,6 +245,10 @@ void core_link_enable_stream(
 		struct core_link *link,
 		struct core_stream *stream);
 
+void core_link_disable_stream(
+		struct core_link *link,
+		struct core_stream *stream);
+
 /********** DAL Core*********************/
 #include "display_clock_interface.h"
 
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
index 0502c4d..67cc020 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
@@ -157,6 +157,9 @@ struct hw_sequencer_funcs {
 	void (*enable_stream)(
 					struct core_stream *stream);
 
+	void (*disable_stream)(
+					struct core_stream *stream);
+
 	void (*update_mst_stream_allocation_table)(
 					struct link_encoder *enc,
 					const struct dp_mst_stream_allocation_table *table);
-- 
2.7.4