From: "Jouni Högander" <jouni.hogander@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: animesh.manna@intel.com, mika.kahola@intel.com,
"Jouni Högander" <jouni.hogander@intel.com>
Subject: [PATCH 06/13] drm/i915/psr: Split enabling sink for PSR and Panel Replay
Date: Fri, 7 Jun 2024 16:49:10 +0300 [thread overview]
Message-ID: <20240607134917.1327574-7-jouni.hogander@intel.com> (raw)
In-Reply-To: <20240607134917.1327574-1-jouni.hogander@intel.com>
Current intel_psr_enable_sink is a mess due to partly reusing PSR bit
definitions for Panel Replay. Even thought PSR and Panel Replay enable
registers do have common bits they still have also different bits and same
bits with different meaning. For sake of clarity split enabling sink to PSR
and Panel Replay specific parts.
Also fix issue caused by using psr->panel_replay_enabled to early.
Fixes: 88ae6c65ecdb ("drm/i915/psr: Unify panel replay enable/disable sink")
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
---
drivers/gpu/drm/i915/display/intel_psr.c | 81 +++++++++++++-----------
1 file changed, 44 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 4a4124a92a0d..3cc38ba2f954 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -686,56 +686,62 @@ static bool psr2_su_region_et_valid(struct intel_dp *intel_dp)
return false;
}
-static unsigned int intel_psr_get_enable_sink_offset(struct intel_dp *intel_dp)
+static void _panel_replay_enable_sink(struct intel_dp *intel_dp,
+ const struct intel_crtc_state *crtc_state)
{
- return intel_dp->psr.panel_replay_enabled ?
- PANEL_REPLAY_CONFIG : DP_PSR_EN_CFG;
+ u8 val = DP_PANEL_REPLAY_ENABLE |
+ DP_PANEL_REPLAY_VSC_SDP_CRC_EN |
+ DP_PANEL_REPLAY_UNRECOVERABLE_ERROR_EN |
+ DP_PANEL_REPLAY_RFB_STORAGE_ERROR_EN |
+ DP_PANEL_REPLAY_ACTIVE_FRAME_CRC_ERROR_EN;
+
+ if (crtc_state->has_sel_update)
+ val |= DP_PANEL_REPLAY_SU_ENABLE;
+
+ if (crtc_state->enable_psr2_su_region_et)
+ val |= DP_PANEL_REPLAY_ENABLE_SU_REGION_ET;
+
+ drm_dp_dpcd_writeb(&intel_dp->aux, PANEL_REPLAY_CONFIG, val);
}
-/*
- * Note: Most of the bits are same in PANEL_REPLAY_CONFIG and DP_PSR_EN_CFG. We
- * are relying on PSR definitions on these "common" bits.
- */
-void intel_psr_enable_sink(struct intel_dp *intel_dp,
- const struct intel_crtc_state *crtc_state)
+static void _psr_enable_sink(struct intel_dp *intel_dp,
+ const struct intel_crtc_state *crtc_state)
{
- struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
- u8 dpcd_val = DP_PSR_ENABLE;
+ struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+ u8 val = DP_PSR_ENABLE;
if (crtc_state->has_sel_update) {
- /* Enable ALPM at sink for psr2 */
- if (!crtc_state->has_panel_replay) {
- drm_dp_dpcd_writeb(&intel_dp->aux,
- DP_RECEIVER_ALPM_CONFIG,
- DP_ALPM_ENABLE |
- DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE);
-
- if (crtc_state->enable_psr2_su_region_et)
- dpcd_val |= DP_PSR_ENABLE_SU_REGION_ET;
- }
-
- dpcd_val |= DP_PSR_ENABLE_PSR2 | DP_PSR_IRQ_HPD_WITH_CRC_ERRORS;
+ val |= DP_PSR_ENABLE_PSR2 | DP_PSR_IRQ_HPD_WITH_CRC_ERRORS;
} else {
if (intel_dp->psr.link_standby)
- dpcd_val |= DP_PSR_MAIN_LINK_ACTIVE;
+ val |= DP_PSR_MAIN_LINK_ACTIVE;
- if (!crtc_state->has_panel_replay && DISPLAY_VER(dev_priv) >= 8)
- dpcd_val |= DP_PSR_CRC_VERIFICATION;
+ if (DISPLAY_VER(i915) >= 8)
+ val |= DP_PSR_CRC_VERIFICATION;
}
- if (crtc_state->has_panel_replay)
- dpcd_val |= DP_PANEL_REPLAY_UNRECOVERABLE_ERROR_EN |
- DP_PANEL_REPLAY_RFB_STORAGE_ERROR_EN;
-
- if (crtc_state->req_psr2_sdp_prior_scanline)
- dpcd_val |= DP_PSR_SU_REGION_SCANLINE_CAPTURE;
+ if (crtc_state->enable_psr2_su_region_et)
+ val |= DP_PANEL_REPLAY_ENABLE_SU_REGION_ET;
if (intel_dp->psr.entry_setup_frames > 0)
- dpcd_val |= DP_PSR_FRAME_CAPTURE;
+ val |= DP_PSR_FRAME_CAPTURE;
- drm_dp_dpcd_writeb(&intel_dp->aux,
- intel_psr_get_enable_sink_offset(intel_dp),
- dpcd_val);
+ drm_dp_dpcd_writeb(&intel_dp->aux, DP_PSR_EN_CFG, val);
+}
+
+void intel_psr_enable_sink(struct intel_dp *intel_dp,
+ const struct intel_crtc_state *crtc_state)
+{
+ /* Enable ALPM at sink for psr2 */
+ if (!crtc_state->has_panel_replay && crtc_state->has_sel_update)
+ drm_dp_dpcd_writeb(&intel_dp->aux,
+ DP_RECEIVER_ALPM_CONFIG,
+ DP_ALPM_ENABLE |
+ DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE);
+
+ crtc_state->has_panel_replay ?
+ _panel_replay_enable_sink(intel_dp, crtc_state) :
+ _psr_enable_sink(intel_dp, crtc_state);
if (intel_dp_is_edp(intel_dp))
drm_dp_dpcd_writeb(&intel_dp->aux, DP_SET_POWER, DP_SET_POWER_D0);
@@ -1920,7 +1926,8 @@ static void intel_psr_disable_locked(struct intel_dp *intel_dp)
/* Disable PSR on Sink */
drm_dp_dpcd_writeb(&intel_dp->aux,
- intel_psr_get_enable_sink_offset(intel_dp), 0);
+ intel_dp->psr.panel_replay_enabled ?
+ PANEL_REPLAY_CONFIG : DP_PSR_EN_CFG, 0);
if (!intel_dp->psr.panel_replay_enabled &&
intel_dp->psr.sel_update_enabled)
--
2.34.1
next prev parent reply other threads:[~2024-06-07 13:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 13:49 [PATCH 00/13] Panel Replay eDP prepare Jouni Högander
2024-06-07 13:49 ` [PATCH 01/13] drm/i915/alpm: Do not use fast_wake_lines for aux less wake time Jouni Högander
2024-06-07 13:49 ` [PATCH 02/13] drm/i915/alpm: Write also AUX Less Wake lines into ALPM_CTL Jouni Högander
2024-06-07 13:49 ` [PATCH 03/13] drm/i915/display: Take panel replay into account in vsc sdp unpacking Jouni Högander
2024-06-07 13:49 ` [PATCH 04/13] drm/i915/display: Skip Panel Replay on pipe comparison if no active planes Jouni Högander
2024-06-07 13:49 ` [PATCH 05/13] drm/display: Add missing Panel Replay Enable SU Region ET bit Jouni Högander
2024-06-11 9:55 ` Maarten Lankhorst
2024-06-07 13:49 ` Jouni Högander [this message]
2024-06-07 13:49 ` [PATCH 07/13] drm/i915/alpm: Share alpm support checks with PSR code Jouni Högander
2024-06-07 13:49 ` [PATCH 08/13] drm/i915/psr: Add Panel Replay support to intel_psr2_config_et_valid Jouni Högander
2024-06-07 13:49 ` [PATCH 09/13] drm/i915/psr: Print Panel Replay status instead of frame lock status Jouni Högander
2024-06-07 13:49 ` [PATCH 10/13] drm/i915/psr: Move vblank length check to separate function Jouni Högander
2024-06-07 13:49 ` [PATCH 11/13] drm/i915/psr: Take into account SU SDP scanline indication in vblank check Jouni Högander
2024-06-07 13:49 ` [PATCH 12/13] drm/i915/psr: Check vblank against IO buffer wake time on Lunarlake Jouni Högander
2024-06-07 13:49 ` [PATCH 13/13] drm/i915/psr: Wake time is aux less wake time for Panel Replay Jouni Högander
2024-06-07 14:31 ` ✗ Fi.CI.CHECKPATCH: warning for Panel Replay eDP prepare Patchwork
2024-06-07 14:31 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-06-07 14:40 ` ✓ Fi.CI.BAT: success " Patchwork
2024-06-07 23:41 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-06-11 10:14 ` Hogander, Jouni
2024-06-10 9:30 ` [PATCH 00/13] " Manna, Animesh
2024-06-11 10:20 ` Hogander, Jouni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240607134917.1327574-7-jouni.hogander@intel.com \
--to=jouni.hogander@intel.com \
--cc=animesh.manna@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kahola@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox