drm/plane-helper: Move drm_plane_helper_atomic_check() into udl
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 4 Dec 2023 09:07:46 +0000 (10:07 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 6 Dec 2023 09:35:49 +0000 (10:35 +0100)
The udl driver is the only caller of drm_plane_helper_atomic_check().
Move the function into the driver. No functional changes.

v2:
* fix documenation (Sui)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Sui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20231204090852.1650-2-tzimmermann@suse.de
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_plane_helper.c
drivers/gpu/drm/udl/udl_modeset.c
include/drm/drm_plane_helper.h

index a209659a996c74b9d4beeb98e8590bd95573872b..2dafc39a27cb93b3bdd7f8e082396ae1b4e08d55 100644 (file)
@@ -439,11 +439,8 @@ EXPORT_SYMBOL(drm_crtc_helper_set_mode);
  * @state: atomic state object
  *
  * Provides a default CRTC-state check handler for CRTCs that only have
- * one primary plane attached to it.
- *
- * This is often the case for the CRTC of simple framebuffers. See also
- * drm_plane_helper_atomic_check() for the respective plane-state check
- * helper function.
+ * one primary plane attached to it. This is often the case for the CRTC
+ * of simple framebuffers.
  *
  * RETURNS:
  * Zero on success, or an errno code otherwise.
index 5e95089676ff81ed70562d6828d786603742e6bf..7982be4b0306d54e152c27cb87c7be82234feca1 100644 (file)
@@ -279,35 +279,3 @@ void drm_plane_helper_destroy(struct drm_plane *plane)
        kfree(plane);
 }
 EXPORT_SYMBOL(drm_plane_helper_destroy);
-
-/**
- * drm_plane_helper_atomic_check() - Helper to check plane atomic-state
- * @plane: plane to check
- * @state: atomic state object
- *
- * Provides a default plane-state check handler for planes whose atomic-state
- * scale and positioning are not expected to change since the plane is always
- * a fullscreen scanout buffer.
- *
- * This is often the case for the primary plane of simple framebuffers. See
- * also drm_crtc_helper_atomic_check() for the respective CRTC-state check
- * helper function.
- *
- * RETURNS:
- * Zero on success, or an errno code otherwise.
- */
-int drm_plane_helper_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state)
-{
-       struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
-       struct drm_crtc *new_crtc = new_plane_state->crtc;
-       struct drm_crtc_state *new_crtc_state = NULL;
-
-       if (new_crtc)
-               new_crtc_state = drm_atomic_get_new_crtc_state(state, new_crtc);
-
-       return drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
-                                                  DRM_PLANE_NO_SCALING,
-                                                  DRM_PLANE_NO_SCALING,
-                                                  false, false);
-}
-EXPORT_SYMBOL(drm_plane_helper_atomic_check);
index 40876bcdd79a47ac24898ccf08b38014b1e6cd14..7702359c90c22594666347b6cc9d271db01df4bd 100644 (file)
@@ -21,7 +21,6 @@
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_modeset_helper_vtables.h>
-#include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -261,6 +260,22 @@ static const uint64_t udl_primary_plane_fmtmods[] = {
        DRM_FORMAT_MOD_INVALID
 };
 
+static int udl_primary_plane_helper_atomic_check(struct drm_plane *plane,
+                                                struct drm_atomic_state *state)
+{
+       struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
+       struct drm_crtc *new_crtc = new_plane_state->crtc;
+       struct drm_crtc_state *new_crtc_state = NULL;
+
+       if (new_crtc)
+               new_crtc_state = drm_atomic_get_new_crtc_state(state, new_crtc);
+
+       return drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
+                                                  DRM_PLANE_NO_SCALING,
+                                                  DRM_PLANE_NO_SCALING,
+                                                  false, false);
+}
+
 static void udl_primary_plane_helper_atomic_update(struct drm_plane *plane,
                                                   struct drm_atomic_state *state)
 {
@@ -296,7 +311,7 @@ out_drm_gem_fb_end_cpu_access:
 
 static const struct drm_plane_helper_funcs udl_primary_plane_helper_funcs = {
        DRM_GEM_SHADOW_PLANE_HELPER_FUNCS,
-       .atomic_check = drm_plane_helper_atomic_check,
+       .atomic_check = udl_primary_plane_helper_atomic_check,
        .atomic_update = udl_primary_plane_helper_atomic_update,
 };
 
index 3a574e8cd22f439cec7a3a3f164df39d67d23c37..75f9c4830564a4d2b5e053e15bf43e800d9be67d 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <linux/types.h>
 
-struct drm_atomic_state;
 struct drm_crtc;
 struct drm_framebuffer;
 struct drm_modeset_acquire_ctx;
@@ -42,7 +41,6 @@ int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *cr
 int drm_plane_helper_disable_primary(struct drm_plane *plane,
                                     struct drm_modeset_acquire_ctx *ctx);
 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