Add accessor function for LT to read requested table from VBT #57. Parse the requested table and transform data into port's buffer.
LT's VS/PE-O tables have less columns than xe3plpd_lt_phy_buf_trans contains fields. Warn about missing fields. Use 6th table if encoder supports DP 2.0 or higher. Otherwise use 5th table for DP. There are no changes to intel_ddi_dp_level() since selection of correct row of intel_ddi_buf_trans_entry is same as when no override request has been done. Tables 1-4 are not used at all and are most likely to be zeroed. 5th table is used for any mode below DP 2.0 (exclusive). 6th table is used for any mode above DP 2.0 (inclusive). Indices for other tables have not yet been observed to be used as of now. v4->v5 - add if-ladder instead of function pointer - blend index computation with table parsing - remove WARN and debug messages - remove enums entirely - add spaces around operators (Suraj) - remove spaces after type casting (Suraj) - remove INTEL_DISPLAY_STATE_WARN (Suraj) v3->v4 - stick to solely changing VBT data into current structures (Jani) - move iterator declaration to declaration block (Suraj) v2->v3 - remove unnecessary braces from if block (Suraj) - return -EINVAL instead of -1 (Suraj) Signed-off-by: Michał Grzelak <[email protected]> --- drivers/gpu/drm/i915/display/intel_bios.c | 35 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_bios.h | 4 +++ .../drm/i915/display/intel_ddi_buf_trans.c | 30 +++++++++++++++- 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index bc48ed9a7cbf5..97026d3cf6441 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -3861,6 +3861,41 @@ bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devda return devdata->display->vbt.version >= 209 && devdata->child.tbt; } +const struct intel_ddi_buf_trans * +intel_bios_get_lt_vspeo(const struct intel_bios_encoder_data *devdata, + int idx) +{ + struct intel_display *display = devdata->display; + struct intel_ddi_buf_trans *vspeo = (void *)devdata->vspeo; + union intel_ddi_buf_trans_entry *entries = (void *)vspeo->entries; + const u32 *tables = display->vbt.vspeo.tables; + int num_columns = display->vbt.vspeo.num_columns; + int num_rows = display->vbt.vspeo.num_rows; + size_t offset = 0; + int level; + + drm_WARN_ONCE(display->drm, 1, + "setting txswing & _level to 0 on LT's VS/PE-O request\n"); + + offset += idx * num_rows * num_columns; + + for (level = 0; level < num_rows; level++) { + u32 main_cursor = tables[offset]; + u32 pre_cursor = tables[offset + 1]; + u32 post_cursor = tables[offset + 2]; + + entries[level].lt.txswing = 0; + entries[level].lt.txswing_level = 0; + entries[level].lt.main_cursor = main_cursor; + entries[level].lt.pre_cursor = pre_cursor; + entries[level].lt.post_cursor = post_cursor; + + offset += num_columns; + } + + return vspeo; +} + bool intel_bios_encoder_is_dedicated_external(const struct intel_bios_encoder_data *devdata) { return devdata->display->vbt.version >= 264 && diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h index 7a50a272cd27d..4a2fd30314fd6 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.h +++ b/drivers/gpu/drm/i915/display/intel_bios.h @@ -73,6 +73,10 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder, const struct intel_bios_encoder_data * intel_bios_encoder_data_lookup(struct intel_display *display, enum port port); +const struct intel_ddi_buf_trans * +intel_bios_get_lt_vspeo(const struct intel_bios_encoder_data *devdata, + int idx); + bool intel_bios_encoder_requests_vspeo(const struct intel_bios_encoder_data *devdata); bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata); bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata); 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 4cd1e4d76c7af..6f3eb0fa16c66 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c @@ -1784,6 +1784,21 @@ xe3plpd_get_lt_buf_trans(struct intel_encoder *encoder, return intel_get_buf_trans(&xe3plpd_lt_trans_dp14, n_entries); } +static const struct intel_ddi_buf_trans * +xe3plpd_get_lt_vspeo_buf_trans(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + int *n_entries) +{ + if (intel_crtc_has_dp_encoder(crtc_state)) { + if (intel_dp_is_uhbr(crtc_state)) + return intel_bios_get_lt_vspeo(encoder->devdata, 5); + else + return intel_bios_get_lt_vspeo(encoder->devdata, 4); + } + + return encoder->get_buf_trans(encoder, crtc_state, n_entries); +} + void intel_ddi_buf_trans_init(struct intel_encoder *encoder) { struct intel_display *display = to_intel_display(encoder); @@ -1857,5 +1872,18 @@ const struct intel_ddi_buf_trans *intel_ddi_buf_trans_get(struct intel_encoder * const struct intel_crtc_state *crtc_state, int *n_entries) { - return encoder->get_buf_trans(encoder, crtc_state, n_entries); + struct intel_display *display = to_intel_display(encoder); + const struct intel_ddi_buf_trans *buf_trans; + bool vspeo; + + vspeo = intel_bios_encoder_requests_vspeo(encoder->devdata); + if (!vspeo) + return encoder->get_buf_trans(encoder, crtc_state, n_entries); + + if (HAS_LT_PHY(display)) + buf_trans = xe3plpd_get_lt_vspeo_buf_trans(encoder, crtc_state, n_entries); + else + buf_trans = encoder->get_buf_trans(encoder, crtc_state, n_entries); + + return intel_get_buf_trans(buf_trans, n_entries); } -- 2.45.2
