Signed-off-by: Harry Wentland <harry.wentland@xxxxxxx> Cc: Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> Cc: Pekka Paalanen <pekka.paalanen@xxxxxxxxxxxxx> Cc: Simon Ser <contact@xxxxxxxxxxx> Cc: Harry Wentland <harry.wentland@xxxxxxx> Cc: Melissa Wen <mwen@xxxxxxxxxx> Cc: Jonas Ådahl <jadahl@xxxxxxxxxx> Cc: Sebastian Wick <sebastian.wick@xxxxxxxxxx> Cc: Shashank Sharma <shashank.sharma@xxxxxxx> Cc: Alexander Goins <agoins@xxxxxxxxxx> Cc: Joshua Ashton <joshua@xxxxxxxxx> Cc: Michel Dänzer <mdaenzer@xxxxxxxxxx> Cc: Aleix Pol <aleixpol@xxxxxxx> Cc: Xaver Hugl <xaver.hugl@xxxxxxxxx> Cc: Victoria Brekenfeld <victoria@xxxxxxxxxxxx> Cc: Sima <daniel@xxxxxxxx> Cc: Uma Shankar <uma.shankar@xxxxxxxxx> Cc: Naseer Ahmed <quic_naseer@xxxxxxxxxxx> Cc: Christopher Braga <quic_cbraga@xxxxxxxxxxx> Cc: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx> Cc: Arthur Grillo <arthurgrillo@xxxxxxxxxx> Cc: Hector Martin <marcan@xxxxxxxxx> Cc: Liviu Dudau <Liviu.Dudau@xxxxxxx> Cc: Sasha McIntosh <sashamcintosh@xxxxxxxxxx> --- 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