Signed-off-by: Harry Wentland <harry.wentl...@amd.com>
Cc: Ville Syrjala <ville.syrj...@linux.intel.com>
Cc: Pekka Paalanen <pekka.paala...@collabora.com>
Cc: Simon Ser <cont...@emersion.fr>
Cc: Harry Wentland <harry.wentl...@amd.com>
Cc: Melissa Wen <m...@igalia.com>
Cc: Jonas Ådahl <jad...@redhat.com>
Cc: Sebastian Wick <sebastian.w...@redhat.com>
Cc: Shashank Sharma <shashank.sha...@amd.com>
Cc: Alexander Goins <ago...@nvidia.com>
Cc: Joshua Ashton <jos...@froggi.es>
Cc: Michel Dänzer <mdaen...@redhat.com>
Cc: Aleix Pol <aleix...@kde.org>
Cc: Xaver Hugl <xaver.h...@gmail.com>
Cc: Victoria Brekenfeld <victo...@system76.com>
Cc: Sima <dan...@ffwll.ch>
Cc: Uma Shankar <uma.shan...@intel.com>
Cc: Naseer Ahmed <quic_nas...@quicinc.com>
Cc: Christopher Braga <quic_cbr...@quicinc.com>
Cc: Abhinav Kumar <quic_abhin...@quicinc.com>
Cc: Arthur Grillo <arthurgri...@riseup.net>
Cc: Hector Martin <mar...@marcan.st>
Cc: Liviu Dudau <liviu.du...@arm.com>
Cc: Sasha McIntosh <sashamcint...@google.com>
---
 drivers/gpu/drm/drm_atomic.c  |  1 +
 drivers/gpu/drm/drm_colorop.c | 42 +++++++++++++++++++++++++++++++++++
 include/drm/drm_colorop.h     |  2 ++
 3 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 781bd3aa1849..cfe9199a15d2 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -803,6 +803,7 @@ static void drm_atomic_colorop_print_state(struct 
drm_printer *p,
        drm_printf(p, "\ttype=%s\n", drm_get_colorop_type_name(colorop->type));
        drm_printf(p, "\tbypass=%u\n", state->bypass);
        drm_printf(p, "\tcurve_1d_type=%s\n", 
drm_get_colorop_curve_1d_type_name(state->curve_1d_type));
+       drm_printf(p, "\tnext=%d\n", drm_colorop_get_next_property(colorop));
 }
 
 static void drm_atomic_plane_print_state(struct drm_printer *p,
diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
index 1afd5fbe8776..ff6f938cc28c 100644
--- a/drivers/gpu/drm/drm_colorop.c
+++ b/drivers/gpu/drm/drm_colorop.c
@@ -340,3 +340,45 @@ void drm_colorop_set_next_property(struct drm_colorop 
*colorop, struct drm_color
                                      next->base.id);
 }
 EXPORT_SYMBOL(drm_colorop_set_next_property);
+
+/**
+ * drm_colorop_set_next_property - gets the next colorop ID
+ * @colorop: drm colorop
+ *
+ * Returns:
+ * The DRM object ID of the next colorop
+ */
+uint32_t drm_colorop_get_next_property(struct drm_colorop *colorop)
+{
+       uint64_t next_id = 0;
+
+       if (!colorop->next_property)
+               return 0;
+
+       drm_object_property_get_value(&colorop->base,
+                                     colorop->next_property,
+                                     &next_id);
+
+       return (uint32_t) next_id;
+}
+EXPORT_SYMBOL(drm_colorop_get_next_property);
+
+
+/**
+ * drm_colorop_set_next_property - gets the next colorop ID
+ * @colorop: drm colorop
+ *
+ * Returns:
+ * The DRM object ID of the next colorop
+ */
+struct drm_colorop *drm_colorop_get_next(struct drm_colorop *colorop)
+{
+       uint64_t next_id = drm_colorop_get_next_property(colorop);
+
+       if (!next_id)
+               return NULL;
+
+       return drm_colorop_find(colorop->dev, NULL, next_id);
+
+}
+EXPORT_SYMBOL(drm_colorop_get_next);
\ No newline at end of file
diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
index 622a671d2458..2ba506a0ea4d 100644
--- a/include/drm/drm_colorop.h
+++ b/include/drm/drm_colorop.h
@@ -228,6 +228,8 @@ const char *drm_get_colorop_type_name(enum drm_colorop_type 
type);
 const char *drm_get_colorop_curve_1d_type_name(enum drm_colorop_curve_1d_type 
type);
 
 void drm_colorop_set_next_property(struct drm_colorop *colorop, struct 
drm_colorop *next);
+uint32_t drm_colorop_get_next_property(struct drm_colorop *colorop);
+struct drm_colorop *drm_colorop_get_next(struct drm_colorop *colorop);
 
 
 #endif /* __DRM_COLOROP_H__ */
-- 
2.42.0

Reply via email to