[PATCH] drm/i915/tgl: Set drm_crtc_state.active=false for all added disconnected CRTCs sharing MST stream.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch avoids failing atomic commits sent by user space by making sure CRTC/Connector added to drm_atomic_state by the driver are in valid state.

When disconnecting MST hub with two or more connected displays. The user space sends IOCTL for each MST pipe to disable.
drm_atomic_state object sent from user space contains only the state of the crtc/pipe intended to disable.
In TGL, intel_dp_mst_atomic_master_trans_check will add all other CRTC and connectors that share the MST stream to drm_atomic_state:

drm_atomic_commit
   drm_atomic_helper_check_modeset
       update_connector_routing
       intel_dp_mst_atomic_check = funcs->atomic_check(connector, state);
       	   intel_dp_mst_atomic_master_trans_check
		intel_atomic_get_digital_connector_state
			drm_atomic_get_connector_state   <-- Add all Connectors
			    drm_atomic_get_crtc_state <-- Add all CRTCs
       update_connector_routing <-- Check added Connector/CRTCs - Will fail

However the added crtc/connector pair will be in invalid state (enabled state for a removed connector)
triggering this condition in drm_atomic_helper.c/update_connector_routing:

	if (!state->duplicated && drm_connector_is_unregistered(connector) &&
	    crtc_state->active) {
		DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] is not registered\n",
				 connector->base.id, connector->name);
		return -EINVAL;
	}

Which will cause the drm_atomic_commit/IOCTL for disabling one of MST stream pipes (Main MST) to fail.

The problem happens when a user space (as Chrome) doesn’t retry a falling commit, leaving a disconnected MST pipe still ON,
which will result in failing reconnect of MST hub or even worse leaving TC PHY in a connected state while the MST Hub is disconnected.

Tested on Ubuntu(drm-tip) and Chrome(kernel-next 5.9 rc7)

Signed-off-by: Khaled Almahallawy <khaled.almahallawy@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index e948aacbd4ab..1ede980876ed 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -265,6 +265,9 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector,
 			return ret;
 		}
 		crtc_state->uapi.mode_changed = true;
+
+		if (connector_iter->base.status == connector_status_disconnected)
+			crtc_state->uapi.active = false;
 	}
 	drm_connector_list_iter_end(&connector_list_iter);
 
-- 
2.25.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux