aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/1001-drm-amd-dal-set-timing_changed-flag-on-clk_src-chang.patch
blob: eececa7499dc06a4b94531d9c7a16a62d32f7ff1 (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
From c0f9ac327ed7caf044ce0b128fd571231f22e37c Mon Sep 17 00:00:00 2001
From: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Date: Fri, 1 Apr 2016 12:13:31 -0400
Subject: [PATCH 1001/1110] drm/amd/dal: set timing_changed flag on clk_src
 change

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc_resource.c      |  3 +++
 .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c    | 23 ++++++++++++----------
 .../gpu/drm/amd/dal/dc/dce112/dce112_resource.c    |  3 +++
 3 files changed, 19 insertions(+), 10 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 087670d..c2f16a9 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_resource.c
@@ -1282,6 +1282,9 @@ enum dc_status resource_map_clock_resources(
 						&context->res_ctx,
 						pipe_ctx->clock_source);
 
+				if (dc->current_context.res_ctx.pipe_ctx[k].clock_source
+					!= pipe_ctx->clock_source)
+					pipe_ctx->flags.timing_changed = true;
 				/* only one cs per stream regardless of mpo */
 				break;
 			}
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 c2adf6b..53da396 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
@@ -673,27 +673,30 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 		struct validate_context *context,
 		struct core_dc *dc)
 {
+	int i;
 	struct core_stream *stream = pipe_ctx->stream;
-	struct pipe_ctx *old_pipe_ctx =
-		&dc->current_context.res_ctx.pipe_ctx[pipe_ctx->pipe_idx];
 	bool timing_changed = context->res_ctx.pipe_ctx[pipe_ctx->pipe_idx]
 							.flags.timing_changed;
 	enum dc_color_space color_space;
 
+	struct pipe_ctx *pipe_ctx_old = NULL;
+
+	for (i = 0; i < MAX_PIPES; i++) {
+		if (dc->current_context.res_ctx.pipe_ctx[i].stream == pipe_ctx->stream)
+			pipe_ctx_old = &dc->current_context.res_ctx.pipe_ctx[i];
+	}
+
 	if (timing_changed) {
 		/* Must blank CRTC after disabling power gating and before any
 		 * programming, otherwise CRTC will be hung in bad state
 		 */
 		pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, true);
 
-		/*
-		 * only disable stream in case it was ever enabled
-		 */
-		if (old_pipe_ctx->stream) {
-			core_link_disable_stream(old_pipe_ctx);
-
-			ASSERT(old_pipe_ctx->clock_source);
-			resource_unreference_clock_source(&dc->current_context.res_ctx, old_pipe_ctx->clock_source);
+		if (pipe_ctx_old) {
+			core_link_disable_stream(pipe_ctx);
+			resource_unreference_clock_source(
+						&dc->current_context.res_ctx,
+						pipe_ctx_old->clock_source);
 		}
 
 		/*TODO: AUTO check if timing changed*/
diff --git a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c
index 7b3dee1..c1fb291 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c
@@ -1022,6 +1022,9 @@ static enum dc_status map_clock_resources(
 						&context->res_ctx,
 						pipe_ctx->clock_source);
 
+				if (pipe_ctx->clock_source
+					!= dc->current_context.res_ctx.pipe_ctx[k].clock_source)
+					pipe_ctx->flags.timing_changed = true;
 				/* only one cs per stream regardless of mpo */
 				break;
 			}
-- 
2.7.4