]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers
authorHaneen Mohammed <hamohammed.sa@gmail.com>
Fri, 25 May 2018 01:25:55 +0000 (04:25 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 18 Jun 2018 07:20:51 +0000 (09:20 +0200)
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@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180525012555.GA8448@haneen-vb
drivers/gpu/drm/drm_connector.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_plane.c
include/drm/drm_connector.h
include/drm/drm_crtc.h
include/drm/drm_plane.h

index 002b244391f9f88fea10be754ac7b76108bfee0a..549b89501e01f17ed5a003890bff1055778f3c24 100644 (file)
@@ -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);
index 163d82ac7d76321a268484b6ae3e0c4392b4402e..f45e7a8d4acd61486e40091ac5cca45b6abbd095 100644 (file)
@@ -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;
 
index 534b579335765b9e07a13903047253a7f9e2d6be..df0b4ebbedbf4e8b803bfbdc5eb791dbad4bc8b7 100644 (file)
@@ -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;
index ee4c48218c85bc3b5cfde66fca913e90440b7bb2..c5797c24edd3d526580087d72bd9d91ddaf696a2 100644 (file)
@@ -616,6 +616,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
@@ -642,6 +644,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);
index 5cf7adeae6a57f6f259cd5ccc6d14a0b394f6ced..23eddbccab10fe0847249d115d8ce306453efde0 100644 (file)
@@ -506,6 +506,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
@@ -532,6 +534,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);
index 14b1607aba4bb464fae1ebe8fd9eb4b0c971c670..7d4d6c7f0afdb0f3764c9fa6f7644398a3e1bb40 100644 (file)
@@ -288,6 +288,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
@@ -314,6 +316,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);