All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 3/5] drm/i915: Split broadwell_load_luts() into smaller functions
Date: Thu, 26 Jan 2017 15:05:26 +0200	[thread overview]
Message-ID: <20170126130526.GD31595@intel.com> (raw)
In-Reply-To: <1485429865-10687-4-git-send-email-ander.conselvan.de.oliveira@intel.com>

On Thu, Jan 26, 2017 at 01:24:23PM +0200, Ander Conselvan de Oliveira wrote:
> Split the logic for progamming each LUT out of broadwell_load_luts(), so
> we can reuse part of it for geminilake.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_reg.h    |  1 +
>  drivers/gpu/drm/i915/intel_color.c | 43 ++++++++++++++++++++++++++++----------
>  2 files changed, 33 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 9947354..06bbe55 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -8171,6 +8171,7 @@ enum {
>  #define   PAL_PREC_10_12_BIT		(0 << 31)
>  #define   PAL_PREC_SPLIT_MODE		(1 << 31)
>  #define   PAL_PREC_AUTO_INCREMENT	(1 << 15)
> +#define   PAL_PREC_INDEX_VALUE_MASK	(0x3ff << 0)
>  #define _PAL_PREC_DATA_A	0x4A404
>  #define _PAL_PREC_DATA_B	0x4AC04
>  #define _PAL_PREC_DATA_C	0x4B404
> diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
> index 34952d0..82a3bc9 100644
> --- a/drivers/gpu/drm/i915/intel_color.c
> +++ b/drivers/gpu/drm/i915/intel_color.c
> @@ -340,20 +340,12 @@ static void haswell_load_luts(struct drm_crtc_state *crtc_state)
>  		hsw_enable_ips(intel_crtc);
>  }
>  
> -/* Loads the palette/gamma unit for the CRTC on Broadwell+. */
> -static void broadwell_load_luts(struct drm_crtc_state *state)
> +static void bdw_load_degamma_lut(struct drm_crtc_state *state)
>  {
> -	struct drm_crtc *crtc = state->crtc;
> -	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
> -	struct intel_crtc_state *intel_state = to_intel_crtc_state(state);
> -	enum pipe pipe = to_intel_crtc(crtc)->pipe;
> +	struct drm_i915_private *dev_priv = to_i915(state->crtc->dev);
> +	enum pipe pipe = to_intel_crtc(state->crtc)->pipe;
>  	uint32_t i, lut_size = INTEL_INFO(dev_priv)->color.degamma_lut_size;
>  
> -	if (crtc_state_is_legacy(state)) {
> -		haswell_load_luts(state);
> -		return;
> -	}
> -
>  	I915_WRITE(PREC_PAL_INDEX(pipe),
>  		   PAL_PREC_SPLIT_MODE | PAL_PREC_AUTO_INCREMENT);
>  
> @@ -377,6 +369,18 @@ static void broadwell_load_luts(struct drm_crtc_state *state)
>  				   (v << 20) | (v << 10) | v);
>  		}
>  	}
> +}
> +
> +static void bdw_load_gamma_lut(struct drm_crtc_state *state, u32 offset)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->crtc->dev);
> +	enum pipe pipe = to_intel_crtc(state->crtc)->pipe;
> +	uint32_t i, lut_size = INTEL_INFO(dev_priv)->color.gamma_lut_size;
> +
> +	WARN_ON(offset & ~PAL_PREC_INDEX_VALUE_MASK);
> +
> +	I915_WRITE(PREC_PAL_INDEX(pipe),
> +		   PAL_PREC_SPLIT_MODE | PAL_PREC_AUTO_INCREMENT | offset);
>  
>  	if (state->gamma_lut) {
>  		struct drm_color_lut *lut =
> @@ -410,6 +414,23 @@ static void broadwell_load_luts(struct drm_crtc_state *state)
>  		I915_WRITE(PREC_PAL_GC_MAX(pipe, 1), (1 << 16) - 1);
>  		I915_WRITE(PREC_PAL_GC_MAX(pipe, 2), (1 << 16) - 1);
>  	}
> +}
> +
> +/* Loads the palette/gamma unit for the CRTC on Broadwell+. */
> +static void broadwell_load_luts(struct drm_crtc_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->crtc->dev);
> +	struct intel_crtc_state *intel_state = to_intel_crtc_state(state);
> +	enum pipe pipe = to_intel_crtc(state->crtc)->pipe;
> +
> +	if (crtc_state_is_legacy(state)) {
> +		haswell_load_luts(state);
> +		return;
> +	}
> +
> +	bdw_load_degamma_lut(state);
> +	bdw_load_gamma_lut(state,
> +			   INTEL_INFO(dev_priv)->color.degamma_lut_size);
>  
>  	intel_state->gamma_mode = GAMMA_MODE_MODE_SPLIT;
>  	I915_WRITE(GAMMA_MODE(pipe), GAMMA_MODE_MODE_SPLIT);
> -- 
> 2.5.5

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-01-26 13:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 11:24 [PATCH v2 0/5] Geminilake pipe CSC Ander Conselvan de Oliveira
2017-01-26 11:24 ` [PATCH v2 1/5] drm/i915: Disable plane gamma in SKL+ sprite planes Ander Conselvan de Oliveira
2017-01-26 11:24 ` [PATCH v2 2/5] drm/i915/glk: Plane color correction register changes Ander Conselvan de Oliveira
2017-01-26 11:32   ` Ville Syrjälä
2017-01-30  8:38     ` Ander Conselvan De Oliveira
2017-01-26 11:24 ` [PATCH v2 3/5] drm/i915: Split broadwell_load_luts() into smaller functions Ander Conselvan de Oliveira
2017-01-26 13:05   ` Ville Syrjälä [this message]
2017-01-26 11:24 ` [PATCH v2 4/5] drm/i915/glk: Program pipe gamma and degamma tables Ander Conselvan de Oliveira
2017-01-26 14:21   ` Ville Syrjälä
2017-01-27  9:01     ` Conselvan De Oliveira, Ander
2017-01-27  9:02     ` [PATCH v3] " Ander Conselvan de Oliveira
2017-01-27 14:04       ` Ville Syrjälä
2017-01-30  8:39         ` Ander Conselvan De Oliveira
2017-01-26 11:24 ` [PATCH v2 5/5] drm/i915/glk: Enable pipe CSC Ander Conselvan de Oliveira
2017-01-30 16:30   ` Ville Syrjälä
2017-01-26 12:54 ` ✓ Fi.CI.BAT: success for Geminilake " Patchwork
2017-01-27  9:19 ` [PATCH RFC 6/5] drm/i915: Merge BDW pipe gamma and degamma table code Ander Conselvan de Oliveira
2017-01-27 14:07   ` Ville Syrjälä
2017-01-27  9:55 ` ✓ Fi.CI.BAT: success for Geminilake pipe CSC (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170126130526.GD31595@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ander.conselvan.de.oliveira@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.