Compute the most appropriate VS/PE-O index for EHL. In cases when eDP encoder uses low vswing, choose 3rd table if encoder supports HBR3. Otherwise use 2nd table for eDP using low vswing.
In cases when eDP encoder does not use low vswing, choose 2nd table if encoder supports mode higher or including HBR2. Otherwise use 3rd table for eDP not using low vswing. For external DP use 2nd table if encoder supports modes higher than or including HBR2. Use 1st table if external DP encoder supports modes lower than HBR2. Warn if encoder does not support DP. In that case fallback to using default VS/PE tables. Looking from other OSes, in case when encoder does not support DP we could theoretically use 1st table. However, as of now, use default tables until it will be explicitly seen in the wild. v2->v3 - remove unnecessary braces from if block - return -EINVAL instead of -1 (Suraj) Signed-off-by: Michał Grzelak <[email protected]> --- .../drm/i915/display/intel_ddi_buf_trans.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 80ca9ca6b6471..36ba0ed4ddc68 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,33 @@ xe3plpd_get_lt_buf_trans(struct intel_encoder *encoder, return intel_get_buf_trans(&xe3plpd_lt_trans_dp14, n_entries); } +static int +ehl_compute_index(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state) +{ + if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP)) { + if (use_edp_low_vswing(encoder)) { + if (crtc_state->port_clock > 540000) + return 2; + else + return 1; + } + } + + if (intel_crtc_has_dp_encoder(crtc_state)) { + if (crtc_state->port_clock > 270000) + return 1; + else + return 0; + } + + 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 snps_c10_vspeo_index snps_c10_compute_index(const struct intel_crtc_state *crtc_state) { @@ -1857,6 +1884,9 @@ vspeo_compute_index(struct intel_encoder *encoder, return snps_c10_compute_index(crtc_state); else return snps_c20_compute_index(crtc_state); + } else if (DISPLAY_VER(display) == 11) { + if (display->platform.elkhartlake) + return ehl_compute_index(encoder, crtc_state); } drm_dbg_kms(display->drm, -- 2.45.2
