[RFC 18/33] drm/i915/color: Add HDR plane LUT range data to color pipeline

Uma Shankar uma.shankar at intel.com
Tue Aug 29 16:04:07 UTC 2023


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

Create a helper function to add details about LUT ranges that HDR
planes can support. Userspace can parse through this information
to generate proper LUT data for respective hardware blocks. It will
be exposed to the user space by the color pipeline.

Co-developed-by: Uma Shankar <uma.shankar at intel.com>
Signed-off-by: Uma Shankar <uma.shankar at intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 09e50659befd..99ae3f4fca05 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -28,6 +28,7 @@
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dsb.h"
+#include "skl_universal_plane.h"
 
 struct intel_color_funcs {
 	int (*color_check)(struct intel_crtc_state *crtc_state);
@@ -3976,6 +3977,52 @@ struct drm_color_op color_pipeline_hdr[] = {
 	},
 };
 
+__maybe_unused
+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};
+	int ret = 0, i = 0;
+
+	if (icl_is_hdr_plane(i915, to_intel_plane(plane)->id)) {
+		blob[i] = drm_property_create_blob(plane->dev,
+						   sizeof(xelpd_pre_csc_hdr),
+						   xelpd_pre_csc_hdr);
+		if (IS_ERR(blob[i])) {
+			ret = PTR_ERR(blob[i]);
+			goto out;
+		}
+
+		/*
+		 * In HDR color pipeline PRE-CSC and POST-CSC are positioned
+		 * at 0th and 2nd index/position
+		 */
+		color_pipeline_hdr[0].blob_id =
+			blob[i++]->base.id;
+
+		blob[i] = drm_property_create_blob(plane->dev,
+						   sizeof(xelpd_post_csc_hdr),
+						   xelpd_post_csc_hdr);
+		if (IS_ERR(blob[i])) {
+			ret = PTR_ERR(blob[i]);
+			goto out;
+		}
+
+		color_pipeline_hdr[2].blob_id =
+			blob[i++]->base.id;
+	}
+
+out:
+	if (ret) {
+		for (int j = 0; j < i; j++) {
+			if (blob[j])
+				drm_property_blob_put(blob[j]);
+		}
+	}
+
+	return ret;
+};
+
 void intel_color_crtc_init(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
-- 
2.38.1



More information about the dri-devel mailing list