aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-03-19 00:33:03 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-03-23 11:22:30 -0400
commit5a27528ade3f5714e565db3c0dd35b6b3f7c1f31 (patch)
tree9ad90bd7c5a494bfa05e6c71707383859381364b
parent54270952e9a83aebf31d16ded28e6757fdf8c88b (diff)
drm: crtc_helper: Update hwmode before mode_set call
Just as we provide crtc->mode pre-populated with the requested mode, move adjusted_mode into hwmode before we call the crtc's mode_set, making sure to restore it on failure. Allows drivers which thoughtlessly discard adjusted_mode in their mode_set hooks (e.g. Exynos) to use hwmode directly, and also provides some neat symmetry with crtc->mode. Signed-off-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3053aab968f9..dd895c409ca3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -270,7 +270,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
270 struct drm_framebuffer *old_fb) 270 struct drm_framebuffer *old_fb)
271{ 271{
272 struct drm_device *dev = crtc->dev; 272 struct drm_device *dev = crtc->dev;
273 struct drm_display_mode *adjusted_mode, saved_mode; 273 struct drm_display_mode *adjusted_mode, saved_mode, saved_hwmode;
274 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 274 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
275 struct drm_encoder_helper_funcs *encoder_funcs; 275 struct drm_encoder_helper_funcs *encoder_funcs;
276 int saved_x, saved_y; 276 int saved_x, saved_y;
@@ -292,6 +292,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
292 } 292 }
293 293
294 saved_mode = crtc->mode; 294 saved_mode = crtc->mode;
295 saved_hwmode = crtc->hwmode;
295 saved_x = crtc->x; 296 saved_x = crtc->x;
296 saved_y = crtc->y; 297 saved_y = crtc->y;
297 298
@@ -334,6 +335,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
334 } 335 }
335 DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id); 336 DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
336 337
338 crtc->hwmode = *adjusted_mode;
339
337 /* Prepare the encoders and CRTCs before setting the mode. */ 340 /* Prepare the encoders and CRTCs before setting the mode. */
338 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 341 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
339 342
@@ -396,9 +399,6 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
396 encoder->bridge->funcs->enable(encoder->bridge); 399 encoder->bridge->funcs->enable(encoder->bridge);
397 } 400 }
398 401
399 /* Store real post-adjustment hardware mode. */
400 crtc->hwmode = *adjusted_mode;
401
402 /* Calculate and store various constants which 402 /* Calculate and store various constants which
403 * are later needed by vblank and swap-completion 403 * are later needed by vblank and swap-completion
404 * timestamping. They are derived from true hwmode. 404 * timestamping. They are derived from true hwmode.
@@ -411,6 +411,7 @@ done:
411 if (!ret) { 411 if (!ret) {
412 crtc->enabled = saved_enabled; 412 crtc->enabled = saved_enabled;
413 crtc->mode = saved_mode; 413 crtc->mode = saved_mode;
414 crtc->hwmode = saved_hwmode;
414 crtc->x = saved_x; 415 crtc->x = saved_x;
415 crtc->y = saved_y; 416 crtc->y = saved_y;
416 } 417 }