[PATCH 5/5] drm: Free atomic state during cleanup
Daniel Vetter
daniel at ffwll.ch
Fri Nov 21 09:08:06 PST 2014
On Fri, Nov 21, 2014 at 05:23:53PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding at nvidia.com>
>
> 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.
>
> Signed-off-by: Thierry Reding <treding at nvidia.com>
Patches 2, 4 & this one here are
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
Cheers, Daniel
> ---
> drivers/gpu/drm/drm_crtc.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index de09c1ff0714..9f736417a95d 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)
> drm_mode_object_put(dev, &crtc->base);
> list_del(&crtc->head);
> dev->mode_config.num_crtc--;
> +
> + WARN_ON(crtc->state && !crtc->funcs->atomic_destroy_state);
> + if (crtc->state && crtc->funcs->atomic_destroy_state)
> + crtc->funcs->atomic_destroy_state(crtc, crtc->state);
> }
> EXPORT_SYMBOL(drm_crtc_cleanup);
>
> @@ -918,6 +922,11 @@ void drm_connector_cleanup(struct drm_connector *connector)
> connector->name = NULL;
> list_del(&connector->head);
> dev->mode_config.num_connector--;
> +
> + WARN_ON(connector->state && !connector->funcs->atomic_destroy_state);
> + if (connector->state && connector->funcs->atomic_destroy_state)
> + connector->funcs->atomic_destroy_state(connector,
> + connector->state);
> }
> EXPORT_SYMBOL(drm_connector_cleanup);
>
> @@ -1244,6 +1253,10 @@ void drm_plane_cleanup(struct drm_plane *plane)
> if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> dev->mode_config.num_overlay_plane--;
> drm_modeset_unlock_all(dev);
> +
> + WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
> + if (plane->state && plane->funcs->atomic_destroy_state)
> + plane->funcs->atomic_destroy_state(plane, plane->state);
> }
> EXPORT_SYMBOL(drm_plane_cleanup);
>
> --
> 2.1.3
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the dri-devel
mailing list