diff options
author | Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com> | 2017-04-21 09:34:09 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-09-26 18:06:35 -0400 |
commit | beb16b6a0f921f66472e4946a4955f07942fa9d8 (patch) | |
tree | d1d1a6c02a70b3351f447b8e189674bb55af7482 /drivers/gpu/drm | |
parent | 03f5c686c3900f74853539cdebe4c25190106402 (diff) |
drm/amd/display: improve cursor programming reliability
This change will cache cursor attributes and reprogram them
when enabling cursor after power gating if the attributes were not
yet reprogrammed
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
7 files changed, 32 insertions, 41 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c index 3dbd6c0885d8..23627b14c16c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c | |||
@@ -182,7 +182,6 @@ bool dc_stream_set_cursor_attributes( | |||
182 | struct core_stream *stream; | 182 | struct core_stream *stream; |
183 | struct core_dc *core_dc; | 183 | struct core_dc *core_dc; |
184 | struct resource_context *res_ctx; | 184 | struct resource_context *res_ctx; |
185 | bool ret = false; | ||
186 | 185 | ||
187 | if (NULL == dc_stream) { | 186 | if (NULL == dc_stream) { |
188 | dm_error("DC: dc_stream is NULL!\n"); | 187 | dm_error("DC: dc_stream is NULL!\n"); |
@@ -200,28 +199,26 @@ bool dc_stream_set_cursor_attributes( | |||
200 | for (i = 0; i < MAX_PIPES; i++) { | 199 | for (i = 0; i < MAX_PIPES; i++) { |
201 | struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; | 200 | struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; |
202 | 201 | ||
203 | if ((pipe_ctx->stream == stream) && | 202 | if (pipe_ctx->stream != stream || !pipe_ctx->ipp) |
204 | (pipe_ctx->ipp != NULL)) { | 203 | continue; |
205 | struct input_pixel_processor *ipp = pipe_ctx->ipp; | 204 | if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface) |
205 | continue; | ||
206 | 206 | ||
207 | if (ipp->funcs->ipp_cursor_set_attributes( | 207 | pipe_ctx->ipp->funcs->ipp_cursor_set_attributes( |
208 | ipp, attributes)) | 208 | pipe_ctx->ipp, attributes); |
209 | ret = true; | ||
210 | } | ||
211 | } | 209 | } |
212 | 210 | ||
213 | return ret; | 211 | return true; |
214 | } | 212 | } |
215 | 213 | ||
216 | bool dc_stream_set_cursor_position( | 214 | bool dc_stream_set_cursor_position( |
217 | const struct dc_stream *dc_stream, | 215 | const struct dc_stream *dc_stream, |
218 | struct dc_cursor_position *position) | 216 | const struct dc_cursor_position *position) |
219 | { | 217 | { |
220 | int i; | 218 | int i; |
221 | struct core_stream *stream; | 219 | struct core_stream *stream; |
222 | struct core_dc *core_dc; | 220 | struct core_dc *core_dc; |
223 | struct resource_context *res_ctx; | 221 | struct resource_context *res_ctx; |
224 | bool ret = false; | ||
225 | 222 | ||
226 | if (NULL == dc_stream) { | 223 | if (NULL == dc_stream) { |
227 | dm_error("DC: dc_stream is NULL!\n"); | 224 | dm_error("DC: dc_stream is NULL!\n"); |
@@ -239,27 +236,27 @@ bool dc_stream_set_cursor_position( | |||
239 | 236 | ||
240 | for (i = 0; i < MAX_PIPES; i++) { | 237 | for (i = 0; i < MAX_PIPES; i++) { |
241 | struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; | 238 | struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; |
239 | struct input_pixel_processor *ipp = pipe_ctx->ipp; | ||
240 | struct dc_cursor_position pos_cpy = *position; | ||
241 | struct dc_cursor_mi_param param = { | ||
242 | .pixel_clk_khz = dc_stream->timing.pix_clk_khz, | ||
243 | .ref_clk_khz = res_ctx->pool->ref_clock_inKhz, | ||
244 | .viewport_x_start = pipe_ctx->scl_data.viewport.x, | ||
245 | .viewport_width = pipe_ctx->scl_data.viewport.width, | ||
246 | .h_scale_ratio = pipe_ctx->scl_data.ratios.horz | ||
247 | }; | ||
248 | |||
249 | if (pipe_ctx->stream != stream || | ||
250 | !pipe_ctx->ipp || !pipe_ctx->surface) | ||
251 | continue; | ||
242 | 252 | ||
243 | if (pipe_ctx->stream == stream && | 253 | if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface) |
244 | pipe_ctx->ipp && pipe_ctx->surface) { | 254 | pos_cpy.enable = false; |
245 | struct input_pixel_processor *ipp = pipe_ctx->ipp; | 255 | |
246 | struct dc_cursor_mi_param param = { | 256 | ipp->funcs->ipp_cursor_set_position(ipp, &pos_cpy, ¶m); |
247 | .pixel_clk_khz = dc_stream->timing.pix_clk_khz, | ||
248 | .ref_clk_khz = res_ctx->pool->ref_clock_inKhz, | ||
249 | .viewport_x_start = pipe_ctx->scl_data.viewport.x, | ||
250 | .viewport_width = pipe_ctx->scl_data.viewport.width, | ||
251 | .h_scale_ratio = pipe_ctx->scl_data.ratios.horz, | ||
252 | }; | ||
253 | |||
254 | if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface) | ||
255 | position->enable = false; | ||
256 | |||
257 | ipp->funcs->ipp_cursor_set_position(ipp, position, ¶m); | ||
258 | ret = true; | ||
259 | } | ||
260 | } | 257 | } |
261 | 258 | ||
262 | return ret; | 259 | return true; |
263 | } | 260 | } |
264 | 261 | ||
265 | uint32_t dc_stream_get_vblank_counter(const struct dc_stream *dc_stream) | 262 | uint32_t dc_stream_get_vblank_counter(const struct dc_stream *dc_stream) |
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index d35fa01024f8..5629e3ca6336 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h | |||
@@ -764,7 +764,7 @@ bool dc_stream_set_cursor_attributes( | |||
764 | 764 | ||
765 | bool dc_stream_set_cursor_position( | 765 | bool dc_stream_set_cursor_position( |
766 | const struct dc_stream *stream, | 766 | const struct dc_stream *stream, |
767 | struct dc_cursor_position *position); | 767 | const struct dc_cursor_position *position); |
768 | 768 | ||
769 | /* Newer interfaces */ | 769 | /* Newer interfaces */ |
770 | struct dc_cursor { | 770 | struct dc_cursor { |
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h b/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h index a374ef2c9d0b..434fe2f5a9d7 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h | |||
@@ -54,7 +54,7 @@ void dce110_ipp_cursor_set_position( | |||
54 | const struct dc_cursor_position *position, | 54 | const struct dc_cursor_position *position, |
55 | const struct dc_cursor_mi_param *param); | 55 | const struct dc_cursor_mi_param *param); |
56 | 56 | ||
57 | bool dce110_ipp_cursor_set_attributes( | 57 | void dce110_ipp_cursor_set_attributes( |
58 | struct input_pixel_processor *ipp, | 58 | struct input_pixel_processor *ipp, |
59 | const struct dc_cursor_attributes *attributes); | 59 | const struct dc_cursor_attributes *attributes); |
60 | 60 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c index 5b230b17fc5c..f712916563b9 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c | |||
@@ -95,7 +95,7 @@ void dce110_ipp_cursor_set_position( | |||
95 | lock(ipp110, false); | 95 | lock(ipp110, false); |
96 | } | 96 | } |
97 | 97 | ||
98 | bool dce110_ipp_cursor_set_attributes( | 98 | void dce110_ipp_cursor_set_attributes( |
99 | struct input_pixel_processor *ipp, | 99 | struct input_pixel_processor *ipp, |
100 | const struct dc_cursor_attributes *attributes) | 100 | const struct dc_cursor_attributes *attributes) |
101 | { | 101 | { |
@@ -122,8 +122,6 @@ bool dce110_ipp_cursor_set_attributes( | |||
122 | 122 | ||
123 | /* Unlock Cursor registers. */ | 123 | /* Unlock Cursor registers. */ |
124 | lock(ipp110, false); | 124 | lock(ipp110, false); |
125 | |||
126 | return true; | ||
127 | } | 125 | } |
128 | 126 | ||
129 | static void enable( | 127 | static void enable( |
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h b/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h index 4b326bcb4600..7f645fde7064 100644 --- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h +++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h | |||
@@ -42,7 +42,7 @@ void dce120_ipp_cursor_set_position( | |||
42 | const struct dc_cursor_position *position, | 42 | const struct dc_cursor_position *position, |
43 | const struct dc_cursor_mi_param *param); | 43 | const struct dc_cursor_mi_param *param); |
44 | 44 | ||
45 | bool dce120_ipp_cursor_set_attributes( | 45 | void dce120_ipp_cursor_set_attributes( |
46 | struct input_pixel_processor *ipp, | 46 | struct input_pixel_processor *ipp, |
47 | const struct dc_cursor_attributes *attributes); | 47 | const struct dc_cursor_attributes *attributes); |
48 | 48 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c index 15671fd2cb9c..dc81d320f6e5 100644 --- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c +++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c | |||
@@ -160,7 +160,7 @@ void dce120_ipp_cursor_set_position( | |||
160 | lock(ipp110, false); | 160 | lock(ipp110, false); |
161 | } | 161 | } |
162 | 162 | ||
163 | bool dce120_ipp_cursor_set_attributes( | 163 | void dce120_ipp_cursor_set_attributes( |
164 | struct input_pixel_processor *ipp, | 164 | struct input_pixel_processor *ipp, |
165 | const struct dc_cursor_attributes *attributes) | 165 | const struct dc_cursor_attributes *attributes) |
166 | { | 166 | { |
@@ -189,7 +189,5 @@ bool dce120_ipp_cursor_set_attributes( | |||
189 | 189 | ||
190 | /* Unlock Cursor registers. */ | 190 | /* Unlock Cursor registers. */ |
191 | lock(ipp110, false); | 191 | lock(ipp110, false); |
192 | |||
193 | return true; | ||
194 | } | 192 | } |
195 | 193 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h b/drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h index 0457bc7a44d4..7928e230eefb 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h | |||
@@ -37,8 +37,6 @@ struct input_pixel_processor { | |||
37 | struct dc_context *ctx; | 37 | struct dc_context *ctx; |
38 | unsigned int inst; | 38 | unsigned int inst; |
39 | const struct ipp_funcs *funcs; | 39 | const struct ipp_funcs *funcs; |
40 | |||
41 | unsigned int cusor_width; | ||
42 | }; | 40 | }; |
43 | 41 | ||
44 | enum ipp_prescale_mode { | 42 | enum ipp_prescale_mode { |
@@ -88,7 +86,7 @@ struct ipp_funcs { | |||
88 | const struct dc_cursor_position *position, | 86 | const struct dc_cursor_position *position, |
89 | const struct dc_cursor_mi_param *param); | 87 | const struct dc_cursor_mi_param *param); |
90 | 88 | ||
91 | bool (*ipp_cursor_set_attributes)( | 89 | void (*ipp_cursor_set_attributes)( |
92 | struct input_pixel_processor *ipp, | 90 | struct input_pixel_processor *ipp, |
93 | const struct dc_cursor_attributes *attributes); | 91 | const struct dc_cursor_attributes *attributes); |
94 | 92 | ||