All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 3/3] drm/i915: clean up and simplify i9xx_crtc_mode_set wrt PLL handling
Date: Thu, 5 Sep 2013 14:04:24 +0300	[thread overview]
Message-ID: <20130905110423.GX11428@intel.com> (raw)
In-Reply-To: <1378293610-26631-3-git-send-email-jani.nikula@intel.com>

On Wed, Sep 04, 2013 at 02:20:10PM +0300, Jani Nikula wrote:
> Flat out skip anything to do with PLL if we have a DSI encoder (and thus
> DSI PLL). Also skip PLL computation if the encoder has already set
> clocks. This allows for some tidying up of the code, including a
> superfluous call to intel_limit() for LVDS downclock path.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c |   44 +++++++++++++++++-----------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 4939683..0646d14 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4891,9 +4891,12 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
>  		num_connectors++;
>  	}
>  
> -	refclk = i9xx_get_refclk(crtc, num_connectors);
> +	if (is_dsi)
> +		goto skip_dpll;
> +
> +	if (!intel_crtc->config.clock_set) {
> +		refclk = i9xx_get_refclk(crtc, num_connectors);
>  
> -	if (!is_dsi && !intel_crtc->config.clock_set) {
>  		/*
>  		 * Returns a set of divisors for the desired target clock with
>  		 * the given refclk, or FALSE.  The returned values represent
> @@ -4904,28 +4907,25 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
>  		ok = dev_priv->display.find_dpll(limit, crtc,
>  						 intel_crtc->config.port_clock,
>  						 refclk, NULL, &clock);
> -		if (!ok && !intel_crtc->config.clock_set) {
> +		if (!ok) {
>  			DRM_ERROR("Couldn't find PLL settings for mode!\n");
>  			return -EINVAL;
>  		}
> -	}
>  
> -	if (!is_dsi && is_lvds && dev_priv->lvds_downclock_avail) {
> -		/*
> -		 * Ensure we match the reduced clock's P to the target clock.
> -		 * If the clocks don't match, we can't switch the display clock
> -		 * by using the FP0/FP1. In such case we will disable the LVDS
> -		 * downclock feature.
> -		*/
> -		limit = intel_limit(crtc, refclk);
> -		has_reduced_clock =
> -			dev_priv->display.find_dpll(limit, crtc,
> -						    dev_priv->lvds_downclock,
> -						    refclk, &clock,
> -						    &reduced_clock);
> -	}
> -	/* Compat-code for transition, will disappear. */
> -	if (!intel_crtc->config.clock_set) {
> +		if (is_lvds && dev_priv->lvds_downclock_avail) {
> +			/*
> +			 * Ensure we match the reduced clock's P to the target
> +			 * clock.  If the clocks don't match, we can't switch
> +			 * the display clock by using the FP0/FP1. In such case
> +			 * we will disable the LVDS downclock feature.
> +			 */
> +			has_reduced_clock =
> +				dev_priv->display.find_dpll(limit, crtc,
> +							    dev_priv->lvds_downclock,
> +							    refclk, &clock,
> +							    &reduced_clock);
> +		}
> +		/* Compat-code for transition, will disappear. */
>  		intel_crtc->config.dpll.n = clock.n;
>  		intel_crtc->config.dpll.m1 = clock.m1;
>  		intel_crtc->config.dpll.m2 = clock.m2;
> @@ -4938,14 +4938,14 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
>  				has_reduced_clock ? &reduced_clock : NULL,
>  				num_connectors);
>  	} else if (IS_VALLEYVIEW(dev)) {
> -		if (!is_dsi)
> -			vlv_update_pll(intel_crtc);
> +		vlv_update_pll(intel_crtc);
>  	} else {
>  		i9xx_update_pll(intel_crtc,
>  				has_reduced_clock ? &reduced_clock : NULL,
>                                  num_connectors);
>  	}

This looks all right.

But I was thinking that we could just set .clock_set=true in DSI code
and move the DSI PLL enable here. But we anyway have to move the DSI PLL
calculations out from the PLL enable func, so I guess we can leave all
that for later.

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

>  
> +skip_dpll:
>  	/* Set up the display plane register */
>  	dspcntr = DISPPLANE_GAMMA_ENABLE;
>  
> -- 
> 1.7.9.5

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-09-05 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 11:20 [PATCH v2 1/3] drm/i915: add asserts for cursor state in crtc mode set Jani Nikula
2013-09-04 11:20 ` [PATCH v2 2/3] drm/i915: do not update cursor " Jani Nikula
2013-09-04 18:32   ` Ville Syrjälä
2013-09-04 11:20 ` [PATCH v2 3/3] drm/i915: clean up and simplify i9xx_crtc_mode_set wrt PLL handling Jani Nikula
2013-09-05 11:04   ` Ville Syrjälä [this message]
2013-09-04 12:11 ` [PATCH v2 1/3] drm/i915: add asserts for cursor state in crtc mode set Ville Syrjälä

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=20130905110423.GX11428@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 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.