intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 08/31] drm/i915: hw state readout for shared pch plls
Date: Fri, 7 Jun 2013 20:23:33 +0300	[thread overview]
Message-ID: <20130607172333.GU5004@intel.com> (raw)
In-Reply-To: <1370432073-27634-9-git-send-email-daniel.vetter@ffwll.ch>

On Wed, Jun 05, 2013 at 01:34:10PM +0200, Daniel Vetter wrote:
> Well, the first step of a long road at least, it only reads out
> the pipe -> shared dpll association thus far. Other state which needs
> to follow:
> 
> - hw state of the dpll (on/off + dpll registers). Currently we just
>   read that out from the hw state, but that doesn't work too well when
>   the dpll is in use, but not yet fully enabled. We get away since
>   most likely it already has been enabled and so the correct state is
>   left behind in the registers. But that doesn't hold for atomic
>   modesets when we want to enable all pipes at once.
> 
> - Refcount reconstruction for each dpll.
> 
> - Cross-checking of all the above. For that we need to keep the dpll
>   register state both in the pipe and in the shared_dpll struct, so
>   that we can check that every pipe is still connected to a correctly
>   configured dpll.
> 
> Note that since the refcount resconstruction isn't done yet this will
> spill a few WARNs at boot-up while trying to disable pch plls which
> have bogus refcounts. But since there's still a pile of refactoring to
> do I'd like to lock down the state handling as soon as possible hence
> decided against reordering the patches to quiet these WARNs - after
> all the issues they're complaining about have existed since forever,
> as Jesse can testify by having pch pll states blow up consistently in
> his fastboot patches ...
> 
> v2: We need to preserve the old shared_dpll since currently the
> shared dpll refcount dropping/getting is done in ->mode_set. With
> the usual pipe_config infrastructure the old dpll id is already lost
> at that point, hence preserve it in the new config.

Ah so here is the missing link. The correct place for this would appear
to be patch 6.

> v3: Rebase on top of the ips patch from Paulo.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 34 ++++++++++++++++++++++++++++------
>  1 file changed, 28 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index a44c43c..20a933f 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4020,12 +4020,11 @@ static void hsw_compute_ips_config(struct intel_crtc *crtc,
>  				   pipe_config->pipe_bpp == 24;
>  }
>  
> -static int intel_crtc_compute_config(struct drm_crtc *crtc,
> +static int intel_crtc_compute_config(struct intel_crtc *crtc,
>  				     struct intel_crtc_config *pipe_config)
>  {
> -	struct drm_device *dev = crtc->dev;
> +	struct drm_device *dev = crtc->base.dev;
>  	struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
>  
>  	if (HAS_PCH_SPLIT(dev)) {
>  		/* FDI link clock is fixed at 2.7G */
> @@ -4056,10 +4055,16 @@ static int intel_crtc_compute_config(struct drm_crtc *crtc,
>  	}
>  
>  	if (IS_HASWELL(dev))
> -		hsw_compute_ips_config(intel_crtc, pipe_config);
> +		hsw_compute_ips_config(crtc, pipe_config);
> +
> +	/* XXX: PCH clock sharing is done in ->mode_set, so make sure the old
> +	 * clock survives for now. */
> +	if (pipe_config->has_pch_encoder &&
> +	    (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)))
> +		pipe_config->shared_dpll = crtc->config.shared_dpll;
>  
>  	if (pipe_config->has_pch_encoder)
> -		return ironlake_fdi_compute_config(intel_crtc, pipe_config);
> +		return ironlake_fdi_compute_config(crtc, pipe_config);
>  
>  	return 0;
>  }
> @@ -4934,6 +4939,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
>  	uint32_t tmp;
>  
>  	pipe_config->cpu_transcoder = crtc->pipe;
> +	pipe_config->shared_dpll = DPLL_ID_PRIVATE;
>  
>  	tmp = I915_READ(PIPECONF(crtc->pipe));
>  	if (!(tmp & PIPECONF_ENABLE))
> @@ -5810,6 +5816,7 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
>  	uint32_t tmp;
>  
>  	pipe_config->cpu_transcoder = crtc->pipe;
> +	pipe_config->shared_dpll = DPLL_ID_PRIVATE;
>  
>  	tmp = I915_READ(PIPECONF(crtc->pipe));
>  	if (!(tmp & PIPECONF_ENABLE))
> @@ -5827,6 +5834,16 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
>  		/* XXX: Can't properly read out the pch dpll pixel multiplier
>  		 * since we don't have state tracking for pch clocks yet. */
>  		pipe_config->pixel_multiplier = 1;
> +
> +		if (HAS_PCH_IBX(dev_priv->dev)) {
> +			pipe_config->shared_dpll = crtc->pipe;

Slightly magic, but all right.

> +		} else {
> +			tmp = I915_READ(PCH_DPLL_SEL);
> +			if (tmp & TRANS_DPLLB_SEL(crtc->pipe))
> +				pipe_config->shared_dpll = DPLL_ID_PCH_PLL_B;
> +			else
> +				pipe_config->shared_dpll = DPLL_ID_PCH_PLL_A;
> +		}
>  	} else {
>  		pipe_config->pixel_multiplier = 1;
>  	}
> @@ -5907,6 +5924,8 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
>  	uint32_t tmp;
>  
>  	pipe_config->cpu_transcoder = crtc->pipe;
> +	pipe_config->shared_dpll = DPLL_ID_PRIVATE;
> +
>  	tmp = I915_READ(TRANS_DDI_FUNC_CTL(TRANSCODER_EDP));
>  	if (tmp & TRANS_DDI_FUNC_ENABLE) {
>  		enum pipe trans_edp_pipe;
> @@ -7768,6 +7787,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
>  	drm_mode_copy(&pipe_config->adjusted_mode, mode);
>  	drm_mode_copy(&pipe_config->requested_mode, mode);
>  	pipe_config->cpu_transcoder = to_intel_crtc(crtc)->pipe;
> +	pipe_config->shared_dpll = DPLL_ID_PRIVATE;

Do we want to put this here, or should we have some DPLL_ID_INVALID, so
that we'd always catch cases where we forgot to really think about which
PLL should be used?

>  
>  	/* Compute a starting value for pipe_config->pipe_bpp taking the source
>  	 * plane pixel format and any sink constraints into account. Returns the
> @@ -7816,7 +7836,7 @@ encoder_retry:
>  	if (!pipe_config->port_clock)
>  		pipe_config->port_clock = pipe_config->adjusted_mode.clock;
>  
> -	ret = intel_crtc_compute_config(crtc, pipe_config);
> +	ret = intel_crtc_compute_config(to_intel_crtc(crtc), pipe_config);
>  	if (ret < 0) {
>  		DRM_DEBUG_KMS("CRTC fixup failed\n");
>  		goto fail;
> @@ -8079,6 +8099,8 @@ intel_pipe_config_compare(struct drm_device *dev,
>  
>  	PIPE_CONF_CHECK_I(ips_enabled);
>  
> +	PIPE_CONF_CHECK_I(shared_dpll);
> +
>  #undef PIPE_CONF_CHECK_I
>  #undef PIPE_CONF_CHECK_FLAGS
>  
> -- 
> 1.7.11.7
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-06-07 17:23 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 11:34 [PATCH 00/31] shared pch display pll rework Daniel Vetter
2013-06-05 11:34 ` [PATCH 01/31] drm/i915: fix up pch pll handling in ->mode_set Daniel Vetter
2013-06-05 11:34 ` [PATCH 02/31] drm/i915: conditionally disable pch resources in ilk_crtc_disable Daniel Vetter
2013-06-05 11:34 ` [PATCH 03/31] drm/i915: lock down pch pll accouting some more Daniel Vetter
2013-06-07 16:32   ` Ville Syrjälä
2013-06-07 20:03     ` Daniel Vetter
2013-06-07 20:46       ` Ville Syrjälä
2013-06-07 21:13         ` Daniel Vetter
2013-06-10 10:11           ` Ville Syrjälä
2013-06-10 14:34             ` Daniel Vetter
2013-06-10 14:47               ` Ville Syrjälä
2013-06-10 15:28                 ` [PATCH] " Daniel Vetter
2013-06-07 21:09     ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 04/31] drm/i915: s/pch_pll/shared_dpll/ Daniel Vetter
2013-06-05 11:34 ` [PATCH 05/31] drm/i915: switch crtc->shared_dpll from a pointer to an enum Daniel Vetter
2013-06-07 16:48   ` Ville Syrjälä
2013-06-07 21:10     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 06/31] drm/i915: move shared_dpll into the pipe config Daniel Vetter
2013-06-07 17:03   ` Ville Syrjälä
2013-06-07 21:10     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 07/31] drm/i915: refactor PCH_DPLL_SEL #defines Daniel Vetter
2013-06-05 11:34 ` [PATCH 08/31] drm/i915: hw state readout for shared pch plls Daniel Vetter
2013-06-07 17:23   ` Ville Syrjälä [this message]
2013-06-07 20:11     ` Daniel Vetter
2013-06-07 21:11     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 09/31] drm/i915: consolidate ->num_shared_dplls assignement Daniel Vetter
2013-06-05 11:34 ` [PATCH 10/31] drm/i915: metadata for shared dplls Daniel Vetter
2013-06-05 11:34 ` [PATCH 11/31] drm/i915: scrap register address storage Daniel Vetter
2013-06-05 11:34 ` [PATCH 12/31] drm/i915: enable/disable hooks for shared dplls Daniel Vetter
2013-06-05 11:34 ` [PATCH 13/31] drm/i915: drop crtc checking from assert_shared_dpll Daniel Vetter
2013-06-05 11:34 ` [PATCH 14/31] drm/i915: display pll hw state readout and checking Daniel Vetter
2013-06-12 13:31   ` Damien Lespiau
2013-06-12 13:39     ` Ville Syrjälä
2013-06-12 13:49       ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 15/31] drm/i915: extract readout_hw_state from setup_hw_state Daniel Vetter
2013-06-12 13:32   ` Damien Lespiau
2013-06-12 14:26   ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 16/31] drm/i915: split up intel_modeset_check_state Daniel Vetter
2013-06-12 13:33   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 17/31] drm/i915: WARN on lack of shared dpll Daniel Vetter
2013-06-12 13:38   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 18/31] drm/i915: hw state readout and cross-checking for shared dplls Daniel Vetter
2013-06-12 15:04   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 19/31] drm/i915: fix up pch pll enabling for pixel multipliers Daniel Vetter
2013-06-12 15:12   ` Damien Lespiau
2013-06-12 19:34     ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 20/31] drm/i915: simplify the reduced clock handling for pch plls Daniel Vetter
2013-06-13 11:26   ` Damien Lespiau
2013-06-13 11:35     ` Daniel Vetter
2013-06-13 12:32       ` Damien Lespiau
2013-06-13 14:33         ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 21/31] drm/i915: consolidate pch pll enable sequence Daniel Vetter
2013-06-24 14:30   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 22/31] drm/i915: use sw tracked state to select shared dplls Daniel Vetter
2013-06-12 15:20   ` Damien Lespiau
2013-06-05 11:34 ` [PATCH 23/31] drm/i915: duplicate intel_enable_pll into i9xx and vlv versions Daniel Vetter
2013-06-05 15:12   ` Jani Nikula
2013-06-05 22:52     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 24/31] drm/i915: asserts for lvds pre_enable Daniel Vetter
2013-06-13 20:26   ` Imre Deak
2013-06-13 20:46     ` Daniel Vetter
2013-06-14 10:45       ` Imre Deak
2013-06-16 19:42     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 25/31] drm/i915: move encoder pre enable hooks togther on ilk+ Daniel Vetter
2013-06-05 11:34 ` [PATCH 26/31] drm/i915: hw state readout for i9xx dplls Daniel Vetter
2013-06-05 11:34 ` [PATCH 27/31] drm/i915: move i9xx dpll enabling into crtc enable function Daniel Vetter
2013-06-05 15:13   ` Jani Nikula
2013-06-06  8:20     ` [PATCH] " Daniel Vetter
2013-06-14 16:02   ` [PATCH 27/31] " Imre Deak
2013-06-16 19:15     ` Daniel Vetter
2013-06-16 19:24     ` [PATCH] " Daniel Vetter
2013-06-05 11:34 ` [PATCH 28/31] drm/i915: s/pre_pll/pre/ on the lvds port " Daniel Vetter
2013-06-15  8:32   ` Imre Deak
2013-06-26 10:02     ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 29/31] drm/i915: clean up vlv ->pre_pll_enable and pll enable sequence Daniel Vetter
2013-06-06  8:22   ` [PATCH] " Daniel Vetter
2013-07-11 14:11     ` Imre Deak
2013-07-11 20:13       ` Daniel Vetter
2013-07-12 16:27       ` Daniel Vetter
2013-06-05 11:34 ` [PATCH 30/31] drm/i915: Fix up cpt pixel multiplier " Daniel Vetter
2013-06-05 11:34 ` [PATCH 31/31] drm/i915: clear DPLL reg when disabling i9xx dplls Daniel Vetter
2013-06-07 17:46 ` [PATCH 00/31] shared pch display pll rework Ville Syrjälä
2013-06-10 15:57   ` Ville Syrjälä
2013-06-10 18:16     ` Daniel Vetter

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=20130607172333.GU5004@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).