From: jsg Date: Fri, 20 Oct 2023 03:43:33 +0000 (+0000) Subject: drm/atomic-helper: relax unregistered connector check X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dd23e57cae98a7ea90ef74ec33a552cd119fe430;p=openbsd drm/atomic-helper: relax unregistered connector check From Simon Ser 0fb82afee55fc6e12f3581e87d47fd1beae36a98 in linux-6.1.y/6.1.59 2b7947bd32e243c52870d54141d3b4ea6775e63d in mainline linux --- diff --git a/sys/dev/pci/drm/drm_atomic_helper.c b/sys/dev/pci/drm/drm_atomic_helper.c index 801ebd69ad2..a2884986113 100644 --- a/sys/dev/pci/drm/drm_atomic_helper.c +++ b/sys/dev/pci/drm/drm_atomic_helper.c @@ -290,7 +290,8 @@ static int update_connector_routing(struct drm_atomic_state *state, struct drm_connector *connector, struct drm_connector_state *old_connector_state, - struct drm_connector_state *new_connector_state) + struct drm_connector_state *new_connector_state, + bool added_by_user) { const struct drm_connector_helper_funcs *funcs; struct drm_encoder *new_encoder; @@ -339,9 +340,13 @@ update_connector_routing(struct drm_atomic_state *state, * there's a chance the connector may have been destroyed during the * process, but it's better to ignore that then cause * drm_atomic_helper_resume() to fail. + * + * Last, we want to ignore connector registration when the connector + * was not pulled in the atomic state by user-space (ie, was pulled + * in by the driver, e.g. when updating a DP-MST stream). */ if (!state->duplicated && drm_connector_is_unregistered(connector) && - crtc_state->active) { + added_by_user && crtc_state->active) { drm_dbg_atomic(connector->dev, "[CONNECTOR:%d:%s] is not registered\n", connector->base.id, connector->name); @@ -620,7 +625,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, struct drm_connector *connector; struct drm_connector_state *old_connector_state, *new_connector_state; int i, ret; - unsigned int connectors_mask = 0; + unsigned int connectors_mask = 0, user_connectors_mask = 0; + + for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) + user_connectors_mask |= BIT(i); for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { bool has_connectors = @@ -685,7 +693,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, */ ret = update_connector_routing(state, connector, old_connector_state, - new_connector_state); + new_connector_state, + BIT(i) & user_connectors_mask); if (ret) return ret; if (old_connector_state->crtc) {