Compute the most appropriate VS/PE-O index for C20 basing on highest
available DP mode.

Use 6th table if encoder supports DP 2.0 or higher. Otherwise use 5th
table for DP.

Warn if encoder does not support DP. In that case fallback to using
default VS/PE tables.

v2->v3
- return -EINVAL instead of -1 (Suraj)

Signed-off-by: Michał Grzelak <[email protected]>
---
 .../drm/i915/display/intel_ddi_buf_trans.c    | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c 
b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index 54ad46643fb5c..e7c497d31d1a8 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -1786,6 +1786,23 @@ xe3plpd_get_lt_buf_trans(struct intel_encoder *encoder,
                return intel_get_buf_trans(&xe3plpd_lt_trans_dp14, n_entries);
 }
 
+static int
+snps_c20_compute_index(const struct intel_crtc_state *crtc_state)
+{
+       if (intel_crtc_has_dp_encoder(crtc_state)) {
+               if (intel_dp_is_uhbr(crtc_state))
+                       return 5;
+               else
+                       return 4;
+       }
+
+       drm_WARN(to_intel_display(crtc_state)->drm, 1,
+                "non-DP (%d) encoder asks to compute VS/PE-O index\n",
+                crtc_state->output_types);
+
+       return -EINVAL;
+}
+
 static enum lt_vspeo_index
 lt_compute_index(const struct intel_crtc_state *crtc_state)
 {
@@ -1809,8 +1826,12 @@ vspeo_compute_index(struct intel_encoder *encoder,
 {
        struct intel_display *display = to_intel_display(encoder);
 
-       if (HAS_LT_PHY(display))
+       if (HAS_LT_PHY(display)) {
                return lt_compute_index(crtc_state);
+       } else if (DISPLAY_VER(display) >= 14) {
+               if (!intel_encoder_is_c10phy(encoder))
+                       return snps_c20_compute_index(crtc_state);
+       }
 
        drm_dbg_kms(display->drm,
                    "VS/PE-O unsupported, using default VS/PE tables");
-- 
2.45.2

Reply via email to