aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-11-25 06:09:49 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-25 07:28:31 -0500
commit3009c0377f25c29852b218a6933a969d02cbdc5d (patch)
treec2cfc032e0d0e12a32e63949efce130776438895 /drivers/gpu/drm/drm_crtc.c
parent37cc0148773abbd8e7dbf8b2cb3399e887233fc2 (diff)
drm: Free atomic state during cleanup
The current state of CRTCs, planes and connectors currently leaks during DRM driver ->unload() unless drivers explicitly clean it up. Since there is nothing driver-specific about it, that cleanup can be done within the DRM core. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 589a921d4313..e4e7b92f6d32 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -721,6 +721,10 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
721 drm_mode_object_put(dev, &crtc->base); 721 drm_mode_object_put(dev, &crtc->base);
722 list_del(&crtc->head); 722 list_del(&crtc->head);
723 dev->mode_config.num_crtc--; 723 dev->mode_config.num_crtc--;
724
725 WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state);
726 if (crtc->state && crtc->funcs->atomic_destroy_state)
727 crtc->funcs->atomic_destroy_state(crtc, crtc->state);
724} 728}
725EXPORT_SYMBOL(drm_crtc_cleanup); 729EXPORT_SYMBOL(drm_crtc_cleanup);
726 730
@@ -918,6 +922,11 @@ void drm_connector_cleanup(struct drm_connector *connector)
918 connector->name = NULL; 922 connector->name = NULL;
919 list_del(&connector->head); 923 list_del(&connector->head);
920 dev->mode_config.num_connector--; 924 dev->mode_config.num_connector--;
925
926 WARN_ON(connector->state && !connector->funcs->atomic_destroy_state);
927 if (connector->state && connector->funcs->atomic_destroy_state)
928 connector->funcs->atomic_destroy_state(connector,
929 connector->state);
921} 930}
922EXPORT_SYMBOL(drm_connector_cleanup); 931EXPORT_SYMBOL(drm_connector_cleanup);
923 932
@@ -1244,6 +1253,10 @@ void drm_plane_cleanup(struct drm_plane *plane)
1244 if (plane->type == DRM_PLANE_TYPE_OVERLAY) 1253 if (plane->type == DRM_PLANE_TYPE_OVERLAY)
1245 dev->mode_config.num_overlay_plane--; 1254 dev->mode_config.num_overlay_plane--;
1246 drm_modeset_unlock_all(dev); 1255 drm_modeset_unlock_all(dev);
1256
1257 WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
1258 if (plane->state && plane->funcs->atomic_destroy_state)
1259 plane->funcs->atomic_destroy_state(plane, plane->state);
1247} 1260}
1248EXPORT_SYMBOL(drm_plane_cleanup); 1261EXPORT_SYMBOL(drm_plane_cleanup);
1249 1262