提交 0955c125 编写于 作者: D Dave Airlie

drm/crtc: take references to connectors used in a modeset. (v2)

This just takes a reference on the connector when we set a mode
in the non-atomic paths.

v2: Follow Daniel Stone's suggestions on when to take/drop
references.
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: NDaniel Stone <daniels@collabora.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 6e86d58b
...@@ -456,6 +456,9 @@ drm_crtc_helper_disable(struct drm_crtc *crtc) ...@@ -456,6 +456,9 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
* between them is henceforth no longer available. * between them is henceforth no longer available.
*/ */
connector->dpms = DRM_MODE_DPMS_OFF; connector->dpms = DRM_MODE_DPMS_OFF;
/* we keep a reference while the encoder is bound */
drm_connector_unreference(connector);
} }
} }
...@@ -606,6 +609,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -606,6 +609,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
mode_changed = true; mode_changed = true;
} }
/* take a reference on all connectors in set */
for (ro = 0; ro < set->num_connectors; ro++) {
drm_connector_reference(set->connectors[ro]);
}
/* a) traverse passed in connector list and get encoders for them */ /* a) traverse passed in connector list and get encoders for them */
count = 0; count = 0;
drm_for_each_connector(connector, dev) { drm_for_each_connector(connector, dev) {
...@@ -724,6 +732,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -724,6 +732,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
} }
} }
/* after fail drop reference on all connectors in save set */
count = 0;
drm_for_each_connector(connector, dev) {
drm_connector_unreference(&save_connectors[count++]);
}
kfree(save_connectors); kfree(save_connectors);
kfree(save_encoders); kfree(save_encoders);
return 0; return 0;
...@@ -740,6 +754,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -740,6 +754,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
*connector = save_connectors[count++]; *connector = save_connectors[count++];
} }
/* after fail drop reference on all connectors in set */
for (ro = 0; ro < set->num_connectors; ro++) {
drm_connector_unreference(set->connectors[ro]);
}
/* Try to restore the config */ /* Try to restore the config */
if (mode_changed && if (mode_changed &&
!drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x, !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册