[PATCH 3/3] display/alpm: Calculate alpm latency
Mitul Golani
mitulkumar.ajitkumar.golani at intel.com
Tue Nov 12 03:54:23 UTC 2024
Calculate latency added by enabling the feature.
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
---
drivers/gpu/drm/i915/display/intel_alpm.c | 21 +++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_alpm.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
index 55f3ae1e68c9..6edb83ca215c 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.c
+++ b/drivers/gpu/drm/i915/display/intel_alpm.c
@@ -415,3 +415,24 @@ void intel_alpm_lobf_debugfs_add(struct intel_connector *connector)
debugfs_create_file("i915_edp_lobf_info", 0444, root,
connector, &i915_edp_lobf_info_fops);
}
+
+int calc_alpm_latency(struct intel_crtc_state *crtc_state)
+{
+ int val, enabled, linetime, aux_less_wake_lines;
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+
+ if (!crtc_state->has_lobf)
+ return 0;
+
+ linetime = DIV_ROUND_UP(crtc_state->hw.adjusted_mode.htotal * 1000,
+ intel_crtc_dotclock(crtc_state));
+
+ val = intel_de_read(i915,
+ ALPM_CTL(i915, crtc_state->cpu_transcoder));
+ enabled = val & ALPM_CTL_ALPM_ENABLE;
+ aux_less_wake_lines = ALPM_CTL_AUX_LESS_WAKE_TIME_MASK & val;
+
+ return intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode,
+ enabled * aux_less_wake_lines * linetime);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_alpm.h b/drivers/gpu/drm/i915/display/intel_alpm.h
index 8c409b10dce6..11074dc41796 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.h
+++ b/drivers/gpu/drm/i915/display/intel_alpm.h
@@ -24,4 +24,5 @@ void intel_alpm_configure(struct intel_dp *intel_dp,
void intel_alpm_lobf_debugfs_add(struct intel_connector *connector);
bool intel_alpm_aux_wake_supported(struct intel_dp *intel_dp);
bool intel_alpm_aux_less_wake_supported(struct intel_dp *intel_dp);
+int calc_alpm_latency(struct intel_crtc_state *crtc_state);
#endif
--
2.46.0
More information about the Intel-gfx-trybot
mailing list