Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329444
b: refs/heads/master
c: 7758a11
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Vetter committed Sep 6, 2012
1 parent c8d3657 commit e3406a9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 87f1faa630b2045ccb6ab29f18c62279ddd7ef17
refs/heads/master: 7758a11340cc8845509303b0bee60401738da82e
75 changes: 47 additions & 28 deletions trunk/drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -6642,6 +6642,48 @@ static void intel_modeset_commit_output_state(struct drm_device *dev)
}
}

static struct drm_display_mode *
intel_modeset_adjusted_mode(struct drm_crtc *crtc,
struct drm_display_mode *mode)
{
struct drm_device *dev = crtc->dev;
struct drm_display_mode *adjusted_mode;
struct drm_encoder_helper_funcs *encoder_funcs;
struct intel_encoder *encoder;

adjusted_mode = drm_mode_duplicate(dev, mode);
if (!adjusted_mode)
return ERR_PTR(-ENOMEM);

/* Pass our mode to the connectors and the CRTC to give them a chance to
* adjust it according to limitations or connector properties, and also
* a chance to reject the mode entirely.
*/
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
base.head) {

if (&encoder->new_crtc->base != crtc)
continue;
encoder_funcs = encoder->base.helper_private;
if (!(encoder_funcs->mode_fixup(&encoder->base, mode,
adjusted_mode))) {
DRM_DEBUG_KMS("Encoder fixup failed\n");
goto fail;
}
}

if (!(intel_crtc_mode_fixup(crtc, mode, adjusted_mode))) {
DRM_DEBUG_KMS("CRTC fixup failed\n");
goto fail;
}
DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);

return adjusted_mode;
fail:
drm_mode_destroy(dev, adjusted_mode);
return ERR_PTR(-EINVAL);
}

bool intel_set_mode(struct drm_crtc *crtc,
struct drm_display_mode *mode,
int x, int y, struct drm_framebuffer *fb)
Expand All @@ -6661,44 +6703,21 @@ bool intel_set_mode(struct drm_crtc *crtc,
return true;
}

adjusted_mode = drm_mode_duplicate(dev, mode);
if (!adjusted_mode)
return false;

saved_hwmode = crtc->hwmode;
saved_mode = crtc->mode;

/* Update crtc values up front so the driver can rely on them for mode
* setting.
*/
crtc->mode = *mode;

/* Pass our mode to the connectors and the CRTC to give them a chance to
* adjust it according to limitations or connector properties, and also
* a chance to reject the mode entirely.
*/
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {

if (encoder->crtc != crtc)
continue;
encoder_funcs = encoder->helper_private;
if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
adjusted_mode))) {
DRM_DEBUG_KMS("Encoder fixup failed\n");
goto done;
}
}

if (!(ret = intel_crtc_mode_fixup(crtc, mode, adjusted_mode))) {
DRM_DEBUG_KMS("CRTC fixup failed\n");
goto done;
adjusted_mode = intel_modeset_adjusted_mode(crtc, mode);
if (IS_ERR(adjusted_mode)) {
return false;
}
DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);

intel_crtc_prepare_encoders(dev);

dev_priv->display.crtc_disable(crtc);

crtc->mode = *mode;

/* Set up the DPLL and any encoders state that needs to adjust or depend
* on the DPLL.
*/
Expand Down

0 comments on commit e3406a9

Please sign in to comment.