aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-30 02:59:56 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-06 01:53:37 -0400
commit5ab432ef4997ce32c9406721b37ef6e97e57dae1 (patch)
treed10c2de94fd561befbccc99f77025e430301b1f8 /drivers/gpu/drm/i915/intel_display.c
parentef9c3aee60442d1eaf81fbd7b63f256410cc0aa9 (diff)
drm/i915/hdmi: convert to encoder->disable/enable
I've picked hdmi as the first encoder to convert because it's rather simple: - no cloning possible - no differences between prepare/commit and dpms off/on switching. A few changes are required to do so: - Split up the dpms code into an enable/disable function and wire it up with the intel encoder. - Noop out the existing encoder prepare/commit functions used by the crtc helper - our crtc enable/disable code now calls back into the encoder enable/disable code at the right spot. - Create new helper functions to handle dpms changes. - Add intel_encoder->connectors_active to better track dpms state. Atm this is unused, but it will be useful to correctly disable the entire display pipe for cloned configurations. Also note that for now this is only useful in the dpms code - thanks to the crtc helper's dpms confusion across a modeset operation we can't (yet) rely on this having a sensible value in all circumstances. - Rip out the encoder helper dpms callback, if this is still getting called somewhere we have a bug. The slight issue with that is that the crtc helper abuses dpms off to disable unused functions. Hence we also need to implement a default encoder disable function to do just that with the new encoder->disable callback. - Note that we drop the cpt modeset verification in the commit callback, too. The right place to do this would be in the crtc's enable function, _after_ all the encoders are set up. But because not all encoders are converted yet, we can't do that. Hence disable this check temporarily as a minor concession to bisectability. v2: Squash the dpms mode to only the supported values - connector->dpms is for internal tracking only, we can hence avoid needless state-changes a bit whithout causing harm. v3: Apply bikeshed to disable|enable_ddi, suggested by Paulo Zanoni. Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 82aaded6713b..cbd356f43d35 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3554,6 +3554,17 @@ void intel_encoder_commit(struct drm_encoder *encoder)
3554 intel_cpt_verify_modeset(dev, intel_crtc->pipe); 3554 intel_cpt_verify_modeset(dev, intel_crtc->pipe);
3555} 3555}
3556 3556
3557void intel_encoder_noop(struct drm_encoder *encoder)
3558{
3559}
3560
3561void intel_encoder_disable(struct drm_encoder *encoder)
3562{
3563 struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
3564
3565 intel_encoder->disable(intel_encoder);
3566}
3567
3557void intel_encoder_destroy(struct drm_encoder *encoder) 3568void intel_encoder_destroy(struct drm_encoder *encoder)
3558{ 3569{
3559 struct intel_encoder *intel_encoder = to_intel_encoder(encoder); 3570 struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
@@ -3562,6 +3573,44 @@ void intel_encoder_destroy(struct drm_encoder *encoder)
3562 kfree(intel_encoder); 3573 kfree(intel_encoder);
3563} 3574}
3564 3575
3576/* Simple dpms helper for encodres with just one connector, no cloning and only
3577 * one kind of off state. It clamps all !ON modes to fully OFF and changes the
3578 * state of the entire output pipe. */
3579void intel_encoder_dpms(struct intel_encoder *encoder, int mode)
3580{
3581 if (mode == DRM_MODE_DPMS_ON) {
3582 encoder->connectors_active = true;
3583
3584 intel_crtc_dpms(encoder->base.crtc, DRM_MODE_DPMS_ON);
3585 } else {
3586 encoder->connectors_active = false;
3587
3588 intel_crtc_dpms(encoder->base.crtc, DRM_MODE_DPMS_OFF);
3589 }
3590}
3591
3592/* Even simpler default implementation, if there's really no special case to
3593 * consider. */
3594void intel_connector_dpms(struct drm_connector *connector, int mode)
3595{
3596 struct intel_encoder *encoder = intel_attached_encoder(connector);
3597
3598 /* All the simple cases only support two dpms states. */
3599 if (mode != DRM_MODE_DPMS_ON)
3600 mode = DRM_MODE_DPMS_OFF;
3601
3602 if (mode == connector->dpms)
3603 return;
3604
3605 connector->dpms = mode;
3606
3607 /* Only need to change hw state when actually enabled */
3608 if (encoder->base.crtc)
3609 intel_encoder_dpms(encoder, mode);
3610 else
3611 encoder->connectors_active = false;
3612}
3613
3565static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, 3614static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
3566 const struct drm_display_mode *mode, 3615 const struct drm_display_mode *mode,
3567 struct drm_display_mode *adjusted_mode) 3616 struct drm_display_mode *adjusted_mode)