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 <nfrapr...@collabora.com> --- drivers/gpu/drm/drm_colorop.c | 73 +++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_colorop.h | 8 +++++ 2 files changed, 81 insertions(+) diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c index db137169effa6cd9e6d5805f65bdfd1cc6882075..b0c3216f4dac22f3408cbd537a20f38d03abc0a7 100644 --- a/drivers/gpu/drm/drm_colorop.c +++ b/drivers/gpu/drm/drm_colorop.c @@ -168,6 +168,20 @@ 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, + enum drm_colorop_type type, uint32_t flags) +{ + int ret; + + ret = drm_common_colorop_init(dev, colorop, type, flags); + + colorop->crtc = crtc; + + return ret; +} + /** * drm_colorop_cleanup - Cleanup a drm_colorop object in color_pipeline * @@ -293,6 +307,23 @@ int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop * } 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, 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, 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; @@ -381,6 +412,35 @@ drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop * } 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 + * @lut1d_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, uint32_t lut_size, + enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, + uint32_t flags) +{ + int ret; + + ret = drm_crtc_colorop_init(dev, colorop, crtc, DRM_COLOROP_1D_LUT, flags); + if (ret) + return ret; + + return drm_common_colorop_curve_1d_lut_init(dev, colorop, lut_size, + lut1d_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) { @@ -408,6 +468,19 @@ int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *c } 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, uint32_t flags) +{ + int ret; + + ret = drm_crtc_colorop_init(dev, colorop, crtc, 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 3e223f3b3597978c5d702ce7622ae30b8aa9dddb..e7d1e5e95a901b1bd91fd8580e2fcb367c0253ce 100644 --- a/include/drm/drm_colorop.h +++ b/include/drm/drm_colorop.h @@ -377,14 +377,22 @@ static inline struct drm_colorop *drm_colorop_find(struct drm_device *dev, void drm_colorop_pipeline_destroy(struct drm_device *dev); +int drm_crtc_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, uint32_t lut_size, + enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, + uint32_t flags); int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, u64 supported_tfs, uint32_t flags); +int drm_crtc_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, u64 supported_tfs, uint32_t flags); int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, uint32_t lut_size, enum drm_colorop_lut1d_interpolation_type lut1d_interpolation, uint32_t flags); int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, uint32_t flags); +int drm_crtc_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, + struct drm_crtc *crtc, uint32_t flags); int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop, struct drm_plane *plane, uint32_t flags); int drm_plane_colorop_3dlut_init(struct drm_device *dev, struct drm_colorop *colorop, -- 2.50.1