public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Don't check gmch state on inherited configs
@ 2014-04-13 10:00 Daniel Vetter
  2014-04-23  7:15 ` Daniel Vetter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Vetter @ 2014-04-13 10:00 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Alan Stern, stable

... our current modeset code isn't good enough yet to handle this. The
scenario is:

1. BIOS sets up a cloned config with lvds+external screen on the same
pipe, e.g. pipe B.

2. We read out that state for pipe B and assign the gmch_pfit state to
it.

3. The initial modeset switches the lvds to pipe A but due to lack of
atomic modeset we don't recompute the config of pipe B.

-> both pipes now claim (in the sw pipe config structure) to use the
gmch_pfit, which just won't work.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74081
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++-----
 drivers/gpu/drm/i915/intel_drv.h     |  3 ++-
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1390ab5e00dc..7b7987dc65ba 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9655,11 +9655,22 @@ intel_pipe_config_compare(struct drm_device *dev,
 	PIPE_CONF_CHECK_I(pipe_src_w);
 	PIPE_CONF_CHECK_I(pipe_src_h);
 
-	PIPE_CONF_CHECK_I(gmch_pfit.control);
-	/* pfit ratios are autocomputed by the hw on gen4+ */
-	if (INTEL_INFO(dev)->gen < 4)
-		PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
-	PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
+	/*
+	 * FIXME: BIOS likes to set up a cloned config with lvds+external
+	 * screen. Since we don't yet re-compute the pipe config when moving
+	 * just the lvds port away to another pipe the sw tracking won't match.
+	 *
+	 * Proper atomic modesets with recomputed global state will fix this.
+	 * Until then just don't check gmch state for inherited modes.
+	 */
+	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_INHERITED_MODE)) {
+		PIPE_CONF_CHECK_I(gmch_pfit.control);
+		/* pfit ratios are autocomputed by the hw on gen4+ */
+		if (INTEL_INFO(dev)->gen < 4)
+			PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
+		PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
+	}
+
 	PIPE_CONF_CHECK_I(pch_pfit.enabled);
 	if (current_config->pch_pfit.enabled) {
 		PIPE_CONF_CHECK_I(pch_pfit.pos);
@@ -11618,6 +11629,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 			    base.head) {
 		memset(&crtc->config, 0, sizeof(crtc->config));
 
+		crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
+
 		crtc->active = dev_priv->display.get_pipe_config(crtc,
 								 &crtc->config);
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index c551472b892e..b885df150910 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -236,7 +236,8 @@ struct intel_crtc_config {
 	 * tracked with quirk flags so that fastboot and state checker can act
 	 * accordingly.
 	 */
-#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
+#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS	(1<<0) /* unreliable sync mode.flags */
+#define PIPE_CONFIG_QUIRK_INHERITED_MODE	(1<<1) /* mode inherited from firmware */
 	unsigned long quirks;
 
 	/* User requested mode, only valid as a starting point to
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Don't check gmch state on inherited configs
  2014-04-13 10:00 [PATCH] drm/i915: Don't check gmch state on inherited configs Daniel Vetter
@ 2014-04-23  7:15 ` Daniel Vetter
  2014-04-23  8:21 ` Ville Syrjälä
  2014-04-23 11:04 ` Jani Nikula
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2014-04-23  7:15 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Alan Stern, stable

On Sun, Apr 13, 2014 at 12:00:33PM +0200, Daniel Vetter wrote:
> ... our current modeset code isn't good enough yet to handle this. The
> scenario is:
> 
> 1. BIOS sets up a cloned config with lvds+external screen on the same
> pipe, e.g. pipe B.
> 
> 2. We read out that state for pipe B and assign the gmch_pfit state to
> it.
> 
> 3. The initial modeset switches the lvds to pipe A but due to lack of
> atomic modeset we don't recompute the config of pipe B.
> 
> -> both pipes now claim (in the sw pipe config structure) to use the
> gmch_pfit, which just won't work.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74081

Tested-by: max <manikulin@gmail.com>

> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++-----
>  drivers/gpu/drm/i915/intel_drv.h     |  3 ++-
>  2 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 1390ab5e00dc..7b7987dc65ba 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9655,11 +9655,22 @@ intel_pipe_config_compare(struct drm_device *dev,
>  	PIPE_CONF_CHECK_I(pipe_src_w);
>  	PIPE_CONF_CHECK_I(pipe_src_h);
>  
> -	PIPE_CONF_CHECK_I(gmch_pfit.control);
> -	/* pfit ratios are autocomputed by the hw on gen4+ */
> -	if (INTEL_INFO(dev)->gen < 4)
> -		PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
> -	PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
> +	/*
> +	 * FIXME: BIOS likes to set up a cloned config with lvds+external
> +	 * screen. Since we don't yet re-compute the pipe config when moving
> +	 * just the lvds port away to another pipe the sw tracking won't match.
> +	 *
> +	 * Proper atomic modesets with recomputed global state will fix this.
> +	 * Until then just don't check gmch state for inherited modes.
> +	 */
> +	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_INHERITED_MODE)) {
> +		PIPE_CONF_CHECK_I(gmch_pfit.control);
> +		/* pfit ratios are autocomputed by the hw on gen4+ */
> +		if (INTEL_INFO(dev)->gen < 4)
> +			PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
> +		PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
> +	}
> +
>  	PIPE_CONF_CHECK_I(pch_pfit.enabled);
>  	if (current_config->pch_pfit.enabled) {
>  		PIPE_CONF_CHECK_I(pch_pfit.pos);
> @@ -11618,6 +11629,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>  			    base.head) {
>  		memset(&crtc->config, 0, sizeof(crtc->config));
>  
> +		crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
> +
>  		crtc->active = dev_priv->display.get_pipe_config(crtc,
>  								 &crtc->config);
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index c551472b892e..b885df150910 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -236,7 +236,8 @@ struct intel_crtc_config {
>  	 * tracked with quirk flags so that fastboot and state checker can act
>  	 * accordingly.
>  	 */
> -#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
> +#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS	(1<<0) /* unreliable sync mode.flags */
> +#define PIPE_CONFIG_QUIRK_INHERITED_MODE	(1<<1) /* mode inherited from firmware */
>  	unsigned long quirks;
>  
>  	/* User requested mode, only valid as a starting point to
> -- 
> 1.8.4.rc3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Don't check gmch state on inherited configs
  2014-04-13 10:00 [PATCH] drm/i915: Don't check gmch state on inherited configs Daniel Vetter
  2014-04-23  7:15 ` Daniel Vetter
@ 2014-04-23  8:21 ` Ville Syrjälä
  2014-04-23 11:04 ` Jani Nikula
  2 siblings, 0 replies; 4+ messages in thread
From: Ville Syrjälä @ 2014-04-23  8:21 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development, Alan Stern, stable

On Sun, Apr 13, 2014 at 12:00:33PM +0200, Daniel Vetter wrote:
> ... our current modeset code isn't good enough yet to handle this. The
> scenario is:
> 
> 1. BIOS sets up a cloned config with lvds+external screen on the same
> pipe, e.g. pipe B.
> 
> 2. We read out that state for pipe B and assign the gmch_pfit state to
> it.
> 
> 3. The initial modeset switches the lvds to pipe A but due to lack of
> atomic modeset we don't recompute the config of pipe B.
> 
> -> both pipes now claim (in the sw pipe config structure) to use the
> gmch_pfit, which just won't work.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74081
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Right. Until we get atomic modeset this seems like the least hackish
thing to do.

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

> ---
>  drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++-----
>  drivers/gpu/drm/i915/intel_drv.h     |  3 ++-
>  2 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 1390ab5e00dc..7b7987dc65ba 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9655,11 +9655,22 @@ intel_pipe_config_compare(struct drm_device *dev,
>  	PIPE_CONF_CHECK_I(pipe_src_w);
>  	PIPE_CONF_CHECK_I(pipe_src_h);
>  
> -	PIPE_CONF_CHECK_I(gmch_pfit.control);
> -	/* pfit ratios are autocomputed by the hw on gen4+ */
> -	if (INTEL_INFO(dev)->gen < 4)
> -		PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
> -	PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
> +	/*
> +	 * FIXME: BIOS likes to set up a cloned config with lvds+external
> +	 * screen. Since we don't yet re-compute the pipe config when moving
> +	 * just the lvds port away to another pipe the sw tracking won't match.
> +	 *
> +	 * Proper atomic modesets with recomputed global state will fix this.
> +	 * Until then just don't check gmch state for inherited modes.
> +	 */
> +	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_INHERITED_MODE)) {
> +		PIPE_CONF_CHECK_I(gmch_pfit.control);
> +		/* pfit ratios are autocomputed by the hw on gen4+ */
> +		if (INTEL_INFO(dev)->gen < 4)
> +			PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
> +		PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
> +	}
> +
>  	PIPE_CONF_CHECK_I(pch_pfit.enabled);
>  	if (current_config->pch_pfit.enabled) {
>  		PIPE_CONF_CHECK_I(pch_pfit.pos);
> @@ -11618,6 +11629,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>  			    base.head) {
>  		memset(&crtc->config, 0, sizeof(crtc->config));
>  
> +		crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
> +
>  		crtc->active = dev_priv->display.get_pipe_config(crtc,
>  								 &crtc->config);
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index c551472b892e..b885df150910 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -236,7 +236,8 @@ struct intel_crtc_config {
>  	 * tracked with quirk flags so that fastboot and state checker can act
>  	 * accordingly.
>  	 */
> -#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
> +#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS	(1<<0) /* unreliable sync mode.flags */
> +#define PIPE_CONFIG_QUIRK_INHERITED_MODE	(1<<1) /* mode inherited from firmware */
>  	unsigned long quirks;
>  
>  	/* User requested mode, only valid as a starting point to
> -- 
> 1.8.4.rc3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Don't check gmch state on inherited configs
  2014-04-13 10:00 [PATCH] drm/i915: Don't check gmch state on inherited configs Daniel Vetter
  2014-04-23  7:15 ` Daniel Vetter
  2014-04-23  8:21 ` Ville Syrjälä
@ 2014-04-23 11:04 ` Jani Nikula
  2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2014-04-23 11:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Alan Stern, stable

On Sun, 13 Apr 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> ... our current modeset code isn't good enough yet to handle this. The
> scenario is:
>
> 1. BIOS sets up a cloned config with lvds+external screen on the same
> pipe, e.g. pipe B.
>
> 2. We read out that state for pipe B and assign the gmch_pfit state to
> it.
>
> 3. The initial modeset switches the lvds to pipe A but due to lack of
> atomic modeset we don't recompute the config of pipe B.
>
> -> both pipes now claim (in the sw pipe config structure) to use the
> gmch_pfit, which just won't work.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74081
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Pushed to -fixes, thanks for the patch and review.

BR,
Jani.


> ---
>  drivers/gpu/drm/i915/intel_display.c | 23 ++++++++++++++++++-----
>  drivers/gpu/drm/i915/intel_drv.h     |  3 ++-
>  2 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 1390ab5e00dc..7b7987dc65ba 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9655,11 +9655,22 @@ intel_pipe_config_compare(struct drm_device *dev,
>  	PIPE_CONF_CHECK_I(pipe_src_w);
>  	PIPE_CONF_CHECK_I(pipe_src_h);
>  
> -	PIPE_CONF_CHECK_I(gmch_pfit.control);
> -	/* pfit ratios are autocomputed by the hw on gen4+ */
> -	if (INTEL_INFO(dev)->gen < 4)
> -		PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
> -	PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
> +	/*
> +	 * FIXME: BIOS likes to set up a cloned config with lvds+external
> +	 * screen. Since we don't yet re-compute the pipe config when moving
> +	 * just the lvds port away to another pipe the sw tracking won't match.
> +	 *
> +	 * Proper atomic modesets with recomputed global state will fix this.
> +	 * Until then just don't check gmch state for inherited modes.
> +	 */
> +	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_INHERITED_MODE)) {
> +		PIPE_CONF_CHECK_I(gmch_pfit.control);
> +		/* pfit ratios are autocomputed by the hw on gen4+ */
> +		if (INTEL_INFO(dev)->gen < 4)
> +			PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
> +		PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits);
> +	}
> +
>  	PIPE_CONF_CHECK_I(pch_pfit.enabled);
>  	if (current_config->pch_pfit.enabled) {
>  		PIPE_CONF_CHECK_I(pch_pfit.pos);
> @@ -11618,6 +11629,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>  			    base.head) {
>  		memset(&crtc->config, 0, sizeof(crtc->config));
>  
> +		crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;
> +
>  		crtc->active = dev_priv->display.get_pipe_config(crtc,
>  								 &crtc->config);
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index c551472b892e..b885df150910 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -236,7 +236,8 @@ struct intel_crtc_config {
>  	 * tracked with quirk flags so that fastboot and state checker can act
>  	 * accordingly.
>  	 */
> -#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
> +#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS	(1<<0) /* unreliable sync mode.flags */
> +#define PIPE_CONFIG_QUIRK_INHERITED_MODE	(1<<1) /* mode inherited from firmware */
>  	unsigned long quirks;
>  
>  	/* User requested mode, only valid as a starting point to
> -- 
> 1.8.4.rc3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-23 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-13 10:00 [PATCH] drm/i915: Don't check gmch state on inherited configs Daniel Vetter
2014-04-23  7:15 ` Daniel Vetter
2014-04-23  8:21 ` Ville Syrjälä
2014-04-23 11:04 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox