Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Always read out M2_N2 in intel_cpu_transcoder_get_m_n, v2.
Date: Mon, 15 Oct 2018 22:12:00 +0300	[thread overview]
Message-ID: <20181015191200.GD9144@intel.com> (raw)
In-Reply-To: <20181015094023.6211-1-maarten.lankhorst@linux.intel.com>

On Mon, Oct 15, 2018 at 11:40:23AM +0200, Maarten Lankhorst wrote:
> has_drrs is a flag we can't read out. We set it when seamless DRRS is
> enabled in pipe_config, so intel_dump_pipe_config() and
> intel_pipe_config_compare() will continue to do the right thing when
> has_drrs is set on the real state.
> 
> This removes one more dereference of crtc->config.
> While at it, fixup the comment and also read out M2_N2 for CHV, since
> we program it in the set_m_n function.
> 
> Changes since v1:
> - Only read out M2/N2 on platforms that support DRRS.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/intel_display.c | 31 ++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 64c1c6f8e0f4..1ca93cb89842 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6769,6 +6769,19 @@ static void intel_pch_transcoder_set_m_n(const struct intel_crtc_state *crtc_sta
>  	I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
>  }
>  
> +static bool transcoder_has_m2_n2(struct drm_i915_private *dev_priv,
> +				 enum transcoder transcoder)
> +{
> +	if (IS_HASWELL(dev_priv))
> +		return transcoder == TRANSCODER_EDP;
> +
> +	/*
> +	 * Strictly speaking some registers are available before
> +	 * gen7, but we only support DRRS on gen7+
> +	 */
> +	return IS_GEN7(dev_priv) || IS_CHERRYVIEW(dev_priv);
> +}
> +
>  static void intel_cpu_transcoder_set_m_n(const struct intel_crtc_state *crtc_state,
>  					 const struct intel_link_m_n *m_n,
>  					 const struct intel_link_m_n *m2_n2)
> @@ -6783,12 +6796,12 @@ static void intel_cpu_transcoder_set_m_n(const struct intel_crtc_state *crtc_sta
>  		I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n);
>  		I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m);
>  		I915_WRITE(PIPE_LINK_N1(transcoder), m_n->link_n);
> -		/* M2_N2 registers to be set only for gen < 8 (M2_N2 available
> -		 * for gen < 8) and if DRRS is supported (to make sure the
> -		 * registers are not unnecessarily accessed).
> +		/*
> +		 *  M2_N2 registers are set only if DRRS is supported
> +		 * (to make sure the registers are not unnecessarily accessed).
>  		 */
> -		if (m2_n2 && (IS_CHERRYVIEW(dev_priv) ||
> -		    INTEL_GEN(dev_priv) < 8) && crtc_state->has_drrs) {
> +		if (m2_n2 && crtc_state->has_drrs &&
> +		    transcoder_has_m2_n2(dev_priv, transcoder)) {
>  			I915_WRITE(PIPE_DATA_M2(transcoder),
>  					TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
>  			I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
> @@ -8637,12 +8650,8 @@ static void intel_cpu_transcoder_get_m_n(struct intel_crtc *crtc,
>  		m_n->gmch_n = I915_READ(PIPE_DATA_N1(transcoder));
>  		m_n->tu = ((I915_READ(PIPE_DATA_M1(transcoder))
>  			    & TU_SIZE_MASK) >> TU_SIZE_SHIFT) + 1;
> -		/* Read M2_N2 registers only for gen < 8 (M2_N2 available for
> -		 * gen < 8) and if DRRS is supported (to make sure the
> -		 * registers are not unnecessarily read).
> -		 */
> -		if (m2_n2 && INTEL_GEN(dev_priv) < 8 &&
> -			crtc->config->has_drrs) {
> +
> +		if (m2_n2 && transcoder_has_m2_n2(dev_priv, transcoder)) {
>  			m2_n2->link_m = I915_READ(PIPE_LINK_M2(transcoder));
>  			m2_n2->link_n =	I915_READ(PIPE_LINK_N2(transcoder));
>  			m2_n2->gmch_m =	I915_READ(PIPE_DATA_M2(transcoder))
> -- 
> 2.19.1

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

  reply	other threads:[~2018-10-15 19:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11 10:04 [PATCH 00/10] drm/i915: Remove low hanging crtc->config fruit, part 2 Maarten Lankhorst
2018-10-11 10:04 ` [PATCH 01/10] drm/i915: Remove crtc->config dereference from drrs_ctl Maarten Lankhorst
2018-10-16 20:13   ` Ville Syrjälä
2018-10-17 13:00     ` Maarten Lankhorst
2018-10-11 10:04 ` [PATCH 02/10] drm/i915: Make intel_dp_set_m_n take crtc_state Maarten Lankhorst
2018-10-11 11:39   ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 03/10] drm/i915: Remove crtc->config references in vlv_prepare_pll Maarten Lankhorst
2018-10-11 11:40   ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 04/10] drm/i915: Always read out M2_N2 in intel_cpu_transcoder_get_m_n Maarten Lankhorst
2018-10-11 11:56   ` Ville Syrjälä
2018-10-11 18:17     ` Maarten Lankhorst
2018-10-11 19:09       ` Ville Syrjälä
2018-10-15  9:40         ` [PATCH] drm/i915: Always read out M2_N2 in intel_cpu_transcoder_get_m_n, v2 Maarten Lankhorst
2018-10-15 19:12           ` Ville Syrjälä [this message]
2018-10-11 10:04 ` [PATCH 05/10] drm/i915: Pass crtc_state to update_scanline_offset Maarten Lankhorst
2018-10-11 11:56   ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 06/10] drm/i915: Remove crtc->config dereferences in intel_sanitize_crtc Maarten Lankhorst
2018-10-11 11:57   ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 07/10] drm/i915: Remove crtc->config dereferences in intel_modeset_setup_hw_state Maarten Lankhorst
2018-10-11 11:59   ` Ville Syrjälä
2018-10-16 13:57     ` Maarten Lankhorst
2018-10-11 10:04 ` [PATCH 08/10] drm/i915: Pass crtc_state to lpt_program_iclkip Maarten Lankhorst
2018-10-11 12:00   ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 09/10] drm/i915: Pass crtc_state to ivybridge_update_fdi_bc_bifurcation Maarten Lankhorst
2018-10-11 12:00   ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 10/10] drm/i915: Remove crtc->active from crtc_enable callbacks Maarten Lankhorst
2018-10-11 12:06   ` Ville Syrjälä
2018-10-11 11:02 ` ✗ Fi.CI.BAT: failure for drm/i915: Remove low hanging crtc->config fruit, part 2 Patchwork
2018-10-15 10:14 ` ✓ Fi.CI.BAT: success for drm/i915: Remove low hanging crtc->config fruit, part 2. (rev2) Patchwork
2018-10-15 11:16 ` ✓ Fi.CI.IGT: " 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=20181015191200.GD9144@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox