[PATCH] drm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers
Sean Paul
seanpaul at chromium.org
Fri May 25 01:43:50 UTC 2018
On Thu, May 24, 2018, 9:26 PM Haneen Mohammed <hamohammed.sa at gmail.com>
wrote:
> This patch add checks for atomic_[duplicate/destroy]_state of
> drm_[connector/crtc/plane]_funcs for atomic drivers in the relevant
> drm_*_init functions since these callback are mandatory for atomic drivers.
>
> Update the kerneldoc comments for those callbacks.
>
> Signed-off-by: Haneen Mohammed <hamohammed.sa at gmail.com>
>
Reviewed-by: Sean Paul <seanpaul at chromium.org>
---
> drivers/gpu/drm/drm_connector.c | 4 ++++
> drivers/gpu/drm/drm_crtc.c | 4 ++++
> drivers/gpu/drm/drm_plane.c | 4 ++++
> include/drm/drm_connector.h | 4 ++++
> include/drm/drm_crtc.h | 4 ++++
> include/drm/drm_plane.h | 4 ++++
> 6 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_connector.c
> b/drivers/gpu/drm/drm_connector.c
> index b3cde897cd80..ab291f4f339a 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -195,6 +195,10 @@ int drm_connector_init(struct drm_device *dev,
> struct ida *connector_ida =
> &drm_connector_enum_list[connector_type].ida;
>
> + WARN_ON(drm_drv_uses_atomic_modeset(dev) &&
> + (!funcs->atomic_destroy_state ||
> + !funcs->atomic_duplicate_state));
> +
> ret = __drm_mode_object_add(dev, &connector->base,
> DRM_MODE_OBJECT_CONNECTOR,
> false, drm_connector_free);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 03583887cfec..d1933c5f2524 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -286,6 +286,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev,
> struct drm_crtc *crtc,
> if (WARN_ON(config->num_crtc >= 32))
> return -EINVAL;
>
> + WARN_ON(drm_drv_uses_atomic_modeset(dev) &&
> + (!funcs->atomic_destroy_state ||
> + !funcs->atomic_duplicate_state));
> +
> crtc->dev = dev;
> crtc->funcs = funcs;
>
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 6d2a6e428a3e..e0efb06eec31 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -177,6 +177,10 @@ int drm_universal_plane_init(struct drm_device *dev,
> struct drm_plane *plane,
> if (WARN_ON(config->num_total_plane >= 32))
> return -EINVAL;
>
> + WARN_ON(drm_drv_uses_atomic_modeset(dev) &&
> + (!funcs->atomic_destroy_state ||
> + !funcs->atomic_duplicate_state));
> +
> ret = drm_mode_object_add(dev, &plane->base,
> DRM_MODE_OBJECT_PLANE);
> if (ret)
> return ret;
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 675cc3f8cf85..65b6c86ecd50 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -608,6 +608,8 @@ struct drm_connector_funcs {
> * cleaned up by calling the @atomic_destroy_state hook in this
> * structure.
> *
> + * This callback is mandatory for atomic drivers.
> + *
> * Atomic drivers which don't subclass &struct drm_connector_state
> should use
> * drm_atomic_helper_connector_duplicate_state(). Drivers that
> subclass the
> * state structure to extend it with driver-private state should
> use
> @@ -634,6 +636,8 @@ struct drm_connector_funcs {
> *
> * Destroy a state duplicated with @atomic_duplicate_state and
> release
> * or unreference all resources it references
> + *
> + * This callback is mandatory for atomic drivers.
> */
> void (*atomic_destroy_state)(struct drm_connector *connector,
> struct drm_connector_state *state);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index a2d81d2907a9..26511d6775d7 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -503,6 +503,8 @@ struct drm_crtc_funcs {
> * cleaned up by calling the @atomic_destroy_state hook in this
> * structure.
> *
> + * This callback is mandatory for atomic drivers.
> + *
> * Atomic drivers which don't subclass &struct drm_crtc_state
> should use
> * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass
> the
> * state structure to extend it with driver-private state should
> use
> @@ -529,6 +531,8 @@ struct drm_crtc_funcs {
> *
> * Destroy a state duplicated with @atomic_duplicate_state and
> release
> * or unreference all resources it references
> + *
> + * This callback is mandatory for atomic drivers.
> */
> void (*atomic_destroy_state)(struct drm_crtc *crtc,
> struct drm_crtc_state *state);
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index f7bf4a48b1c3..d6d68b466649 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -277,6 +277,8 @@ struct drm_plane_funcs {
> * cleaned up by calling the @atomic_destroy_state hook in this
> * structure.
> *
> + * This callback is mandatory for atomic drivers.
> + *
> * Atomic drivers which don't subclass &struct drm_plane_state
> should use
> * drm_atomic_helper_plane_duplicate_state(). Drivers that
> subclass the
> * state structure to extend it with driver-private state should
> use
> @@ -303,6 +305,8 @@ struct drm_plane_funcs {
> *
> * Destroy a state duplicated with @atomic_duplicate_state and
> release
> * or unreference all resources it references
> + *
> + * This callback is mandatory for atomic drivers.
> */
> void (*atomic_destroy_state)(struct drm_plane *plane,
> struct drm_plane_state *state);
> --
> 2.17.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180524/b24c1bf4/attachment.html>
More information about the dri-devel
mailing list