drm/plane-helper: Provide DRM_PLANE_NON_ATOMIC_FUNCS initializer macro
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 9 Sep 2022 10:59:47 +0000 (12:59 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 20 Sep 2022 07:42:31 +0000 (09:42 +0200)
Provide DRM_PLANE_NON_ATOMIC_FUNCS, which initializes plane functions
of non-atomic drivers to default values. The macro is not supposed to
be used in new code, but helps with documenting and finding existing
users.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Lyude Paul <lyude@redhat.com> # nouveau
Link: https://patchwork.freedesktop.org/patch/msgid/20220909105947.6487-5-tzimmermann@suse.de
drivers/gpu/drm/drm_modeset_helper.c
drivers/gpu/drm/nouveau/dispnv04/crtc.c
include/drm/drm_plane_helper.h

index 38040ee..f858dfe 100644 (file)
@@ -108,9 +108,7 @@ static const uint32_t safe_modeset_formats[] = {
 };
 
 static const struct drm_plane_funcs primary_plane_funcs = {
-       .update_plane = drm_plane_helper_update_primary,
-       .disable_plane = drm_plane_helper_disable_primary,
-       .destroy = drm_plane_helper_destroy,
+       DRM_PLANE_NON_ATOMIC_FUNCS,
 };
 
 /**
index 6b8a014..ee92d57 100644 (file)
@@ -1276,9 +1276,7 @@ static const uint32_t modeset_formats[] = {
 };
 
 static const struct drm_plane_funcs nv04_primary_plane_funcs = {
-       .update_plane = drm_plane_helper_update_primary,
-       .disable_plane = drm_plane_helper_disable_primary,
-       .destroy = drm_plane_helper_destroy,
+       DRM_PLANE_NON_ATOMIC_FUNCS,
 };
 
 static int nv04_crtc_vblank_handler(struct nvif_notify *notify)
index 7760b27..ff83d26 100644 (file)
@@ -43,4 +43,16 @@ int drm_plane_helper_disable_primary(struct drm_plane *plane,
 void drm_plane_helper_destroy(struct drm_plane *plane);
 int drm_plane_helper_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state);
 
+/**
+ * DRM_PLANE_NON_ATOMIC_FUNCS - Default plane functions for non-atomic drivers
+ *
+ * This macro initializes plane functions for non-atomic drivers to default
+ * values. Non-atomic interfaces are deprecated and should not be used in new
+ * drivers.
+ */
+#define DRM_PLANE_NON_ATOMIC_FUNCS \
+       .update_plane = drm_plane_helper_update_primary, \
+       .disable_plane = drm_plane_helper_disable_primary, \
+       .destroy = drm_plane_helper_destroy
+
 #endif