[Intel-gfx] [RFC v1 3/7] drm/i915: Add Support for Multi Segment Gamma Mode

Uma Shankar uma.shankar at intel.com
Tue Mar 19 08:30:14 UTC 2019


Multi Segment Gamma Mode is added in Gen11+ platforms.
Added a property interface to enable that.

Signed-off-by: Uma Shankar <uma.shankar at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h    |  1 +
 drivers/gpu/drm/i915/intel_color.c | 23 +++++++++++++++++++++++
 include/uapi/drm/i915_drm.h        | 14 ++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 02231ae..f20d418 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1736,6 +1736,7 @@ struct drm_i915_private {
 	struct drm_property *force_audio_property;
 
 	struct drm_property *gamma_mode_property;
+	struct drm_property *multi_segment_gamma_mode_property;
 
 	/* hda/i915 audio component */
 	struct i915_audio_component *audio_component;
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index 9d43d19..399d63d 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -149,6 +149,26 @@ static bool crtc_state_is_legacy_gamma(const struct intel_crtc_state *crtc_state
 	drm_object_attach_property(&crtc->base.base, prop, 0);
 }
 
+void
+intel_attach_multi_segment_gamma_mode_property(struct intel_crtc *crtc)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_property *prop;
+
+	prop = dev_priv->multi_segment_gamma_mode_property;
+	if (!prop) {
+		prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
+					   "Multi-segment Gamma", 0);
+		if (!prop)
+			return;
+
+		dev_priv->multi_segment_gamma_mode_property = prop;
+	}
+
+	drm_object_attach_property(&crtc->base.base, prop, 0);
+}
+
 /*
  * When using limited range, multiply the matrix given by userspace by
  * the matrix that we would use for the limited range.
@@ -953,4 +973,7 @@ void intel_color_init(struct intel_crtc *crtc)
 					   INTEL_INFO(dev_priv)->color.gamma_lut_size);
 
 	intel_attach_gamma_mode_property(crtc);
+
+	if (INTEL_GEN(dev_priv) >= 11)
+		intel_attach_multi_segment_gamma_mode_property(crtc);
 }
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index aa2d4c7..8f1974e 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -1842,6 +1842,20 @@ struct drm_i915_query_topology_info {
 	__u8 data[];
 };
 
+/*
+ * Structure for muti segmented gamma lut
+ */
+struct multi_segment_gamma_lut {
+	/* Number of Lut Segments */
+	__u8 segment_cnt;
+	/* Precison of LUT entries in bits */
+	__u8 precision_bits;
+	/* Pointer having number of LUT elements in each segment */
+	__u32 *segment_lut_cnt_ptr;
+	/* Pointer to store exact lut values for each segment */
+	__u32 *segment_lut_ptr;
+};
+
 #if defined(__cplusplus)
 }
 #endif
-- 
1.9.1



More information about the Intel-gfx mailing list