All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: factor out intel_mode_target_cdclk
Date: Mon, 22 Jun 2015 14:37:33 +0100	[thread overview]
Message-ID: <20150622133733.GG13593@strange.amr.corp.intel.com> (raw)
In-Reply-To: <1434538855-21722-1-git-send-email-imre.deak@intel.com>

On Wed, Jun 17, 2015 at 02:00:54PM +0300, Imre Deak wrote:
> For GEN9 the target cdclk frequency is needed during the modeset state check
> phase too, so factor out this functionality.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

I believe the "proper" way to do it is to put what you called the target
CDCLK in the atomic state and use that here. Maarten has a patch to do
that towards the end of his atomic series.

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_display.c | 48 ++++++++++++++++++++++--------------
>  1 file changed, 30 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 2641053..9b68a5c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -5899,21 +5899,37 @@ static int intel_mode_max_pixclk(struct drm_device *dev,
>  	return max_pixclk;
>  }
>  
> -static int valleyview_modeset_global_pipes(struct drm_atomic_state *state)
> +static int intel_mode_target_cdclk(struct drm_i915_private *dev_priv,
> +				   struct drm_atomic_state *state)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(state->dev);
> -	struct drm_crtc *crtc;
> -	struct drm_crtc_state *crtc_state;
> -	int max_pixclk = intel_mode_max_pixclk(state->dev, state);
> -	int cdclk, ret = 0;
> +	int max_pixclk = intel_mode_max_pixclk(dev_priv->dev, state);
> +	int cdclk;
>  
>  	if (max_pixclk < 0)
>  		return max_pixclk;
>  
> -	if (IS_VALLEYVIEW(dev_priv))
> -		cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
> -	else
> +	if (IS_BROXTON(dev_priv)) {
>  		cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
> +	} else if (IS_VALLEYVIEW(dev_priv)) {
> +		cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
> +	} else {
> +		MISSING_CASE(INTEL_INFO(dev_priv));
> +		cdclk = 0;
> +	}
> +
> +	return cdclk;
> +}
> +
> +static int valleyview_modeset_global_pipes(struct drm_atomic_state *state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->dev);
> +	struct drm_crtc *crtc;
> +	struct drm_crtc_state *crtc_state;
> +	int cdclk, ret = 0;
> +
> +	cdclk = intel_mode_target_cdclk(dev_priv, state);
> +	if (cdclk < 0)
> +		return cdclk;
>  
>  	if (cdclk == dev_priv->cdclk_freq)
>  		return 0;
> @@ -5981,16 +5997,14 @@ static void valleyview_modeset_global_resources(struct drm_atomic_state *old_sta
>  {
>  	struct drm_device *dev = old_state->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	int max_pixclk = intel_mode_max_pixclk(dev, NULL);
>  	int req_cdclk;
>  
> -	/* The path in intel_mode_max_pixclk() with a NULL atomic state should
> +	/* The path in intel_mode_target_cdclk() with a NULL atomic state should
>  	 * never fail. */
> -	if (WARN_ON(max_pixclk < 0))
> +	req_cdclk = intel_mode_target_cdclk(dev_priv, NULL);
> +	if (WARN_ON(req_cdclk < 0))
>  		return;
>  
> -	req_cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
> -
>  	if (req_cdclk != dev_priv->cdclk_freq) {
>  		/*
>  		 * FIXME: We can end up here with all power domains off, yet
> @@ -9556,15 +9570,13 @@ static void broxton_modeset_global_resources(struct drm_atomic_state *old_state)
>  {
>  	struct drm_device *dev = old_state->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	int max_pixclk = intel_mode_max_pixclk(dev, NULL);
>  	int req_cdclk;
>  
>  	/* see the comment in valleyview_modeset_global_resources */
> -	if (WARN_ON(max_pixclk < 0))
> +	req_cdclk = intel_mode_target_cdclk(dev_priv, NULL);
> +	if (WARN_ON(req_cdclk < 0))
>  		return;
>  
> -	req_cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
> -
>  	if (req_cdclk != dev_priv->cdclk_freq)
>  		broxton_set_cdclk(dev, req_cdclk);
>  }
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-06-22 13:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 11:00 [PATCH 1/2] drm/i915: factor out intel_mode_target_cdclk Imre Deak
2015-06-17 11:00 ` [PATCH 2/2] drm/i915/bxt: fix max scaling factor calculation Imre Deak
2015-06-22 13:37 ` Damien Lespiau [this message]
2015-06-22 13:46   ` [PATCH 1/2] drm/i915: factor out intel_mode_target_cdclk Imre Deak

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=20150622133733.GG13593@strange.amr.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=imre.deak@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.