[v5 09/24] drm/i915/color: Add helper to create intel colorop
Jani Nikula
jani.nikula at linux.intel.com
Fri Jul 4 12:37:55 UTC 2025
On Wed, 02 Jul 2025, Uma Shankar <uma.shankar at intel.com> wrote:
> From: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
>
> Add intel colorop create helper
>
> Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
> Signed-off-by: Uma Shankar <uma.shankar at intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_color.c | 39 ++++++++++++++++++++++
> drivers/gpu/drm/i915/display/intel_color.h | 3 ++
> 2 files changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index 671db6926e4c..5f38a5ff541c 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -3962,6 +3962,45 @@ static const struct intel_color_funcs ilk_color_funcs = {
> .get_config = ilk_get_config,
> };
>
> +/* TODO: Move to another file */
> +struct intel_plane_colorop *intel_colorop_alloc(void)
> +{
> + struct intel_plane_colorop *colorop;
> + struct intel_plane_colorop_state *colorop_state;
> +
> + colorop = kzalloc(sizeof(*colorop), GFP_KERNEL);
> + if (!colorop)
> + return ERR_PTR(-ENOMEM);
> +
> + colorop_state = kzalloc(sizeof(*colorop_state), GFP_KERNEL);
> + if (!colorop_state) {
> + kfree(colorop);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + /* TODO: Add color op reset
> + * intel_colorop_state_reset(plane_state, plane);
> + */
> +
> + colorop->base.state = &colorop_state->uapi;
> +
> + return colorop;
> +}
> +
> +struct intel_plane_colorop *intel_plane_colorop_create(enum intel_color_block id)
> +{
> + struct intel_plane_colorop *colorop;
> +
> + colorop = intel_colorop_alloc();
> +
> + if (IS_ERR(colorop))
> + return colorop;
> +
> + colorop->id = id;
> +
> + return colorop;
> +}
> +
> void intel_color_crtc_init(struct intel_crtc *crtc)
> {
> struct intel_display *display = to_intel_display(crtc);
> diff --git a/drivers/gpu/drm/i915/display/intel_color.h b/drivers/gpu/drm/i915/display/intel_color.h
> index bf7a12ce9df0..f3c7cd694b99 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.h
> +++ b/drivers/gpu/drm/i915/display/intel_color.h
> @@ -14,6 +14,7 @@ struct intel_crtc;
> struct intel_display;
> struct intel_dsb;
> struct drm_property_blob;
> +enum intel_color_block;
>
> void intel_color_init_hooks(struct intel_display *display);
> int intel_color_init(struct intel_display *display);
> @@ -40,5 +41,7 @@ bool intel_color_lut_equal(const struct intel_crtc_state *crtc_state,
> const struct drm_property_blob *blob2,
> bool is_pre_csc_lut);
> void intel_color_assert_luts(const struct intel_crtc_state *crtc_state);
> +struct intel_plane_colorop *intel_colorop_alloc(void);
> +struct intel_plane_colorop *intel_plane_colorop_create(enum intel_color_block id);
The naming seems inconsistent.
>
> #endif /* __INTEL_COLOR_H__ */
--
Jani Nikula, Intel
More information about the dri-devel
mailing list