After refactoring the AMD colorop state lifetime,
drm_atomic_add_affected_colorops() is no longer used anywhere but
drm_atomic_duplicate_state. Move this helper to drm_atomic_helper.c,
make it static and rename to duplicate_plane_colorops for clarity.

Signed-off-by: Melissa Wen <[email protected]>
---
 drivers/gpu/drm/drm_atomic.c        | 46 -------------------------
 drivers/gpu/drm/drm_atomic_helper.c | 52 ++++++++++++++++++++++++++++-
 include/drm/drm_atomic.h            |  4 ---
 3 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index d8b56fa47d45..821e05eb232a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1888,52 +1888,6 @@ drm_atomic_add_affected_planes(struct drm_atomic_commit 
*state,
 }
 EXPORT_SYMBOL(drm_atomic_add_affected_planes);
 
-/**
- * drm_atomic_add_affected_colorops - add colorops for plane
- * @state: atomic state
- * @plane: DRM plane
- *
- * This function walks the current configuration and adds all colorops
- * currently used by @plane to the atomic configuration @state. This is useful
- * when an atomic commit also needs to check all currently enabled colorop on
- * @plane, e.g. when changing the mode. It's also useful when re-enabling a 
plane
- * to avoid special code to force-enable all colorops.
- *
- * Since acquiring a colorop state will always also acquire the w/w mutex of 
the
- * current plane for that colorop (if there is any) adding all the colorop 
states for
- * a plane will not reduce parallelism of atomic updates.
- *
- * Returns:
- * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
- * then the w/w mutex code has detected a deadlock and the entire atomic
- * sequence must be restarted. All other errors are fatal.
- */
-int
-drm_atomic_add_affected_colorops(struct drm_atomic_commit *state,
-                                struct drm_plane *plane)
-{
-       struct drm_colorop *colorop;
-       struct drm_colorop_state *colorop_state;
-
-       WARN_ON(!drm_atomic_get_new_plane_state(state, plane));
-
-       drm_dbg_atomic(plane->dev,
-                      "Adding all current colorops for [PLANE:%d:%s] to %p\n",
-                      plane->base.id, plane->name, state);
-
-       drm_for_each_colorop(colorop, plane->dev) {
-               if (colorop->plane != plane)
-                       continue;
-
-               colorop_state = drm_atomic_get_colorop_state(state, colorop);
-               if (IS_ERR(colorop_state))
-                       return PTR_ERR(colorop_state);
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL(drm_atomic_add_affected_colorops);
-
 /**
  * drm_atomic_check_only - check whether a given config would work
  * @state: atomic configuration to check
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 60e69061faa9..358b89e93620 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3697,6 +3697,56 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_atomic_helper_shutdown);
 
+/*
+ * duplicate_plane_colorops - add colorops for plane
+ * @state: atomic state
+ * @plane: DRM plane
+ *
+ * Add the state of each colorop of a given @plane to @state, including
+ * colorops from color pipelines that are not currently active. This duplicated
+ * state is used to restore the hardware state later; furthermore, the
+ * drm_atomic_helper_resume() function, for instance, resets all colorop
+ * states before committing it, and any colorop that is omitted would lose its
+ * settings.
+ *
+ * Use this only in duplicated states: the drm_atomic_check_only() function
+ * rejects colorops from a pipeline that the atomic commit is neither enabling
+ * nor disabling it; this check is only bypassed when state->duplicated is set.
+ *
+ * Since acquiring a colorop state will always also acquire the w/w mutex of 
the
+ * current plane for that colorop (if there is any) adding all the colorop 
states for
+ * a plane will not reduce parallelism of atomic updates.
+ *
+ * Returns:
+ * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
+ * then the w/w mutex code has detected a deadlock and the entire atomic
+ * sequence must be restarted. All other errors are fatal.
+ */
+static int
+duplicate_plane_colorops(struct drm_atomic_commit *state,
+                        struct drm_plane *plane)
+{
+       struct drm_colorop *colorop;
+       struct drm_colorop_state *colorop_state;
+
+       WARN_ON(!drm_atomic_get_new_plane_state(state, plane));
+
+       drm_dbg_atomic(plane->dev,
+                      "Adding all colorops for [PLANE:%d:%s] to %p\n",
+                      plane->base.id, plane->name, state);
+
+       drm_for_each_colorop(colorop, plane->dev) {
+               if (colorop->plane != plane)
+                       continue;
+
+               colorop_state = drm_atomic_get_colorop_state(state, colorop);
+               if (IS_ERR(colorop_state))
+                       return PTR_ERR(colorop_state);
+       }
+
+       return 0;
+}
+
 /**
  * drm_atomic_helper_duplicate_state - duplicate an atomic state object
  * @dev: DRM device
@@ -3758,7 +3808,7 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
                        goto free;
                }
 
-               err = drm_atomic_add_affected_colorops(state, plane);
+               err = duplicate_plane_colorops(state, plane);
                if (err)
                        goto free;
        }
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 3ae35b09c0cf..1ba000e392f4 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -937,10 +937,6 @@ drm_atomic_add_affected_connectors(struct 
drm_atomic_commit *state,
 int __must_check
 drm_atomic_add_affected_planes(struct drm_atomic_commit *state,
                               struct drm_crtc *crtc);
-int __must_check
-drm_atomic_add_affected_colorops(struct drm_atomic_commit *state,
-                                struct drm_plane *plane);
-
 int __must_check drm_atomic_check_only(struct drm_atomic_commit *state);
 int __must_check drm_atomic_commit(struct drm_atomic_commit *state);
 int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_commit 
*state);
-- 
2.53.0

Reply via email to