This will give us the flexibility to move them to post atomic modeset functions. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_dp.c | 5 +++-- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_psr.c | 38 ++++++++++++++++++++++++-------------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 06d3002..b8f8dee 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -2404,7 +2404,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder) intel_dp_stop_link_train(intel_dp); intel_edp_backlight_on(intel_dp); - intel_psr_enable(intel_dp); + intel_psr_enable(intel_crtc); intel_edp_drrs_enable(intel_dp); } @@ -2432,7 +2432,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) struct intel_dp *intel_dp = enc_to_intel_dp(encoder); intel_edp_drrs_disable(intel_dp); - intel_psr_disable(intel_dp); + intel_psr_disable(intel_crtc); intel_edp_backlight_off(intel_dp); } } diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index e154a2e..92f59cc 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2374,7 +2374,7 @@ static void intel_disable_dp(struct intel_encoder *encoder) intel_audio_codec_disable(encoder); if (HAS_PSR(dev) && !HAS_DDI(dev)) - intel_psr_disable(intel_dp); + intel_psr_disable(crtc); /* Make sure the panel is off before trying to change the mode. But also * ensure that we have vdd while we switch off the panel. */ @@ -2629,9 +2629,10 @@ static void g4x_enable_dp(struct intel_encoder *encoder) static void vlv_enable_dp(struct intel_encoder *encoder) { struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); + struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); intel_edp_backlight_on(intel_dp); - intel_psr_enable(intel_dp); + intel_psr_enable(crtc); } static void g4x_pre_enable_dp(struct intel_encoder *encoder) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 06511d2..cafe4c1 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1399,8 +1399,8 @@ void intel_backlight_unregister(struct drm_device *dev); /* intel_psr.c */ bool intel_psr_ready(struct intel_dp *intel_dp, struct intel_crtc_state *pipe_config); -void intel_psr_enable(struct intel_dp *intel_dp); -void intel_psr_disable(struct intel_dp *intel_dp); +void intel_psr_enable(struct intel_crtc *intel_crtc); +void intel_psr_disable(struct intel_crtc *intel_crtc); void intel_psr_invalidate(struct drm_device *dev, unsigned frontbuffer_bits); void intel_psr_flush(struct drm_device *dev, diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c index e690db3..bcf2d9d 100644 --- a/drivers/gpu/drm/i915/intel_psr.c +++ b/drivers/gpu/drm/i915/intel_psr.c @@ -371,18 +371,19 @@ static void intel_psr_activate(struct intel_dp *intel_dp) /** * intel_psr_enable - Enable PSR - * @intel_dp: Intel DP + * @intel_crtc: Intel CRTC * * This function can only be called after the pipe is fully trained and enabled. */ -void intel_psr_enable(struct intel_dp *intel_dp) +void intel_psr_enable(struct intel_crtc *intel_crtc) { - struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); - struct drm_device *dev = intel_dig_port->base.base.dev; + struct drm_crtc *crtc = &intel_crtc->base; + struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; - struct intel_crtc *crtc = to_intel_crtc(intel_dig_port->base.base.crtc); + struct intel_encoder *intel_encoder; + struct intel_dp *intel_dp = NULL; - if (!crtc->config->psr_ready) + if (!intel_crtc->config->psr_ready) return; mutex_lock(&dev_priv->psr.lock); @@ -391,6 +392,16 @@ void intel_psr_enable(struct intel_dp *intel_dp) goto unlock; } + for_each_encoder_on_crtc(dev, crtc, intel_encoder) { + if (intel_encoder->type == INTEL_OUTPUT_EDP) + intel_dp = enc_to_intel_dp(&intel_encoder->base); + } + + if (!intel_dp) { + DRM_DEBUG_KMS("No eDP found\n"); + goto unlock; + } + dev_priv->psr.busy_frontbuffer_bits = 0; if (HAS_DDI(dev)) { @@ -398,8 +409,8 @@ void intel_psr_enable(struct intel_dp *intel_dp) if (dev_priv->psr.psr2_support) { /* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ - if (crtc->config->pipe_src_w > 3200 || - crtc->config->pipe_src_h > 2000) + if (intel_crtc->config->pipe_src_w > 3200 || + intel_crtc->config->pipe_src_h > 2000) dev_priv->psr.psr2_support = false; else skl_psr_setup_su_vsc(intel_dp); @@ -484,14 +495,13 @@ static void hsw_psr_disable(struct intel_dp *intel_dp) /** * intel_psr_disable - Disable PSR - * @intel_dp: Intel DP + * @intel_crtc: Intel CRTC * * This function needs to be called before disabling pipe. */ -void intel_psr_disable(struct intel_dp *intel_dp) +void intel_psr_disable(struct intel_crtc *intel_crtc) { - struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); - struct drm_device *dev = intel_dig_port->base.base.dev; + struct drm_device *dev = intel_crtc->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; mutex_lock(&dev_priv->psr.lock); @@ -501,9 +511,9 @@ void intel_psr_disable(struct intel_dp *intel_dp) } if (HAS_DDI(dev)) - hsw_psr_disable(intel_dp); + hsw_psr_disable(dev_priv->psr.enabled); else - vlv_psr_disable(intel_dp); + vlv_psr_disable(dev_priv->psr.enabled); dev_priv->psr.enabled = NULL; mutex_unlock(&dev_priv->psr.lock); -- 2.4.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx