]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/display: Hook up intel_colorop_destroy
authorChaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Mon, 2 Feb 2026 09:41:58 +0000 (15:11 +0530)
committerSuraj Kandpal <suraj.kandpal@intel.com>
Tue, 10 Feb 2026 05:33:07 +0000 (11:03 +0530)
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 <chaitanya.kumar.borah@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patch.msgid.link/20260202094202.2871478-6-chaitanya.kumar.borah@intel.com
drivers/gpu/drm/i915/display/intel_color_pipeline.c
drivers/gpu/drm/i915/display/intel_colorop.c
drivers/gpu/drm/i915/display/intel_colorop.h

index d3d73d60727cfc27a2376605d18fca4699d8df14..8fecc53540ba569dc3af520aeb7b9c81c74fe90e 100644 (file)
 #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);
index 1d84933f05aa9fd48dbab9033ff32eeeaf345bf5..9e54f51cfad87ecee4aa77b2dd5d3c31117872e5 100644 (file)
@@ -35,3 +35,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));
+}
index 9276eee6e75a3eb326b0adfc6f14d02f9f57985e..638baf67d98d65d4cf3265de799284f83bd32983 100644 (file)
@@ -13,5 +13,6 @@ struct intel_colorop;
 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__ */