diff mbox series

[v2,6/7] drm/i915/psr: Add VRR send push interface for PSR usage

Message ID 20241101062728.3865980-7-jouni.hogander@intel.com (mailing list archive)
State New
Headers show
Series Use trans push mechanism to generate frame change event | expand

Commit Message

Hogander, Jouni Nov. 1, 2024, 6:27 a.m. UTC
Add own interface for PSR usage to perform push on frontbuffer tracking
invalidate and flush call backs. Use this new interface from PSR code.

v2:
  - use crtc->trans_push_enabled instead of rmw
  - intel_vrr_psr_send_push takes struct intel_crtc * and enum transcoder
    as a parameter

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c |  7 ++++++-
 drivers/gpu/drm/i915/display/intel_vrr.c | 20 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_vrr.h |  4 ++++
 3 files changed, 30 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 12ec1ea94b53..1fa632d708e7 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -2310,6 +2310,7 @@  static u32 man_trk_ctl_continuos_full_frame(struct intel_display *display)
 static void psr_force_exit(struct intel_dp *intel_dp)
 {
 	struct intel_display *display = to_intel_display(intel_dp);
+	struct intel_crtc *crtc = to_intel_crtc(intel_dp->attached_connector->base.state->crtc);
 	enum transcoder cpu_transcoder = intel_dp->psr.transcoder;
 
 	if (intel_dp->psr.psr2_sel_fetch_enabled)
@@ -2332,8 +2333,12 @@  static void psr_force_exit(struct intel_dp *intel_dp)
 	 * This workaround do not exist for platforms with display 10 or newer
 	 * but testing proved that it works for up display 13, for newer
 	 * than that testing will be needed.
+	 *
+	 * In Lunarlake we can use TRANS_PUSH mechanism to force sending update
+	 * to sink.
 	 */
-	intel_de_write(display, CURSURFLIVE(display, intel_dp->psr.pipe), 0);
+	DISPLAY_VER(display) >= 20 ? intel_vrr_psr_send_push(crtc, cpu_transcoder) :
+		intel_de_write(display, CURSURFLIVE(display, intel_dp->psr.pipe), 0);
 }
 
 void intel_psr2_program_trans_man_trk_ctl(const struct intel_crtc_state *crtc_state)
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 51cf1800ae87..a3fcdc5e9493 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -332,6 +332,26 @@  void intel_vrr_send_push(const struct intel_crtc_state *crtc_state)
 		       crtc->trans_push_enabled | TRANS_PUSH_SEND);
 }
 
+/**
+ * intel_vrr_psr_send_push - Send push interface for PSR code
+ * @crtc: Intel crtc
+ * @cpu_transcoder: cpu transcoder
+ *
+ * This is for PSR usage to perform push on frontbuffer tracking invalidate and
+ * flush call back. PSR mutex should be taken by caller.
+ */
+void
+intel_vrr_psr_send_push(struct intel_crtc *crtc, enum transcoder cpu_transcoder)
+{
+	struct intel_display *display = to_intel_display(crtc);
+
+	if (DISPLAY_VER(display) < 20)
+		return;
+
+	intel_de_write(display, TRANS_PUSH(display, cpu_transcoder),
+		       crtc->trans_push_enabled | TRANS_PUSH_SEND);
+}
+
 bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_display *display = to_intel_display(crtc_state);
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h
index b954a60e1aae..6095221843ca 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.h
+++ b/drivers/gpu/drm/i915/display/intel_vrr.h
@@ -11,7 +11,10 @@ 
 struct drm_connector_state;
 struct intel_atomic_state;
 struct intel_connector;
+struct intel_crtc;
 struct intel_crtc_state;
+struct intel_display;
+enum transcoder;
 
 bool intel_vrr_is_capable(struct intel_connector *connector);
 bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh);
@@ -27,6 +30,7 @@  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_psr_send_push(struct intel_crtc *crtc, enum transcoder cpu_transcoder);
 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);