aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/0526-drm-amd-display-fix-issues-with-incorrectly-detectin.patch
blob: 631e6a251e52e9f6f91061c1b641e042e2002058 (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
From de8fe8fac857149f44890f203eebd413544913db Mon Sep 17 00:00:00 2001
From: Anthony Koo <Anthony.Koo@amd.com>
Date: Wed, 14 Jun 2017 10:19:57 -0400
Subject: [PATCH 0526/4131] drm/amd/display: fix issues with incorrectly
 detecting UPDATE_TYPE_FULL

This is due to how structures are being packed with padding added.
Structure field initialization doesn't clear the padding bytes, which cause
our memcmp to give incorrect result.

Move smaller structure parameters to end of structure.

Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c |  6 ++-
 drivers/gpu/drm/amd/display/dc/dc.h      | 75 +++++++++++++++++---------------
 2 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index f5f365b..a8f34a9 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -628,7 +628,8 @@ static bool is_validation_required(
 			return true;
 
 		for (j = 0; j < set[i].surface_count; j++) {
-			struct dc_surface temp_surf = { 0 };
+			struct dc_surface temp_surf;
+			memset(&temp_surf, 0, sizeof(temp_surf));
 
 			temp_surf = *context->stream_status[i].surfaces[j];
 			temp_surf.clip_rect = set[i].surfaces[j]->clip_rect;
@@ -1095,6 +1096,7 @@ static enum surface_update_type get_plane_info_update_type(
 		int surface_index)
 {
 	struct dc_plane_info temp_plane_info;
+	memset(&temp_plane_info, 0, sizeof(temp_plane_info));
 
 	if (!u->plane_info)
 		return UPDATE_TYPE_FAST;
@@ -1294,7 +1296,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 		update_surface_trace(dc, srf_updates, surface_count);
 
 	if (update_type >= UPDATE_TYPE_FULL) {
-		const struct dc_surface *new_surfaces[MAX_SURFACES] = { 0 };
+		const struct dc_surface *new_surfaces[MAX_SURFACES] = {0};
 
 		for (i = 0; i < surface_count; i++)
 			new_surfaces[i] = srf_updates[i].surface;
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 6d91839..36b3b12 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -54,8 +54,8 @@ struct dc_caps {
 
 
 struct dc_dcc_surface_param {
-	enum surface_pixel_format format;
 	struct dc_size surface_size;
+	enum surface_pixel_format format;
 	enum swizzle_mode_values swizzle_mode;
 	enum dc_scan_direction scan;
 };
@@ -67,9 +67,6 @@ struct dc_dcc_setting {
 };
 
 struct dc_surface_dcc_cap {
-	bool capable;
-	bool const_color_support;
-
 	union {
 		struct {
 			struct dc_dcc_setting rgb;
@@ -80,6 +77,9 @@ struct dc_surface_dcc_cap {
 			struct dc_dcc_setting chroma;
 		} video;
 	};
+
+	bool capable;
+	bool const_color_support;
 };
 
 struct dc_static_screen_events {
@@ -201,12 +201,12 @@ enum frame_buffer_mode {
 } ;
 
 struct dchub_init_data {
-	bool dchub_initialzied;
-	bool dchub_info_valid;
 	int64_t zfb_phys_addr_base;
 	int64_t zfb_mc_base_addr;
 	uint64_t zfb_size_in_byte;
 	enum frame_buffer_mode fb_mode;
+	bool dchub_initialzied;
+	bool dchub_info_valid;
 };
 
 struct dc_init_data {
@@ -240,9 +240,6 @@ enum {
 };
 
 struct dc_hdr_static_metadata {
-	bool hdr_supported;
-	bool is_hdr;
-
 	/* display chromaticities and white point in units of 0.00001 */
 	unsigned int chromaticity_green_x;
 	unsigned int chromaticity_green_y;
@@ -257,6 +254,9 @@ struct dc_hdr_static_metadata {
 	uint32_t max_luminance;
 	uint32_t maximum_content_light_level;
 	uint32_t maximum_frame_average_light_level;
+
+	bool hdr_supported;
+	bool is_hdr;
 };
 
 enum dc_transfer_func_type {
@@ -285,15 +285,12 @@ enum dc_transfer_func_predefined {
 };
 
 struct dc_transfer_func {
+	struct dc_transfer_func_distributed_points tf_pts;
 	enum dc_transfer_func_type type;
 	enum dc_transfer_func_predefined tf;
-	struct dc_transfer_func_distributed_points tf_pts;
 };
 
 struct dc_surface {
-	bool per_pixel_alpha;
-	bool visible;
-	bool flip_immediate;
 	struct dc_plane_address address;
 
 	struct scaling_taps scaling_quality;
@@ -303,38 +300,42 @@ struct dc_surface {
 
 	union plane_size plane_size;
 	union dc_tiling_info tiling_info;
+
 	struct dc_plane_dcc_param dcc;
-	enum dc_color_space color_space;
+	struct dc_hdr_static_metadata hdr_static_ctx;
+
+	const struct dc_gamma *gamma_correction;
+	const struct dc_transfer_func *in_transfer_func;
 
+	enum dc_color_space color_space;
 	enum surface_pixel_format format;
 	enum dc_rotation_angle rotation;
-	bool horizontal_mirror;
 	enum plane_stereo_format stereo_format;
 
-	struct dc_hdr_static_metadata hdr_static_ctx;
-
-	const struct dc_gamma *gamma_correction;
-	const struct dc_transfer_func *in_transfer_func;
+	bool per_pixel_alpha;
+	bool visible;
+	bool flip_immediate;
+	bool horizontal_mirror;
 };
 
 struct dc_plane_info {
-	bool per_pixel_alpha;
 	union plane_size plane_size;
 	union dc_tiling_info tiling_info;
 	struct dc_plane_dcc_param dcc;
 	enum surface_pixel_format format;
 	enum dc_rotation_angle rotation;
-	bool horizontal_mirror;
 	enum plane_stereo_format stereo_format;
 	enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
+	bool horizontal_mirror;
 	bool visible;
+	bool per_pixel_alpha;
 };
 
 struct dc_scaling_info {
-		struct rect src_rect;
-		struct rect dst_rect;
-		struct rect clip_rect;
-		struct scaling_taps scaling_quality;
+	struct rect src_rect;
+	struct rect dst_rect;
+	struct rect clip_rect;
+	struct scaling_taps scaling_quality;
 };
 
 struct dc_surface_update {
@@ -460,24 +461,26 @@ enum surface_update_type {
 struct dc_stream {
 	const struct dc_sink *sink;
 	struct dc_crtc_timing timing;
-	enum signal_type output_signal;
-
-	enum dc_color_space output_color_space;
-	enum dc_dither_option dither_option;
 
 	struct rect src; /* composition area */
 	struct rect dst; /* stream addressable area */
 
 	struct audio_info audio_info;
 
-	bool ignore_msa_timing_param;
-
 	struct freesync_context freesync_ctx;
 
 	const struct dc_transfer_func *out_transfer_func;
 	struct colorspace_transform gamut_remap_matrix;
 	struct csc_transform csc_color_matrix;
+
+	enum signal_type output_signal;
+
+	enum dc_color_space output_color_space;
+	enum dc_dither_option dither_option;
+
 	enum view_3d_format view_format;
+
+	bool ignore_msa_timing_param;
 	/* TODO: custom INFO packets */
 	/* TODO: ABM info (DMCU) */
 	/* TODO: PSR info */
@@ -667,9 +670,10 @@ struct dc_link {
 	union compliance_test_state compliance_test_state;
 
 	void *priv;
-	bool aux_mode;
 
 	struct ddc_service *ddc;
+
+	bool aux_mode;
 };
 
 struct dpcd_caps {
@@ -685,12 +689,13 @@ struct dpcd_caps {
 	indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
 	struct dc_dongle_caps dongle_caps;
 
-	bool allow_invalid_MSA_timing_param;
-	bool panel_mode_edp;
 	uint32_t sink_dev_id;
 	uint32_t branch_dev_id;
 	int8_t branch_dev_name[6];
 	int8_t branch_hw_revision;
+
+	bool allow_invalid_MSA_timing_param;
+	bool panel_mode_edp;
 };
 
 struct dc_link_status {
@@ -801,9 +806,9 @@ struct dc_sink {
 	struct dc_edid_caps edid_caps; /* parse display caps */
 	struct dc_container_id *dc_container_id;
 	uint32_t dongle_max_pix_clk;
-	bool converter_disable_audio;
 	void *priv;
 	struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
+	bool converter_disable_audio;
 };
 
 void dc_sink_retain(const struct dc_sink *sink);
-- 
2.7.4