From patchwork Fri Apr 12 10:20:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Shankar, Uma" X-Patchwork-Id: 10897777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2037E1390 for ; Fri, 12 Apr 2019 09:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFC3328E29 for ; Fri, 12 Apr 2019 09:55:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3AE928E2B; Fri, 12 Apr 2019 09:55:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1004228E29 for ; Fri, 12 Apr 2019 09:55:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE3A189812; Fri, 12 Apr 2019 09:55:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12CF189760; Fri, 12 Apr 2019 09:55:16 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2019 02:55:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,340,1549958400"; d="scan'208";a="315350685" Received: from linuxpresi1-desktop.iind.intel.com ([10.223.74.121]) by orsmga005.jf.intel.com with ESMTP; 12 Apr 2019 02:55:11 -0700 From: Uma Shankar To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [v3 2/7] drm/i915: Define color lut range structure Date: Fri, 12 Apr 2019 15:50:58 +0530 Message-Id: <1555064463-18479-3-git-send-email-uma.shankar@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555064463-18479-1-git-send-email-uma.shankar@intel.com> References: <1555064463-18479-1-git-send-email-uma.shankar@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dcastagna@chromium.org, sam@ravnborg.org, emil.l.velikov@gmail.com, Uma Shankar , seanpaul@chromium.org, ville.syrjala@intel.com, maarten.lankhorst@intel.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Ville Syrjälä 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ä Signed-off-by: Uma Shankar --- 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))