[10/20] drm/i915: Add gamma/degamma readout for bdw+
diff mbox series

Message ID 20200717211345.26851-11-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • drm/i915: Finish (de)gamma readout
Related show

Commit Message

Ville Syrjälä July 17, 2020, 9:13 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Read out the gamme/degamma LUT on bdw+. Not entirely complete
as we need a bit more special sauce to handle the split gamma
mode.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Shankar, Uma Sept. 17, 2020, 8:15 p.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Saturday, July 18, 2020 2:44 AM
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 10/20] drm/i915: Add gamma/degamma readout for
> bdw+
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Read out the gamme/degamma LUT on bdw+. Not entirely complete as we need

s/gamme/gamma
With this,
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

> a bit more special sauce to handle the split gamma mode.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_color.c | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c
> b/drivers/gpu/drm/i915/display/intel_color.c
> index 6842f5c0356d..5742ac1af862 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1991,6 +1991,32 @@ static struct drm_property_blob
> *bdw_read_lut_10(struct intel_crtc *crtc,
>  	return blob;
>  }
> 
> +static void bdw_read_luts(struct intel_crtc_state *crtc_state) {
> +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> +	struct drm_property_blob **blob =
> +		crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA ?
> +		&crtc_state->hw.gamma_lut : &crtc_state->hw.degamma_lut;
> +
> +	if (!crtc_state->gamma_enable)
> +		return;
> +
> +	switch (crtc_state->gamma_mode) {
> +	case GAMMA_MODE_MODE_8BIT:
> +		*blob = ilk_read_lut_8(crtc);
> +		break;
> +	case GAMMA_MODE_MODE_SPLIT:
> +		/* FIXME */
> +		break;
> +	case GAMMA_MODE_MODE_10BIT:
> +		*blob = bdw_read_lut_10(crtc, PAL_PREC_INDEX_VALUE(0));
> +		break;
> +	default:
> +		MISSING_CASE(crtc_state->gamma_mode);
> +		break;
> +	}
> +}
> +
>  static struct drm_property_blob *glk_read_degamma_lut(struct intel_crtc *crtc)
> {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); @@ -2154,6
> +2180,7 @@ void intel_color_init(struct intel_crtc *crtc)
>  			dev_priv->display.read_luts = glk_read_luts;
>  		} else if (INTEL_GEN(dev_priv) >= 8) {
>  			dev_priv->display.load_luts = bdw_load_luts;
> +			dev_priv->display.read_luts = bdw_read_luts;
>  		} else if (INTEL_GEN(dev_priv) >= 7) {
>  			dev_priv->display.load_luts = ivb_load_luts;
>  		} else {
> --
> 2.26.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 6842f5c0356d..5742ac1af862 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1991,6 +1991,32 @@  static struct drm_property_blob *bdw_read_lut_10(struct intel_crtc *crtc,
 	return blob;
 }
 
+static void bdw_read_luts(struct intel_crtc_state *crtc_state)
+{
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	struct drm_property_blob **blob =
+		crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA ?
+		&crtc_state->hw.gamma_lut : &crtc_state->hw.degamma_lut;
+
+	if (!crtc_state->gamma_enable)
+		return;
+
+	switch (crtc_state->gamma_mode) {
+	case GAMMA_MODE_MODE_8BIT:
+		*blob = ilk_read_lut_8(crtc);
+		break;
+	case GAMMA_MODE_MODE_SPLIT:
+		/* FIXME */
+		break;
+	case GAMMA_MODE_MODE_10BIT:
+		*blob = bdw_read_lut_10(crtc, PAL_PREC_INDEX_VALUE(0));
+		break;
+	default:
+		MISSING_CASE(crtc_state->gamma_mode);
+		break;
+	}
+}
+
 static struct drm_property_blob *glk_read_degamma_lut(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -2154,6 +2180,7 @@  void intel_color_init(struct intel_crtc *crtc)
 			dev_priv->display.read_luts = glk_read_luts;
 		} else if (INTEL_GEN(dev_priv) >= 8) {
 			dev_priv->display.load_luts = bdw_load_luts;
+			dev_priv->display.read_luts = bdw_read_luts;
 		} else if (INTEL_GEN(dev_priv) >= 7) {
 			dev_priv->display.load_luts = ivb_load_luts;
 		} else {