DC Patches Jan 31, 2022
Subsystems (3)
cover DC Patches Jan 31, 2022
This DC patchset brings improvements in multiple areas. In summary, we have:
- DC refactor and bug fixes for DP links
- Bug fixes for DP2
- Fix regressions causing display not light up
- Improved debug trace
- Improved DP AUX transfer
- Updated watermark latencies to fix underflows in some modes
Anthony Koo (1):
drm/amd/display: [FW Promotion] Release 0.0.102.0
Aric Cyr (1):
drm/amd/display: 3.2.171
Fangzhi Zuo (2):
drm/amd/display: Trigger DP2 Sequence With Uncertified Cable drm/amd/display: Add Missing HPO Stream Encoder Function Hook
Leo (Hanghong) Ma (1):
drm/amd/display: add infoframe update sequence debug trace
Paul Hsieh (1):
drm/amd/display: watermark latencies is not enough on DCN31
Shen, George (1):
drm/amd/display: Add link enc null ptr check for cable ID (#2597)
Wenjing Liu (8):
drm/amd/display: add setup/reset stream encoder to link_hwss drm/amd/display: refactor destructive verify link cap sequence drm/amd/display: add enable/disable dp link output to link_hwss drm/amd/display: add set dp link test pattern to link_hwss drm/amd/display: add set dp lane settings to link_hwss drm/amd/display: temporarly move non link_hwss code to dc_link_dp drm/amd/display: move get_link_hwss to dc_resource drm/amd/display: move link_hwss to link folder and break down to files
Wyatt Wood (1):
drm/amd/display: Improve dce_aux_transfer_with_retries logging
Zhan Liu (1):
drm/amd/display: revert "Reset fifo after enable otg"
.../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 26 + drivers/gpu/drm/amd/display/dc/Makefile | 4 +- .../display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c | 20 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 87 +- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 778 ++++++++++++-- .../drm/amd/display/dc/core/dc_link_hwss.c | 959 ------------------ .../gpu/drm/amd/display/dc/core/dc_resource.c | 59 +- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_link.h | 4 +- drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 2 +- .../drm/amd/display/dc/dce/dce_link_encoder.c | 17 +- .../drm/amd/display/dc/dce/dce_link_encoder.h | 3 +- .../display/dc/dce110/dce110_hw_sequencer.c | 49 +- .../amd/display/dc/dcn10/dcn10_link_encoder.c | 17 +- .../amd/display/dc/dcn10/dcn10_link_encoder.h | 3 +- .../display/dc/dcn10/dcn10_stream_encoder.c | 15 - .../display/dc/dcn10/dcn10_stream_encoder.h | 3 - .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 41 +- .../display/dc/dcn20/dcn20_stream_encoder.c | 2 - .../dc/dcn30/dcn30_dio_stream_encoder.c | 2 - .../dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 11 + .../dc/dcn31/dcn31_hpo_dp_stream_encoder.h | 9 +- .../gpu/drm/amd/display/dc/inc/core_types.h | 1 + .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 47 +- .../drm/amd/display/dc/inc/hw/link_encoder.h | 3 +- .../amd/display/dc/inc/hw/stream_encoder.h | 4 - .../gpu/drm/amd/display/dc/inc/link_dpcd.h | 2 +- .../gpu/drm/amd/display/dc/inc/link_hwss.h | 90 +- drivers/gpu/drm/amd/display/dc/inc/resource.h | 10 +- drivers/gpu/drm/amd/display/dc/link/Makefile | 30 + .../drm/amd/display/dc/link/link_hwss_dio.c | 137 +++ .../drm/amd/display/dc/link/link_hwss_dio.h | 53 + .../drm/amd/display/dc/link/link_hwss_dpia.c | 51 + .../drm/amd/display/dc/link/link_hwss_dpia.h | 34 + .../amd/display/dc/link/link_hwss_hpo_dp.c | 254 +++++ .../amd/display/dc/link/link_hwss_hpo_dp.h | 35 + .../amd/display/dc/link/link_hwss_hpo_frl.c | 43 + .../amd/display/dc/link/link_hwss_hpo_frl.h | 34 + .../gpu/drm/amd/display/dc/virtual/Makefile | 2 +- .../display/dc/virtual/virtual_link_encoder.c | 3 +- .../display/dc/virtual/virtual_link_hwss.c | 43 + .../display/dc/virtual/virtual_link_hwss.h | 34 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 8 +- 44 files changed, 1726 insertions(+), 1308 deletions(-) delete mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c create mode 100644 drivers/gpu/drm/amd/display/dc/link/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.c create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.h create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.c create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.h create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.c create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.h create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.c create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.h create mode 100644 drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.c create mode 100644 drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h
Signature · 1 line
2.34.1
PATCH 1/17 drm/amd/display: Add link enc null ptr check for cable ID (#2597)
From: "Shen, George" <[email protected]>
[Why]
Certain configurations will result in link encoder to not be assigned to the link at the time we apply cable ID logic. We should skip it in those cases.
[How]
Check if link_enc is not null before applying cable ID.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +6 -1
@@ -6327,7 +6327,12 @@ void dpcd_set_source_specific_data(struct dc_link *link)void dpcd_update_cable_id (struct dc_link *link) { -if (!link->link_enc->features.flags.bits.IS_UHBR10_CAPABLE || +struct link_encoder *link_enc =NULL ; + + link_enc =link_enc_cfg_get_link_enc (link); + +if (!link_enc || + !link_enc->features.flags.bits.IS_UHBR10_CAPABLE || link->dprx_status.cable_id_updated)return ;
Signature · 1 line
2.34.1
PATCH 2/17 drm/amd/display: Improve dce_aux_transfer_with_retries logging
In reply to Stylon WangFrom: Wyatt Wood <[email protected]>
[Why + How]
Payload reply is unknown and not handled in switch statement.
--- drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1 -1
@@ -878,7 +878,7 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,default :DC_TRACE_LEVEL_MESSAGE (DAL_TRACE_LEVEL_ERROR , LOG_FLAG_Error_I2cAux, -"dce_aux_transfer_with_retries: AUX_RET_SUCCESS: FAILURE: AUX_TRANSACTION_REPLY_* unknown, default case." ); +"dce_aux_transfer_with_retries: AUX_RET_SUCCESS: FAILURE: AUX_TRANSACTION_REPLY_* unknown, default case. Reply: %d" , *payload->reply); goto fail; }break ;
Signature · 1 line
2.34.1
PATCH 3/17 drm/amd/display: watermark latencies is not enough on DCN31
In reply to Stylon WangFrom: Paul Hsieh <[email protected]>
[Why]
The original latencies were causing underflow in some modes.
Resolution: 2880x1620@60p when HDR enable
[How]
1. Replace with the up-to-date watermark values based on new measurments
2. Correct the ddr_wm_table name to DDR5 on DCN31
--- .../display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c +10 -10
@@ -329,38 +329,38 @@ static struct clk_bw_params dcn31_bw_params = { }; -static struct wm_table ddr4_wm_table = { +static struct wm_table ddr5_wm_table = { .entries = { { .wm_inst =WM_A , .wm_type =WM_TYPE_PSTATE_CHG , .pstate_latency_us =11.72 , - .sr_exit_time_us =6.09 , - .sr_enter_plus_exit_time_us =7.14 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , .valid = true, }, { .wm_inst =WM_B , .wm_type =WM_TYPE_PSTATE_CHG , .pstate_latency_us =11.72 , - .sr_exit_time_us =10.12 , - .sr_enter_plus_exit_time_us =11.48 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , .valid = true, }, { .wm_inst =WM_C , .wm_type =WM_TYPE_PSTATE_CHG , .pstate_latency_us =11.72 , - .sr_exit_time_us =10.12 , - .sr_enter_plus_exit_time_us =11.48 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , .valid = true, }, { .wm_inst =WM_D , .wm_type =WM_TYPE_PSTATE_CHG , .pstate_latency_us =11.72 , - .sr_exit_time_us =10.12 , - .sr_enter_plus_exit_time_us =11.48 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , .valid = true, }, }
@@ -687,7 +687,7 @@ void dcn31_clk_mgr_construct(if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType) { dcn31_bw_params.wm_table = lpddr5_wm_table; }else { - dcn31_bw_params.wm_table = ddr4_wm_table; + dcn31_bw_params.wm_table = ddr5_wm_table; }/* Saved clocks configured at boot for debug purposes */ dcn31_dump_clk_registers (&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info);
Signature · 1 line
2.34.1
PATCH 4/17 drm/amd/display: add infoframe update sequence debug trace
In reply to Stylon WangFrom: "Leo (Hanghong) Ma" <[email protected]>
[Why]
We find some of the driver sequence debug trace for infoframe update is missing so add it.
[How]
Add the missing sequence debug trace for infoframe update.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
@@ -2720,6 +2720,9 @@ static void commit_planes_do_stream_update(struct dc *dc, stream_update->vsp_infopacket) {resource_build_info_frame (pipe_ctx); dc->hwss.update_info_frame (pipe_ctx); + +if (dc_is_dp_signal (pipe_ctx->stream->signal)) +dp_source_sequence_trace (pipe_ctx->stream->link,DPCD_SOURCE_SEQ_AFTER_UPDATE_INFO_FRAME ); } if (stream_update->hdr_static_metadata &&
Signature · 1 line
2.34.1
PATCH 5/17 drm/amd/display: revert "Reset fifo after enable otg"
In reply to Stylon WangFrom: Zhan Liu <[email protected]>
[Why]
This change causes regression, that prevents some systems from lighting up internal displays.
[How]
Revert this patch until a new solution is ready.
--- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 5 ----- .../amd/display/dc/dcn10/dcn10_stream_encoder.c | 15 --------------- .../amd/display/dc/dcn10/dcn10_stream_encoder.h | 3 --- .../amd/display/dc/dcn20/dcn20_stream_encoder.c | 2 -- .../display/dc/dcn30/dcn30_dio_stream_encoder.c | 2 -- .../drm/amd/display/dc/inc/hw/stream_encoder.h | 4 ---- 6 files changed, 31 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +0 -5
@@ -1567,11 +1567,6 @@ static enum dc_status apply_single_controller_ctx_to_hw( pipe_ctx->stream_res.stream_enc, pipe_ctx->stream_res.tg->inst); -if (dc_is_embedded_signal (pipe_ctx->stream->signal) && - pipe_ctx->stream_res.stream_enc->funcs->reset_fifo) - pipe_ctx->stream_res.stream_enc->funcs->reset_fifo ( - pipe_ctx->stream_res.stream_enc); -if (dc_is_dp_signal (pipe_ctx->stream->signal))dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_CONNECT_DIG_FE_OTG );
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +0 -15
@@ -902,19 +902,6 @@ void enc1_stream_encoder_stop_dp_info_packets( } -void enc1_stream_encoder_reset_fifo ( -struct stream_encoder *enc) -{ -struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); - -/* set DIG_START to 0x1 to reset FIFO */ -REG_UPDATE (DIG_FE_CNTL ,DIG_START ,1 ); -udelay (100 ); - -/* write 0 to take the FIFO out of reset */ -REG_UPDATE (DIG_FE_CNTL ,DIG_START ,0 ); -} -void enc1_stream_encoder_dp_blank (struct dc_link *link,struct stream_encoder *enc)
@@ -1600,8 +1587,6 @@ static const struct stream_encoder_funcs dcn10_str_enc_funcs = { enc1_stream_encoder_send_immediate_sdp_message, .stop_dp_info_packets = enc1_stream_encoder_stop_dp_info_packets, - .reset_fifo = - enc1_stream_encoder_reset_fifo, .dp_blank = enc1_stream_encoder_dp_blank, .dp_unblank =
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h +0 -3
@@ -626,9 +626,6 @@ void enc1_stream_encoder_send_immediate_sdp_message(void enc1_stream_encoder_stop_dp_info_packets (struct stream_encoder *enc); -void enc1_stream_encoder_reset_fifo ( -struct stream_encoder *enc); -void enc1_stream_encoder_dp_blank (struct dc_link *link,struct stream_encoder *enc);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +0 -2
@@ -593,8 +593,6 @@ static const struct stream_encoder_funcs dcn20_str_enc_funcs = { enc1_stream_encoder_send_immediate_sdp_message, .stop_dp_info_packets = enc1_stream_encoder_stop_dp_info_packets, - .reset_fifo = - enc1_stream_encoder_reset_fifo, .dp_blank = enc1_stream_encoder_dp_blank, .dp_unblank =
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c +0 -2
@@ -789,8 +789,6 @@ static const struct stream_encoder_funcs dcn30_str_enc_funcs = { enc3_stream_encoder_update_dp_info_packets, .stop_dp_info_packets = enc1_stream_encoder_stop_dp_info_packets, - .reset_fifo = - enc1_stream_encoder_reset_fifo, .dp_blank = enc1_stream_encoder_dp_blank, .dp_unblank =
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +0 -4
@@ -164,10 +164,6 @@ struct stream_encoder_funcs {void (*stop_dp_info_packets)(struct stream_encoder *enc); -void (*reset_fifo)( -struct stream_encoder *enc - ); -void (*dp_blank)(struct dc_link *link,struct stream_encoder *enc);
Signature · 1 line
2.34.1
PATCH 6/17 drm/amd/display: add setup/reset stream encoder to link_hwss
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Factor setup/reset stream encoder to link hwss.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 64 +++---- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 23 +-- .../drm/amd/display/dc/core/dc_link_hwss.c | 170 +++++++++++------- .../display/dc/dce110/dce110_hw_sequencer.c | 44 ++--- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 40 +---- .../gpu/drm/amd/display/dc/inc/link_hwss.h | 22 ++- 6 files changed, 180 insertions(+), 183 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +34 -30
@@ -3441,7 +3441,7 @@ static enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx,struct link_mst_stream_allocation_table proposed_table = {0 };struct fixed31_32 avg_time_slots_per_mtp;const struct dc_link_settings empty_link_settings = {0 }; -const struct link_hwss *link_hwss =dc_link_hwss_get (link, &pipe_ctx->link_res); +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);DC_LOGGER_INIT (link->ctx->logger);/* slot X.Y for SST payload deallocate */
@@ -3450,9 +3450,11 @@ static enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx,dc_log_vcp_x_y (link, avg_time_slots_per_mtp); - link_hwss->set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); -if (link_hwss->set_hblank_min_symbol_width) - link_hwss->set_hblank_min_symbol_width (pipe_ctx, +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, + avg_time_slots_per_mtp); +if (link_hwss->ext.set_hblank_min_symbol_width) + link_hwss->ext.set_hblank_min_symbol_width (pipe_ctx, &empty_link_settings, avg_time_slots_per_mtp); }
@@ -3498,9 +3500,11 @@ static enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx,dc_log_vcp_x_y (link, avg_time_slots_per_mtp); - link_hwss->set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); -if (link_hwss->set_hblank_min_symbol_width) - link_hwss->set_hblank_min_symbol_width (pipe_ctx, +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, + avg_time_slots_per_mtp); +if (link_hwss->ext.set_hblank_min_symbol_width) + link_hwss->ext.set_hblank_min_symbol_width (pipe_ctx, &link->cur_link_settings, avg_time_slots_per_mtp); }
@@ -3526,7 +3530,7 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx)struct fixed31_32 pbn_per_slot;int i;enum act_return_status ret; -const struct link_hwss *link_hwss =dc_link_hwss_get (link, &pipe_ctx->link_res); +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);DC_LOGGER_INIT (link->ctx->logger);/* Link encoder may have been dynamically assigned to non-physical display endpoint. */
@@ -3634,9 +3638,10 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx)dc_log_vcp_x_y (link, avg_time_slots_per_mtp); - link_hwss->set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); -if (link_hwss->set_hblank_min_symbol_width) - link_hwss->set_hblank_min_symbol_width (pipe_ctx, +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); +if (link_hwss->ext.set_hblank_min_symbol_width) + link_hwss->ext.set_hblank_min_symbol_width (pipe_ctx, &link->cur_link_settings, avg_time_slots_per_mtp);
@@ -3655,7 +3660,7 @@ enum dc_status dc_link_reduce_mst_payload(struct pipe_ctx *pipe_ctx, uint32_t bwstruct dp_mst_stream_allocation_table proposed_table = {0 };uint8_t i;enum act_return_status ret; -const struct link_hwss *link_hwss =dc_link_hwss_get (link, &pipe_ctx->link_res); +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);DC_LOGGER_INIT (link->ctx->logger);/* decrease throttled vcp size */
@@ -3663,9 +3668,10 @@ enum dc_status dc_link_reduce_mst_payload(struct pipe_ctx *pipe_ctx, uint32_t bw pbn =get_pbn_from_bw_in_kbps (bw_in_kbps); avg_time_slots_per_mtp =dc_fixpt_div (pbn, pbn_per_slot); - link_hwss->set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); -if (link_hwss->set_hblank_min_symbol_width) - link_hwss->set_hblank_min_symbol_width (pipe_ctx, +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); +if (link_hwss->ext.set_hblank_min_symbol_width) + link_hwss->ext.set_hblank_min_symbol_width (pipe_ctx, &link->cur_link_settings, avg_time_slots_per_mtp);
@@ -3737,7 +3743,7 @@ enum dc_status dc_link_increase_mst_payload(struct pipe_ctx *pipe_ctx, uint32_tstruct dp_mst_stream_allocation_table proposed_table = {0 };uint8_t i;enum act_return_status ret; -const struct link_hwss *link_hwss =dc_link_hwss_get (link, &pipe_ctx->link_res); +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);DC_LOGGER_INIT (link->ctx->logger);/* notify immediate branch device table update */
@@ -3796,9 +3802,10 @@ enum dc_status dc_link_increase_mst_payload(struct pipe_ctx *pipe_ctx, uint32_t pbn_per_slot =get_pbn_per_slot (stream); avg_time_slots_per_mtp =dc_fixpt_div (pbn, pbn_per_slot); - link_hwss->set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); -if (link_hwss->set_hblank_min_symbol_width) - link_hwss->set_hblank_min_symbol_width (pipe_ctx, +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); +if (link_hwss->ext.set_hblank_min_symbol_width) + link_hwss->ext.set_hblank_min_symbol_width (pipe_ctx, &link->cur_link_settings, avg_time_slots_per_mtp);
@@ -3815,7 +3822,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)struct fixed31_32 avg_time_slots_per_mtp =dc_fixpt_from_int (0 );int i;bool mst_mode = (link->type == dc_connection_mst_branch); -const struct link_hwss *link_hwss =dc_link_hwss_get (link, &pipe_ctx->link_res); +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);const struct dc_link_settings empty_link_settings = {0 };DC_LOGGER_INIT (link->ctx->logger);
@@ -3834,9 +3841,10 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)*/ /* slot X.Y */ - link_hwss->set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); -if (link_hwss->set_hblank_min_symbol_width) - link_hwss->set_hblank_min_symbol_width (pipe_ctx, +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); +if (link_hwss->ext.set_hblank_min_symbol_width) + link_hwss->ext.set_hblank_min_symbol_width (pipe_ctx, &empty_link_settings, avg_time_slots_per_mtp);
@@ -4004,8 +4012,8 @@ static void fpga_dp_hpo_enable_link_and_stream(struct dc_state *state, struct pistruct fixed31_32 avg_time_slots_per_mtp;uint8_t req_slot_count =0 ;uint8_t vc_id =1 ;/// VC ID always 1 for SST -struct dc_link_settings link_settings = {0 }; +const struct link_hwss *link_hwss =get_link_hwss (stream->link, &pipe_ctx->link_res);DC_LOGGER_INIT (pipe_ctx->stream->ctx->logger);decide_link_settings (stream, &link_settings);
@@ -4066,12 +4074,8 @@ static void fpga_dp_hpo_enable_link_and_stream(struct dc_state *state, struct pi pipe_ctx->link_res.hpo_dp_link_enc, &proposed_table); - pipe_ctx->link_res.hpo_dp_link_enc->funcs->set_throttled_vcp_size ( - pipe_ctx->link_res.hpo_dp_link_enc, - pipe_ctx->stream_res.hpo_dp_stream_enc->inst, - avg_time_slots_per_mtp); - - +if (link_hwss->ext.set_throttled_vcp_size) + link_hwss->ext.set_throttled_vcp_size (pipe_ctx, avg_time_slots_per_mtp); dc->hwss.unblank_stream (pipe_ctx, &stream->link->cur_link_settings); }
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +6 -17
@@ -2700,26 +2700,15 @@ bool perform_link_training_with_retries(struct dc_stream_state *stream = pipe_ctx->stream;struct dc_link *link = stream->link;enum dp_panel_mode panel_mode =dp_get_panel_mode (link); -struct link_encoder *link_enc;enum link_training_result status =LINK_TRAINING_CR_FAIL_LANE0 ;struct dc_link_settings current_setting = *link_setting; +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res); -/* Dynamically assigned link encoders associated with stream rather than -* link. -*/ -if (link->is_dig_mapping_flexible && link->dc->res_pool->funcs->link_encs_assign) - link_enc =link_enc_cfg_get_link_enc_used_by_stream (link->ctx->dc, pipe_ctx->stream); -else - link_enc = link->link_enc; - -/* We need to do this before the link training to ensure the idle pattern in SST -* mode will be sent right after the link training -*/ -if (dp_get_link_encoding_format (¤t_setting) == DP_8b_10b_ENCODING) { - link_enc->funcs->connect_dig_be_to_fe (link_enc, - pipe_ctx->stream_res.stream_enc->id, true); -dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_CONNECT_DIG_FE_BE ); - } +if (dp_get_link_encoding_format (¤t_setting) == DP_8b_10b_ENCODING) +/* We need to do this before the link training to ensure the idle +* pattern in SST mode will be sent right after the link training +*/ + link_hwss->setup_stream_encoder (pipe_ctx);for (j =0 ; j < attempts; ++j) {
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +107 -63
210 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +11 -33
69 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +8 -32
@@ -2390,46 +2390,22 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx)uint32_t active_total_with_borders;uint32_t early_control =0 ;struct timing_generator *tg = pipe_ctx->stream_res.tg; -struct link_encoder *link_enc; +const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res); +struct dc *dc = pipe_ctx->stream->ctx->dc; -if (link->is_dig_mapping_flexible && - link->dc->res_pool->funcs->link_encs_assign) - link_enc =link_enc_cfg_get_link_enc_used_by_stream (link->ctx->dc, pipe_ctx->stream); -else - link_enc = link->link_enc; -ASSERT (link_enc); - -/* For MST, there are multiply stream go to only one link. -* connect DIG back_end to front_end while enable_stream and -* disconnect them during disable_stream -* BY this, it is logic clean to separate stream and link -*/ if (is_dp_128b_132b_signal (pipe_ctx)) { -if (pipe_ctx->stream->ctx->dc->hwseq->funcs.setup_hpo_hw_control) - pipe_ctx->stream->ctx->dc->hwseq->funcs.setup_hpo_hw_control ( - pipe_ctx->stream->ctx->dc->hwseq, true); -setup_dp_hpo_stream (pipe_ctx, true); - pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->enable_stream ( - pipe_ctx->stream_res.hpo_dp_stream_enc); - pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->map_stream_to_link ( - pipe_ctx->stream_res.hpo_dp_stream_enc, - pipe_ctx->stream_res.hpo_dp_stream_enc->inst, - pipe_ctx->link_res.hpo_dp_link_enc->inst); +if (dc->hwseq->funcs.setup_hpo_hw_control) + dc->hwseq->funcs.setup_hpo_hw_control (dc->hwseq, true); } -if (!is_dp_128b_132b_signal (pipe_ctx) && link_enc) - link_enc->funcs->connect_dig_be_to_fe ( - link_enc, pipe_ctx->stream_res.stream_enc->id, true); - -if (dc_is_dp_signal (pipe_ctx->stream->signal)) -dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_CONNECT_DIG_FE_BE ); + link_hwss->setup_stream_encoder (pipe_ctx);if (pipe_ctx->plane_state && pipe_ctx->plane_state->flip_immediate !=1 ) { -if (link->dc->hwss.program_dmdata_engine) - link->dc->hwss.program_dmdata_engine (pipe_ctx); +if (dc->hwss.program_dmdata_engine) + dc->hwss.program_dmdata_engine (pipe_ctx); } - link->dc->hwss.update_info_frame (pipe_ctx); + dc->hwss.update_info_frame (pipe_ctx);if (dc_is_dp_signal (pipe_ctx->stream->signal))dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_UPDATE_INFO_FRAME );
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +14 -8
@@ -77,21 +77,27 @@ struct link_resource;struct fixed31_32 ;struct pipe_ctx ; -struct link_hwss { -/* you must define a dummy implementation and assign the function to -* dummy_link_hwss if you don't want to check for NULL pointer +struct link_hwss_ext { +/* function pointers below require check for NULL at all time +* ********************************************************************* */ +void (*set_hblank_min_symbol_width)(struct pipe_ctx *pipe_ctx, +const struct dc_link_settings *link_settings, +struct fixed31_32 throttled_vcp_size);void (*set_throttled_vcp_size)(struct pipe_ctx *pipe_ctx,struct fixed31_32 throttled_vcp_size); +}; -/* function pointers below this point require check for NULL +struct link_hwss { +struct link_hwss_ext ext; + +/* function pointers below MUST be assigned to all types of link_hwss * ********************************************************************* */ -void (*set_hblank_min_symbol_width)(struct pipe_ctx *pipe_ctx, -const struct dc_link_settings *link_settings, -struct fixed31_32 throttled_vcp_size); +void (*setup_stream_encoder)(struct pipe_ctx *pipe_ctx); +void (*reset_stream_encoder)(struct pipe_ctx *pipe_ctx); }; -const struct link_hwss *dc_link_hwss_get (const struct dc_link *link,const struct link_resource *link_res); +const struct link_hwss *get_link_hwss (const struct dc_link *link,const struct link_resource *link_res);#endif /* __DC_LINK_HWSS_H__ */
Signature · 1 line
2.34.1
PATCH 7/17 drm/amd/display: refactor destructive verify link cap sequence
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[how]
1. move decide det link training link resource before each link training.
2. move disable link for handling vbios case into set all streams dpms off for link sequence.
3. extract usbc hotplug workaround into its own wa function.
4. Minor syntax changes to improve code readability.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 17 +-- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 134 +++++++----------- .../gpu/drm/amd/display/dc/core/dc_resource.c | 22 ++- .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 7 - drivers/gpu/drm/amd/display/dc/inc/resource.h | 7 +- 5 files changed, 83 insertions(+), 104 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +7 -10
@@ -893,6 +893,7 @@ static void set_all_streams_dpms_off_for_link(struct dc_link *link)struct pipe_ctx *pipe_ctx;struct dc_stream_update stream_update;bool dpms_off = true; +struct link_resource link_res = {0 };memset (&stream_update,0 ,sizeof (stream_update)); stream_update.dpms_off = &dpms_off;
@@ -907,33 +908,29 @@ static void set_all_streams_dpms_off_for_link(struct dc_link *link) link->ctx->dc->current_state); } } + +/* link can be also enabled by vbios. In this case it is not recorded +* in pipe_ctx. Disable link phy here to make sure it is completely off +*/ +dp_disable_link_phy (link, &link_res, link->connector_signal); }static void verify_link_capability_destructive (struct dc_link *link,struct dc_sink *sink,enum dc_detect_reason reason) { -struct link_resource link_res = {0 };bool should_prepare_phy_clocks =should_prepare_phy_clocks_for_link_verification (link->dc, reason);if (should_prepare_phy_clocks)prepare_phy_clocks_for_destructive_link_verification (link->dc); -if (dc_is_dp_signal (link->local_sink->sink_signal)) {struct dc_link_settings known_limit_link_setting =dp_get_max_link_cap (link); -set_all_streams_dpms_off_for_link (link); -if (dp_get_link_encoding_format (&known_limit_link_setting) == - DP_128b_132b_ENCODING) - link_res.hpo_dp_link_enc =resource_get_hpo_dp_link_enc_for_det_lt ( - &link->dc->current_state->res_ctx, - link->dc->res_pool, - link);dp_verify_link_cap_with_retries ( - link, &link_res, &known_limit_link_setting, + link, &known_limit_link_setting,LINK_TRAINING_MAX_VERIFY_RETRY ); }else {ASSERT (0 );
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +53 -81
196 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +20 -2
@@ -3187,9 +3187,9 @@ void get_audio_check(struct audio_info *aud_modes, } } -struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt ( +static struct hpo_dp_link_encoder *get_temp_hpo_dp_link_enc (const struct resource_context *res_ctx, -const struct resource_pool *pool, +const struct resource_pool *const pool,const struct dc_link *link) {struct hpo_dp_link_encoder *hpo_dp_link_enc =NULL ;
@@ -3206,6 +3206,24 @@ struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt(return hpo_dp_link_enc; } +bool get_temp_dp_link_res (struct dc_link *link, +struct link_resource *link_res, +struct dc_link_settings *link_settings) +{ +const struct dc *dc = link->dc; +const struct resource_context *res_ctx = &dc->current_state->res_ctx; + +memset (link_res,0 ,sizeof (*link_res)); + +if (dp_get_link_encoding_format (link_settings) == DP_128b_132b_ENCODING) { + link_res->hpo_dp_link_enc =get_temp_hpo_dp_link_enc (res_ctx, + dc->res_pool, link); +if (!link_res->hpo_dp_link_enc) +return false; + } +return true; +} +void reset_syncd_pipes_from_disabled_pipes (struct dc *dc,struct dc_state *context) {
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +0 -7
@@ -56,15 +56,8 @@ enum {struct dc_link_settings dp_get_max_link_cap (struct dc_link *link); -bool dp_verify_link_cap ( -struct dc_link *link, -const struct link_resource *link_res, -struct dc_link_settings *known_limit_link_setting, -int *fail_count); -bool dp_verify_link_cap_with_retries (struct dc_link *link, -const struct link_resource *link_res,struct dc_link_settings *known_limit_link_setting,int attempts);
drivers/gpu/drm/amd/display/dc/inc/resource.h +3 -4
@@ -201,10 +201,9 @@ int get_num_mpc_splits(struct pipe_ctx *pipe);int get_num_odm_splits (struct pipe_ctx *pipe); -struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt ( -const struct resource_context *res_ctx, -const struct resource_pool *pool, -const struct dc_link *link); +bool get_temp_dp_link_res (struct dc_link *link, +struct link_resource *link_res, +struct dc_link_settings *link_settings);void reset_syncd_pipes_from_disabled_pipes (struct dc *dc,struct dc_state *context);
Signature · 1 line
2.34.1
PATCH 8/17 drm/amd/display: add enable/disable dp link output to link_hwss
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Factor enable/disable dp link output to link hwss.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 6 +- .../drm/amd/display/dc/core/dc_link_hwss.c | 256 +++++++++--------- .../gpu/drm/amd/display/dc/inc/link_hwss.h | 8 + 3 files changed, 139 insertions(+), 131 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +4 -2
@@ -4016,8 +4016,10 @@ static void fpga_dp_hpo_enable_link_and_stream(struct dc_state *state, struct pidecide_link_settings (stream, &link_settings); stream->link->cur_link_settings = link_settings; -/* Enable clock, Configure lane count, and Enable Link Encoder*/ -enable_dp_hpo_output (stream->link, &pipe_ctx->link_res, &stream->link->cur_link_settings); +if (link_hwss->ext.enable_dp_link_output) + link_hwss->ext.enable_dp_link_output (stream->link, &pipe_ctx->link_res, + stream->signal, pipe_ctx->clock_source->id, + &link_settings);#ifdef DIAGS_BUILD /* Workaround for FPGA HPO capture DP link data:
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +127 -129
343 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +8 -0
@@ -86,6 +86,14 @@ struct link_hwss_ext { struct fixed31_32 throttled_vcp_size);void (*set_throttled_vcp_size)(struct pipe_ctx *pipe_ctx,struct fixed31_32 throttled_vcp_size); +void (*enable_dp_link_output)(struct dc_link *link, +const struct link_resource *link_res, +enum signal_type signal, +enum clock_source_id clock_source, +const struct dc_link_settings *link_settings); +void (*disable_dp_link_output)(struct dc_link *link, +const struct link_resource *link_res, +enum signal_type signal); };struct link_hwss {
Signature · 1 line
2.34.1
PATCH 9/17 drm/amd/display: add set dp link test pattern to link_hwss
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Factor set dp link test pattern to link_hwss.
--- .../drm/amd/display/dc/core/dc_link_hwss.c | 46 +++++++++++-------- .../gpu/drm/amd/display/dc/inc/link_hwss.h | 3 ++ 2 files changed, 29 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +26 -20
@@ -323,33 +323,16 @@ void dp_set_hw_test_pattern( uint8_t *custom_pattern, uint32_t custom_pattern_size) { +const struct link_hwss *link_hwss =get_link_hwss (link, link_res);struct encoder_set_dp_phy_pattern_param pattern_param = {0 }; -struct link_encoder *encoder; -enum dp_link_encoding link_encoding_format =dp_get_link_encoding_format (&link->cur_link_settings); - - encoder =link_enc_cfg_get_link_enc (link); -ASSERT (encoder); pattern_param.dp_phy_pattern = test_pattern; pattern_param.custom_pattern = custom_pattern; pattern_param.custom_pattern_size = custom_pattern_size; pattern_param.dp_panel_mode =dp_get_panel_mode (link); -switch (link_encoding_format) { -case DP_128b_132b_ENCODING: - link_res->hpo_dp_link_enc->funcs->set_link_test_pattern ( - link_res->hpo_dp_link_enc, &pattern_param); -break ; -case DP_8b_10b_ENCODING: -ASSERT (encoder); - encoder->funcs->dp_set_phy_pattern (encoder, &pattern_param); -break ; -default : -DC_LOG_ERROR ("%s: Unknown link encoding format." , __func__); -break ; - } - -dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_SET_SOURCE_PATTERN ); +if (link_hwss->ext.set_dp_link_test_pattern) + link_hwss->ext.set_dp_link_test_pattern (link, link_res, &pattern_param); }#undef DC_LOGGER
@@ -754,6 +737,17 @@ static void disable_dio_dp_link_output(struct dc_link *link,dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY ); } +static void set_dio_dp_link_test_pattern (struct dc_link *link, +const struct link_resource *link_res, +struct encoder_set_dp_phy_pattern_param *tp_params) +{ +struct link_encoder *link_enc =link_enc_cfg_get_link_enc (link); + +ASSERT (link_enc); + link_enc->funcs->dp_set_phy_pattern (link_enc, tp_params); +dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_SET_SOURCE_PATTERN ); +} +static const struct link_hwss dio_link_hwss = { .setup_stream_encoder = setup_dio_stream_encoder, .reset_stream_encoder = reset_dio_stream_encoder,
@@ -761,6 +755,7 @@ static const struct link_hwss dio_link_hwss = { .set_throttled_vcp_size = set_dio_throttled_vcp_size, .enable_dp_link_output = enable_dio_dp_link_output, .disable_dp_link_output = disable_dio_dp_link_output, + .set_dp_link_test_pattern = set_dio_dp_link_test_pattern, }, };
@@ -927,6 +922,15 @@ static void disable_hpo_dp_link_output(struct dc_link *link, } } +static void set_hpo_dp_link_test_pattern (struct dc_link *link, +const struct link_resource *link_res, +struct encoder_set_dp_phy_pattern_param *tp_params) +{ + link_res->hpo_dp_link_enc->funcs->set_link_test_pattern ( + link_res->hpo_dp_link_enc, tp_params); +dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_SET_SOURCE_PATTERN ); +} +static const struct link_hwss hpo_dp_link_hwss = { .setup_stream_encoder = setup_hpo_dp_stream_encoder, .reset_stream_encoder = reset_hpo_dp_stream_encoder,
@@ -935,6 +939,7 @@ static const struct link_hwss hpo_dp_link_hwss = { .set_hblank_min_symbol_width = set_dp_hpo_hblank_min_symbol_width, .enable_dp_link_output = enable_hpo_dp_link_output, .disable_dp_link_output = disable_hpo_dp_link_output, + .set_dp_link_test_pattern = set_hpo_dp_link_test_pattern, }, };/*********************** below goes to dpia_link_hwss *************************/
@@ -952,6 +957,7 @@ static const struct link_hwss dpia_link_hwss = { .set_throttled_vcp_size = set_dio_throttled_vcp_size, .enable_dp_link_output = enable_dio_dp_link_output, .disable_dp_link_output = disable_dio_dp_link_output, + .set_dp_link_test_pattern = set_dio_dp_link_test_pattern, }, };
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +3 -0
@@ -94,6 +94,9 @@ struct link_hwss_ext {void (*disable_dp_link_output)(struct dc_link *link,const struct link_resource *link_res,enum signal_type signal); +void (*set_dp_link_test_pattern)(struct dc_link *link, +const struct link_resource *link_res, +struct encoder_set_dp_phy_pattern_param *tp_params); };struct link_hwss {
Signature · 1 line
2.34.1
PATCH 10/17 drm/amd/display: add set dp lane settings to link_hwss
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Factor set dp lane settings to link_hwss.
--- .../drm/amd/display/dc/core/dc_link_hwss.c | 40 ++++++++++++++----- .../drm/amd/display/dc/dce/dce_link_encoder.c | 17 ++++---- .../drm/amd/display/dc/dce/dce_link_encoder.h | 3 +- .../amd/display/dc/dcn10/dcn10_link_encoder.c | 17 ++++---- .../amd/display/dc/dcn10/dcn10_link_encoder.h | 3 +- .../drm/amd/display/dc/inc/hw/link_encoder.h | 3 +- .../gpu/drm/amd/display/dc/inc/link_hwss.h | 4 ++ .../display/dc/virtual/virtual_link_encoder.c | 3 +- 8 files changed, 59 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +29 -11
@@ -295,22 +295,16 @@ void dp_set_hw_lane_settings( const struct link_training_settings *link_settings, uint32_t offset) { -struct link_encoder *encoder = link->link_enc; +const struct link_hwss *link_hwss =get_link_hwss (link, link_res);if ((link->lttpr_mode ==LTTPR_MODE_NON_TRANSPARENT ) && !is_immediate_downstream (link, offset))return ; -/* call Encoder to set lane settings */ -if (dp_get_link_encoding_format (&link_settings->link_settings) == - DP_128b_132b_ENCODING) { - link_res->hpo_dp_link_enc->funcs->set_ffe ( - link_res->hpo_dp_link_enc, +if (link_hwss->ext.set_dp_lane_settings) + link_hwss->ext.set_dp_lane_settings (link, link_res, &link_settings->link_settings, - link_settings->lane_settings[0 ].FFE_PRESET.raw); - }else if (dp_get_link_encoding_format (&link_settings->link_settings) - == DP_8b_10b_ENCODING) { - encoder->funcs->dp_set_lane_settings (encoder, link_settings); - } + link_settings->hw_lane_settings); +memmove (link->cur_lane_setting, link_settings->lane_settings,sizeof (link->cur_lane_setting));
@@ -748,6 +742,16 @@ static void set_dio_dp_link_test_pattern(struct dc_link *link,dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_SET_SOURCE_PATTERN ); } +static void set_dio_dp_lane_settings (struct dc_link *link, +const struct link_resource *link_res, +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]) +{ +struct link_encoder *link_enc =link_enc_cfg_get_link_enc (link); + + link_enc->funcs->dp_set_lane_settings (link_enc, link_settings, lane_settings); +} +static const struct link_hwss dio_link_hwss = { .setup_stream_encoder = setup_dio_stream_encoder, .reset_stream_encoder = reset_dio_stream_encoder,
@@ -756,6 +760,7 @@ static const struct link_hwss dio_link_hwss = { .enable_dp_link_output = enable_dio_dp_link_output, .disable_dp_link_output = disable_dio_dp_link_output, .set_dp_link_test_pattern = set_dio_dp_link_test_pattern, + .set_dp_lane_settings = set_dio_dp_lane_settings, }, };
@@ -931,6 +936,17 @@ static void set_hpo_dp_link_test_pattern(struct dc_link *link,dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_SET_SOURCE_PATTERN ); } +static void set_hpo_dp_lane_settings (struct dc_link *link, +const struct link_resource *link_res, +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]) +{ + link_res->hpo_dp_link_enc->funcs->set_ffe ( + link_res->hpo_dp_link_enc, + link_settings, + lane_settings[0 ].FFE_PRESET.raw); +} +static const struct link_hwss hpo_dp_link_hwss = { .setup_stream_encoder = setup_hpo_dp_stream_encoder, .reset_stream_encoder = reset_hpo_dp_stream_encoder,
@@ -940,6 +956,7 @@ static const struct link_hwss hpo_dp_link_hwss = { .enable_dp_link_output = enable_hpo_dp_link_output, .disable_dp_link_output = disable_hpo_dp_link_output, .set_dp_link_test_pattern = set_hpo_dp_link_test_pattern, + .set_dp_lane_settings = set_hpo_dp_lane_settings, }, };/*********************** below goes to dpia_link_hwss *************************/
@@ -958,6 +975,7 @@ static const struct link_hwss dpia_link_hwss = { .enable_dp_link_output = enable_dio_dp_link_output, .disable_dp_link_output = disable_dio_dp_link_output, .set_dp_link_test_pattern = set_dio_dp_link_test_pattern, + .set_dp_lane_settings = set_dio_dp_lane_settings, }, };
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +9 -8
@@ -1325,7 +1325,8 @@ void dce110_link_encoder_disable_output(void dce110_link_encoder_dp_set_lane_settings (struct link_encoder *enc, -const struct link_training_settings *link_settings) +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]) {struct dce110_link_encoder *enc110 =TO_DCE110_LINK_ENC (enc);union dpcd_training_lane_set training_lane_set = { {0 } };
@@ -1340,26 +1341,26 @@ void dce110_link_encoder_dp_set_lane_settings( cntl.action =TRANSMITTER_CONTROL_SET_VOLTAGE_AND_PREEMPASIS ; cntl.transmitter = enc110->base.transmitter; cntl.connector_obj_id = enc110->base.connector; - cntl.lanes_number = link_settings->link_settings.lane_count; + cntl.lanes_number = link_settings->lane_count; cntl.hpd_sel = enc110->base.hpd_source; - cntl.pixel_clock = link_settings->link_settings.link_rate * + cntl.pixel_clock = link_settings->link_rate *LINK_RATE_REF_FREQ_IN_KHZ ; -for (lane =0 ; lane < link_settings->link_settings.lane_count; lane++) { +for (lane =0 ; lane < link_settings->lane_count; lane++) {/* translate lane settings */ training_lane_set.bits.VOLTAGE_SWING_SET = - link_settings->lane_settings[lane].VOLTAGE_SWING; + lane_settings[lane].VOLTAGE_SWING; training_lane_set.bits.PRE_EMPHASIS_SET = - link_settings->lane_settings[lane].PRE_EMPHASIS; + lane_settings[lane].PRE_EMPHASIS;/* post cursor 2 setting only applies to HBR2 link rate */ -if (link_settings->link_settings.link_rate ==LINK_RATE_HIGH2 ) { +if (link_settings->link_rate ==LINK_RATE_HIGH2 ) {/* this is passed to VBIOS * to program post cursor 2 level */ training_lane_set.bits.POST_CURSOR2_SET = - link_settings->lane_settings[lane].POST_CURSOR2; + lane_settings[lane].POST_CURSOR2; } cntl.lane_select = lane;
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +2 -1
@@ -279,7 +279,8 @@ void dce110_link_encoder_disable_output(/* set DP lane settings */ void dce110_link_encoder_dp_set_lane_settings (struct link_encoder *enc, -const struct link_training_settings *link_settings); +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]); void dce110_link_encoder_dp_set_phy_pattern( struct link_encoder *enc,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +9 -8
@@ -1101,7 +1101,8 @@ void dcn10_link_encoder_disable_output(void dcn10_link_encoder_dp_set_lane_settings (struct link_encoder *enc, -const struct link_training_settings *link_settings) +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]) {struct dcn10_link_encoder *enc10 =TO_DCN10_LINK_ENC (enc);union dpcd_training_lane_set training_lane_set = { {0 } };
@@ -1116,26 +1117,26 @@ void dcn10_link_encoder_dp_set_lane_settings( cntl.action =TRANSMITTER_CONTROL_SET_VOLTAGE_AND_PREEMPASIS ; cntl.transmitter = enc10->base.transmitter; cntl.connector_obj_id = enc10->base.connector; - cntl.lanes_number = link_settings->link_settings.lane_count; + cntl.lanes_number = link_settings->lane_count; cntl.hpd_sel = enc10->base.hpd_source; - cntl.pixel_clock = link_settings->link_settings.link_rate * + cntl.pixel_clock = link_settings->link_rate *LINK_RATE_REF_FREQ_IN_KHZ ;LINK_RATE_REF_FREQ_IN_KHZ ; -for (lane =0 ; lane < link_settings->link_settings.lane_count; lane++) { +for (lane =0 ; lane < link_settings->lane_count; lane++) {/* translate lane settings */ training_lane_set.bits.VOLTAGE_SWING_SET = - link_settings->lane_settings[lane].VOLTAGE_SWING; + lane_settings[lane].VOLTAGE_SWING; training_lane_set.bits.PRE_EMPHASIS_SET = - link_settings->lane_settings[lane].PRE_EMPHASIS; + lane_settings[lane].PRE_EMPHASIS;/* post cursor 2 setting only applies to HBR2 link rate */ -if (link_settings->link_settings.link_rate ==LINK_RATE_HIGH2 ) { +if (link_settings->link_rate ==LINK_RATE_HIGH2 ) {/* this is passed to VBIOS * to program post cursor 2 level */ training_lane_set.bits.POST_CURSOR2_SET = - link_settings->lane_settings[lane].POST_CURSOR2; + lane_settings[lane].POST_CURSOR2; } cntl.lane_select = lane;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.h +2 -1
@@ -581,7 +581,8 @@ void dcn10_link_encoder_disable_output(/* set DP lane settings */ void dcn10_link_encoder_dp_set_lane_settings (struct link_encoder *enc, -const struct link_training_settings *link_settings); +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]); void dcn10_link_encoder_dp_set_phy_pattern( struct link_encoder *enc,
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +2 -1
@@ -162,7 +162,8 @@ struct link_encoder_funcs {void (*disable_output)(struct link_encoder *link_enc,enum signal_type signal);void (*dp_set_lane_settings)(struct link_encoder *enc, -const struct link_training_settings *link_settings); +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]);void (*dp_set_phy_pattern)(struct link_encoder *enc,const struct encoder_set_dp_phy_pattern_param *para); void (*update_mst_stream_allocation_table)(
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +4 -0
@@ -97,6 +97,10 @@ struct link_hwss_ext {void (*set_dp_link_test_pattern)(struct dc_link *link,const struct link_resource *link_res,struct encoder_set_dp_phy_pattern_param *tp_params); +void (*set_dp_lane_settings)(struct dc_link *link, +const struct link_resource *link_res, +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]); };struct link_hwss {
drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c +2 -1
@@ -63,7 +63,8 @@ static void virtual_link_encoder_disable_output(static void virtual_link_encoder_dp_set_lane_settings (struct link_encoder *enc, -const struct link_training_settings *link_settings) {} +const struct dc_link_settings *link_settings, +const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX ]) {} static void virtual_link_encoder_dp_set_phy_pattern( struct link_encoder *enc,
Signature · 1 line
2.34.1
PATCH 11/17 drm/amd/display: temporarly move non link_hwss code to dc_link_dp
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Clean up dc_link_hwss file in the preparation of breaking it down to file for each encoder type. We temporarly move the original dp link functions in link_hwss back to dc_link_dp. We will break dc_link_dp down after link_hwss is in good shape.
--- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 613 ++++++++++++++++ .../drm/amd/display/dc/core/dc_link_hwss.c | 653 +----------------- drivers/gpu/drm/amd/display/dc/dc_link.h | 4 +- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 1 + .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 40 ++ .../gpu/drm/amd/display/dc/inc/link_dpcd.h | 2 +- .../gpu/drm/amd/display/dc/inc/link_hwss.h | 56 +- 7 files changed, 682 insertions(+), 687 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +613 -0
@@ -27,6 +27,7 @@#include "dm_helpers.h" #include "opp.h" #include "dsc.h" +#include "clk_mgr.h" #include "resource.h" #include "inc/core_types.h"
@@ -6713,3 +6714,615 @@ void dc_link_dp_clear_rx_status(struct dc_link *link) {memset (&link->dprx_status,0 ,sizeof (link->dprx_status)); } + +void dp_receiver_power_ctrl (struct dc_link *link,bool on) +{ +uint8_t state; + + state = on ?DP_POWER_STATE_D0 :DP_POWER_STATE_D3 ; + +if (link->sync_lt_in_progress) +return ; + +core_link_write_dpcd (link,DP_SET_POWER , &state, +sizeof (state)); + +} + +void dp_source_sequence_trace (struct dc_link *link,uint8_t dp_test_mode) +{ +if (link !=NULL && link->dc->debug.enable_driver_sequence_debug) +core_link_write_dpcd (link,DP_SOURCE_SEQUENCE , + &dp_test_mode,sizeof (dp_test_mode)); +} + + +static uint8_t convert_to_count (uint8_t lttpr_repeater_count) +{ +switch (lttpr_repeater_count) { +case 0x80 :// 1 lttpr repeater +return 1 ; +case 0x40 :// 2 lttpr repeaters +return 2 ; +case 0x20 :// 3 lttpr repeaters +return 3 ; +case 0x10 :// 4 lttpr repeaters +return 4 ; +case 0x08 :// 5 lttpr repeaters +return 5 ; +case 0x04 :// 6 lttpr repeaters +return 6 ; +case 0x02 :// 7 lttpr repeaters +return 7 ; +case 0x01 :// 8 lttpr repeaters +return 8 ; +default : +break ; + } +return 0 ;// invalid value +} + +static inline bool is_immediate_downstream (struct dc_link *link,uint32_t offset) +{ +return (convert_to_count (link->dpcd_caps.lttpr_caps.phy_repeater_cnt) == offset); +} + +void dp_enable_link_phy ( +struct dc_link *link, +const struct link_resource *link_res, +enum signal_type signal, +enum clock_source_id clock_source, +const struct dc_link_settings *link_settings) +{ +struct dc *dc = link->ctx->dc; +struct dmcu *dmcu = dc->res_pool->dmcu; +struct pipe_ctx *pipes = + link->dc->current_state->res_ctx.pipe_ctx; +struct clock_source *dp_cs = + link->dc->res_pool->dp_clock_source; +const struct link_hwss *link_hwss =get_link_hwss (link, link_res); +unsigned int i; + +if (link->connector_signal ==SIGNAL_TYPE_EDP ) { + link->dc->hwss.edp_power_control (link, true); + link->dc->hwss.edp_wait_for_hpd_ready (link, true); + } + +/* If the current pixel clock source is not DTO(happens after +* switching from HDMI passive dongle to DP on the same connector), +* switch the pixel clock source to DTO. +*/ +for (i =0 ; i <MAX_PIPES ; i++) { +if (pipes[i].stream !=NULL && + pipes[i].stream->link == link) { +if (pipes[i].clock_source !=NULL && + pipes[i].clock_source->id !=CLOCK_SOURCE_ID_DP_DTO ) { + pipes[i].clock_source = dp_cs; + pipes[i].stream_res.pix_clk_params.requested_pix_clk_100hz = + pipes[i].stream->timing.pix_clk_100hz; + pipes[i].clock_source->funcs->program_pix_clk ( + pipes[i].clock_source, + &pipes[i].stream_res.pix_clk_params, + &pipes[i].pll_settings); + } + } + } + + link->cur_link_settings = *link_settings; + +if (dp_get_link_encoding_format (link_settings) == DP_8b_10b_ENCODING) { +if (dc->clk_mgr->funcs->notify_link_rate_change) + dc->clk_mgr->funcs->notify_link_rate_change (dc->clk_mgr, link); + } + +if (dmcu !=NULL && dmcu->funcs->lock_phy) + dmcu->funcs->lock_phy (dmcu); + +if (link_hwss->ext.enable_dp_link_output) + link_hwss->ext.enable_dp_link_output (link, link_res, signal, + clock_source, link_settings); + +if (dmcu !=NULL && dmcu->funcs->unlock_phy) + dmcu->funcs->unlock_phy (dmcu); + +dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_ENABLE_LINK_PHY ); +dp_receiver_power_ctrl (link, true); +} + +void edp_add_delay_for_T9 (struct dc_link *link) +{ +if (link->local_sink && + link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off >0 ) +udelay (link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off *1000 ); +} + +bool edp_receiver_ready_T9 (struct dc_link *link) +{ +unsigned int tries =0 ; +unsigned char sinkstatus =0 ; +unsigned char edpRev =0 ; +enum dc_status result =DC_OK ; + result =core_link_read_dpcd (link,DP_EDP_DPCD_REV , &edpRev,sizeof (edpRev)); + +/* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/ +if (result ==DC_OK && edpRev >=DP_EDP_12 ) { +do { + sinkstatus =1 ; + result =core_link_read_dpcd (link,DP_SINK_STATUS , &sinkstatus,sizeof (sinkstatus)); +if (sinkstatus ==0 ) +break ; +if (result !=DC_OK ) +break ; +udelay (100 );//MAx T9 + }while (++tries <50 ); + } + +return result; +} +bool edp_receiver_ready_T7 (struct dc_link *link) +{ +unsigned char sinkstatus =0 ; +unsigned char edpRev =0 ; +enum dc_status result =DC_OK ; + +/* use absolute time stamp to constrain max T7*/ +unsigned long long enter_timestamp =0 ; +unsigned long long finish_timestamp =0 ; +unsigned long long time_taken_in_ns =0 ; + + result =core_link_read_dpcd (link,DP_EDP_DPCD_REV , &edpRev,sizeof (edpRev)); + +if (result ==DC_OK && edpRev >=DP_EDP_12 ) { +/* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/ + enter_timestamp =dm_get_timestamp (link->ctx); +do { + sinkstatus =0 ; + result =core_link_read_dpcd (link,DP_SINK_STATUS , &sinkstatus,sizeof (sinkstatus)); +if (sinkstatus ==1 ) +break ; +if (result !=DC_OK ) +break ; +udelay (25 ); + finish_timestamp =dm_get_timestamp (link->ctx); + time_taken_in_ns =dm_get_elapse_time_in_ns (link->ctx, finish_timestamp, enter_timestamp); + }while (time_taken_in_ns <50 *1000000 );//MAx T7 is 50ms + } + +if (link->local_sink && + link->local_sink->edid_caps.panel_patch.extra_t7_ms >0 ) +udelay (link->local_sink->edid_caps.panel_patch.extra_t7_ms *1000 ); + +return result; +} + +void dp_disable_link_phy (struct dc_link *link,const struct link_resource *link_res, +enum signal_type signal) +{ +struct dc *dc = link->ctx->dc; +struct dmcu *dmcu = dc->res_pool->dmcu; +const struct link_hwss *link_hwss =get_link_hwss (link, link_res); + +if (!link->wa_flags.dp_keep_receiver_powered) +dp_receiver_power_ctrl (link, false); + +if (signal ==SIGNAL_TYPE_EDP ) { +if (link->dc->hwss.edp_backlight_control) + link->dc->hwss.edp_backlight_control (link, false); +if (link_hwss->ext.disable_dp_link_output) + link_hwss->ext.disable_dp_link_output (link, link_res, signal); + link->dc->hwss.edp_power_control (link, false); + }else { +if (dmcu !=NULL && dmcu->funcs->lock_phy) + dmcu->funcs->lock_phy (dmcu); +if (link_hwss->ext.disable_dp_link_output) + link_hwss->ext.disable_dp_link_output (link, link_res, signal); +if (dmcu !=NULL && dmcu->funcs->unlock_phy) + dmcu->funcs->unlock_phy (dmcu); + } + +dp_source_sequence_trace (link,DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY ); + +/* Clear current link setting.*/ +memset (&link->cur_link_settings,0 , +sizeof (link->cur_link_settings)); + +if (dc->clk_mgr->funcs->notify_link_rate_change) + dc->clk_mgr->funcs->notify_link_rate_change (dc->clk_mgr, link); +} + +void dp_disable_link_phy_mst (struct dc_link *link,const struct link_resource *link_res, +enum signal_type signal) +{ +/* MST disable link only when no stream use the link */ +if (link->mst_stream_alloc_table.stream_count >0 ) +return ; + +dp_disable_link_phy (link, link_res, signal); + +/* set the sink to SST mode after disabling the link */ +dp_enable_mst_on_sink (link, false); +} + +bool dp_set_hw_training_pattern ( +struct dc_link *link, +const struct link_resource *link_res, +enum dc_dp_training_pattern pattern, +uint32_t offset) +{ +enum dp_test_pattern test_pattern =DP_TEST_PATTERN_UNSUPPORTED ; + +switch (pattern) { +case DP_TRAINING_PATTERN_SEQUENCE_1 : + test_pattern =DP_TEST_PATTERN_TRAINING_PATTERN1 ; +break ; +case DP_TRAINING_PATTERN_SEQUENCE_2 : + test_pattern =DP_TEST_PATTERN_TRAINING_PATTERN2 ; +break ; +case DP_TRAINING_PATTERN_SEQUENCE_3 : + test_pattern =DP_TEST_PATTERN_TRAINING_PATTERN3 ; +break ; +case DP_TRAINING_PATTERN_SEQUENCE_4 : + test_pattern =DP_TEST_PATTERN_TRAINING_PATTERN4 ; +break ; +case DP_128b_132b_TPS1: + test_pattern = DP_TEST_PATTERN_128b_132b_TPS1_TRAINING_MODE; +break ; +case DP_128b_132b_TPS2: + test_pattern = DP_TEST_PATTERN_128b_132b_TPS2_TRAINING_MODE; +break ; +default : +break ; + } + +dp_set_hw_test_pattern (link, link_res, test_pattern,NULL ,0 ); + +return true; +} + +void dp_set_hw_lane_settings ( +struct dc_link *link, +const struct link_resource *link_res, +const struct link_training_settings *link_settings, +uint32_t offset) +{ +const struct link_hwss *link_hwss =get_link_hwss (link, link_res); + +if ((link->lttpr_mode ==LTTPR_MODE_NON_TRANSPARENT ) && !is_immediate_downstream (link, offset)) +return ; + +if (link_hwss->ext.set_dp_lane_settings) + link_hwss->ext.set_dp_lane_settings (link, link_res, + &link_settings->link_settings, + link_settings->hw_lane_settings); + +memmove (link->cur_lane_setting, + link_settings->hw_lane_settings, +sizeof (link->cur_lane_setting)); +} + +void dp_set_hw_test_pattern ( +struct dc_link *link, +const struct link_resource *link_res, +enum dp_test_pattern test_pattern, +uint8_t *custom_pattern, +uint32_t custom_pattern_size) +{ +const struct link_hwss *link_hwss =get_link_hwss (link, link_res); +struct encoder_set_dp_phy_pattern_param pattern_param = {0 }; + + pattern_param.dp_phy_pattern = test_pattern; + pattern_param.custom_pattern = custom_pattern; + pattern_param.custom_pattern_size = custom_pattern_size; + pattern_param.dp_panel_mode =dp_get_panel_mode (link); + +if (link_hwss->ext.set_dp_link_test_pattern) + link_hwss->ext.set_dp_link_test_pattern (link, link_res, &pattern_param); +} + +void dp_retrain_link_dp_test (struct dc_link *link, +struct dc_link_settings *link_setting, +bool skip_video_pattern) +{ +struct pipe_ctx *pipes = + &link->dc->current_state->res_ctx.pipe_ctx[0 ]; +unsigned int i; + + +for (i =0 ; i <MAX_PIPES ; i++) { +if (pipes[i].stream !=NULL && + !pipes[i].top_pipe && !pipes[i].prev_odm_pipe && + pipes[i].stream->link !=NULL && + pipes[i].stream_res.stream_enc !=NULL && + pipes[i].stream->link == link) { +udelay (100 ); + + pipes[i].stream_res.stream_enc->funcs->dp_blank (link, + pipes[i].stream_res.stream_enc); + +/* disable any test pattern that might be active */ +dp_set_hw_test_pattern (link, &pipes[i].link_res, +DP_TEST_PATTERN_VIDEO_MODE ,NULL ,0 ); + +dp_receiver_power_ctrl (link, false); + + link->dc->hwss.disable_stream (&pipes[i]); +if ((&pipes[i])->stream_res.audio && !link->dc->debug.az_endpoint_mute_only) + (&pipes[i])->stream_res.audio->funcs->az_disable ((&pipes[i])->stream_res.audio); + +if (link->link_enc) + link->link_enc->funcs->disable_output ( + link->link_enc, +SIGNAL_TYPE_DISPLAY_PORT ); + +/* Clear current link setting. */ +memset (&link->cur_link_settings,0 , +sizeof (link->cur_link_settings)); + +perform_link_training_with_retries ( + link_setting, + skip_video_pattern, +LINK_TRAINING_ATTEMPTS , + &pipes[i], +SIGNAL_TYPE_DISPLAY_PORT , + false); + + link->dc->hwss.enable_stream (&pipes[i]); + + link->dc->hwss.unblank_stream (&pipes[i], + link_setting); + +if (pipes[i].stream_res.audio) { +/* notify audio driver for +* audio modes of monitor */ + pipes[i].stream_res.audio->funcs->az_enable ( + pipes[i].stream_res.audio); + +/* un-mute audio */ +/* TODO: audio should be per stream rather than +* per link */ + pipes[i].stream_res.stream_enc->funcs-> +audio_mute_control ( + pipes[i].stream_res.stream_enc, false); + } + } + } +} + +#undef DC_LOGGER +#define DC_LOGGER \ + dsc->ctx->logger +static void dsc_optc_config_log (struct display_stream_compressor *dsc, +struct dsc_optc_config *config) +{ +uint32_t precision =1 <<28 ; +uint32_t bytes_per_pixel_int = config->bytes_per_pixel / precision; +uint32_t bytes_per_pixel_mod = config->bytes_per_pixel % precision; +uint64_t ll_bytes_per_pix_fraq = bytes_per_pixel_mod; + +/* 7 fractional digits decimal precision for bytes per pixel is enough because DSC +* bits per pixel precision is 1/16th of a pixel, which means bytes per pixel precision is +* 1/16/8 = 1/128 of a byte, or 0.0078125 decimal +*/ + ll_bytes_per_pix_fraq *=10000000 ; + ll_bytes_per_pix_fraq /= precision; + +DC_LOG_DSC ("\tbytes_per_pixel 0x%08x (%d.%07d)" , + config->bytes_per_pixel, bytes_per_pixel_int, (uint32_t )ll_bytes_per_pix_fraq); +DC_LOG_DSC ("\tis_pixel_format_444 %d" , config->is_pixel_format_444); +DC_LOG_DSC ("\tslice_width %d" , config->slice_width); +} + +bool dp_set_dsc_on_rx (struct pipe_ctx *pipe_ctx,bool enable) +{ +struct dc *dc = pipe_ctx->stream->ctx->dc; +struct dc_stream_state *stream = pipe_ctx->stream; +bool result = false; + +if (dc_is_virtual_signal (stream->signal) ||IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) + result = true; +else + result =dm_helpers_dp_write_dsc_enable (dc->ctx, stream, enable); +return result; +} + +/* The stream with these settings can be sent (unblanked) only after DSC was enabled on RX first, +* i.e. after dp_enable_dsc_on_rx() had been called +*/ +void dp_set_dsc_on_stream (struct pipe_ctx *pipe_ctx,bool enable) +{ +struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; +struct dc *dc = pipe_ctx->stream->ctx->dc; +struct dc_stream_state *stream = pipe_ctx->stream; +struct pipe_ctx *odm_pipe; +int opp_cnt =1 ; + +for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) + opp_cnt++; + +if (enable) { +struct dsc_config dsc_cfg; +struct dsc_optc_config dsc_optc_cfg; +enum optc_dsc_mode optc_dsc_mode; + +/* Enable DSC hw block */ + dsc_cfg.pic_width = (stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt; + dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom; + dsc_cfg.pixel_encoding = stream->timing.pixel_encoding; + dsc_cfg.color_depth = stream->timing.display_color_depth; + dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false; + dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg; +ASSERT (dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt ==0 ); + dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt; + + dsc->funcs->dsc_set_config (dsc, &dsc_cfg, &dsc_optc_cfg); + dsc->funcs->dsc_enable (dsc, pipe_ctx->stream_res.opp->inst); +for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { +struct display_stream_compressor *odm_dsc = odm_pipe->stream_res.dsc; + + odm_dsc->funcs->dsc_set_config (odm_dsc, &dsc_cfg, &dsc_optc_cfg); + odm_dsc->funcs->dsc_enable (odm_dsc, odm_pipe->stream_res.opp->inst); + } + dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt; + dsc_cfg.pic_width *= opp_cnt; + + optc_dsc_mode = dsc_optc_cfg.is_pixel_format_444 ?OPTC_DSC_ENABLED_444 :OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED ; + +/* Enable DSC in encoder */ +if (dc_is_dp_signal (stream->signal) && !IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment) + && !is_dp_128b_132b_signal (pipe_ctx)) { +DC_LOG_DSC ("Setting stream encoder DSC config for engine %d:" , (int )pipe_ctx->stream_res.stream_enc->id); +dsc_optc_config_log (dsc, &dsc_optc_cfg); + pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config (pipe_ctx->stream_res.stream_enc, + optc_dsc_mode, + dsc_optc_cfg.bytes_per_pixel, + dsc_optc_cfg.slice_width); + +/* PPS SDP is set elsewhere because it has to be done after DIG FE is connected to DIG BE */ + } + +/* Enable DSC in OPTC */ +DC_LOG_DSC ("Setting optc DSC config for tg instance %d:" , pipe_ctx->stream_res.tg->inst); +dsc_optc_config_log (dsc, &dsc_optc_cfg); + pipe_ctx->stream_res.tg->funcs->set_dsc_config (pipe_ctx->stream_res.tg, + optc_dsc_mode, + dsc_optc_cfg.bytes_per_pixel, + dsc_optc_cfg.slice_width); + }else { +/* disable DSC in OPTC */ + pipe_ctx->stream_res.tg->funcs->set_dsc_config ( + pipe_ctx->stream_res.tg, +OPTC_DSC_DISABLED ,0 ,0 ); + +/* disable DSC in stream encoder */ +if (dc_is_dp_signal (stream->signal)) { +if (is_dp_128b_132b_signal (pipe_ctx)) + pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_set_dsc_pps_info_packet ( + pipe_ctx->stream_res.hpo_dp_stream_enc, + false, +NULL , + true); +else if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) { + pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config ( + pipe_ctx->stream_res.stream_enc, +OPTC_DSC_DISABLED ,0 ,0 ); + pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_pps_info_packet ( + pipe_ctx->stream_res.stream_enc, false,NULL , true); + } + } + +/* disable DSC block */ + pipe_ctx->stream_res.dsc->funcs->dsc_disable (pipe_ctx->stream_res.dsc); +for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) + odm_pipe->stream_res.dsc->funcs->dsc_disable (odm_pipe->stream_res.dsc); + } +} + +bool dp_set_dsc_enable (struct pipe_ctx *pipe_ctx,bool enable) +{ +struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; +bool result = false; + +if (!pipe_ctx->stream->timing.flags.DSC) + goto out; +if (!dsc) + goto out; + +if (enable) { + { +dp_set_dsc_on_stream (pipe_ctx, true); + result = true; + } + }else { +dp_set_dsc_on_rx (pipe_ctx, false); +dp_set_dsc_on_stream (pipe_ctx, false); + result = true; + } +out: +return result; +} + +/* +* For dynamic bpp change case, dsc is programmed with MASTER_UPDATE_LOCK enabled; +* hence PPS info packet update need to use frame update instead of immediate update. +* Added parameter immediate_update for this purpose. +* The decision to use frame update is hard-coded in function dp_update_dsc_config(), +* which is the only place where a "false" would be passed in for param immediate_update. +* +* immediate_update is only applicable when DSC is enabled. +*/ +bool dp_set_dsc_pps_sdp (struct pipe_ctx *pipe_ctx,bool enable,bool immediate_update) +{ +struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; +struct dc_stream_state *stream = pipe_ctx->stream; + +if (!pipe_ctx->stream->timing.flags.DSC || !dsc) +return false; + +if (enable) { +struct dsc_config dsc_cfg; +uint8_t dsc_packed_pps[128 ]; + +memset (&dsc_cfg,0 ,sizeof (dsc_cfg)); +memset (dsc_packed_pps,0 ,128 ); + +/* Enable DSC hw block */ + dsc_cfg.pic_width = stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right; + dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom; + dsc_cfg.pixel_encoding = stream->timing.pixel_encoding; + dsc_cfg.color_depth = stream->timing.display_color_depth; + dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false; + dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg; + +DC_LOG_DSC (" " ); + dsc->funcs->dsc_get_packed_pps (dsc, &dsc_cfg, &dsc_packed_pps[0 ]); +if (dc_is_dp_signal (stream->signal)) { +DC_LOG_DSC ("Setting stream encoder DSC PPS SDP for engine %d\n" , (int )pipe_ctx->stream_res.stream_enc->id); +if (is_dp_128b_132b_signal (pipe_ctx)) + pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_set_dsc_pps_info_packet ( + pipe_ctx->stream_res.hpo_dp_stream_enc, + true, + &dsc_packed_pps[0 ], + immediate_update); +else + pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_pps_info_packet ( + pipe_ctx->stream_res.stream_enc, + true, + &dsc_packed_pps[0 ], + immediate_update); + } + }else { +/* disable DSC PPS in stream encoder */ +if (dc_is_dp_signal (stream->signal)) { +if (is_dp_128b_132b_signal (pipe_ctx)) + pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_set_dsc_pps_info_packet ( + pipe_ctx->stream_res.hpo_dp_stream_enc, + false, +NULL , + true); +else + pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_pps_info_packet ( + pipe_ctx->stream_res.stream_enc, false,NULL , true); + } + } + +return true; +} + + +bool dp_update_dsc_config (struct pipe_ctx *pipe_ctx) +{ +struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; + +if (!pipe_ctx->stream->timing.flags.DSC) +return false; +if (!dsc) +return false; + +dp_set_dsc_on_stream (pipe_ctx, true); +dp_set_dsc_pps_sdp (pipe_ctx, true, false); +return true; +} + +#undef DC_LOGGER +#define DC_LOGGER \ + link->ctx->logger
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +15 -638
680 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_link.h +3 -1
@@ -465,6 +465,8 @@ void dc_link_get_cur_link_res(const struct dc_link *link,void dc_get_cur_link_res_map (const struct dc *dc,uint32_t *map);/* restore link resource allocation state from a snapshot */ void dc_restore_link_res_map (const struct dc *dc,uint32_t *map); -void dc_link_dp_clear_rx_status (struct dc_link *link); +struct gpio *get_hpd_gpio (struct dc_bios *dcb, +struct graphics_object_id link_id, +struct gpio_service *gpio_service);#endif /* DC_LINK_H_ */
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +1 -0
@@ -55,6 +55,7 @@#include "inc/link_dpcd.h" #include "dpcd_defs.h" #include "inc/link_enc_cfg.h" +#include "link_hwss.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +40 -0
@@ -218,4 +218,44 @@ bool is_dp_128b_132b_signal(struct pipe_ctx *pipe_ctx);bool dp_retrieve_lttpr_cap (struct dc_link *link);void edp_panel_backlight_power_on (struct dc_link *link); +void dp_receiver_power_ctrl (struct dc_link *link,bool on); +void dp_source_sequence_trace (struct dc_link *link,uint8_t dp_test_mode); +void dp_enable_link_phy ( +struct dc_link *link, +const struct link_resource *link_res, +enum signal_type signal, +enum clock_source_id clock_source, +const struct dc_link_settings *link_settings); +void edp_add_delay_for_T9 (struct dc_link *link); +bool edp_receiver_ready_T9 (struct dc_link *link); +bool edp_receiver_ready_T7 (struct dc_link *link); + +void dp_disable_link_phy (struct dc_link *link,const struct link_resource *link_res, +enum signal_type signal); + +void dp_disable_link_phy_mst (struct dc_link *link,const struct link_resource *link_res, +enum signal_type signal); + +bool dp_set_hw_training_pattern ( +struct dc_link *link, +const struct link_resource *link_res, +enum dc_dp_training_pattern pattern, +uint32_t offset); + +void dp_set_hw_lane_settings ( +struct dc_link *link, +const struct link_resource *link_res, +const struct link_training_settings *link_settings, +uint32_t offset); + +void dp_set_hw_test_pattern ( +struct dc_link *link, +const struct link_resource *link_res, +enum dp_test_pattern test_pattern, +uint8_t *custom_pattern, +uint32_t custom_pattern_size); + +void dp_retrain_link_dp_test (struct dc_link *link, +struct dc_link_settings *link_setting, +bool skip_video_pattern);#endif /* __DC_LINK_DP_H__ */
drivers/gpu/drm/amd/display/dc/inc/link_dpcd.h +1 -1
@@ -27,7 +27,7 @@#define __LINK_DPCD_H__#include <inc/core_status.h> #include <dc_link.h> -#include <inc/link_hwss.h> +#include <dc_link_dp.h> enum dc_status core_link_read_dpcd( struct dc_link *link,
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +9 -47
65 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 12/17 drm/amd/display: move get_link_hwss to dc_resource
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Isolate the way to obtain link_hwss from the actual implemenation of link_hwss. So the caller can call link_hwss without knowing the implementation detail of link_hwss.
--- .../drm/amd/display/dc/core/dc_link_hwss.c | 51 ++++++++++++------- .../gpu/drm/amd/display/dc/core/dc_resource.c | 33 ++++++++++++ .../gpu/drm/amd/display/dc/inc/link_hwss.h | 17 ++++++- drivers/gpu/drm/amd/display/dc/inc/resource.h | 3 ++ 4 files changed, 85 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +33 -18
@@ -29,12 +29,6 @@ static void virtual_setup_stream_encoder(struct pipe_ctx *pipe_ctx);static void virtual_reset_stream_encoder (struct pipe_ctx *pipe_ctx);/************************* below goes to dio_link_hwss ************************/ -static bool can_use_dio_link_hwss (const struct dc_link *link, -const struct link_resource *link_res) -{ -return link->link_enc !=NULL ; -} -static void set_dio_throttled_vcp_size (struct pipe_ctx *pipe_ctx,struct fixed31_32 throttled_vcp_size) {
@@ -135,14 +129,19 @@ static const struct link_hwss dio_link_hwss = { }, }; -/*********************** below goes to hpo_dp_link_hwss ***********************/ -static bool can_use_dp_hpo_link_hwss (const struct dc_link *link, +bool can_use_dio_link_hwss (const struct dc_link *link,const struct link_resource *link_res) { -return link_res->hpo_dp_link_enc !=NULL ; +return link->link_enc !=NULL ; } -static void set_dp_hpo_throttled_vcp_size (struct pipe_ctx *pipe_ctx, +const struct link_hwss *get_dio_link_hwss (void ) +{ +return &dio_link_hwss; +} + +/*********************** below goes to hpo_dp_link_hwss ***********************/ +static void set_hpo_dp_throttled_vcp_size (struct pipe_ctx *pipe_ctx,struct fixed31_32 throttled_vcp_size) { struct hpo_dp_stream_encoder *hpo_dp_stream_encoder =
@@ -155,7 +154,7 @@ static void set_dp_hpo_throttled_vcp_size(struct pipe_ctx *pipe_ctx, throttled_vcp_size); } -static void set_dp_hpo_hblank_min_symbol_width (struct pipe_ctx *pipe_ctx, +static void set_hpo_dp_hblank_min_symbol_width (struct pipe_ctx *pipe_ctx,const struct dc_link_settings *link_settings,struct fixed31_32 throttled_vcp_size) {
@@ -328,22 +327,27 @@ static const struct link_hwss hpo_dp_link_hwss = { .setup_stream_encoder = setup_hpo_dp_stream_encoder, .reset_stream_encoder = reset_hpo_dp_stream_encoder, .ext = { - .set_throttled_vcp_size = set_dp_hpo_throttled_vcp_size, - .set_hblank_min_symbol_width = set_dp_hpo_hblank_min_symbol_width, + .set_throttled_vcp_size = set_hpo_dp_throttled_vcp_size, + .set_hblank_min_symbol_width = set_hpo_dp_hblank_min_symbol_width, .enable_dp_link_output = enable_hpo_dp_link_output, .disable_dp_link_output = disable_hpo_dp_link_output, .set_dp_link_test_pattern = set_hpo_dp_link_test_pattern, .set_dp_lane_settings = set_hpo_dp_lane_settings, }, }; -/*********************** below goes to dpia_link_hwss *************************/ -static bool can_use_dpia_link_hwss (const struct dc_link *link, + +bool can_use_hpo_dp_link_hwss (const struct dc_link *link,const struct link_resource *link_res) { -return link->is_dig_mapping_flexible && - link->dc->res_pool->funcs->link_encs_assign; +return link_res->hpo_dp_link_enc !=NULL ; } +const struct link_hwss *get_hpo_dp_link_hwss (void ) +{ +return &hpo_dp_link_hwss; +} + +/*********************** below goes to dpia_link_hwss *************************/ static const struct link_hwss dpia_link_hwss = { .setup_stream_encoder = setup_dio_stream_encoder, .reset_stream_encoder = reset_dio_stream_encoder,
@@ -356,7 +360,18 @@ static const struct link_hwss dpia_link_hwss = { }, }; -/*********************** below goes to link_hwss ******************************/ +bool can_use_dpia_link_hwss (const struct dc_link *link, +const struct link_resource *link_res) +{ +return link->is_dig_mapping_flexible && + link->dc->res_pool->funcs->link_encs_assign; +} + +const struct link_hwss *get_dpia_link_hwss (void ) +{ +return &dpia_link_hwss; +} +/*********************** below goes to virtual_link_hwss ******************************/ static void virtual_setup_stream_encoder (struct pipe_ctx *pipe_ctx) { }
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +33 -0
@@ -3310,3 +3310,36 @@ uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter tr#endif return phy_idx; } + +const struct link_hwss *get_link_hwss (const struct dc_link *link, +const struct link_resource *link_res) +{ +/* Link_hwss is only accessible by getter function instead of accessing +* by pointers in dc with the intent to protect against breaking polymorphism. +*/ +if (can_use_hpo_dp_link_hwss (link, link_res)) +/* TODO: some assumes that if decided link settings is 128b/132b +* channel coding format hpo_dp_link_enc should be used. +* Others believe that if hpo_dp_link_enc is available in link +* resource then hpo_dp_link_enc must be used. This bound between +* hpo_dp_link_enc != NULL and decided link settings is loosely coupled +* with a premise that both hpo_dp_link_enc pointer and decided link +* settings are determined based on single policy function like +* "decide_link_settings" from upper layer. This "convention" +* cannot be maintained and enforced at current level. +* Therefore a refactor is due so we can enforce a strong bound +* between those two parameters at this level. +* +* To put it simple, we want to make enforcement at low level so that +* we will not return link hwss if caller plans to do 8b/10b +* with an hpo encoder. Or we can return a very dummy one that doesn't +* do work for all functions +*/ +return get_hpo_dp_link_hwss (); +else if (can_use_dpia_link_hwss (link, link_res)) +return get_dpia_link_hwss (); +else if (can_use_dio_link_hwss (link, link_res)) +return get_dio_link_hwss (); +else +return get_virtual_link_hwss (); +}
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +16 -1
@@ -75,6 +75,21 @@ struct link_hwss { void (*reset_stream_encoder)(struct pipe_ctx *pipe_ctx); }; -const struct link_hwss *get_link_hwss (const struct dc_link *link,const struct link_resource *link_res); + +/*********************** below goes to virtual_link_hwss **********************/ +const struct link_hwss *get_virtual_link_hwss (void ); +/*********************** below goes to dpia_link_hwss *************************/ +bool can_use_dpia_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); +const struct link_hwss *get_dpia_link_hwss (void ); +/*********************** below goes to hpo_dp_link_hwss ***********************/ +bool can_use_hpo_dp_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); +const struct link_hwss *get_hpo_dp_link_hwss (void ); +/************************* below goes to dio_link_hwss ************************/ +bool can_use_dio_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); +const struct link_hwss *get_dio_link_hwss (void );#endif /* __DC_LINK_HWSS_H__ */ +
drivers/gpu/drm/amd/display/dc/inc/resource.h +3 -0
@@ -214,4 +214,7 @@ void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc,uint8_t resource_transmitter_to_phy_idx (const struct dc *dc,enum transmitter transmitter); +const struct link_hwss *get_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); +#endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */
Signature · 1 line
2.34.1
PATCH 13/17 drm/amd/display: move link_hwss to link folder and break down to files
In reply to Stylon WangFrom: Wenjing Liu <[email protected]>
[why]
Move link_hwss to its own folder as part of DC LIB and break it down to separate file one for each type of backend for code isolation.
---
drivers/gpu/drm/amd/display/dc/Makefile | 4 +-
.../gpu/drm/amd/display/dc/core/dc_link_dp.c | 1 +
.../gpu/drm/amd/display/dc/core/dc_resource.c | 4 +
.../gpu/drm/amd/display/dc/inc/core_types.h | 1 +
.../gpu/drm/amd/display/dc/inc/link_hwss.h | 18 --
drivers/gpu/drm/amd/display/dc/link/Makefile | 30 +++
.../drm/amd/display/dc/link/link_hwss_dio.c | 137 +++++++++++
.../drm/amd/display/dc/link/link_hwss_dio.h | 53 +++++
.../drm/amd/display/dc/link/link_hwss_dpia.c | 51 +++++
.../drm/amd/display/dc/link/link_hwss_dpia.h | 34 +++
.../link_hwss_hpo_dp.c} | 213 ++----------------
.../amd/display/dc/link/link_hwss_hpo_dp.h | 35 +++
.../amd/display/dc/link/link_hwss_hpo_frl.c | 43 ++++
.../amd/display/dc/link/link_hwss_hpo_frl.h | 34 +++
.../gpu/drm/amd/display/dc/virtual/Makefile | 2 +-
.../display/dc/virtual/virtual_link_hwss.c | 43 ++++
.../display/dc/virtual/virtual_link_hwss.h | 34 +++
17 files changed, 528 insertions(+), 209 deletions(-)
create mode 100644 drivers/gpu/drm/amd/display/dc/link/Makefile
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.c
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.h
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.c
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.h
rename drivers/gpu/drm/amd/display/dc/{core/dc_link_hwss.c => link/link_hwss_hpo_dp.c} (54%)
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.h
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.c
create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.h
create mode 100644 drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.c
create mode 100644 drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.hdrivers/gpu/drm/amd/display/dc/Makefile +2 -2
@@ -23,7 +23,7 @@ # Makefile for Display Core (dc) component. # -DC_LIBS = basics bios clk_mgr dce dml gpio irq virtual +DC_LIBS = basics bios dml clk_mgr dce gpio irq link virtual ifdef CONFIG_DRM_AMD_DC_DCN DC_LIBS += dcn20
@@ -58,7 +58,7 @@ AMD_DC = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/dc/,$(DC_LI include $(AMD_DC) DISPLAY_CORE = dc.o dc_stat.o dc_link.o dc_resource.o dc_hw_sequencer.o dc_sink.o \ -dc_surface.o dc_link_hwss.o dc_link_dp.o dc_link_ddc.o dc_debug.o dc_stream.o \ +dc_surface.o dc_link_dp.o dc_link_ddc.o dc_debug.o dc_stream.o \ dc_link_enc_cfg.o dc_link_dpia.o dc_link_dpcd.o ifdef CONFIG_DRM_AMD_DC_DCN
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -0
@@ -6842,6 +6842,7 @@ bool edp_receiver_ready_T9(struct dc_link *link)unsigned char sinkstatus =0 ;unsigned char edpRev =0 ;enum dc_status result =DC_OK ; + result =core_link_read_dpcd (link,DP_EDP_DPCD_REV , &edpRev,sizeof (edpRev));/* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
@@ -43,6 +43,10 @@#include "dpcd_defs.h" #include "link_enc_cfg.h" #include "dc_link_dp.h" +#include "virtual/virtual_link_hwss.h" +#include "link/link_hwss_dio.h" +#include "link/link_hwss_dpia.h" +#include "link/link_hwss_hpo_dp.h" #if defined(CONFIG_DRM_AMD_DC_SI )#include "dce60/dce60_resource.h"
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -0
@@ -54,6 +54,7 @@ void enable_surface_flip_reporting(struct dc_plane_state *plane_state,#ifdef CONFIG_DRM_AMD_DC_HDCP #include "dm_cp_psp.h" #endif +#include "link_hwss.h" /************ link *****************/ struct link_init_data {
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +0 -18
@@ -27,7 +27,6 @@#define __DC_LINK_HWSS_H__/* include basic type headers only */ -#include "os_types.h" #include "dc_dp_types.h" #include "signal_types.h" #include "grph_object_id.h"
@@ -74,22 +73,5 @@ struct link_hwss {void (*setup_stream_encoder)(struct pipe_ctx *pipe_ctx); void (*reset_stream_encoder)(struct pipe_ctx *pipe_ctx); }; - - -/*********************** below goes to virtual_link_hwss **********************/ -const struct link_hwss *get_virtual_link_hwss (void ); -/*********************** below goes to dpia_link_hwss *************************/ -bool can_use_dpia_link_hwss (const struct dc_link *link, -const struct link_resource *link_res); -const struct link_hwss *get_dpia_link_hwss (void ); -/*********************** below goes to hpo_dp_link_hwss ***********************/ -bool can_use_hpo_dp_link_hwss (const struct dc_link *link, -const struct link_resource *link_res); -const struct link_hwss *get_hpo_dp_link_hwss (void ); -/************************* below goes to dio_link_hwss ************************/ -bool can_use_dio_link_hwss (const struct dc_link *link, -const struct link_resource *link_res); -const struct link_hwss *get_dio_link_hwss (void ); -#endif /* __DC_LINK_HWSS_H__ */
drivers/gpu/drm/amd/display/dc/link/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +# +# Copyright 2022 Advanced Micro Devices, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# Makefile for the link sub-component of DAL. +# It abstracts the control and status of back end pipe such as DIO, HPO, DPIA, +# PHY, HPD, DDC and etc). + +LINK = link_hwss_dio.o link_hwss_dpia.o link_hwss_hpo_dp.o + +AMD_DAL_LINK = $(addprefix $(AMDDALPATH)/dc/link/,$(LINK)) + +AMD_DISPLAY_FILES += $(AMD_DAL_LINK)
drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.c new file +137 -0
137 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/link/link_hwss_dio.h new file +53 -0
53 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.c new file +51 -0
51 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/link/link_hwss_dpia.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ +#ifndef __LINK_HWSS_DPIA_H__ +#define __LINK_HWSS_DPIA_H__ + +#include "link_hwss.h" + +const struct link_hwss *get_dpia_link_hwss (void ); +bool can_use_dpia_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); + +#endif /* __LINK_HWSS_DPIA_H__ */
drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.c renamed from drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +25 -188
228 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_dp.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ +#ifndef __LINK_HWSS_HPO_DP_H__ +#define __LINK_HWSS_HPO_DP_H__ + +#include "link_hwss.h" + +bool can_use_hpo_dp_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); +const struct link_hwss *get_hpo_dp_link_hwss (void ); + + +#endif /* __LINK_HWSS_HPO_DP_H__ */
drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.c new file +43 -0
43 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/link/link_hwss_hpo_frl.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ +#ifndef __LINK_HWSS_HPO_FRL_H__ +#define __LINK_HWSS_HPO_FRL_H__ + +#include "link_hwss.h" + +bool can_use_hpo_frl_link_hwss (const struct dc_link *link, +const struct link_resource *link_res); +const struct link_hwss *get_hpo_frl_link_hwss (void ); + +#endif /* __LINK_HWSS_HPO_FRL_H__ */
drivers/gpu/drm/amd/display/dc/virtual/Makefile +1 -1
@@ -23,7 +23,7 @@ # Makefile for the virtual sub-component of DAL. # It provides the control and status of HW CRTC block. -VIRTUAL = virtual_link_encoder.o virtual_stream_encoder.o +VIRTUAL = virtual_link_encoder.o virtual_stream_encoder.o virtual_link_hwss.o AMD_DAL_VIRTUAL = $(addprefix $(AMDDALPATH)/dc/virtual/,$(VIRTUAL))
drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.c new file +43 -0
43 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/virtual/virtual_link_hwss.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ +#ifndef __DC_VIRTUAL_LINK_HWSS_H__ +#define __DC_VIRTUAL_LINK_HWSS_H__ + +#include "core_types.h" + +void virtual_setup_stream_encoder (struct pipe_ctx *pipe_ctx); +void virtual_reset_stream_encoder (struct pipe_ctx *pipe_ctx); +const struct link_hwss *get_virtual_link_hwss (void ); + +#endif /* __DC_VIRTUAL_LINK_HWSS_H__ */
Signature · 1 line
2.34.1
PATCH 14/17 drm/amd/display: [FW Promotion] Release 0.0.102.0
In reply to Stylon WangFrom: Anthony Koo <[email protected]>
- Correct number of reserved bits in cmd_lock_hw
- Extend bits of hw_lock_client to allow for more clients
--- drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +4 -4
@@ -47,10 +47,10 @@/* Firmware versioning. */ #ifdef DMUB_EXPOSE_VERSION -#define DMUB_FW_VERSION_GIT_HASH 0x1288a7b7 +#define DMUB_FW_VERSION_GIT_HASH 0xab0ae3c8#define DMUB_FW_VERSION_MAJOR 0#define DMUB_FW_VERSION_MINOR 0 -#define DMUB_FW_VERSION_REVISION 101 +#define DMUB_FW_VERSION_REVISION 102#define DMUB_FW_VERSION_TEST 0#define DMUB_FW_VERSION_VBIOS 0#define DMUB_FW_VERSION_HOTFIX 0
@@ -525,7 +525,7 @@ union dmub_inbox0_cmd_lock_hw { uint32_t command_code: 8;/* NOTE: Must be have enough bits to match: enum hw_lock_client */ - uint32_t hw_lock_client: 1; + uint32_t hw_lock_client: 2;/* NOTE: Below fields must match with: struct dmub_hw_lock_inst_flags */ uint32_t otg_inst: 3;
@@ -540,7 +540,7 @@ union dmub_inbox0_cmd_lock_hw { uint32_t lock: 1; /**< Lock */ uint32_t should_release: 1; /**< Release */ - uint32_t reserved: 8; /**< Reserved for extending more clients, HW, etc. */ + uint32_t reserved: 7; /**< Reserved for extending more clients, HW, etc. */ } bits;uint32_t all; };
Signature · 1 line
2.34.1
PATCH 15/17 drm/amd/display: 3.2.171
In reply to Stylon WangFrom: Aric Cyr <[email protected]>
This version brings along following fixes:
- DC refactor and bug fixes for DP links
- Bug fixes for DP2
- Fix regressions causing display not light up
- Improved debug trace
- Improved DP AUX transfer
- Updated watermark latencies to fix underflows in some modes
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -47,7 +47,7 @@ struct aux_payload;struct set_config_cmd_payload ;struct dmub_notification ; -#define DC_VER "3.2.170" +#define DC_VER "3.2.171"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 1 line
2.34.1
PATCH 16/17 drm/amd/display: Trigger DP2 Sequence With Uncertified Cable
In reply to Stylon WangFrom: Fangzhi Zuo <[email protected]>
DP2 sequence is triggered only if VESA certified cable is detected.
Force DP2 sequence with uncertified cable for testing purpose.
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +26 -0
@@ -3431,6 +3431,30 @@ static int dp_force_sst_get(void *data, u64 *val) }DEFINE_DEBUGFS_ATTRIBUTE (dp_set_mst_en_for_sst_ops, dp_force_sst_get, dp_force_sst_set,"%llu\n" ); + +/* +* Force DP2 sequence without VESA certified cable. +* Example usage: echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_dp_ignore_cable_id +*/ +static int dp_ignore_cable_id_set (void *data,u64 val) +{ +struct amdgpu_device *adev = data; + + adev->dm.dc->debug.ignore_cable_id = val; + +return 0 ; +} + +static int dp_ignore_cable_id_get (void *data,u64 *val) +{ +struct amdgpu_device *adev = data; + + *val = adev->dm.dc->debug.ignore_cable_id; + +return 0 ; +} +DEFINE_DEBUGFS_ATTRIBUTE (dp_ignore_cable_id_ops, dp_ignore_cable_id_get, + dp_ignore_cable_id_set,"%llu\n" );#endif /*
@@ -3549,6 +3573,8 @@ void dtn_debugfs_init(struct amdgpu_device *adev)#if defined(CONFIG_DRM_AMD_DC_DCN )debugfs_create_file ("amdgpu_dm_dp_set_mst_en_for_sst" ,0644 , root, adev, &dp_set_mst_en_for_sst_ops); +debugfs_create_file ("amdgpu_dm_dp_ignore_cable_id" ,0644 , root, adev, + &dp_ignore_cable_id_ops);#endif debugfs_create_file_unsafe("amdgpu_dm_visual_confirm", 0644, root, adev,
Signature · 1 line
2.34.1
PATCH 17/17 drm/amd/display: Add Missing HPO Stream Encoder Function Hook
In reply to Stylon WangFrom: Fangzhi Zuo <[email protected]>
[Why]configure_dp_hpo_throttled_vcp_size() was missing promotion before, but it was covered by not calling the missing function hook in the old interface hpo_dp_link_encoder->funcs.
Recent refactor replaces with new caller link_hwss->set_throttled_vcp_size which needs that hook, and that causes null ptr hang.
--- .../display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 11 +++++++++++ .../display/dc/dcn31/dcn31_hpo_dp_stream_encoder.h | 9 ++++++--- 2 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +11 -0
@@ -710,6 +710,16 @@ static void dcn31_hpo_dp_stream_enc_read_state( } } +static void dcn31_set_hblank_min_symbol_width ( +struct hpo_dp_stream_encoder *enc, +uint16_t width) +{ +struct dcn31_hpo_dp_stream_encoder *enc3 =DCN3_1_HPO_DP_STREAM_ENC_FROM_HPO_STREAM_ENC (enc); + +REG_SET (DP_SYM32_ENC_HBLANK_CONTROL ,0 , +HBLANK_MINIMUM_SYMBOL_WIDTH , width); +} +static const struct hpo_dp_stream_encoder_funcs dcn30_str_enc_funcs = { .enable_stream = dcn31_hpo_dp_stream_enc_enable_stream, .dp_unblank = dcn31_hpo_dp_stream_enc_dp_unblank,
@@ -725,6 +735,7 @@ static const struct hpo_dp_stream_encoder_funcs dcn30_str_enc_funcs = { .dp_audio_enable = dcn31_hpo_dp_stream_enc_audio_enable, .dp_audio_disable = dcn31_hpo_dp_stream_enc_audio_disable, .read_state = dcn31_hpo_dp_stream_enc_read_state, + .set_hblank_min_symbol_width = dcn31_set_hblank_min_symbol_width, }; void dcn31_hpo_dp_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.h +6 -3
@@ -80,7 +80,8 @@SRI (DP_SYM32_ENC_SDP_GSP_CONTROL11 ,DP_SYM32_ENC , id),\SRI (DP_SYM32_ENC_SDP_METADATA_PACKET_CONTROL ,DP_SYM32_ENC , id),\SRI (DP_SYM32_ENC_SDP_AUDIO_CONTROL0 ,DP_SYM32_ENC , id),\ - SRI(DP_SYM32_ENC_VID_CRC_CONTROL, DP_SYM32_ENC, id) +SRI (DP_SYM32_ENC_VID_CRC_CONTROL ,DP_SYM32_ENC , id), \ + SRI(DP_SYM32_ENC_HBLANK_CONTROL, DP_SYM32_ENC, id)#define DCN3_1_HPO_DP_STREAM_ENC_REGS \ uint32_t DP_STREAM_MAPPER_CONTROL0;\
@@ -116,7 +117,8 @@uint32_t DP_SYM32_ENC_SDP_GSP_CONTROL11 ;\uint32_t DP_SYM32_ENC_SDP_METADATA_PACKET_CONTROL ;\uint32_t DP_SYM32_ENC_SDP_AUDIO_CONTROL0 ;\ - uint32_t DP_SYM32_ENC_VID_CRC_CONTROL +uint32_t DP_SYM32_ENC_VID_CRC_CONTROL ;\ + uint32_t DP_SYM32_ENC_HBLANK_CONTROL#define DCN3_1_HPO_DP_STREAM_ENC_MASK_SH_LIST (mask_sh)\
@@ -202,7 +204,8 @@type GSP_SOF_REFERENCE ;\type METADATA_PACKET_ENABLE ;\type CRC_ENABLE ;\ - type CRC_CONT_MODE_ENABLE +type CRC_CONT_MODE_ENABLE ;\ + type HBLANK_MINIMUM_SYMBOL_WIDTH struct dcn31_hpo_dp_stream_encoder_registers {
Signature · 1 line
2.34.1