Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: wayland-devel@lists.freedesktop.org
Subject: [Intel-gfx] [RFC 32/33] drm/i915/color: Add a dummy pipeline with 3D LUT
Date: Tue, 29 Aug 2023 21:34:21 +0530	[thread overview]
Message-ID: <20230829160422.1251087-33-uma.shankar@intel.com> (raw)
In-Reply-To: <20230829160422.1251087-1-uma.shankar@intel.com>

From: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>

This patch is to demonstrate how a pipeline can be added.

Co-developed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
---
 drivers/gpu/drm/drm_atomic_state_helper.c  |  3 ++
 drivers/gpu/drm/drm_atomic_uapi.c          | 15 +++++++++
 drivers/gpu/drm/i915/display/intel_color.c | 37 ++++++++++++++++++++--
 include/drm/drm_plane.h                    |  6 ++++
 4 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
index a554e04c2ce3..9c389d97b344 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -349,6 +349,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
 		drm_property_blob_get(state->color.post_csc_lut);
 	if (state->color.private_color_op_data)
 		drm_property_blob_get(state->color.private_color_op_data);
+	if (state->color.lut_3d)
+		drm_property_blob_get(state->color.lut_3d);
 
 	state->color_mgmt_changed = false;
 }
@@ -402,6 +404,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)
 	drm_property_blob_put(state->color.ctm);
 	drm_property_blob_put(state->color.post_csc_lut);
 	drm_property_blob_put(state->color.private_color_op_data);
+	drm_property_blob_put(state->color.lut_3d);
 }
 EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
 
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 9e0fb36d1f47..5629db763fd1 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -482,6 +482,15 @@ int drm_plane_reset_color_op_blobs(struct drm_plane *plane,
 						       &blob_replaced);
 	temp_replaced |= blob_replaced;
 
+	if (ret)
+		goto out;
+
+	ret = drm_atomic_replace_property_blob_from_id(dev,
+						       &state->color.lut_3d,
+						       0, -1, -1,
+						       &blob_replaced);
+	temp_replaced |= blob_replaced;
+
 	if (ret)
 		goto out;
 out:
@@ -551,6 +560,12 @@ int drm_plane_replace_color_op_blobs(struct drm_plane *plane,
 							color_op[i].blob_id,
 							-1, -1,
 							&blob_replaced);
+		} else if (color_op[i].name == DRM_CB_3D_LUT) {
+			ret = drm_atomic_replace_property_blob_from_id(dev,
+							&state->color.lut_3d,
+							color_op[i].blob_id,
+							-1, sizeof(struct drm_color_lut_ext),
+							&blob_replaced);
 		} else {
 			ret = -EINVAL;
 			goto copy_fail;
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 4e5c82c88bd4..2352ddb4a96a 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -4265,6 +4265,19 @@ static const struct drm_color_lut_range xelpd_post_csc_hdr[] = {
 	},
 };
 
+static const struct drm_color_lut_range dummy_3d_lut_range[] = {
+	{
+		.flags = (DRM_MODE_LUT_POST_CSC |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 32,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = 0, .end = (1 << 24) - 1,
+		.min = 0, .max = (1 << 24) - 1,
+	},
+};
+
 struct drm_color_op color_pipeline_sdr[] = {
 	{
 		.name = DRM_CB_PRE_CSC,
@@ -4300,10 +4313,17 @@ struct drm_color_op color_pipeline_hdr[] = {
 	},
 };
 
+struct drm_color_op color_pipeline_3dlut[] = {
+	{
+		.name = DRM_CB_3D_LUT,
+		.type = CURVE_3D,
+	},
+};
+
 static int intel_prepare_plane_color_pipeline(struct drm_plane *plane)
 {
 	struct drm_i915_private *i915 = to_i915(plane->dev);
-	struct drm_property_blob *blob[2] = {NULL};
+	struct drm_property_blob *blob[3] = {NULL};
 	int ret = 0, i = 0;
 
 	if (icl_is_hdr_plane(i915, to_intel_plane(plane)->id)) {
@@ -4350,6 +4370,17 @@ static int intel_prepare_plane_color_pipeline(struct drm_plane *plane)
 			color_pipeline_sdr[1].blob_id = blob[i++]->base.id;
 	}
 
+	blob[i] = drm_property_create_blob(plane->dev,
+					   sizeof(dummy_3d_lut_range),
+					   dummy_3d_lut_range);
+
+	if (IS_ERR(blob[i])) {
+		ret = PTR_ERR(blob[i]);
+		goto out;
+	}
+
+	color_pipeline_3dlut[0].blob_id = blob[i++]->base.id;
+
 out:
 	if (ret) {
 		for (int j = 0; j < i; j++) {
@@ -4368,7 +4399,7 @@ void intel_color_plane_init(struct drm_plane *plane)
 	if (DISPLAY_VER(i915) < 13)
 		return;
 
-	drm_plane_create_get_color_pipeline_property(plane->dev, plane, 2);
+	drm_plane_create_get_color_pipeline_property(plane->dev, plane, 3);
 
 	intel_prepare_plane_color_pipeline(plane);
 
@@ -4387,6 +4418,8 @@ void intel_color_plane_init(struct drm_plane *plane)
 					     color_pipeline_sdr,
 					     sizeof(color_pipeline_sdr));
 
+	drm_plane_add_color_pipeline(plane, "color pipeline 3dlut", color_pipeline_3dlut,
+				     sizeof(color_pipeline_3dlut));
 	drm_plane_attach_get_color_pipeline_property(plane);
 
 	drm_plane_create_set_color_pipeline_property(plane->dev, plane);
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 601b01e47a93..5cb84fa32dd5 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -284,6 +284,12 @@ struct drm_plane_state {
 		 * For example: Parameterized/non-parameterized fixed function operations
 		 */
 		struct drm_property_blob *private_color_op_data;
+
+		/* @lut_3d:
+		 *
+		 * Three dimensional luts
+		 */
+		struct drm_property_blob *lut_3d;
 	} color;
 
 	/**
-- 
2.38.1


  parent reply	other threads:[~2023-08-29 16:01 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 16:03 [Intel-gfx] [RFC 00/33] Add Support for Plane Color Pipeline Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 01/33] drm/doc/rfc: Add RFC document for proposed " Uma Shankar
2023-08-29 19:40   ` Harry Wentland
2023-08-30  8:59     ` Shankar, Uma
2023-08-30 12:28       ` Pekka Paalanen
2023-09-04 13:44         ` Shankar, Uma
2023-09-05 11:32           ` Pekka Paalanen
2023-09-07 12:31             ` Shankar, Uma
2023-09-08  8:31               ` Pekka Paalanen
2023-09-07 20:08   ` Christopher Braga
2023-10-13  5:46     ` Shankar, Uma
2023-08-29 16:03 ` [Intel-gfx] [RFC 02/33] drm: Add color operation structure Uma Shankar
2023-08-30 13:00   ` Pekka Paalanen
2023-09-04 14:10     ` Shankar, Uma
2023-09-05 11:33       ` Pekka Paalanen
2023-08-29 16:03 ` [Intel-gfx] [RFC 03/33] drm: Add plane get color pipeline property Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 04/33] drm: Add helper to add color pipeline Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 05/33] drm: Add structures for setting " Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 06/33] drm: Add set colorpipeline property Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 07/33] drm: Add Enhanced Gamma LUT precision structure Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 08/33] drm: Add color lut range structure Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 09/33] drm: Add color information to plane state Uma Shankar
2023-08-29 16:03 ` [Intel-gfx] [RFC 10/33] drm: Manage color blob states Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 11/33] drm: Replace individual color blobs Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 12/33] drm: Reset pipeline when user sends NULL blob Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 13/33] drm: Reset plane color state on pipeline switch request Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 14/33] drm/i915/color: Add lut range for SDR planes Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 15/33] drm/i915/color: Add lut range for HDR planes Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 16/33] drm/i915/color: Add color pipeline " Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 17/33] drm/i915/color: Add color pipeline for SDR planes Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 18/33] drm/i915/color: Add HDR plane LUT range data to color pipeline Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 19/33] drm/i915/color: Add SDR " Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 20/33] drm/i915/color: Add color pipelines to plane Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 21/33] drm/i915/color: Create and attach set color pipeline property Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 22/33] drm/i915/color: Add plane color callbacks Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 23/33] drm/i915/color: Load plane color luts from atomic flip Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 24/33] drm/i915/xelpd: Add plane color check to glk_plane_color_ctl Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 25/33] drm/i915/xelpd: Add register definitions for Plane Degamma Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 26/33] drm/i915/color: Add color functions for ADL Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 27/33] drm/i915/color: Program Plane Pre-CSC Registers Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 28/33] drm/i915/xelpd: Add register definitions for Plane Post CSC Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 29/33] drm/i915/xelpd: Program Plane Post CSC Registers Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 30/33] drm/i915/color: Enable Plane CSC Uma Shankar
2023-08-29 16:04 ` [Intel-gfx] [RFC 31/33] drm/i915/color: Enable plane color features Uma Shankar
2023-08-29 16:04 ` Uma Shankar [this message]
2023-08-29 16:04 ` [Intel-gfx] [RFC 33/33] drm/i915/color: Add example implementation for vendor specific color operation Uma Shankar
2023-08-29 19:26 ` [Intel-gfx] [RFC 00/33] Add Support for Plane Color Pipeline Harry Wentland
2023-08-30  8:47   ` Shankar, Uma
2023-08-30 21:15     ` Sebastian Wick
2023-09-04 14:29       ` Shankar, Uma
2023-09-05 11:33         ` Pekka Paalanen
2023-09-05 12:33           ` Sebastian Wick
2023-09-05 12:57             ` Sebastian Wick
2023-08-29 20:02 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2023-08-29 20:02 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-08-29 20:17 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

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=20230829160422.1251087-33-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=wayland-devel@lists.freedesktop.org \
    /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