public inbox for intel-gfx@lists.freedesktop.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 1/4] drm/i915: Do not use atomic modesets in hw readout.
Date: Fri, 12 Jun 2015 15:07:49 +0300	[thread overview]
Message-ID: <20150612120749.GC5176@intel.com> (raw)
In-Reply-To: <1434100542-15301-2-git-send-email-maarten.lankhorst@linux.intel.com>

On Fri, Jun 12, 2015 at 11:15:39AM +0200, Maarten Lankhorst wrote:
> This should fix fallout caused by making intel_crtc_control
> and update_dpms atomic, which became a problem after reverting the
> atomic hw readout patch.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90929
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

So far my 830 and gen4 seem happy with this.

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

> ---
>  drivers/gpu/drm/i915/intel_display.c | 75 +++++++++++++++---------------------
>  1 file changed, 32 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 5cc2263db199..7abaffeda7ce 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6187,31 +6187,35 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
>  	mutex_unlock(&dev->struct_mutex);
>  }
>  
> +static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
> +{
> +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> +	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
> +	enum intel_display_power_domain domain;
> +	unsigned long domains;
> +
> +	if (!intel_crtc->active)
> +		return;
> +
> +	intel_crtc_disable_planes(crtc);
> +	dev_priv->display.crtc_disable(crtc);
> +
> +	domains = intel_crtc->enabled_power_domains;
> +	for_each_power_domain(domain, domains)
> +		intel_display_power_put(dev_priv, domain);
> +	intel_crtc->enabled_power_domains = 0;
> +}
> +
>  /*
>   * turn all crtc's off, but do not adjust state
>   * This has to be paired with a call to intel_modeset_setup_hw_state.
>   */
>  void intel_display_suspend(struct drm_device *dev)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct drm_crtc *crtc;
>  
> -	for_each_crtc(dev, crtc) {
> -		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -		enum intel_display_power_domain domain;
> -		unsigned long domains;
> -
> -		if (!intel_crtc->active)
> -			continue;
> -
> -		intel_crtc_disable_planes(crtc);
> -		dev_priv->display.crtc_disable(crtc);
> -
> -		domains = intel_crtc->enabled_power_domains;
> -		for_each_power_domain(domain, domains)
> -			intel_display_power_put(dev_priv, domain);
> -		intel_crtc->enabled_power_domains = 0;
> -	}
> +	for_each_crtc(dev, crtc)
> +		intel_crtc_disable_noatomic(crtc);
>  }
>  
>  /* Master function to enable/disable CRTC and corresponding power wells */
> @@ -15120,7 +15124,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  {
>  	struct drm_device *dev = crtc->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_encoder *encoder;
>  	u32 reg;
> +	bool enable;
>  
>  	/* Clear any frame start delays used for debugging left by the BIOS */
>  	reg = PIPECONF(crtc->config->cpu_transcoder);
> @@ -15137,7 +15143,6 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  	 * disable the crtc (and hence change the state) if it is wrong. Note
>  	 * that gen4+ has a fixed plane -> pipe mapping.  */
>  	if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) {
> -		struct intel_connector *connector;
>  		bool plane;
>  
>  		DRM_DEBUG_KMS("[CRTC:%d] wrong plane connection detected!\n",
> @@ -15149,29 +15154,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  		plane = crtc->plane;
>  		to_intel_plane_state(crtc->base.primary->state)->visible = true;
>  		crtc->plane = !plane;
> -		intel_crtc_control(&crtc->base, false);
> +		intel_crtc_disable_noatomic(&crtc->base);
>  		crtc->plane = plane;
> -
> -		/* ... and break all links. */
> -		for_each_intel_connector(dev, connector) {
> -			if (connector->encoder->base.crtc != &crtc->base)
> -				continue;
> -
> -			connector->base.dpms = DRM_MODE_DPMS_OFF;
> -			connector->base.encoder = NULL;
> -		}
> -		/* multiple connectors may have the same encoder:
> -		 *  handle them and break crtc link separately */
> -		for_each_intel_connector(dev, connector)
> -			if (connector->encoder->base.crtc == &crtc->base) {
> -				connector->encoder->base.crtc = NULL;
> -				connector->encoder->connectors_active = false;
> -			}
> -
> -		WARN_ON(crtc->active);
> -		crtc->base.state->enable = false;
> -		crtc->base.state->active = false;
> -		crtc->base.enabled = false;
>  	}
>  
>  	if (dev_priv->quirks & QUIRK_PIPEA_FORCE &&
> @@ -15185,13 +15169,18 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  
>  	/* Adjust the state of the output pipe according to whether we
>  	 * have active connectors/encoders. */
> -	intel_crtc_update_dpms(&crtc->base);
> +	enable = false;
> +	for_each_encoder_on_crtc(dev, &crtc->base, encoder)
> +		enable |= encoder->connectors_active;
> +
> +	if (!enable)
> +		intel_crtc_disable_noatomic(&crtc->base);
>  
>  	if (crtc->active != crtc->base.state->active) {
> -		struct intel_encoder *encoder;
>  
>  		/* This can happen either due to bugs in the get_hw_state
> -		 * functions or because the pipe is force-enabled due to the
> +		 * functions or because of calls to intel_crtc_disable_noatomic,
> +		 * or because the pipe is force-enabled due to the
>  		 * pipe A quirk. */
>  		DRM_DEBUG_KMS("[CRTC:%d] hw state adjusted, was %s, now %s\n",
>  			      crtc->base.base.id,
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

  reply	other threads:[~2015-06-12 12:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12  9:15 [PATCH 0/4] Fix more fallout from reverting atomic hw readout Maarten Lankhorst
2015-06-12  9:15 ` [PATCH 1/4] drm/i915: Do not use atomic modesets in " Maarten Lankhorst
2015-06-12 12:07   ` Ville Syrjälä [this message]
2015-06-12  9:15 ` [PATCH 2/4] drm/i915: get rid of intel_plane_restore in intel_crtc_page_flip Maarten Lankhorst
2015-06-12 10:16   ` Ville Syrjälä
2015-06-12 10:31     ` Maarten Lankhorst
2015-06-12 11:27       ` Ville Syrjälä
2015-06-12 11:43         ` Ville Syrjälä
2015-06-12 13:17           ` Maarten Lankhorst
2015-06-15 16:44             ` Daniel Vetter
2015-06-12  9:15 ` [PATCH 3/4] drm/i915: Set hwmode during readout Maarten Lankhorst
2015-06-12 10:16   ` Ville Syrjälä
2015-06-12  9:15 ` [PATCH 4/4] drm/i915: Only enable cursor if it can be enabled Maarten Lankhorst
2015-06-12 10:26   ` Ville Syrjälä
2015-06-12 10:32     ` Maarten Lankhorst
2015-06-12 11:49       ` Ville Syrjälä
2015-06-15 16:49         ` Daniel Vetter
2015-06-12 12:45 ` [PATCH 0/4] Fix more fallout from reverting atomic hw readout Jani Nikula
2015-06-12 13:10   ` Maarten Lankhorst
2015-06-15 16:48     ` 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=20150612120749.GC5176@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