Add support for building colorop pipelines using an 'add new entry to start of pipeline' helper instead of 'add new entry to end of pipeline'. This is a pre-req of converting the pipeline to a proper list rather than explicit 'next' pointers.
Signed-off-by: John Harrison <[email protected]> --- drivers/gpu/drm/drm_colorop.c | 25 +++++++++++++++++++++++++ include/drm/drm_colorop.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c index c0eecde8c176..b568ae942706 100644 --- a/drivers/gpu/drm/drm_colorop.c +++ b/drivers/gpu/drm/drm_colorop.c @@ -655,3 +655,28 @@ void drm_colorop_set_next_property(struct drm_colorop *colorop, struct drm_color colorop->next = next; } EXPORT_SYMBOL(drm_colorop_set_next_property); + +/** + * drm_colorop_add_to_pipeline - adds the given colorop to a color pipeline + * @pipeline: drm colorop pipeline + * @colorop: drm colorop to add + * + * Should be used when constructing the color pipeline. Adds the new colorop + * to the end of the pipeline and sets the 'next' property of the previously + * last colorop (if there is one) to point to the new colorop. + */ +void drm_colorop_add_to_pipeline(struct drm_colorop *pipeline, struct drm_colorop *colorop) +{ + struct drm_colorop *last = pipeline; + + /* Head entry does not need processing */ + if (colorop == pipeline) + return; + + while (last->next) + last = last->next; + + drm_object_property_set_value(&last->base, last->next_property, colorop->base.id); + last->next = colorop; +} +EXPORT_SYMBOL(drm_colorop_add_to_pipeline); diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h index 7f0bd58fb625..5c34bc3f115f 100644 --- a/include/drm/drm_colorop.h +++ b/include/drm/drm_colorop.h @@ -464,5 +464,6 @@ const char * drm_get_colorop_lut3d_interpolation_name(enum drm_colorop_lut3d_interpolation_type type); void drm_colorop_set_next_property(struct drm_colorop *colorop, struct drm_colorop *next); +void drm_colorop_add_to_pipeline(struct drm_colorop *pipeline, struct drm_colorop *colorop); #endif /* __DRM_COLOROP_H__ */ -- 2.43.0
