Skip to content

Commit 35d3e8c

Browse files
Wayne LinLyude
authored andcommitted
drm/dp_mst: Do not set proposed vcpi directly
[Why] When we receive CSN message to notify one port is disconnected, we will implicitly set its corresponding num_slots to 0. Later on, we will eventually call drm_dp_update_payload_part1() to arrange down streams. In drm_dp_update_payload_part1(), we iterate over all proposed_vcpis[] to do the update. Not specific to a target sink only. For example, if we light up 2 monitors, Monitor_A and Monitor_B, and then we unplug Monitor_B. Later on, when we call drm_dp_update_payload_part1() to try to update payload for Monitor_A, we'll also implicitly clean payload for Monitor_B at the same time. And finally, when we try to call drm_dp_update_payload_part1() to clean payload for Monitor_B, we will do nothing at this time since payload for Monitor_B has been cleaned up previously. For StarTech 1to3 DP hub, it seems like if we didn't update DPCD payload ID table then polling for "ACT Handled"(BIT_1 of DPCD 002C0h) will fail and this polling will last for 3 seconds. Therefore, guess the best way is we don't set the proposed_vcpi[] diretly. Let user of these herlper functions to set the proposed_vcpi directly. [How] 1. Revert commit 7617e96 ("drm/dp_mst: clear time slots for ports invalid") 2. Tackle the issue in previous commit by skipping those trasient proposed VCPIs. These stale VCPIs shoulde be explicitly cleared by user later on. Changes since v1: * Change debug macro to use drm_dbg_kms() instead * Amend the commit message to add Fixed & Cc tags Signed-off-by: Wayne Lin <[email protected]> Fixes: 7617e96 ("drm/dp_mst: clear time slots for ports invalid") Cc: Lyude Paul <[email protected]> Cc: Wayne Lin <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: [email protected] Cc: <[email protected]> # v5.5+ Signed-off-by: Lyude Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Lyude Paul <[email protected]>
1 parent d29b429 commit 35d3e8c

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

drivers/gpu/drm/drm_dp_mst_topology.c

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
25012501
{
25022502
struct drm_dp_mst_topology_mgr *mgr = mstb->mgr;
25032503
struct drm_dp_mst_port *port;
2504-
int old_ddps, old_input, ret, i;
2504+
int old_ddps, ret;
25052505
u8 new_pdt;
25062506
bool new_mcs;
25072507
bool dowork = false, create_connector = false;
@@ -2533,7 +2533,6 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
25332533
}
25342534

25352535
old_ddps = port->ddps;
2536-
old_input = port->input;
25372536
port->input = conn_stat->input_port;
25382537
port->ldps = conn_stat->legacy_device_plug_status;
25392538
port->ddps = conn_stat->displayport_device_plug_status;
@@ -2555,28 +2554,6 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
25552554
dowork = false;
25562555
}
25572556

2558-
if (!old_input && old_ddps != port->ddps && !port->ddps) {
2559-
for (i = 0; i < mgr->max_payloads; i++) {
2560-
struct drm_dp_vcpi *vcpi = mgr->proposed_vcpis[i];
2561-
struct drm_dp_mst_port *port_validated;
2562-
2563-
if (!vcpi)
2564-
continue;
2565-
2566-
port_validated =
2567-
container_of(vcpi, struct drm_dp_mst_port, vcpi);
2568-
port_validated =
2569-
drm_dp_mst_topology_get_port_validated(mgr, port_validated);
2570-
if (!port_validated) {
2571-
mutex_lock(&mgr->payload_lock);
2572-
vcpi->num_slots = 0;
2573-
mutex_unlock(&mgr->payload_lock);
2574-
} else {
2575-
drm_dp_mst_topology_put_port(port_validated);
2576-
}
2577-
}
2578-
}
2579-
25802557
if (port->connector)
25812558
drm_modeset_unlock(&mgr->base.lock);
25822559
else if (create_connector)
@@ -3410,8 +3387,15 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)
34103387
port = drm_dp_mst_topology_get_port_validated(
34113388
mgr, port);
34123389
if (!port) {
3413-
mutex_unlock(&mgr->payload_lock);
3414-
return -EINVAL;
3390+
if (vcpi->num_slots == payload->num_slots) {
3391+
cur_slots += vcpi->num_slots;
3392+
payload->start_slot = req_payload.start_slot;
3393+
continue;
3394+
} else {
3395+
drm_dbg_kms("Fail:set payload to invalid sink");
3396+
mutex_unlock(&mgr->payload_lock);
3397+
return -EINVAL;
3398+
}
34153399
}
34163400
put_port = true;
34173401
}

0 commit comments

Comments
 (0)