diff options
author | Dave Airlie <airlied@redhat.com> | 2016-04-27 11:27:54 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-05-05 12:52:01 +1000 |
commit | 0955c1250e9699b3bdc633d778710d219c61df66 (patch) | |
tree | e2a5e3e87618d5cc76345d24cafd16fd2fc1f2d4 /drivers/gpu/drm/drm_crtc_helper.c | |
parent | 6e86d58be3d175ca950eb0dde05f175debc10ef3 (diff) | |
download | linux-0955c1250e9699b3bdc633d778710d219c61df66.tar.bz2 |
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: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 66ca31348546..f47a252ffa89 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -456,6 +456,9 @@ drm_crtc_helper_disable(struct drm_crtc *crtc) * between them is henceforth no longer available. */ 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) 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 */ count = 0; drm_for_each_connector(connector, dev) { @@ -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_encoders); return 0; @@ -740,6 +754,11 @@ fail: *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 */ if (mode_changed && !drm_crtc_helper_set_mode(save_set.crtc, save_set.mode, save_set.x, |