In Lunarlake and onwards it is possible to generate "PSR frame change" event using TRANS_PUSH mechanism. Implement function to enable this and take PSR into account in intel_vrr_send_push. v2: use intel_vrr_trans_push_enabled_set_clear instead of rmw Signed-off-by: Jouni Högander <jouni.hogander@xxxxxxxxx> --- drivers/gpu/drm/i915/display/intel_psr.c | 6 ++++ drivers/gpu/drm/i915/display/intel_vrr.c | 37 ++++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_vrr.h | 2 ++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 880ea845207f..a82d75f97c55 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -44,6 +44,7 @@ #include "intel_psr.h" #include "intel_psr_regs.h" #include "intel_snps_phy.h" +#include "intel_vrr.h" #include "skl_universal_plane.h" /** @@ -1934,6 +1935,9 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp, intel_de_rmw(display, CLKGATE_DIS_MISC, 0, CLKGATE_DIS_MISC_DMASC_GATING_DIS); } + + if (DISPLAY_VER(dev_priv) >= 20) + intel_vrr_psr_frame_change_enable(crtc_state); } static bool psr_interrupt_error_check(struct intel_dp *intel_dp) @@ -2170,6 +2174,8 @@ void intel_psr_disable(struct intel_dp *intel_dp, mutex_lock(&intel_dp->psr.lock); + if (DISPLAY_VER(display) >= 20) + intel_vrr_psr_frame_change_disable(old_crtc_state); intel_psr_disable_locked(intel_dp); mutex_unlock(&intel_dp->psr.lock); diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index 328cc0a741bf..51cf1800ae87 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -324,7 +324,8 @@ void intel_vrr_send_push(const struct intel_crtc_state *crtc_state) struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; - if (!crtc_state->vrr.enable) + if (!crtc_state->vrr.enable && (DISPLAY_VER(display) < 20 || + !crtc_state->has_psr)) return; intel_de_write(display, TRANS_PUSH(display, cpu_transcoder), @@ -336,7 +337,8 @@ bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state) struct intel_display *display = to_intel_display(crtc_state); enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; - if (!crtc_state->vrr.enable) + if (!crtc_state->vrr.enable && (DISPLAY_VER(display) < 20 || + !crtc_state->has_psr)) return false; return intel_de_read(display, TRANS_PUSH(display, cpu_transcoder)) & TRANS_PUSH_SEND; @@ -381,6 +383,37 @@ void intel_vrr_enable(const struct intel_crtc_state *crtc_state) } } +/** + * intel_vrr_psr_frame_change_enable - Enable PSR frame change mechanism + * @crtc_state: Intel crtc state + * + * This function is for PSR to enable PSR frame change mechanism which is more + * controlled way to generate frame change event. + */ +void intel_vrr_psr_frame_change_enable(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; + + intel_vrr_trans_push_enabled_set_clear(crtc, cpu_transcoder, 0, + LNL_TRANS_PUSH_PSR_PR_EN); +} + +/** + * intel_vrr_psr_frame_change_disable - Disable PSR frame change mechanism + * @crtc_state: Intel crtc state + * + * This function is for PSR to disable PSR frame change mechanism. + */ +void intel_vrr_psr_frame_change_disable(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; + + intel_vrr_trans_push_enabled_set_clear(crtc, cpu_transcoder, + LNL_TRANS_PUSH_PSR_PR_EN, 0); +} + void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state) { struct intel_display *display = to_intel_display(old_crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h index b3b45c675020..b954a60e1aae 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.h +++ b/drivers/gpu/drm/i915/display/intel_vrr.h @@ -25,6 +25,8 @@ void intel_vrr_enable(const struct intel_crtc_state *crtc_state); void intel_vrr_send_push(const struct intel_crtc_state *crtc_state); bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state); void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state); +void intel_vrr_psr_frame_change_enable(const struct intel_crtc_state *crtc_state); +void intel_vrr_psr_frame_change_disable(const struct intel_crtc_state *crtc_state); void intel_vrr_get_config(struct intel_crtc_state *crtc_state); int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state); int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state); -- 2.34.1