No functional changes at this point. Only using intel_crtc instead of intel_dp to let DRRS enable/disable functions more flexible to be moved around on a following patch. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_ddi.c | 4 ++-- drivers/gpu/drm/i915/intel_drrs.c | 34 +++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 972acef..92918cf 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_drrs_enable(intel_dp); + intel_drrs_enable(intel_crtc); } if (intel_crtc->config->has_audio) { @@ -2430,7 +2430,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) if (type == INTEL_OUTPUT_EDP) { struct intel_dp *intel_dp = enc_to_intel_dp(encoder); - intel_drrs_disable(intel_dp); + intel_drrs_disable(intel_crtc); intel_edp_backlight_off(intel_dp); } } diff --git a/drivers/gpu/drm/i915/intel_drrs.c b/drivers/gpu/drm/i915/intel_drrs.c index dce16ea..6287aee 100644 --- a/drivers/gpu/drm/i915/intel_drrs.c +++ b/drivers/gpu/drm/i915/intel_drrs.c @@ -162,17 +162,17 @@ static void intel_drrs_set_state(struct drm_device *dev, int refresh_rate) /** * intel_drrs_enable - init drrs struct if supported - * @intel_dp: DP struct + * @intel_crtc: Intel CRTC * * Initializes frontbuffer_bits and drrs.dp */ -void intel_drrs_enable(struct intel_dp *intel_dp) +void intel_drrs_enable(struct intel_crtc *intel_crtc) { - struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); - struct drm_device *dev = dig_port->base.base.dev; + struct drm_device *dev = intel_crtc->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; - struct drm_crtc *crtc = dig_port->base.base.crtc; - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct drm_crtc *crtc = &intel_crtc->base; + struct intel_encoder *intel_encoder; + struct intel_dp *intel_dp = NULL; if (!intel_crtc->config->has_drrs) { DRM_DEBUG_KMS("Panel doesn't support DRRS\n"); @@ -190,6 +190,16 @@ void intel_drrs_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->drrs.busy_frontbuffer_bits = 0; dev_priv->drrs.dp = intel_dp; @@ -200,17 +210,14 @@ unlock: /** * intel_edp_drrs_disable - Disable DRRS - * @intel_dp: DP struct + * @intel_crtc: Intel CRTC * */ -void intel_drrs_disable(struct intel_dp *intel_dp) +void intel_drrs_disable(struct intel_crtc *intel_crtc) { - struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); - struct drm_device *dev = dig_port->base.base.dev; + struct drm_device *dev = intel_crtc->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; - struct drm_crtc *crtc = dig_port->base.base.crtc; - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - struct intel_panel *panel = &intel_dp->attached_connector->panel; + struct intel_panel *panel; if (!intel_crtc->config->has_drrs) return; @@ -221,6 +228,7 @@ void intel_drrs_disable(struct intel_dp *intel_dp) return; } + panel = &dev_priv->drrs.dp->attached_connector->panel; if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) intel_drrs_set_state(dev_priv->dev, panel->fixed_mode->vrefresh); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 73406c3..48f461f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1210,8 +1210,8 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier); u32 skl_plane_ctl_rotation(unsigned int rotation); /* intel_drrs.c */ -void intel_drrs_enable(struct intel_dp *intel_dp); -void intel_drrs_disable(struct intel_dp *intel_dp); +void intel_drrs_enable(struct intel_crtc *intel_crtc); +void intel_drrs_disable(struct intel_crtc *intel_crtc); void intel_drrs_invalidate(struct drm_device *dev, unsigned frontbuffer_bits); void intel_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits); -- 2.4.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx