From: NĂcolas F. R. A. Prado <[email protected]> Introduce colorop helper counterparts for post-blend color pipelines that take a CRTC instead of a plane.
Signed-off-by: NĂcolas F. R. A. Prado <[email protected]> Co-developed-by: Ariel D'Alessandro <[email protected]> Signed-off-by: Ariel D'Alessandro <[email protected]> Reviewed-by: Louis Chauvet <[email protected]> Reviewed-by: Harry Wentland <[email protected]> --- drivers/gpu/drm/drm_colorop.c | 81 +++++++++++++++++++++++++++++++++++ include/drm/drm_colorop.h | 14 ++++++ 2 files changed, 95 insertions(+) diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c index a3567b8380e3..62dc85604761 100644 --- a/drivers/gpu/drm/drm_colorop.c +++ b/drivers/gpu/drm/drm_colorop.c @@ -191,6 +191,21 @@ static int drm_plane_colorop_init(struct drm_device *dev, return ret; } +static int drm_crtc_colorop_init(struct drm_device *dev, + struct drm_colorop *colorop, + struct drm_crtc *crtc, + const struct drm_colorop_funcs *funcs, + enum drm_colorop_type type, uint32_t flags) +{ + int ret; + + ret = drm_common_colorop_init(dev, colorop, funcs, type, flags); + + colorop->crtc = crtc; + + return ret; +} + /** * drm_colorop_cleanup - Cleanup a drm_colorop object in color_pipeline * @@ -319,6 +334,26 @@ int drm_plane_colorop_curve_1d_init(struct drm_device *dev, } EXPORT_SYMBOL(drm_plane_colorop_curve_1d_init); +int drm_crtc_colorop_curve_1d_init(struct drm_device *dev, + struct drm_colorop *colorop, + struct drm_crtc *crtc, + const struct drm_colorop_funcs *funcs, + u64 supported_tfs, uint32_t flags) +{ + int ret; + + ret = drm_colorop_has_supported_tf(dev, &crtc->base, crtc->name, supported_tfs); + if (ret) + return ret; + + ret = drm_crtc_colorop_init(dev, colorop, crtc, funcs, DRM_COLOROP_1D_CURVE, flags); + if (ret) + return ret; + + return drm_common_colorop_curve_1d_init(dev, colorop, supported_tfs, flags); +} +EXPORT_SYMBOL(drm_crtc_colorop_curve_1d_init); + static int drm_colorop_create_data_prop(struct drm_device *dev, struct drm_colorop *colorop) { struct drm_property *prop; @@ -408,6 +443,37 @@ drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, } EXPORT_SYMBOL(drm_plane_colorop_curve_1d_lut_init); +/** + * drm_crtc_colorop_curve_1d_lut_init - Initialize a DRM_COLOROP_1D_LUT + * + * @dev: DRM device + * @colorop: The drm_colorop object to initialize + * @crtc: The associated drm_crtc + * @lut_size: LUT size supported by driver + * @interpolation: 1D LUT interpolation type + * @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. + * @return zero on success, -E value on failure + */ +int +drm_crtc_colorop_curve_1d_lut_init(struct drm_device *dev, + struct drm_colorop *colorop, + struct drm_crtc *crtc, + const struct drm_colorop_funcs *funcs, + uint32_t lut_size, + enum drm_colorop_lut1d_interpolation_type interpolation, + uint32_t flags) +{ + int ret; + + ret = drm_crtc_colorop_init(dev, colorop, crtc, funcs, DRM_COLOROP_1D_LUT, flags); + if (ret) + return ret; + + return drm_common_colorop_curve_1d_lut_init(dev, colorop, lut_size, + interpolation, flags); +} +EXPORT_SYMBOL(drm_crtc_colorop_curve_1d_lut_init); + static int drm_common_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, uint32_t flags) @@ -439,6 +505,21 @@ int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, } EXPORT_SYMBOL(drm_plane_colorop_ctm_3x4_init); +int drm_crtc_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, + const struct drm_colorop_funcs *funcs, + uint32_t flags) +{ + int ret; + + ret = drm_crtc_colorop_init(dev, colorop, crtc, funcs, DRM_COLOROP_CTM_3X4, flags); + if (ret) + return ret; + + return drm_common_colorop_ctm_3x4_init(dev, colorop, flags); +} +EXPORT_SYMBOL(drm_crtc_colorop_ctm_3x4_init); + /** * drm_plane_colorop_mult_init - Initialize a DRM_COLOROP_MULTIPLIER * diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h index a165a887c05d..bbd0847a6d40 100644 --- a/include/drm/drm_colorop.h +++ b/include/drm/drm_colorop.h @@ -561,6 +561,13 @@ static inline struct drm_colorop *drm_colorop_find(struct drm_device *dev, void drm_colorop_pipeline_destroy(struct drm_device *dev); void drm_colorop_cleanup(struct drm_colorop *colorop); +int drm_crtc_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, + const struct drm_colorop_funcs *funcs, + uint32_t lut_size, + enum drm_colorop_lut1d_interpolation_type interpolation, + uint32_t flags); + int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, const struct drm_colorop_funcs *funcs, u64 supported_tfs, uint32_t flags); @@ -570,9 +577,16 @@ int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_color uint32_t lut_size, enum drm_colorop_lut1d_interpolation_type interpolation, uint32_t flags); +int drm_crtc_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, + const struct drm_colorop_funcs *funcs, + u64 supported_tfs, uint32_t flags); + int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, const struct drm_colorop_funcs *funcs, uint32_t flags); +int drm_crtc_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, const struct drm_colorop_funcs *funcs, uint32_t flags); int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, const struct drm_colorop_funcs *funcs, uint32_t flags); -- 2.53.0
