Move everything possible from Panel Replay compute config into pre compute config. DSC compression check and ALPM computation can't be moved as information used for those is available only after we know link parameters.
Signed-off-by: Jouni Högander <[email protected]> --- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 +- drivers/gpu/drm/i915/display/intel_psr.c | 47 +++++++++++++++------ drivers/gpu/drm/i915/display/intel_psr.h | 3 +- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index e7782d41224a4..2f36d34ab6871 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -3676,7 +3676,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, if (intel_dp_hdisplay_bad(display, adjusted_mode->crtc_hdisplay)) return -EINVAL; - intel_psr_pre_compute_config(intel_dp, pipe_config); + intel_psr_pre_compute_config(intel_dp, pipe_config, conn_state); /* * Try to respect downstream TMDS clock limits first, if diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 24cc347f38ee1..a2675defaa3bf 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -640,7 +640,7 @@ static int mst_stream_compute_link_for_joined_pipes(struct intel_encoder *encode return -EINVAL; } - intel_psr_pre_compute_config(intel_dp, pipe_config); + intel_psr_pre_compute_config(intel_dp, pipe_config, conn_state); /* enable compression if the mode doesn't fit available BW */ if (dsc_needed) { diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 75614abac24bb..a61fa9d0ff82c 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -1820,7 +1820,34 @@ static bool _panel_replay_compute_config(struct intel_crtc_state *crtc_state, struct intel_connector *connector = to_intel_connector(conn_state->connector); struct intel_dp *intel_dp = intel_attached_dp(connector); + struct intel_display *display = to_intel_display(crtc_state); + + if (crtc_state->dsc.compression_enable && + connector->dp.panel_replay_caps.dsc_support == + INTEL_DP_PANEL_REPLAY_DSC_NOT_SUPPORTED) { + drm_dbg_kms(display->drm, + "Panel Replay not enabled because it's not supported with DSC\n"); + return false; + } + + if (!intel_dp_is_edp(intel_dp)) + return true; + + /* Remaining checks are for eDP only */ + + if (!alpm_config_valid(intel_dp, crtc_state, true, true, false)) + return false; + + return true; +} + +static bool _panel_replay_pre_compute_config(struct intel_dp *intel_dp, + struct intel_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ struct intel_display *display = to_intel_display(intel_dp); + struct intel_connector *connector = + to_intel_connector(conn_state->connector); struct intel_hdcp *hdcp = &connector->hdcp; if (!CAN_PANEL_REPLAY(intel_dp)) @@ -1840,14 +1867,6 @@ static bool _panel_replay_compute_config(struct intel_crtc_state *crtc_state, return false; } - if (crtc_state->dsc.compression_enable && - connector->dp.panel_replay_caps.dsc_support == - INTEL_DP_PANEL_REPLAY_DSC_NOT_SUPPORTED) { - drm_dbg_kms(display->drm, - "Panel Replay not enabled because it's not supported with DSC\n"); - return false; - } - crtc_state->link_off_after_as_sdp_when_pr_active = compute_link_off_after_as_sdp_when_pr_active(connector); crtc_state->disable_as_sdp_when_pr_active = compute_disable_as_sdp_when_pr_active(connector); @@ -1885,9 +1904,6 @@ static bool _panel_replay_compute_config(struct intel_crtc_state *crtc_state, return false; } - if (!alpm_config_valid(intel_dp, crtc_state, true, true, false)) - return false; - return true; } @@ -1928,7 +1944,8 @@ void intel_psr_set_non_psr_pipes(struct intel_dp *intel_dp, } void intel_psr_pre_compute_config(struct intel_dp *intel_dp, - struct intel_crtc_state *crtc_state) + struct intel_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct intel_display *display = to_intel_display(intel_dp); const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; @@ -1962,6 +1979,9 @@ void intel_psr_pre_compute_config(struct intel_dp *intel_dp, } crtc_state->has_psr = true; + crtc_state->has_panel_replay = + _panel_replay_pre_compute_config(intel_dp, crtc_state, + conn_state); } void intel_psr_compute_config(struct intel_dp *intel_dp, @@ -1976,7 +1996,8 @@ void intel_psr_compute_config(struct intel_dp *intel_dp, /* Only used for state verification. */ crtc_state->panel_replay_dsc_support = connector->dp.panel_replay_caps.dsc_support; - crtc_state->has_panel_replay = _panel_replay_compute_config(crtc_state, conn_state); + if (crtc_state->has_panel_replay) + crtc_state->has_panel_replay = _panel_replay_compute_config(crtc_state, conn_state); crtc_state->has_psr = crtc_state->has_panel_replay ? true : _psr_compute_config(intel_dp, crtc_state, conn_state); diff --git a/drivers/gpu/drm/i915/display/intel_psr.h b/drivers/gpu/drm/i915/display/intel_psr.h index 56af6bde68f86..e8171c8b4fb11 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.h +++ b/drivers/gpu/drm/i915/display/intel_psr.h @@ -48,7 +48,8 @@ void intel_psr_compute_config(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_state, struct drm_connector_state *conn_state); void intel_psr_pre_compute_config(struct intel_dp *intel_dp, - struct intel_crtc_state *crtc_state); + struct intel_crtc_state *crtc_state, + struct drm_connector_state *conn_state); void intel_psr_get_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config); void intel_psr_irq_handler(struct intel_dp *intel_dp, u32 psr_iir); -- 2.43.0
