aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0534-drm-amd-display-Remove-check-update-type-function.patch
blob: f46b69f9002b80423e0765c2fde68e9d4638c28f (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
From 9f21c89449833397644835797422a2e351e23dcb Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Date: Tue, 20 Jun 2017 10:56:35 -0400
Subject: [PATCH 0534/4131] drm/amd/display: Remove check update type function.

Due to using dc_commit_surface_to_stream instead of build
stream and surface updates any surface commit today is
evlauted to full. Until we fix this and can corretly
evluate type of surface update, anything which is not page
flip or cursor update will be treted as full update chnage
and global lock will be aquired.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 80 +++-------------------
 1 file changed, 8 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index e88911f..5998830 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -2988,63 +2988,11 @@ static uint32_t remove_from_val_sets(
 	return set_count;
 }
 
-
-static enum surface_update_type  amdgpu_dm_check_surfaces_update_type(
-		struct dc *dc,
-		const struct dc_surface **new_surfaces,
-		uint8_t new_surface_count,
-		const struct dc_stream *dc_stream)
-{
-	struct dc_surface_update srf_updates[MAX_SURFACES];
-	struct dc_flip_addrs flip_addr[MAX_SURFACES];
-	struct dc_plane_info plane_info[MAX_SURFACES];
-	struct dc_scaling_info scaling_info[MAX_SURFACES];
-	int i;
-	const struct dc_stream_status *stream_status =
-			dc_stream_get_status(dc_stream);
-	enum surface_update_type update_type;
-
-	memset(srf_updates, 0, sizeof(srf_updates));
-	memset(flip_addr, 0, sizeof(flip_addr));
-	memset(plane_info, 0, sizeof(plane_info));
-	memset(scaling_info, 0, sizeof(scaling_info));
-
-	for (i = 0; i < new_surface_count; i++) {
-		srf_updates[i].surface = new_surfaces[i];
-		srf_updates[i].gamma =
-			(struct dc_gamma *)new_surfaces[i]->gamma_correction;
-		flip_addr[i].address = new_surfaces[i]->address;
-		flip_addr[i].flip_immediate = new_surfaces[i]->flip_immediate;
-		plane_info[i].color_space = new_surfaces[i]->color_space;
-		plane_info[i].format = new_surfaces[i]->format;
-		plane_info[i].plane_size = new_surfaces[i]->plane_size;
-		plane_info[i].rotation = new_surfaces[i]->rotation;
-		plane_info[i].horizontal_mirror = new_surfaces[i]->horizontal_mirror;
-		plane_info[i].stereo_format = new_surfaces[i]->stereo_format;
-		plane_info[i].tiling_info = new_surfaces[i]->tiling_info;
-		plane_info[i].visible = new_surfaces[i]->visible;
-		plane_info[i].dcc = new_surfaces[i]->dcc;
-		scaling_info[i].scaling_quality = new_surfaces[i]->scaling_quality;
-		scaling_info[i].src_rect = new_surfaces[i]->src_rect;
-		scaling_info[i].dst_rect = new_surfaces[i]->dst_rect;
-		scaling_info[i].clip_rect = new_surfaces[i]->clip_rect;
-
-		srf_updates[i].flip_addr = &flip_addr[i];
-		srf_updates[i].plane_info = &plane_info[i];
-		srf_updates[i].scaling_info = &scaling_info[i];
-	}
-
-	update_type = dc_check_update_surfaces_for_stream(
-			dc, srf_updates, new_surface_count, NULL, stream_status);
-
-	return update_type;
-}
-
 /*`
  * Grabs all modesetting locks to serialize against any blocking commits,
  * Waits for completion of all non blocking commits.
  */
-static void aquire_global_lock(
+static void do_aquire_global_lock(
 		struct drm_device *dev,
 		struct drm_atomic_state *state)
 {
@@ -3107,7 +3055,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	 * This bool will be set for true for any modeset/reset
 	 * or surface update which implies non fast surfae update.
 	 */
-	bool wait_for_prev_commits = false;
+	bool aquire_global_lock = false;
 
 	ret = drm_atomic_helper_check(dev, state);
 
@@ -3192,7 +3140,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 			new_stream_count++;
 			need_to_validate = true;
-			wait_for_prev_commits = true;
+			aquire_global_lock = true;
 
 		} else if (modereset_required(crtc_state)) {
 
@@ -3202,7 +3150,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 						set,
 						set_count,
 						acrtc->stream);
-				wait_for_prev_commits = true;
+				aquire_global_lock = true;
 			}
 		}
 
@@ -3261,7 +3209,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 		new_stream_count++;
 		need_to_validate = true;
-		wait_for_prev_commits = true;
+		aquire_global_lock = true;
 	}
 
 	for (i = 0; i < set_count; i++) {
@@ -3327,25 +3275,13 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 							surface);
 
 				need_to_validate = true;
+				aquire_global_lock = true;
 			}
 		}
 	}
 
 	context = dc_get_validate_context(dc, set, set_count);
 
-	for (i = 0; i < set_count; i++) {
-		for (j = 0; j < set[i].surface_count; j++) {
-			if (amdgpu_dm_check_surfaces_update_type(
-					dc,
-					set[i].surfaces,
-					set[i].surface_count,
-					set[i].stream) > UPDATE_TYPE_FAST) {
-				wait_for_prev_commits = true;
-				break;
-			}
-		}
-	}
-
 	if (need_to_validate == false || set_count == 0 || context) {
 
 		ret = 0;
@@ -3358,8 +3294,8 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		 * will wait for completion of any outstanding flip using DRMs
 		 * synchronization events.
 		 */
-		if (wait_for_prev_commits)
-			aquire_global_lock(dev, state);
+		if (aquire_global_lock)
+			do_aquire_global_lock(dev, state);
 
 	}
 
-- 
2.7.4