aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0623-drm-amd-dal-Unblanking-logic-change-in-DM-DC.patch
blob: d05c9d44ceb24d953d4f2f09e05ea205e4ce8bfc (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
From 56f1ac8be4cdb4f124348e34d9838fc3df9b5ccf Mon Sep 17 00:00:00 2001
From: Jun Lei <Jun.Lei@amd.com>
Date: Tue, 15 Dec 2015 18:08:17 -0500
Subject: [PATCH 0623/1110] drm/amd/dal: Unblanking logic change in DM/DC

DC should unblank and blank displays in commit_surfaces based on *enabled*
surfaces rather than just surface count.

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Jordan Lazare <Jordan.Lazare@amd.com>
---
 .../gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c    |  2 +-
 drivers/gpu/drm/amd/dal/dc/core/dc_target.c        | 36 ++++++++++++++--------
 drivers/gpu/drm/amd/dal/dc/dc.h                    |  2 +-
 3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index 465d9bf..516d321 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -492,7 +492,7 @@ static void fill_plane_attributes_from_fb(
 	surface->plane_size.grph.surface_pitch =
 		fb->pitches[0] / (fb->bits_per_pixel / 8);
 
-	surface->enabled = true;
+	surface->visible = true;
 	surface->scaling_quality.h_taps_c = 2;
 	surface->scaling_quality.v_taps_c = 2;
 
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
index 9ae98c5..82cdae1 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
@@ -194,36 +194,46 @@ gamma_param_fail:
 
 bool dc_commit_surfaces_to_target(
 		struct dc *dc,
-		struct dc_surface *surfaces[],
-		uint8_t surface_count,
+		struct dc_surface *new_surfaces[],
+		uint8_t new_surface_count,
 		struct dc_target *dc_target)
 
 {
 	uint8_t i, j;
 	struct core_target *target = DC_TARGET_TO_CORE(dc_target);
-	bool need_blanking = (target->status.surface_count == 0);
+
+	bool current_enabled_surface_count = 0;
+	bool new_enabled_surface_count = 0;
+
+	for (i = 0; i < target->status.surface_count; i++)
+		if (target->status.surfaces[i]->visible)
+			current_enabled_surface_count++;
+
+	for (i = 0; i < new_surface_count; i++)
+		if (new_surfaces[i]->visible)
+			new_enabled_surface_count++;
 
 	dal_logger_write(dc->ctx->logger,
 				LOG_MAJOR_INTERFACE_TRACE,
 				LOG_MINOR_COMPONENT_DC,
 				"%s: commit %d surfaces to target 0x%x",
 				__func__,
-				surface_count,
+				new_surface_count,
 				dc_target);
 
 
 	if (!logical_attach_surfaces_to_target(
-						surfaces,
-						surface_count,
+						new_surfaces,
+						new_surface_count,
 						dc_target)) {
 		BREAK_TO_DEBUGGER();
 		goto unexpected_fail;
 	}
 
-	for (i = 0; i < surface_count; i++)
+	for (i = 0; i < new_surface_count; i++)
 		for (j = 0; j < target->public.stream_count; j++)
 			build_scaling_params(
-				surfaces[i],
+				new_surfaces[i],
 				DC_STREAM_TO_CORE(target->public.streams[j]));
 
 	if (dc->hwss.validate_bandwidth(dc, &dc->current_context) != DC_OK) {
@@ -233,11 +243,11 @@ bool dc_commit_surfaces_to_target(
 
 	dc->hwss.program_bw(dc, &dc->current_context);
 
-	if (need_blanking)
+	if (current_enabled_surface_count > 0 && new_enabled_surface_count == 0)
 		dc_target_disable_memory_requests(dc_target);
 
-	for (i = 0; i < surface_count; i++) {
-		struct dc_surface *surface = surfaces[i];
+	for (i = 0; i < new_surface_count; i++) {
+		struct dc_surface *surface = new_surfaces[i];
 		struct core_surface *core_surface = DC_SURFACE_TO_CORE(surface);
 
 		dal_logger_write(dc->ctx->logger,
@@ -258,13 +268,13 @@ bool dc_commit_surfaces_to_target(
 		dc->hwss.update_plane_address(core_surface, target);
 	}
 
-	if (surface_count > 0 && need_blanking)
+	if (current_enabled_surface_count == 0 && new_enabled_surface_count > 0)
 		dc_target_enable_memory_requests(dc_target);
 
 	return true;
 
 unexpected_fail:
-	for (i = 0; i < surface_count; i++) {
+	for (i = 0; i < new_surface_count; i++) {
 		target->status.surfaces[i] = NULL;
 	}
 	target->status.surface_count = 0;
diff --git a/drivers/gpu/drm/amd/dal/dc/dc.h b/drivers/gpu/drm/amd/dal/dc/dc.h
index bbeaf23..264b428 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc.h
@@ -58,7 +58,7 @@ void dc_destroy(struct dc **dc);
  ******************************************************************************/
 
 struct dc_surface {
-	bool enabled;
+	bool visible;
 	bool flip_immediate;
 	struct dc_plane_address address;
 
-- 
2.7.4