[v3 2/7] drm/i915: Define color lut range structure

Uma Shankar uma.shankar at intel.com
Fri Apr 12 10:20:58 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

This defines the color lut ranges for 10bit and multi
segmented gamma range for ICL.

v2: Defined and advertise the gamma modes supported on
various platforms as suggested by Ville.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar at intel.com>
---
 drivers/gpu/drm/i915/intel_color.c | 566 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 562 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index ca341a9..c433215 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -383,6 +383,20 @@ static u32 ilk_lut_10(const struct drm_color_lut *color)
 		drm_color_lut_extract(color->blue, 10);
 }
 
+static bool i9xx_has_10bit_lut(struct drm_i915_private *dev_priv)
+{
+        /*
+         * Bspec:
+         " "NOTE: The 8-bit (non-10-bit) mode is the only
+         *  mode supported by BrookDale-G and Springdale-G."
+         * and
+         * "NOTE: The 8-bit (non-10-bit) mode is the only
+         * mode supported by Alviso and Grantsdale."
+         */
+        return !IS_I845G(dev_priv) && !IS_I865G(dev_priv) &&
+                !IS_I915G(dev_priv) && !IS_I915GM(dev_priv);
+}
+
 /* Loads the legacy palette/gamma unit for the CRTC. */
 static void i9xx_load_luts_internal(const struct intel_crtc_state *crtc_state,
 				    const struct drm_property_blob *blob)
@@ -1221,10 +1235,420 @@ static int icl_color_check(struct intel_crtc_state *crtc_state)
 	return 0;
 }
 
+enum {
+	I9XX_LUT_SIZE_8BIT = 256,
+	I9XX_LUT_SIZE_10BIT = 129,
+
+	ILK_LUT_SIZE_10BIT = 1024,
+	ILK_LUT_SIZE_12BIT = 513,
+
+	IVB_LUT_SIZE_SPLIT = 512,
+
+	CHV_LUT_SIZE_CGM_DEGAMMA = 65,
+	CHV_LUT_SIZE_CGM_GAMMA = 257,
+};
+
+#define I9XX_GAMMA_8 \
+	{ \
+		.flags = DRM_MODE_LUT_GAMMA, \
+		.count = 256, \
+		.input_bpc = 8, .output_bpc = 8, \
+		.start = 0, .end = (1 << 8) - 1, \
+		.min = 0, .max = (1 << 8) - 1, \
+	}
+
+static const struct drm_color_lut_range i9xx_gamma_8[] = {
+	I9XX_GAMMA_8,
+};
+
+static const struct drm_color_lut_range i9xx_gamma_10_slope[] = {
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 129,
+		.input_bpc = 10, .output_bpc = 10,
+		.start = 0, .end = 1 << 10,
+		.min = 0, .max = (1 << 10) - 1,
+	},
+};
+
+#define I965_GAMMA_10 \
+	{ \
+		.flags = (DRM_MODE_LUT_GAMMA | \
+			  DRM_MODE_LUT_INTERPOLATE | \
+			  DRM_MODE_LUT_NON_DECREASING), \
+		.count = 128, \
+		.input_bpc = 10, .output_bpc = 16, \
+		.start = 0, .end = (1 << 10) - (1 << 10) / 128, \
+		.min = 0, .max = (1 << 16) - 1, \
+	}, \
+	/* PIPEGCMAX */ \
+	{ \
+		.flags = (DRM_MODE_LUT_GAMMA | \
+			  DRM_MODE_LUT_INTERPOLATE | \
+			  DRM_MODE_LUT_REUSE_LAST | \
+			  DRM_MODE_LUT_NON_DECREASING), \
+		.count = 1, \
+		.input_bpc = 10, .output_bpc = 16, \
+		.start = (1 << 10) - (1 << 10) / 128, .end = 1 << 10, \
+		.min = 0, .max = 1 << 16, \
+	}
+
+static const struct drm_color_lut_range i965_gamma_10[] = {
+	I965_GAMMA_10,
+};
+
+#define CHV_CGM_DEGAMMA \
+        { \
+                .flags = (DRM_MODE_LUT_DEGAMMA | \
+                          DRM_MODE_LUT_INTERPOLATE | \
+                          DRM_MODE_LUT_NON_DECREASING), \
+                .count = 65, \
+                .input_bpc = 10, .output_bpc = 14, \
+                .start = 0, .end = 1 << 10, \
+                .min = 0, .max = (1 << 14) - 1, \
+        }
+#define CHV_CGM_GAMMA \
+        { \
+                .flags = (DRM_MODE_LUT_GAMMA | \
+                          DRM_MODE_LUT_INTERPOLATE | \
+                          DRM_MODE_LUT_NON_DECREASING), \
+                .count = 257, \
+                .input_bpc = 14, .output_bpc = 10, \
+                .start = 0, .end = 1 << 14, \
+                .min = 0, .max = (1 << 10) - 1, \
+        }
+
+static const struct drm_color_lut_range chv_cgm_degamma[] = {
+        CHV_CGM_DEGAMMA,
+};
+
+static const struct drm_color_lut_range chv_cgm_gamma[] = {
+        CHV_CGM_GAMMA,
+};
+
+static const struct drm_color_lut_range chv_cgm_degamma_i9xx_gamma_8[] = {
+        CHV_CGM_DEGAMMA,
+        I9XX_GAMMA_8,
+};
+
+static const struct drm_color_lut_range chv_cgm_degamma_i965_gamma_10[] = {
+        CHV_CGM_DEGAMMA,
+        I965_GAMMA_10,
+};
+
+static const struct drm_color_lut_range chv_cgm_degamma_cgm_degamma[] = {
+        CHV_CGM_DEGAMMA,
+        CHV_CGM_GAMMA,
+};
+
+static const struct drm_color_lut_range ilk_gamma_degamma_8[] = {
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_DEGAMMA),
+		.count = 256,
+		.input_bpc = 8, .output_bpc = 8,
+		.start = 0, .end = (1 << 8) - 1,
+		.min = 0, .max = (1 << 8) - 1,
+	},
+};
+
+static const struct drm_color_lut_range ilk_gamma_degamma_10[] = {
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_DEGAMMA),
+		.count = 1024,
+		.input_bpc = 10, .output_bpc = 10,
+		.start = 0, .end = (1 << 10) - 1,
+		.min = 0, .max = (1 << 10) - 1,
+	},
+};
+
+static const struct drm_color_lut_range ilk_gamma_degamma_12p4[] = {
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_DEGAMMA |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 512,
+		.input_bpc = 12, .output_bpc = 16,
+		.start = 0, .end = (1 << 12) - (1 << 12) / 512,
+		.min = 0, .max = (1 << 16) - 1,
+	},
+	/* PIPEGCMAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_DEGAMMA |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 10, .output_bpc = 16,
+		.start = (1 << 12) - (1 << 12) / 512, .end = 1 << 12,
+		.min = 0, .max = 1 << 16,
+	},
+};
+
+static const struct drm_color_lut_range ivb_gamma_degamma_10[] = {
+        {
+                .flags = (DRM_MODE_LUT_GAMMA |
+                          DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE),
+                .count = 1024,
+                .input_bpc = 10, .output_bpc = 10,
+                .start = 0, .end = (1 << 10) - 1,
+                .min = 0, .max = (1 << 10) - 1,
+        },
+        /* PAL_EXT_GC_MAX */
+        {
+                .flags = (DRM_MODE_LUT_GAMMA |
+                          DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE |
+                          DRM_MODE_LUT_INTERPOLATE |
+                          DRM_MODE_LUT_REUSE_LAST |
+                          DRM_MODE_LUT_NON_DECREASING),
+                .count = 1,
+                .input_bpc = 10, .output_bpc = 16,
+                .start = 1 << 10, .end = 3 << 10,
+                .min = 0, .max = (8 << 16) - 1,
+        }
+};
+
+static const struct drm_color_lut_range glk_gamma_10[] = {
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE),
+		.count = 1024,
+		.input_bpc = 10, .output_bpc = 10,
+		.start = 0, .end = (1 << 10) - 1,
+		.min = 0, .max = (1 << 10) - 1,
+	},
+	/* PAL_EXT_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 10, .output_bpc = 16,
+		.start = 1 << 10, .end = 3 << 10,
+		.min = 0, .max = (8 << 16) - 1,
+	},
+	/* PAL_EXT2_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 10, .output_bpc = 16,
+		.start = 3 << 12, .end = 7 << 12,
+		.min = 0, .max = (8 << 16) - 1,
+	},
+};
+
+/* FIXME input bpc? */
+static const struct drm_color_lut_range glk_gamma_12p4[] = {
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 512,
+		.input_bpc = 16, .output_bpc = 16,
+		.start = 0, .end = (1 << 16) - (1 << 16) / 512,
+		.min = 0, .max = (1 << 16) - 1,
+	},
+	/* PAL_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 16, .output_bpc = 16,
+		.start = (1 << 16) - (1 << 16) / 512, .end = 1 << 16,
+		.min = 0, .max = 1 << 16,
+	},
+	/* PAL_EXT_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 16, .output_bpc = 16,
+		.start = 1 << 16, .end = 3 << 16,
+		.min = 0, .max = (8 << 16) - 1,
+	},
+	/* PAL_EXT2_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 16, .output_bpc = 16,
+		.start = 3 << 16, .end = 7 << 16,
+		.min = 0, .max = (8 << 16) - 1,
+	},
+};
+
+static const struct drm_color_lut_range ivb_split_gamma[] = {
+        {
+                .flags = (DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE),
+                .count = 512,
+                .input_bpc = 9, .output_bpc = 10,
+                .start = 0, .end = (1 << 9) - 1,
+                .min = 0, .max = (1 << 10) - 1,
+        },
+        /* PAL_EXT_GC_MAX */
+        {
+                .flags = (DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE |
+                          DRM_MODE_LUT_INTERPOLATE |
+                          DRM_MODE_LUT_REUSE_LAST |
+                          DRM_MODE_LUT_NON_DECREASING),
+                .count = 1,
+                .input_bpc = 10, .output_bpc = 16,
+                .start = 1 << 9, .end = 3 << 9,
+                .min = 0, .max = (8 << 16) - 1,
+        },
+        {
+                .flags = DRM_MODE_LUT_GAMMA,
+                .count = 512,
+                .input_bpc = 9, .output_bpc = 10,
+                .start = 0, .end = (1 << 9) - 1,
+                .min = 0, .max = (1 << 10) - 1,
+        },
+};
+
+/* FIXME input bpc? */
+static const struct drm_color_lut_range ivb_gamma_degamma_12p4[] = {
+        {
+                .flags = (DRM_MODE_LUT_GAMMA |
+                          DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE |
+                          DRM_MODE_LUT_INTERPOLATE |
+                          DRM_MODE_LUT_NON_DECREASING),
+                .count = 512,
+                .input_bpc = 12, .output_bpc = 16,
+                .start = 0, .end = (1 << 12) - (1 << 12) / 512,
+                .min = 0, .max = (1 << 16) - 1,
+        },
+        /* PAL_GC_MAX */
+        {
+                .flags = (DRM_MODE_LUT_GAMMA |
+                          DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE |
+                          DRM_MODE_LUT_INTERPOLATE |
+                          DRM_MODE_LUT_REUSE_LAST |
+                          DRM_MODE_LUT_NON_DECREASING),
+                .count = 1,
+                .input_bpc = 12, .output_bpc = 16,
+                .start = (1 << 12) - (1 << 12) / 512, .end = 1 << 12,
+                .min = 0, .max = 1 << 16,
+        },
+        /* PAL_EXT_GC_MAX */
+        {
+                .flags = (DRM_MODE_LUT_GAMMA |
+                          DRM_MODE_LUT_DEGAMMA |
+                          DRM_MODE_LUT_REFLECT_NEGATIVE |
+                          DRM_MODE_LUT_INTERPOLATE |
+                          DRM_MODE_LUT_REUSE_LAST |
+                          DRM_MODE_LUT_NON_DECREASING),
+                .count = 1,
+                .input_bpc = 12, .output_bpc = 16,
+                .start = 1 << 12, .end = 3 << 12,
+                .min = 0, .max = (8 << 16) - 1,
+        },
+};
+
+ /* FIXME input bpc? */
+static const struct drm_color_lut_range icl_multi_seg_gamma[] = {
+	/* segment 1 aka. super fine segment */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 9,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = 0, .end = (1 << 24) / (128 * 256),
+		.min = 0, .max = (1 << 16) - 1,
+	},
+	/* segment 2 aka. fine segment */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 257,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = 0, .end = (1 << 24) / 128,
+		.min = 0, .max = (1 << 16) - 1,
+	},
+	/* segment 3 aka. coarse segment */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 257,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = 0, .end = (1 << 24) - (1 << 24) / 256,
+		.min = 0, .max = (1 << 16) - 1,
+	},
+	/* segment 3 aka. coarse segment / PAL_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = (1 << 24) - (1 << 24) / 256, .end = 1 << 24,
+		.min = 0, .max = 1 << 16,
+	},
+	/* PAL_EXT_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = 1 << 24, .end = 3 << 24,
+		.min = 0, .max = (8 << 16) - 1,
+	},
+	/* PAL_EXT2_GC_MAX */
+	{
+		.flags = (DRM_MODE_LUT_GAMMA |
+			  DRM_MODE_LUT_REFLECT_NEGATIVE |
+			  DRM_MODE_LUT_INTERPOLATE |
+			  DRM_MODE_LUT_REUSE_LAST |
+			  DRM_MODE_LUT_NON_DECREASING),
+		.count = 1,
+		.input_bpc = 24, .output_bpc = 16,
+		.start = 3 << 24, .end = 7 << 24,
+		.min = 0, .max = (8 << 16) - 1,
+	},
+};
+
 void intel_color_init(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	bool has_ctm = INTEL_INFO(dev_priv)->color.degamma_lut_size != 0;
+	int degamma_lut_size, gamma_lut_size;
 
 	drm_mode_crtc_set_gamma_size(&crtc->base, 256);
 
@@ -1233,25 +1657,159 @@ void intel_color_init(struct intel_crtc *crtc)
 			dev_priv->display.color_check = chv_color_check;
 			dev_priv->display.color_commit = i9xx_color_commit;
 			dev_priv->display.load_luts = cherryview_load_luts;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma",
+						       	i9xx_gamma_8,
+							sizeof(i9xx_gamma_8));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "interpolated gamma",
+						       i965_gamma_10,
+						       sizeof(i965_gamma_10));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "CGM gamma",
+						       	chv_cgm_gamma,
+							sizeof(chv_cgm_gamma));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "CGM degamma",
+						       	chv_cgm_degamma,
+							sizeof(chv_cgm_degamma));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "CGM degamma with 8bit gamma",
+						       	chv_cgm_degamma_i9xx_gamma_8,
+							sizeof(chv_cgm_degamma));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "CGM degamma with 10bit interpolated gamma",
+						       	chv_cgm_degamma_i965_gamma_10,
+							sizeof(chv_cgm_degamma));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "CGM degamma with CGM gamma",
+						       	chv_cgm_degamma_cgm_degamma,
+							sizeof(chv_cgm_degamma));
 		} else if (INTEL_GEN(dev_priv) >= 4) {
 			dev_priv->display.color_check = i9xx_color_check;
 			dev_priv->display.color_commit = i9xx_color_commit;
 			dev_priv->display.load_luts = i965_load_luts;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma",
+						       	i9xx_gamma_8,
+							sizeof(i9xx_gamma_8));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "interpolated gamma",
+						       i965_gamma_10,
+						       sizeof(i965_gamma_10));
 		} else {
 			dev_priv->display.color_check = i9xx_color_check;
 			dev_priv->display.color_commit = i9xx_color_commit;
 			dev_priv->display.load_luts = i9xx_load_luts;
+
+			degamma_lut_size = 0;
+			gamma_lut_size = 0;
+			has_ctm = false;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma",
+						       	i9xx_gamma_8,
+							sizeof(i9xx_gamma_8));
+
+			if (i9xx_has_10bit_lut(dev_priv)) {
+				/* 10bit interpolated gamma */
+				gamma_lut_size = I9XX_LUT_SIZE_10BIT;
+
+				drm_color_add_gamma_mode_range(&dev_priv->drm,
+							       "interpolated gamma",
+							       	i9xx_gamma_10_slope,
+								sizeof(i9xx_gamma_10_slope));
+			}
 		}
 	} else {
-		if (INTEL_GEN(dev_priv) >= 11)
+		if (INTEL_GEN(dev_priv) >= 11) {
 			dev_priv->display.color_check = icl_color_check;
-		else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
+			/* don't advertize the >= 1.0 entries */
+			degamma_lut_size = 0;
+			gamma_lut_size = ILK_LUT_SIZE_10BIT;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma",
+						       	i9xx_gamma_8,
+							sizeof(i9xx_gamma_8));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "10bit gamma",
+						       	glk_gamma_10,
+							sizeof(glk_gamma_10));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "interpolated gamma",
+						       glk_gamma_12p4,
+						       sizeof(glk_gamma_12p4));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "multi-segmented gamma",
+						       icl_multi_seg_gamma,
+						       sizeof(icl_multi_seg_gamma));
+		} else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
 			dev_priv->display.color_check = glk_color_check;
-		else if (INTEL_GEN(dev_priv) >= 7)
+			/* don't advertize the >= 1.0 entries */
+			degamma_lut_size = 0;
+			gamma_lut_size = ILK_LUT_SIZE_10BIT;
+			has_ctm = true;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma",
+						       	i9xx_gamma_8,
+							sizeof(i9xx_gamma_8));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "10bit gamma",
+						       	glk_gamma_10,
+							sizeof(glk_gamma_10));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "interpolated gamma",
+						       glk_gamma_12p4,
+						       sizeof(glk_gamma_12p4));
+		} else if (INTEL_GEN(dev_priv) >= 7) {
 			dev_priv->display.color_check = ivb_color_check;
-		else
+
+			/* don't advertize the >= 1.0 entries */
+			degamma_lut_size = IVB_LUT_SIZE_SPLIT;
+			gamma_lut_size = IVB_LUT_SIZE_SPLIT;
+			has_ctm = true;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma or degamma",
+						       ilk_gamma_degamma_8,
+						       sizeof(ilk_gamma_degamma_8));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "split gamma",
+						       ivb_split_gamma,
+						       sizeof(ivb_split_gamma));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "10bit gamma or degamma",
+						       ivb_gamma_degamma_10,
+						       sizeof(ivb_gamma_degamma_10));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "interpolated gamma or degamma",
+						       	ivb_gamma_degamma_12p4,
+							sizeof(ivb_gamma_degamma_12p4));
+		} else {
 			dev_priv->display.color_check = ilk_color_check;
 
+			degamma_lut_size = 0;
+			gamma_lut_size = ILK_LUT_SIZE_10BIT;
+			has_ctm = true;
+
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "8bit gamma or degamma",
+						       	ilk_gamma_degamma_8,
+							sizeof(ilk_gamma_degamma_8));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "10bit gamma or degamma",
+						       ilk_gamma_degamma_10,
+						       sizeof(ilk_gamma_degamma_10));
+			drm_color_add_gamma_mode_range(&dev_priv->drm,
+						       "interpolated gamma or degamma",
+						       ilk_gamma_degamma_12p4,
+						       sizeof(ilk_gamma_degamma_12p4));
+		}
+
 		if (INTEL_GEN(dev_priv) >= 9)
 			dev_priv->display.color_commit = skl_color_commit;
 		else if (IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
-- 
1.9.1



More information about the dri-devel mailing list