> Subject: [PATCH 09/13] drm/i915/display: Hook up intel_colorop_destroy
> 
> i915 embeds struct drm_colorop inside struct intel_colorop, so the default
> drm_colorop_destroy() helper cannot be used. Add an
> intel_colorop_destroy() helper that performs common DRM cleanup and frees
> intel_colorop object.
> 
> This ensures correct teardown of plane color pipeline objects.
> 
> Signed-off-by: Chaitanya Kumar Borah <[email protected]>

LGTM,
Reviewed-by: Suraj Kandpal <[email protected]>

> ---
>  drivers/gpu/drm/i915/display/intel_color_pipeline.c | 13 +++++++++----
>  drivers/gpu/drm/i915/display/intel_colorop.c        |  6 ++++++
>  drivers/gpu/drm/i915/display/intel_colorop.h        |  1 +
>  3 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_color_pipeline.c
> b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
> index d3d73d60727c..8fecc53540ba 100644
> --- a/drivers/gpu/drm/i915/display/intel_color_pipeline.c
> +++ b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
> @@ -13,6 +13,10 @@
>  #define PLANE_DEGAMMA_SIZE 128
>  #define PLANE_GAMMA_SIZE 32
> 
> +static const struct drm_colorop_funcs intel_colorop_funcs = {
> +     .destroy = intel_colorop_destroy,
> +};
> +
>  static
>  int _intel_color_pipeline_plane_init(struct drm_plane *plane, struct
> drm_prop_enum_list *list,
>                                    enum pipe pipe)
> @@ -25,7 +29,7 @@ int _intel_color_pipeline_plane_init(struct drm_plane
> *plane, struct drm_prop_en
> 
>       colorop = intel_colorop_create(INTEL_PLANE_CB_PRE_CSC_LUT);
> 
> -     ret = drm_plane_colorop_curve_1d_lut_init(dev, &colorop->base,
> plane, NULL,
> +     ret = drm_plane_colorop_curve_1d_lut_init(dev, &colorop->base,
> plane,
> +&intel_colorop_funcs,
>                                                 PLANE_DEGAMMA_SIZE,
> 
> DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
> 
> DRM_COLOROP_FLAG_ALLOW_BYPASS); @@ -39,7 +43,7 @@ int
> _intel_color_pipeline_plane_init(struct drm_plane *plane, struct drm_prop_en
>       prev_op = &colorop->base;
> 
>       colorop = intel_colorop_create(INTEL_PLANE_CB_CSC);
> -     ret = drm_plane_colorop_ctm_3x4_init(dev, &colorop->base, plane,
> NULL,
> +     ret = drm_plane_colorop_ctm_3x4_init(dev, &colorop->base, plane,
> +&intel_colorop_funcs,
> 
> DRM_COLOROP_FLAG_ALLOW_BYPASS);
>       if (ret)
>               return ret;
> @@ -52,7 +56,8 @@ int _intel_color_pipeline_plane_init(struct drm_plane
> *plane, struct drm_prop_en
>           plane->type == DRM_PLANE_TYPE_PRIMARY) {
>               colorop = intel_colorop_create(INTEL_PLANE_CB_3DLUT);
> 
> -             ret = drm_plane_colorop_3dlut_init(dev, &colorop->base,
> plane, NULL, 17,
> +             ret = drm_plane_colorop_3dlut_init(dev, &colorop->base,
> plane,
> +                                                &intel_colorop_funcs, 17,
> 
> DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL,
>                                                  true);
>               if (ret)
> @@ -64,7 +69,7 @@ int _intel_color_pipeline_plane_init(struct drm_plane
> *plane, struct drm_prop_en
>       }
> 
>       colorop = intel_colorop_create(INTEL_PLANE_CB_POST_CSC_LUT);
> -     ret = drm_plane_colorop_curve_1d_lut_init(dev, &colorop->base,
> plane, NULL,
> +     ret = drm_plane_colorop_curve_1d_lut_init(dev, &colorop->base,
> plane,
> +&intel_colorop_funcs,
>                                                 PLANE_GAMMA_SIZE,
> 
> DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
> 
> DRM_COLOROP_FLAG_ALLOW_BYPASS); diff --git
> a/drivers/gpu/drm/i915/display/intel_colorop.c
> b/drivers/gpu/drm/i915/display/intel_colorop.c
> index f2fc0d8780ce..fae4383f8518 100644
> --- a/drivers/gpu/drm/i915/display/intel_colorop.c
> +++ b/drivers/gpu/drm/i915/display/intel_colorop.c
> @@ -33,3 +33,9 @@ struct intel_colorop *intel_colorop_create(enum
> intel_color_block id)
> 
>       return colorop;
>  }
> +
> +void intel_colorop_destroy(struct drm_colorop *colorop) {
> +     drm_colorop_cleanup(colorop);
> +     kfree(to_intel_colorop(colorop));
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_colorop.h
> b/drivers/gpu/drm/i915/display/intel_colorop.h
> index 21d58eb9f3d0..79824506bbab 100644
> --- a/drivers/gpu/drm/i915/display/intel_colorop.h
> +++ b/drivers/gpu/drm/i915/display/intel_colorop.h
> @@ -11,5 +11,6 @@
>  struct intel_colorop *to_intel_colorop(struct drm_colorop *colorop);  struct
> intel_colorop *intel_colorop_alloc(void);  struct intel_colorop
> *intel_colorop_create(enum intel_color_block id);
> +void intel_colorop_destroy(struct drm_colorop *colorop);
> 
>  #endif /* __INTEL_COLOROP_H__ */
> --
> 2.25.1

Reply via email to