Skip to contentSkip to conversation

drm/atomic: convert drm_atomic_get_{old, new}_colorop_state() into proper functions

PATCH Superseded Jani Nikula 4 participants 5 messages Dec 18, 2025 – Dec 21, 2025

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/atomic: convert drm_atomic_get_{old, new}_colorop_state() into proper functions

There is no real reason to include drm_colorop.h from drm_atomic.h, as drm_atomic_get_{old,new}_colorop_state() have no real reason to be static inline.

Convert the static inlines to proper functions, and drop the include to reduce the include dependencies and improve data hiding.

Fixes cfc27680ee20 ("drm/colorop: Introduce new drm_colorop mode object")
Cc Simon Ser <[email protected]>
Cc Alex Hung <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Daniel Stone <[email protected]>
Cc Melissa Wen <[email protected]>
Cc Sebastian Wick <[email protected]>

---

Including the massive Cc list because I don't want to keep doing this afterwards. This stuff needs to be blocked and fixed during review. Just stop including headers from headers. It's a PITA to clean up.

---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  3 ++
 drivers/gpu/drm/drm_atomic.c                  | 32 +++++++++++++++
 drivers/gpu/drm/drm_atomic_helper.c           |  1 +
 .../drm/i915/display/intel_display_types.h    |  1 +
 include/drm/drm_atomic.h                      | 39 ++++---------------
 5 files changed, 45 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +3 -0
index 1dcc79b35225..20a76d81d532 100644
@@ -23,6 +23,9 @@
  * Authors: AMD
  *
  */
+
+#include <drm/drm_colorop.h>
+
 #include "amdgpu.h"
 #include "amdgpu_mode.h"
 #include "amdgpu_dm.h"
drivers/gpu/drm/drm_atomic.c +32 -0
index 6d3ea8056b60..52738b80ddbe 100644
@@ -641,6 +641,38 @@ drm_atomic_get_colorop_state(struct drm_atomic_state *state,
 }
 EXPORT_SYMBOL(drm_atomic_get_colorop_state);
 
+/**
+ * drm_atomic_get_old_colorop_state - get colorop state, if it exists
+ * @state: global atomic state object
+ * @colorop: colorop to grab
+ *
+ * This function returns the old colorop state for the given colorop, or
+ * NULL if the colorop is not part of the global atomic state.
+ */
+struct drm_colorop_state *
+drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop)
+{
+	return state->colorops[drm_colorop_index(colorop)].old_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_old_colorop_state);
+
+/**
+ * drm_atomic_get_new_colorop_state - get colorop state, if it exists
+ * @state: global atomic state object
+ * @colorop: colorop to grab
+ *
+ * This function returns the new colorop state for the given colorop, or
+ * NULL if the colorop is not part of the global atomic state.
+ */
+struct drm_colorop_state *
+drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop)
+{
+	return state->colorops[drm_colorop_index(colorop)].new_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_new_colorop_state);
+
 static bool
 plane_switching_crtc(const struct drm_plane_state *old_plane_state,
 		     const struct drm_plane_state *new_plane_state)
drivers/gpu/drm/drm_atomic_helper.c +1 -0
index 10adac9397cf..5840e9cc6f66 100644
@@ -34,6 +34,7 @@
 #include <drm/drm_atomic_uapi.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_bridge.h>
+#include <drm/drm_colorop.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index 6ff53cd58052..eb2e3f1e83c9 100644
@@ -34,6 +34,7 @@
 #include <drm/display/drm_dp_tunnel.h>
 #include <drm/display/drm_dsc.h>
 #include <drm/drm_atomic.h>
+#include <drm/drm_colorop.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_framebuffer.h>
include/drm/drm_atomic.h +8 -31
index 74ce26fa8838..178f8f62c80f 100644
@@ -30,7 +30,6 @@
 
 #include <drm/drm_crtc.h>
 #include <drm/drm_util.h>
-#include <drm/drm_colorop.h>
 
 /**
  * struct drm_crtc_commit - track modeset commits on a CRTC
@@ -712,6 +711,14 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
 struct drm_colorop_state *
 drm_atomic_get_colorop_state(struct drm_atomic_state *state,
 			     struct drm_colorop *colorop);
+
+struct drm_colorop_state *
+drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop);
+struct drm_colorop_state *
+drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop);
+
 struct drm_connector_state * __must_check
 drm_atomic_get_connector_state(struct drm_atomic_state *state,
 			       struct drm_connector *connector);
@@ -808,36 +815,6 @@ drm_atomic_get_new_plane_state(const struct drm_atomic_state *state,
 	return state->planes[drm_plane_index(plane)].new_state;
 }
 
-/**
- * drm_atomic_get_old_colorop_state - get colorop state, if it exists
- * @state: global atomic state object
- * @colorop: colorop to grab
- *
- * This function returns the old colorop state for the given colorop, or
- * NULL if the colorop is not part of the global atomic state.
- */
-static inline struct drm_colorop_state *
-drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
-				 struct drm_colorop *colorop)
-{
-	return state->colorops[drm_colorop_index(colorop)].old_state;
-}
-
-/**
- * drm_atomic_get_new_colorop_state - get colorop state, if it exists
- * @state: global atomic state object
- * @colorop: colorop to grab
- *
- * This function returns the new colorop state for the given colorop, or
- * NULL if the colorop is not part of the global atomic state.
- */
-static inline struct drm_colorop_state *
-drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
-				 struct drm_colorop *colorop)
-{
-	return state->colorops[drm_colorop_index(colorop)].new_state;
-}
-
 /**
  * drm_atomic_get_old_connector_state - get connector state, if it exists
  * @state: global atomic state object
Signature · 1 line
2.47.3
#1 lore raw

✗ Fi.CI.BUILD: failure for drm/atomic: convert drm_atomic_get_{old, new}_colorop_state() into proper functions

== Series Details ==

== Series Details ==

Series: drm/atomic: convert drm_atomic_get_{old, new}_colorop_state() into proper functions
URL : https://patchwork.freedesktop.org/series/159220/
State : failure

== Summary ==

Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] drivers/gpu/drm/vkms/vkms_drv.o
drivers/gpu/drm/vkms/vkms_drv.c: In function ‘vkms_destroy’:
drivers/gpu/drm/vkms/vkms_drv.c:261:9: error: implicit declaration of function ‘drm_colorop_pipeline_destroy’ [-Werror=implicit-function-declaration]

  261 |         drm_colorop_pipeline_destroy(&config->dev->drm);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/vkms/vkms_drv.o] Error 1 make[5]: *** [scripts/Makefile.build:556: drivers/gpu/drm/vkms] Error 2 make[4]: *** [scripts/Makefile.build:556: drivers/gpu/drm] Error 2 make[3]: *** [scripts/Makefile.build:556: drivers/gpu] Error 2 make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
make[1]: *** [/home/kbuild/kernel/Makefile:2054: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Build failed, no error log produced

#2 lore raw

Re: [PATCH] drm/atomic: convert drm_atomic_get_{old,new}_colorop_state() into proper functions

In reply to Jani Nikula

Hi Jani,

Some compilation errors with this patch:

drivers/gpu/drm/vkms/vkms_drv.c: In function ‘vkms_destroy’:
drivers/gpu/drm/vkms/vkms_drv.c:261:9: error: implicit declaration of function ‘drm_colorop_pipeline_destroy’ [-Werror=implicit-function-declaration]

  261 |         drm_colorop_pipeline_destroy(&config->dev->drm);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[9]: *** [scripts/Makefile.build:287: drivers/gpu/drm/vkms/vkms_drv.o] Error 1
make[9]: *** Waiting for unfinished jobs....
drivers/gpu/drm/vkms/vkms_composer.c: In function ‘apply_colorop’:
drivers/gpu/drm/vkms/vkms_composer.c:164:58: error: invalid use of undefined type ‘struct drm_colorop’
164 | struct drm_colorop_state *colorop_state = colorop->state;
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:165:41: error: invalid use of undefined type ‘struct drm_colorop’
165 | struct drm_device *dev = colorop->dev;
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:167:20: error: invalid use of undefined type ‘struct drm_colorop’
167 | if (colorop->type == DRM_COLOROP_1D_CURVE) {
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:168:38: error: invalid use of undefined type ‘struct drm_colorop_state’
168 | switch (colorop_state->curve_1d_type) {
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:169:22: error: ‘DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF’ undeclared (first use in this function)
169 | case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:

      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/gpu/drm/vkms/vkms_composer.c:169:22: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/vkms/vkms_composer.c:174:22: error: ‘DRM_COLOROP_1D_CURVE_SRGB_EOTF’ undeclared (first use in this function); did you mean ‘DRM_COLOROP_1D_CURVE’?
174 | case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
...

Including the drm_colorop.h in vkms_composer.c and vkms_drv.c fixes them:

drivers/gpu/drm/vkms/vkms_composer.c +1 -0
index 3cf3f26e0d8e..cd85de4ffd03 100644
@@ -5,6 +5,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
+#include <drm/drm_colorop.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_fixed.h>
 #include <drm/drm_gem_framebuffer_helper.h>
drivers/gpu/drm/vkms/vkms_drv.c +1 -0
index dd1402f43773..434c295f44ba 100644
@@ -17,6 +17,7 @@
 #include <drm/drm_gem.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_colorop.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>

Alex

Quoted 174 lines · Jani Nikula

There is no real reason to include drm_colorop.h from drm_atomic.h, as drm_atomic_get_{old,new}_colorop_state() have no real reason to be static inline.

Convert the static inlines to proper functions, and drop the include to reduce the include dependencies and improve data hiding.

Fixes cfc27680ee20 ("drm/colorop: Introduce new drm_colorop mode object")
Cc Simon Ser <[email protected]>
Cc Alex Hung <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Daniel Stone <[email protected]>
Cc Melissa Wen <[email protected]>
Cc Sebastian Wick <[email protected]>

---

Including the massive Cc list because I don't want to keep doing this afterwards. This stuff needs to be blocked and fixed during review. Just stop including headers from headers. It's a PITA to clean up.

---
  .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  3 ++
  drivers/gpu/drm/drm_atomic.c                  | 32 +++++++++++++++
  drivers/gpu/drm/drm_atomic_helper.c           |  1 +
  .../drm/i915/display/intel_display_types.h    |  1 +
  include/drm/drm_atomic.h                      | 39 ++++---------------
  5 files changed, 45 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +3 -0
index 1dcc79b35225..20a76d81d532 100644
@@ -23,6 +23,9 @@
   * Authors: AMD
   *
   */
+
+#include <drm/drm_colorop.h>
+
  #include "amdgpu.h"
  #include "amdgpu_mode.h"
  #include "amdgpu_dm.h"
drivers/gpu/drm/drm_atomic.c +32 -0
index 6d3ea8056b60..52738b80ddbe 100644
@@ -641,6 +641,38 @@ drm_atomic_get_colorop_state(struct drm_atomic_state *state,
  }
  EXPORT_SYMBOL(drm_atomic_get_colorop_state);
 
+/**
+ * drm_atomic_get_old_colorop_state - get colorop state, if it exists
+ * @state: global atomic state object
+ * @colorop: colorop to grab
+ *
+ * This function returns the old colorop state for the given colorop, or
+ * NULL if the colorop is not part of the global atomic state.
+ */
+struct drm_colorop_state *
+drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop)
+{
+	return state->colorops[drm_colorop_index(colorop)].old_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_old_colorop_state);
+
+/**
+ * drm_atomic_get_new_colorop_state - get colorop state, if it exists
+ * @state: global atomic state object
+ * @colorop: colorop to grab
+ *
+ * This function returns the new colorop state for the given colorop, or
+ * NULL if the colorop is not part of the global atomic state.
+ */
+struct drm_colorop_state *
+drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop)
+{
+	return state->colorops[drm_colorop_index(colorop)].new_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_new_colorop_state);
+
  static bool
  plane_switching_crtc(const struct drm_plane_state *old_plane_state,
  		     const struct drm_plane_state *new_plane_state)
drivers/gpu/drm/drm_atomic_helper.c +1 -0
index 10adac9397cf..5840e9cc6f66 100644
@@ -34,6 +34,7 @@
  #include <drm/drm_atomic_uapi.h>
  #include <drm/drm_blend.h>
  #include <drm/drm_bridge.h>
+#include <drm/drm_colorop.h>
  #include <drm/drm_damage_helper.h>
  #include <drm/drm_device.h>
  #include <drm/drm_drv.h>
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index 6ff53cd58052..eb2e3f1e83c9 100644
@@ -34,6 +34,7 @@
  #include <drm/display/drm_dp_tunnel.h>
  #include <drm/display/drm_dsc.h>
  #include <drm/drm_atomic.h>
+#include <drm/drm_colorop.h>
  #include <drm/drm_crtc.h>
  #include <drm/drm_encoder.h>
  #include <drm/drm_framebuffer.h>
include/drm/drm_atomic.h +8 -31
index 74ce26fa8838..178f8f62c80f 100644
@@ -30,7 +30,6 @@
 
  #include <drm/drm_crtc.h>
  #include <drm/drm_util.h>
-#include <drm/drm_colorop.h>
 
  /**
   * struct drm_crtc_commit - track modeset commits on a CRTC
@@ -712,6 +711,14 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
  struct drm_colorop_state *
  drm_atomic_get_colorop_state(struct drm_atomic_state *state,
  			     struct drm_colorop *colorop);
+
+struct drm_colorop_state *
+drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop);
+struct drm_colorop_state *
+drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop);
+
  struct drm_connector_state * __must_check
  drm_atomic_get_connector_state(struct drm_atomic_state *state,
  			       struct drm_connector *connector);
@@ -808,36 +815,6 @@ drm_atomic_get_new_plane_state(const struct drm_atomic_state *state,
  	return state->planes[drm_plane_index(plane)].new_state;
  }
 
-/**
- * drm_atomic_get_old_colorop_state - get colorop state, if it exists
- * @state: global atomic state object
- * @colorop: colorop to grab
- *
- * This function returns the old colorop state for the given colorop, or
- * NULL if the colorop is not part of the global atomic state.
- */
-static inline struct drm_colorop_state *
-drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
-				 struct drm_colorop *colorop)
-{
-	return state->colorops[drm_colorop_index(colorop)].old_state;
-}
-
-/**
- * drm_atomic_get_new_colorop_state - get colorop state, if it exists
- * @state: global atomic state object
- * @colorop: colorop to grab
- *
- * This function returns the new colorop state for the given colorop, or
- * NULL if the colorop is not part of the global atomic state.
- */
-static inline struct drm_colorop_state *
-drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
-				 struct drm_colorop *colorop)
-{
-	return state->colorops[drm_colorop_index(colorop)].new_state;
-}
-
  /**
   * drm_atomic_get_old_connector_state - get connector state, if it exists
   * @state: global atomic state object
#3 lore raw

Re: [PATCH] drm/atomic: convert drm_atomic_get_{old,new}_colorop_state() into proper functions

Quoted 3 lines · Alex Hung

Hi Jani,

Some compilation errors with this patch:

Thanks a lot, sent v2.

BR,
Jani.

Quoted 249 lines

drivers/gpu/drm/vkms/vkms_drv.c: In function ‘vkms_destroy’:
drivers/gpu/drm/vkms/vkms_drv.c:261:9: error: implicit declaration of function ‘drm_colorop_pipeline_destroy’ [-Werror=implicit-function-declaration]

   261 |         drm_colorop_pipeline_destroy(&config->dev->drm);
       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[9]: *** [scripts/Makefile.build:287:
drivers/gpu/drm/vkms/vkms_drv.o] Error 1
make[9]: *** Waiting for unfinished jobs.... drivers/gpu/drm/vkms/vkms_composer.c: In function ‘apply_colorop’:
drivers/gpu/drm/vkms/vkms_composer.c:164:58: error: invalid use of undefined type ‘struct drm_colorop’
164 | struct drm_colorop_state *colorop_state = colorop->state;
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:165:41: error: invalid use of undefined type ‘struct drm_colorop’
165 | struct drm_device *dev = colorop->dev;
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:167:20: error: invalid use of undefined type ‘struct drm_colorop’
167 | if (colorop->type == DRM_COLOROP_1D_CURVE) {
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:168:38: error: invalid use of undefined type ‘struct drm_colorop_state’
168 | switch (colorop_state->curve_1d_type) {
| ^~
drivers/gpu/drm/vkms/vkms_composer.c:169:22: error:
‘DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF’ undeclared (first use in this function)
169 | case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:

       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/gpu/drm/vkms/vkms_composer.c:169:22: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/vkms/vkms_composer.c:174:22: error:
‘DRM_COLOROP_1D_CURVE_SRGB_EOTF’ undeclared (first use in this function); did you mean ‘DRM_COLOROP_1D_CURVE’?
174 | case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
...

Including the drm_colorop.h in vkms_composer.c and vkms_drv.c fixes them:

drivers/gpu/drm/vkms/vkms_composer.c +1 -0
index 3cf3f26e0d8e..cd85de4ffd03 100644
@@ -5,6 +5,7 @@
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_blend.h>
+#include <drm/drm_colorop.h>
  #include <drm/drm_fourcc.h>
  #include <drm/drm_fixed.h>
  #include <drm/drm_gem_framebuffer_helper.h>
drivers/gpu/drm/vkms/vkms_drv.c +1 -0
index dd1402f43773..434c295f44ba 100644
@@ -17,6 +17,7 @@
  #include <drm/drm_gem.h>
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
+#include <drm/drm_colorop.h>
  #include <drm/drm_drv.h>
  #include <drm/drm_fbdev_shmem.h>
  #include <drm/drm_file.h>

Alex

Quoted 174 lines · Jani Nikula

There is no real reason to include drm_colorop.h from drm_atomic.h, as drm_atomic_get_{old,new}_colorop_state() have no real reason to be static inline.

Convert the static inlines to proper functions, and drop the include to reduce the include dependencies and improve data hiding.

Fixes cfc27680ee20 ("drm/colorop: Introduce new drm_colorop mode object")
Cc Simon Ser <[email protected]>
Cc Alex Hung <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Daniel Stone <[email protected]>
Cc Melissa Wen <[email protected]>
Cc Sebastian Wick <[email protected]>

---

Including the massive Cc list because I don't want to keep doing this afterwards. This stuff needs to be blocked and fixed during review. Just stop including headers from headers. It's a PITA to clean up.

---
  .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  3 ++
  drivers/gpu/drm/drm_atomic.c                  | 32 +++++++++++++++
  drivers/gpu/drm/drm_atomic_helper.c           |  1 +
  .../drm/i915/display/intel_display_types.h    |  1 +
  include/drm/drm_atomic.h                      | 39 ++++---------------
  5 files changed, 45 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +3 -0
index 1dcc79b35225..20a76d81d532 100644
@@ -23,6 +23,9 @@
   * Authors: AMD
   *
   */
+
+#include <drm/drm_colorop.h>
+
  #include "amdgpu.h"
  #include "amdgpu_mode.h"
  #include "amdgpu_dm.h"
drivers/gpu/drm/drm_atomic.c +32 -0
index 6d3ea8056b60..52738b80ddbe 100644
@@ -641,6 +641,38 @@ drm_atomic_get_colorop_state(struct drm_atomic_state *state,
  }
  EXPORT_SYMBOL(drm_atomic_get_colorop_state);
 
+/**
+ * drm_atomic_get_old_colorop_state - get colorop state, if it exists
+ * @state: global atomic state object
+ * @colorop: colorop to grab
+ *
+ * This function returns the old colorop state for the given colorop, or
+ * NULL if the colorop is not part of the global atomic state.
+ */
+struct drm_colorop_state *
+drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop)
+{
+	return state->colorops[drm_colorop_index(colorop)].old_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_old_colorop_state);
+
+/**
+ * drm_atomic_get_new_colorop_state - get colorop state, if it exists
+ * @state: global atomic state object
+ * @colorop: colorop to grab
+ *
+ * This function returns the new colorop state for the given colorop, or
+ * NULL if the colorop is not part of the global atomic state.
+ */
+struct drm_colorop_state *
+drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop)
+{
+	return state->colorops[drm_colorop_index(colorop)].new_state;
+}
+EXPORT_SYMBOL(drm_atomic_get_new_colorop_state);
+
  static bool
  plane_switching_crtc(const struct drm_plane_state *old_plane_state,
  		     const struct drm_plane_state *new_plane_state)
drivers/gpu/drm/drm_atomic_helper.c +1 -0
index 10adac9397cf..5840e9cc6f66 100644
@@ -34,6 +34,7 @@
  #include <drm/drm_atomic_uapi.h>
  #include <drm/drm_blend.h>
  #include <drm/drm_bridge.h>
+#include <drm/drm_colorop.h>
  #include <drm/drm_damage_helper.h>
  #include <drm/drm_device.h>
  #include <drm/drm_drv.h>
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index 6ff53cd58052..eb2e3f1e83c9 100644
@@ -34,6 +34,7 @@
  #include <drm/display/drm_dp_tunnel.h>
  #include <drm/display/drm_dsc.h>
  #include <drm/drm_atomic.h>
+#include <drm/drm_colorop.h>
  #include <drm/drm_crtc.h>
  #include <drm/drm_encoder.h>
  #include <drm/drm_framebuffer.h>
include/drm/drm_atomic.h +8 -31
index 74ce26fa8838..178f8f62c80f 100644
@@ -30,7 +30,6 @@
 
  #include <drm/drm_crtc.h>
  #include <drm/drm_util.h>
-#include <drm/drm_colorop.h>
 
  /**
   * struct drm_crtc_commit - track modeset commits on a CRTC
@@ -712,6 +711,14 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
  struct drm_colorop_state *
  drm_atomic_get_colorop_state(struct drm_atomic_state *state,
  			     struct drm_colorop *colorop);
+
+struct drm_colorop_state *
+drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop);
+struct drm_colorop_state *
+drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
+				 struct drm_colorop *colorop);
+
  struct drm_connector_state * __must_check
  drm_atomic_get_connector_state(struct drm_atomic_state *state,
  			       struct drm_connector *connector);
@@ -808,36 +815,6 @@ drm_atomic_get_new_plane_state(const struct drm_atomic_state *state,
  	return state->planes[drm_plane_index(plane)].new_state;
  }
 
-/**
- * drm_atomic_get_old_colorop_state - get colorop state, if it exists
- * @state: global atomic state object
- * @colorop: colorop to grab
- *
- * This function returns the old colorop state for the given colorop, or
- * NULL if the colorop is not part of the global atomic state.
- */
-static inline struct drm_colorop_state *
-drm_atomic_get_old_colorop_state(struct drm_atomic_state *state,
-				 struct drm_colorop *colorop)
-{
-	return state->colorops[drm_colorop_index(colorop)].old_state;
-}
-
-/**
- * drm_atomic_get_new_colorop_state - get colorop state, if it exists
- * @state: global atomic state object
- * @colorop: colorop to grab
- *
- * This function returns the new colorop state for the given colorop, or
- * NULL if the colorop is not part of the global atomic state.
- */
-static inline struct drm_colorop_state *
-drm_atomic_get_new_colorop_state(struct drm_atomic_state *state,
-				 struct drm_colorop *colorop)
-{
-	return state->colorops[drm_colorop_index(colorop)].new_state;
-}
-
  /**
   * drm_atomic_get_old_connector_state - get connector state, if it exists
   * @state: global atomic state object
Signature · 1 line
Jani Nikula, Intel
#4 lore raw
In reply to Jani Nikula
kernel test robot noticed the following build errors:

Hi Jani,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-tip/drm-tip linus/master v6.19-rc1 next-20251219] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jani-Nikula/drm-atomic-convert-drm_atomic_get_-old-new-_colorop_state-into-proper-functions/20251218-221750
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20251218141527.405328-1-jani.nikula%40intel.com
patch subject: [PATCH] drm/atomic: convert drm_atomic_get_{old, new}_colorop_state() into proper functions
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20251221/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251221/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/gpu/drm/vkms/vkms_drv.c: In function 'vkms_destroy':

>> drivers/gpu/drm/vkms/vkms_drv.c:261:9: error: implicit declaration of function 'drm_colorop_pipeline_destroy' [-Wimplicit-function-declaration]
     261 |         drm_colorop_pipeline_destroy(&config->dev->drm);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/gpu/drm/vkms/vkms_composer.c: In function 'apply_colorop':
>> drivers/gpu/drm/vkms/vkms_composer.c:164:58: error: invalid use of undefined type 'struct drm_colorop'
     164 |         struct drm_colorop_state *colorop_state = colorop->state;
         |                                                          ^~
   drivers/gpu/drm/vkms/vkms_composer.c:165:41: error: invalid use of undefined type 'struct drm_colorop'
     165 |         struct drm_device *dev = colorop->dev;
         |                                         ^~
   drivers/gpu/drm/vkms/vkms_composer.c:167:20: error: invalid use of undefined type 'struct drm_colorop'
     167 |         if (colorop->type == DRM_COLOROP_1D_CURVE) {
         |                    ^~
>> drivers/gpu/drm/vkms/vkms_composer.c:168:38: error: invalid use of undefined type 'struct drm_colorop_state'
     168 |                 switch (colorop_state->curve_1d_type) {
         |                                      ^~
>> drivers/gpu/drm/vkms/vkms_composer.c:169:22: error: 'DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF' undeclared (first use in this function)
     169 |                 case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vkms/vkms_composer.c:169:22: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/vkms/vkms_composer.c:174:22: error: 'DRM_COLOROP_1D_CURVE_SRGB_EOTF' undeclared (first use in this function); did you mean 'DRM_COLOROP_1D_CURVE'?
     174 |                 case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                      DRM_COLOROP_1D_CURVE
   In file included from arch/x86/include/asm/alternative.h:9,
                    from arch/x86/include/asm/nospec-branch.h:10,
                    from arch/x86/include/asm/irqflags.h:9,
                    from include/linux/irqflags.h:18,
                    from include/linux/spinlock.h:59,
                    from include/drm/drm_crtc.h:28,
                    from include/drm/drm_atomic.h:31,
                    from drivers/gpu/drm/vkms/vkms_composer.c:5:
   drivers/gpu/drm/vkms/vkms_composer.c:182:52: error: invalid use of undefined type 'struct drm_colorop_state'
     182 |                                       colorop_state->curve_1d_type);
         |                                                    ^~
   arch/x86/include/asm/bug.h:175:74: note: in definition of macro '__WARN_print_arg'
     175 |         static_call_mod(WARN_trap)(__WARN_bug_entry(__flags, format), ## arg); \
         |                                                                          ^~~
   include/drm/drm_print.h:784:9: note: in expansion of macro 'WARN_ONCE'
     784 |         WARN_ONCE(condition, "%s %s: [drm] " format,                    \
         |         ^~~~~~~~~
   drivers/gpu/drm/vkms/vkms_composer.c:180:25: note: in expansion of macro 'drm_WARN_ONCE'
     180 |                         drm_WARN_ONCE(dev, true,
         |                         ^~~~~~~~~~~~~
   drivers/gpu/drm/vkms/vkms_composer.c:185:27: error: invalid use of undefined type 'struct drm_colorop'
     185 |         } else if (colorop->type == DRM_COLOROP_CTM_3X4) {
         |                           ^~
   drivers/gpu/drm/vkms/vkms_composer.c:186:34: error: invalid use of undefined type 'struct drm_colorop_state'
     186 |                 if (colorop_state->data)
         |                                  ^~
   drivers/gpu/drm/vkms/vkms_composer.c:188:83: error: invalid use of undefined type 'struct drm_colorop_state'
     188 |                                          (struct drm_color_ctm_3x4 *)colorop_state->data->data);
         |                                                                                   ^~
   drivers/gpu/drm/vkms/vkms_composer.c: In function 'pre_blend_color_transform':
   drivers/gpu/drm/vkms/vkms_composer.c:218:48: error: invalid use of undefined type 'struct drm_colorop'
     218 |                         colorop_state = colorop->state;
         |                                                ^~
   drivers/gpu/drm/vkms/vkms_composer.c:223:43: error: invalid use of undefined type 'struct drm_colorop_state'
     223 |                         if (!colorop_state->bypass)
         |                                           ^~
   drivers/gpu/drm/vkms/vkms_composer.c:226:42: error: invalid use of undefined type 'struct drm_colorop'
     226 |                         colorop = colorop->next;
         |                                          ^~

vim +164 drivers/gpu/drm/vkms/vkms_composer.c

ea3f6baf3196c3 Harry Wentland 2025-11-14  161  
bff4d3cd3c9fcd Harry Wentland 2025-11-14  162  static void apply_colorop(struct pixel_argb_s32 *pixel, struct drm_colorop *colorop)
c1e578bd08da79 Harry Wentland 2025-11-14  163  {
c1e578bd08da79 Harry Wentland 2025-11-14 @164  	struct drm_colorop_state *colorop_state = colorop->state;
c1e578bd08da79 Harry Wentland 2025-11-14  165  	struct drm_device *dev = colorop->dev;
c1e578bd08da79 Harry Wentland 2025-11-14  166  
c1e578bd08da79 Harry Wentland 2025-11-14  167  	if (colorop->type == DRM_COLOROP_1D_CURVE) {
c1e578bd08da79 Harry Wentland 2025-11-14 @168  		switch (colorop_state->curve_1d_type) {
c1e578bd08da79 Harry Wentland 2025-11-14 @169  		case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:
c1e578bd08da79 Harry Wentland 2025-11-14  170  			pixel->r = apply_lut_to_channel_value(&srgb_inv_eotf, pixel->r, LUT_RED);
c1e578bd08da79 Harry Wentland 2025-11-14  171  			pixel->g = apply_lut_to_channel_value(&srgb_inv_eotf, pixel->g, LUT_GREEN);
c1e578bd08da79 Harry Wentland 2025-11-14  172  			pixel->b = apply_lut_to_channel_value(&srgb_inv_eotf, pixel->b, LUT_BLUE);
c1e578bd08da79 Harry Wentland 2025-11-14  173  			break;
c1e578bd08da79 Harry Wentland 2025-11-14 @174  		case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
c1e578bd08da79 Harry Wentland 2025-11-14  175  			pixel->r = apply_lut_to_channel_value(&srgb_eotf, pixel->r, LUT_RED);
c1e578bd08da79 Harry Wentland 2025-11-14  176  			pixel->g = apply_lut_to_channel_value(&srgb_eotf, pixel->g, LUT_GREEN);
c1e578bd08da79 Harry Wentland 2025-11-14  177  			pixel->b = apply_lut_to_channel_value(&srgb_eotf, pixel->b, LUT_BLUE);
c1e578bd08da79 Harry Wentland 2025-11-14  178  			break;
c1e578bd08da79 Harry Wentland 2025-11-14  179  		default:
c1e578bd08da79 Harry Wentland 2025-11-14  180  			drm_WARN_ONCE(dev, true,
c1e578bd08da79 Harry Wentland 2025-11-14  181  				      "unknown colorop 1D curve type %d\n",
c1e578bd08da79 Harry Wentland 2025-11-14  182  				      colorop_state->curve_1d_type);
c1e578bd08da79 Harry Wentland 2025-11-14  183  			break;
c1e578bd08da79 Harry Wentland 2025-11-14  184  		}
ea3f6baf3196c3 Harry Wentland 2025-11-14  185  	} else if (colorop->type == DRM_COLOROP_CTM_3X4) {
ea3f6baf3196c3 Harry Wentland 2025-11-14  186  		if (colorop_state->data)
ea3f6baf3196c3 Harry Wentland 2025-11-14  187  			apply_3x4_matrix(pixel,
ea3f6baf3196c3 Harry Wentland 2025-11-14  188  					 (struct drm_color_ctm_3x4 *)colorop_state->data->data);
c1e578bd08da79 Harry Wentland 2025-11-14  189  	}
c1e578bd08da79 Harry Wentland 2025-11-14  190  }

c1e578bd08da79 Harry Wentland 2025-11-14 191

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki