drm/amd/display: Add polling method to handle MST reply packet
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 4/33 drm/amd/display: Add polling method to handle MST reply packet
From: Wayne Lin <[email protected]>
[Why]
Specific TBT4 dock doesn't send out short HPD to notify source that IRQ event DOWN_REP_MSG_RDY is set. Which violates the spec and cause source can't send out streams to mst sinks.
[How]
To cover this misbehavior, add an additional polling method to detect DOWN_REP_MSG_RDY is set. HPD driven handling method is still kept. Just hook up our handler to drm mgr->cbs->poll_hpd_irq().
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 117 +++++------------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 ++ .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 110 ++++++++++++++++ .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 11 ++ 4 files changed, 159 insertions(+), 86 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +31 -86
@@ -1347,6 +1347,15 @@ static void dm_handle_hpd_rx_offload_work(struct work_struct *work)if (amdgpu_in_reset (adev)) goto skip; +if (offload_work->data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY || + offload_work->data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) { +dm_handle_mst_sideband_msg_ready_event (&aconnector->mst_mgr,DOWN_OR_UP_MSG_RDY_EVENT ); +spin_lock_irqsave (&offload_work->offload_wq->offload_lock, flags); + offload_work->offload_wq->is_handling_mst_msg_rdy_event = false; +spin_unlock_irqrestore (&offload_work->offload_wq->offload_lock, flags); + goto skip; + } +mutex_lock (&adev->dm.dc_lock);if (offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST) {dc_link_dp_handle_automated_test (dc_link);
@@ -3232,87 +3241,6 @@ static void handle_hpd_irq(void *param) } -static void dm_handle_mst_sideband_msg (struct amdgpu_dm_connector *aconnector) -{ -u8 esi[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {0 }; -u8 dret; -bool new_irq_handled = false; -int dpcd_addr; -int dpcd_bytes_to_read; - -const int max_process_count =30 ; -int process_count =0 ; - -const struct dc_link_status *link_status =dc_link_get_status (aconnector->dc_link); - -if (link_status->dpcd_caps->dpcd_rev.raw <0x12 ) { - dpcd_bytes_to_read =DP_LANE0_1_STATUS -DP_SINK_COUNT ; -/* DPCD 0x200 - 0x201 for downstream IRQ */ - dpcd_addr =DP_SINK_COUNT ; - }else { - dpcd_bytes_to_read =DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ; -/* DPCD 0x2002 - 0x2005 for downstream IRQ */ - dpcd_addr =DP_SINK_COUNT_ESI ; - } - - dret =drm_dp_dpcd_read ( - &aconnector->dm_dp_aux.aux, - dpcd_addr, - esi, - dpcd_bytes_to_read); - -while (dret == dpcd_bytes_to_read && - process_count < max_process_count) { -u8 ack[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {}; -u8 retry; - - dret =0 ; - - process_count++; - -DRM_DEBUG_DRIVER ("ESI %02x %02x %02x\n" , esi[0 ], esi[1 ], esi[2 ]); -/* handle HPD short pulse irq */ -if (aconnector->mst_mgr.mst_state) -drm_dp_mst_hpd_irq_handle_event (&aconnector->mst_mgr, - esi, - ack, - &new_irq_handled); - -if (new_irq_handled) { -/* ACK at DPCD to notify down stream */ -for (retry =0 ; retry <3 ; retry++) { -ssize_t wret; - - wret =drm_dp_dpcd_writeb (&aconnector->dm_dp_aux.aux, - dpcd_addr +1 , - ack[1 ]); -if (wret ==1 ) -break ; - } - -if (retry ==3 ) { -DRM_ERROR ("Failed to ack MST event.\n" ); -return ; - } - -drm_dp_mst_hpd_irq_send_new_request (&aconnector->mst_mgr); -/* check if there is new irq to be handled */ - dret =drm_dp_dpcd_read ( - &aconnector->dm_dp_aux.aux, - dpcd_addr, - esi, - dpcd_bytes_to_read); - - new_irq_handled = false; - }else { -break ; - } - } - -if (process_count == max_process_count) -DRM_DEBUG_DRIVER ("Loop exceeded max iterations\n" ); -} -static void schedule_hpd_rx_offload_work (struct hpd_rx_irq_offload_work_queue *offload_wq,union hpd_irq_data hpd_irq_data) {
@@ -3374,7 +3302,23 @@ static void handle_hpd_rx_irq(void *param)if (dc_link_dp_allow_hpd_rx_irq (dc_link)) {if (hpd_irq_data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY || hpd_irq_data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) { -dm_handle_mst_sideband_msg (aconnector); +bool skip = false; + +/* +* DOWN_REP_MSG_RDY is also handled by polling method +* mgr->cbs->poll_hpd_irq() +*/ +spin_lock (&offload_wq->offload_lock); + skip = offload_wq->is_handling_mst_msg_rdy_event; + +if (!skip) + offload_wq->is_handling_mst_msg_rdy_event = true; + +spin_unlock (&offload_wq->offload_lock); + +if (!skip) +schedule_hpd_rx_offload_work (offload_wq, hpd_irq_data); + goto out; }
@@ -3483,11 +3427,11 @@ static void register_hpd_handlers(struct amdgpu_device *adev)amdgpu_dm_irq_register_interrupt (adev, &int_params, handle_hpd_rx_irq, (void *) aconnector); - -if (adev->dm.hpd_rx_offload_wq) - adev->dm.hpd_rx_offload_wq[dc_link->link_index].aconnector = - aconnector; } + +if (adev->dm.hpd_rx_offload_wq) + adev->dm.hpd_rx_offload_wq[connector->index].aconnector = + aconnector; } }
@@ -7300,6 +7244,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, aconnector->as_type =ADAPTIVE_SYNC_TYPE_NONE ;memset (&aconnector->vsdb_info,0 ,sizeof (aconnector->vsdb_info));mutex_init (&aconnector->hpd_lock); +mutex_init (&aconnector->handle_mst_msg_ready);/* * configure support HPD hot plug connector_>polled default value is 0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +7 -0
@@ -194,6 +194,11 @@ struct hpd_rx_irq_offload_work_queue {* we're handling link loss */ bool is_handling_link_loss; +/** +* @is_handling_mst_msg_rdy_event: Used to prevent inserting mst message +* ready event when we're already handling mst message ready event +*/ +bool is_handling_mst_msg_rdy_event;/** * @aconnector: The aconnector that this work queue is attached to */
@@ -638,6 +643,8 @@ struct amdgpu_dm_connector {struct drm_dp_mst_port *mst_output_port;struct amdgpu_dm_connector *mst_root;struct drm_dp_aux *dsc_aux; +struct mutex handle_mst_msg_ready; +/* TODO see if we can merge with ddc_bus or make a dm_connector */ struct amdgpu_i2c_adapter *i2c;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +110 -0
118 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +11 -0
@@ -49,6 +49,13 @@#define PBN_FEC_OVERHEAD_MULTIPLIER_8B_10B 1031#define PBN_FEC_OVERHEAD_MULTIPLIER_128B_132B 1000 +enum mst_msg_ready_type { +NONE_MSG_RDY_EVENT =0 , +DOWN_REP_MSG_RDY_EVENT =1 , +UP_REQ_MSG_RDY_EVENT =2 , +DOWN_OR_UP_MSG_RDY_EVENT =3 +}; +struct amdgpu_display_manager ;struct amdgpu_dm_connector ;
@@ -61,6 +68,10 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,void dm_dp_create_fake_mst_encoders (struct amdgpu_device *adev); +void dm_handle_mst_sideband_msg_ready_event ( +struct drm_dp_mst_topology_mgr *mgr, +enum mst_msg_ready_type msg_rdy_type); +struct dsc_mst_fairness_vars {int pbn;bool dsc_enabled;
Signature · 1 line
2.34.1
PATCH 11/33 drm/amd/display: check TG is non-null before checking if enabled
In reply to a message not in the archiveFrom: Taimur Hassan <[email protected]>
[Why & How]
If there is no TG allocation we can dereference a NULL pointer when checking if the TG is enabled.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -1
@@ -3278,7 +3278,8 @@ void dcn10_wait_for_mpcc_disconnect(if (pipe_ctx->stream_res.opp->mpcc_disconnect_pending[mpcc_inst]) {struct hubp *hubp =get_hubp_by_inst (res_pool, mpcc_inst); -if (pipe_ctx->stream_res.tg->funcs->is_tg_enabled (pipe_ctx->stream_res.tg)) +if (pipe_ctx->stream_res.tg && + pipe_ctx->stream_res.tg->funcs->is_tg_enabled (pipe_ctx->stream_res.tg)) res_pool->mpc->funcs->wait_for_idle (res_pool->mpc, mpcc_inst); pipe_ctx->stream_res.opp->mpcc_disconnect_pending[mpcc_inst] = false; hubp->funcs->set_blank (hubp, true);
Signature · 1 line
2.34.1
PATCH 20/33 drm/amd/display: Prevent vtotal from being set to 0
In reply to a message not in the archiveFrom: Daniel Miess <[email protected]>
[Why]
In dcn314 DML the destination pipe vtotal was being set to the crtc adjustment vtotal_min value even in cases where that value is 0.
[How]
Only set vtotal to the crtc adjustment vtotal_min value in cases where the value is non-zero.
--- drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c +5 -1
@@ -295,7 +295,11 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c pipe = &res_ctx->pipe_ctx[i]; timing = &pipe->stream->timing; - pipes[pipe_cnt].pipe.dest.vtotal = pipe->stream->adjust.v_total_min; +if (pipe->stream->adjust.v_total_min !=0 ) + pipes[pipe_cnt].pipe.dest.vtotal = pipe->stream->adjust.v_total_min; +else + pipes[pipe_cnt].pipe.dest.vtotal = timing->v_total; + pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total - pipes[pipe_cnt].pipe.dest.vactive; pipes[pipe_cnt].pipe.dest.vblank_nom =min (pipes[pipe_cnt].pipe.dest.vblank_nom, dcn3_14_ip.VBlankNomDefaultUS); pipes[pipe_cnt].pipe.dest.vblank_nom =max (pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width);
Signature · 1 line
2.34.1
PATCH 22/33 drm/amd/display: Keep PHY active for DP displays on DCN31
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why & How]
Port of a change that went into DCN314 to keep the PHY enabled when we have a connected and active DP display.
The PHY can hang if PHY refclk is disabled inadvertently.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c +5 -0
@@ -87,6 +87,11 @@ static int dcn31_get_active_display_cnt_wa( stream->signal == SIGNAL_TYPE_DVI_SINGLE_LINK || stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) tmds_present = true; + +/* Checking stream / link detection ensuring that PHY is active*/ +if (dc_is_dp_signal (stream->signal) && !stream->dpms_off) + display_count++; + }for (i =0 ; i < dc->link_count; i++) {
Signature · 1 line
2.34.1
PATCH 26/33 drm/amd/display: Disable MPC split by default on special asic
In reply to a message not in the archiveFrom: Zhikai Zhai <[email protected]>
[WHY]
All of pipes will be used when the MPC split enable on the dcn which just has 2 pipes. Then MPO enter will trigger the minimal transition which need programe dcn from 2 pipes MPC split to 2 pipes MPO. This action will cause lag if happen frequently.
[HOW]
Disable the MPC split for the platform which dcn resource is limited
--- drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c +1 -1
@@ -65,7 +65,7 @@ static const struct dc_debug_options debug_defaults_drv = { .timing_trace = false, .clock_trace = true, .disable_pplib_clock_request = true, - .pipe_split_policy = MPC_SPLIT_DYNAMIC, + .pipe_split_policy = MPC_SPLIT_AVOID, .force_single_disp_pipe_split = false, .disable_dcc = DCC_ENABLE, .vsr_support = true,
Signature · 1 line
2.34.1