Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: harry.wentland@amd.com, jani.nikula@linux.intel.com,
	louis.chauvet@bootlin.com, mwen@igalia.com, contact@emersion.fr,
	alex.hung@amd.com, daniels@collabora.com, uma.shankar@intel.com,
	suraj.kandpal@intel.com, nfraprado@collabora.com,
	ville.syrjala@linux.intel.com, matthew.d.roper@intel.com
Subject: [PATCH v3 09/13] drm/i915/display: Hook up intel_colorop_destroy
Date: Tue, 13 Jan 2026 15:52:59 +0530	[thread overview]
Message-ID: <20260113102303.724205-10-chaitanya.kumar.borah@intel.com> (raw)
In-Reply-To: <20260113102303.724205-1-chaitanya.kumar.borah@intel.com>

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>
---
 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 1d84933f05aa..9e54f51cfad8 100644
--- a/drivers/gpu/drm/i915/display/intel_colorop.c
+++ b/drivers/gpu/drm/i915/display/intel_colorop.c
@@ -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));
+}
diff --git a/drivers/gpu/drm/i915/display/intel_colorop.h b/drivers/gpu/drm/i915/display/intel_colorop.h
index 9276eee6e75a..638baf67d98d 100644
--- a/drivers/gpu/drm/i915/display/intel_colorop.h
+++ b/drivers/gpu/drm/i915/display/intel_colorop.h
@@ -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__ */
-- 
2.25.1


  parent reply	other threads:[~2026-01-13 10:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 10:22 [PATCH v3 00/13] drm: Color pipeline teardown and follow-up fixes/improvements Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 01/13] drm/i915/color: Place 3D LUT after CSC in plane color pipeline Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 02/13] drm/amd/display: Fix color pipeline enum name leak Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 03/13] drm/vkms: " Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 04/13] drm/i915/display: " Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 05/13] drm/colorop: Add destroy helper for colorop objects Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 06/13] drm: Allow driver-managed destruction of " Chaitanya Kumar Borah
2026-01-14  5:37   ` Kandpal, Suraj
2026-01-14  7:51     ` Borah, Chaitanya Kumar
2026-01-13 10:22 ` [PATCH v3 07/13] drm/amd/display: Hook up colorop destroy helper for plane pipelines Chaitanya Kumar Borah
2026-01-13 10:22 ` [PATCH v3 08/13] drm/vkms: " Chaitanya Kumar Borah
2026-01-13 10:22 ` Chaitanya Kumar Borah [this message]
2026-01-13 10:23 ` [PATCH v3 10/13] drm: Clean up colorop objects during mode_config cleanup Chaitanya Kumar Borah
2026-01-13 10:23 ` [PATCH v3 11/13] drm/vkms: Remove drm_colorop_pipeline_destroy() from vkms_destroy() Chaitanya Kumar Borah
2026-01-13 10:23 ` [PATCH v3 12/13] drm/colorop: Use destroy callback for color pipeline teardown Chaitanya Kumar Borah
2026-01-13 10:23 ` [PATCH v3 13/13] drm/i915/color: Add failure handling in plane color pipeline init Chaitanya Kumar Borah
2026-01-13 11:18 ` ✗ CI.checkpatch: warning for drm: Color pipeline teardown and follow-up fixes/improvements (rev3) Patchwork
2026-01-13 11:19 ` ✓ CI.KUnit: success " Patchwork
2026-01-13 11:38 ` ✗ CI.checksparse: warning " Patchwork
2026-01-13 12:06 ` ✓ Xe.CI.BAT: success " Patchwork
2026-01-13 19:20 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-21 13:51 ` [PATCH v3 00/13] drm: Color pipeline teardown and follow-up fixes/improvements Jani Nikula
2026-01-22  9:57   ` Maarten Lankhorst
2026-01-27  6:00     ` Borah, Chaitanya Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260113102303.724205-10-chaitanya.kumar.borah@intel.com \
    --to=chaitanya.kumar.borah@intel.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=contact@emersion.fr \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=louis.chauvet@bootlin.com \
    --cc=matthew.d.roper@intel.com \
    --cc=mwen@igalia.com \
    --cc=nfraprado@collabora.com \
    --cc=suraj.kandpal@intel.com \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox