[PATCH v5 5/6] display/psr: Add latency for PSR
Mitul Golani
mitulkumar.ajitkumar.golani at intel.com
Wed Oct 16 09:07:53 UTC 2024
Count and add latency accounter for PSR enablement.
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
---
drivers/gpu/drm/i915/display/intel_psr.c | 27 ++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_psr.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 3b20325b3f6a..d9938d164dbf 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -960,6 +960,33 @@ static int psr2_block_count(struct intel_dp *intel_dp)
return psr2_block_count_lines(intel_dp) / 4;
}
+int calc_psr_latency(struct intel_crtc_state *crtc_state)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+ int linetime, io_wake_time;
+ struct intel_dp *intel_dp;
+ struct intel_encoder *encoder;
+
+ if (!crtc_state->has_psr)
+ return 0;
+
+ for_each_intel_encoder_mask_with_psr(display->drm, encoder,
+ crtc_state->uapi.encoder_mask) {
+ intel_dp = enc_to_intel_dp(encoder);
+ break;
+ }
+
+ /* TODO:
+ * Implement calculation for PSR and Panle replay latency, As it could
+ * be possible that PSR or panel replay can also be enabled.
+ */
+ linetime = DIV_ROUND_UP(crtc_state->hw.adjusted_mode.htotal * 1000,
+ intel_crtc_dotclock(crtc_state));
+ io_wake_time = psr2_block_count_lines(intel_dp) * linetime;
+
+ return intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode, io_wake_time);
+}
+
static u8 frames_before_su_entry(struct intel_dp *intel_dp)
{
u8 frames_before_su_entry;
diff --git a/drivers/gpu/drm/i915/display/intel_psr.h b/drivers/gpu/drm/i915/display/intel_psr.h
index 5f26f61f82aa..756aef4b4233 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.h
+++ b/drivers/gpu/drm/i915/display/intel_psr.h
@@ -24,6 +24,7 @@ struct intel_plane_state;
#define CAN_PANEL_REPLAY(intel_dp) ((intel_dp)->psr.sink_panel_replay_support && \
(intel_dp)->psr.source_panel_replay_support)
+int calc_psr_latency(struct intel_crtc_state *crtc_state);
bool intel_encoder_can_psr(struct intel_encoder *encoder);
bool intel_psr_needs_aux_io_power(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state);
--
2.46.0
More information about the Intel-gfx-trybot
mailing list