Skip to contentSkip to conversation

More "unclaimed register" fixes

PATCH Applied Paulo Zanoni 5 participants 73 messages Mar 6, 2013 – Apr 17, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover More "unclaimed register" fixes

From: Paulo Zanoni <[email protected]>

Hi

This series fixes a few more "unclaimed register" problems. Some of them are only visible if you're only using eDP (i.e., the power well is down) and most of them are only visible if you get a GPU hang. The good thing is that I only get GPU hangs when I run ZZ_hangman :)

Now when I boot a machine with only eDP the only "unclaimed register" message I see is right after the audio driver loads. And then if I run ZZ_hangmen I won't see "unclaimed register" messages.

Big series but small patches, most of them trivial.

Thanks,
Paulo

Paulo Zanoni (15):
drm/i915: only disable DDI sound if intel_crtc->eld_vld drm/i915: disable sound first on intel_disable_ddi drm/i915: add intel_power_well_is_down
drm/i915: don't touch the PF regs if the power well is down drm/i915: capture the correct cursor registers on IVB drm/i915: there's no DSPSIZE register on gen4+ drm/i915: there's no DSPADDR register on Haswell drm/i915: remove DSPPOS register
drm/i915: there's no PIPESTAT on Gen5+
drm/i915: check the power well when capturing error state drm/i915: add HAS_POWER_WELL
drm/i915: reorganize intel_lvds_supported drm/i915: don't save/restore PCH_LVDS on LPT drm/i915: check the power well on i915_pipe_enabled drm/i915: add missing space in error message

 drivers/gpu/drm/i915/i915_drv.h      |    3 +-
 drivers/gpu/drm/i915/i915_irq.c      |   10 +++--
 drivers/gpu/drm/i915/i915_reg.h      |    3 --
 drivers/gpu/drm/i915/i915_suspend.c  |    7 +--
 drivers/gpu/drm/i915/i915_ums.c      |    4 --
 drivers/gpu/drm/i915/intel_ddi.c     |   11 +++--
 drivers/gpu/drm/i915/intel_display.c |   80 +++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_lvds.c    |   10 ++---
 drivers/gpu/drm/i915/intel_pm.c      |   20 ++++++++-
 10 files changed, 98 insertions(+), 51 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/15 drm/i915: only disable DDI sound if intel_crtc->eld_vld

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

---
 drivers/gpu/drm/i915/intel_ddi.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -3
index 56bb7cb..cd2f519 100644
@@ -1347,9 +1347,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 		ironlake_edp_backlight_off(intel_dp);
 	}
 
-	tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-	tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	if (intel_crtc->eld_vld) {
+		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+			 (pipe * 4));
+		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	}
 }
 
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 01/15] drm/i915: only disable DDI sound if intel_crtc->eld_vld

Quoted 18 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

---
 drivers/gpu/drm/i915/intel_ddi.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 56bb7cb..cd2f519 100644
@@ -1347,9 +1347,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 		ironlake_edp_backlight_off(intel_dp);
 	}

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi(struct intel_encoder *intel_encoder) · line 1355

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -3
 
-	tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-	tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	if (intel_crtc->eld_vld) {
+		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+			 (pipe * 4));
+		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	}

We set eld_vld=false before disabling the crtc in intel_crtc_disable(). I think you need to rearrange that so that we clear eld_vld only after ->crtc_disable has been called.

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
 }
 
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#3 lore raw

Re: [PATCH 01/15] drm/i915: only disable DDI sound if intel_crtc->eld_vld

Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

---
 drivers/gpu/drm/i915/intel_ddi.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 56bb7cb..cd2f519 100644
@@ -1347,9 +1347,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 		ironlake_edp_backlight_off(intel_dp);
 	}
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi(struct intel_encoder *intel_encoder) · line 1355

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -3
-	tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-	tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	if (intel_crtc->eld_vld) {
+		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+			 (pipe * 4));
+		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	}

We set eld_vld=false before disabling the crtc in intel_crtc_disable(). I think you need to rearrange that so that we clear eld_vld only after ->crtc_disable has been called.

Just looked a bit through the code here and ->eld_vld is another case of where the ddi encoder needs to know something which only the connector really knows currently. Since in our dp/hdmi/sdvo code we just check <connector>->has_audio in the respective modeset function.

And it's not really the only place where the apparently common ddi functions are just if ladders gropping around in connector details.

I guess we need to eventually clean this mess up, once things have settled a bit, since I fear the duplication it icky little bugs this fragmentation of state keeping might (or probably will) cause.

Ideas welcome ;-)

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw

Re: [PATCH 01/15] drm/i915: only disable DDI sound if intel_crtc->eld_vld

In reply to Ville Syrjälä
Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

---
 drivers/gpu/drm/i915/intel_ddi.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 56bb7cb..cd2f519 100644
@@ -1347,9 +1347,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 		ironlake_edp_backlight_off(intel_dp);
 	}
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi(struct intel_encoder *intel_encoder) · line 1355

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -3
-	tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-	tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	if (intel_crtc->eld_vld) {
+		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+			 (pipe * 4));
+		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	}

We set eld_vld=false before disabling the crtc in intel_crtc_disable(). I think you need to rearrange that so that we clear eld_vld only after ->crtc_disable has been called.

I've forgotten to drop my bikeshed on the patch itself:

This looks a bit fishy since currently we assume that disabling something just works (especially clearing a few registers). And I don't really understand how we can hit unclaimed register issues since the pipe should be enabled when we call this function here ...

So either transcoder eDP doesn't have audio, in which case I think it'd be better to check for that here (plus ensure that we yell at callers for integrated eDP in e.g. hsw_write_eld). Or it _does_ have audio, but the audio stuff is in the power well. In which case we need to add a check.

Yes, I'm too lazy to check the docs myself, but tbh it's still w/e here so don't want to fire up the work machine ;-)

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw

Re: [PATCH 01/15] drm/i915: only disable DDI sound if intel_crtc->eld_vld

Hi

2013/3/17 Daniel Vetter <[email protected]>:

Quoted 35 lines · Ville Syrjälä
Quoted 20 lines · Paulo Zanoni
Quoted 19 lines

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

---
 drivers/gpu/drm/i915/intel_ddi.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 56bb7cb..cd2f519 100644
@@ -1347,9 +1347,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
            ironlake_edp_backlight_off(intel_dp);
    }
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi(struct intel_encoder *intel_encoder) · line 1355

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -3
-   tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-   tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-   I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+   if (intel_crtc->eld_vld) {
+           tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+           tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+                    (pipe * 4));
+           I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+   }

We set eld_vld=false before disabling the crtc in intel_crtc_disable(). I think you need to rearrange that so that we clear eld_vld only after ->crtc_disable has been called.

Quoted 6 lines

I've forgotten to drop my bikeshed on the patch itself:

This looks a bit fishy since currently we assume that disabling something just works (especially clearing a few registers). And I don't really understand how we can hit unclaimed register issues since the pipe should be enabled when we call this function here ...

The audio registers are on the power well. My test case is: eDP panel without sound. We don't hit unclaimed registers at the ->enable function because it's protected by eld_vld (which is false, because we don't have sound), but then at the disable path we just unconditionally touch the registers which are on the power down well, so "unclaimed register".

Quoted 4 lines

So either transcoder eDP doesn't have audio, in which case I think it'd be better to check for that here (plus ensure that we yell at callers for integrated eDP in e.g. hsw_write_eld).

The eld_vld is the "check for audio" which you're asking for.

Quoted 2 lines

Or it _does_ have audio, but the
audio stuff is in the power well. In which case we need to add a check.

We need to patch haswell_modeset_global_resources to enable the power well in case eDP has sound, but this is an unrelated bug with a different patch. It's on my TODO list too.

Still, Ville's comment is valid, so I need to resend.

Quoted 9 lines

Yes, I'm too lazy to check the docs myself, but tbh it's still w/e here so don't want to fire up the work machine ;-)

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

Signature · 1 line
Paulo Zanoni
#6 lore raw

Re: [PATCH 01/15] drm/i915: only disable DDI sound if intel_crtc->eld_vld

Quoted 53 lines · Paulo Zanoni

Hi

2013/3/17 Daniel Vetter <[email protected]>:

Quoted 35 lines · Ville Syrjälä
Quoted 20 lines · Paulo Zanoni
Quoted 19 lines

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

---
 drivers/gpu/drm/i915/intel_ddi.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 56bb7cb..cd2f519 100644
@@ -1347,9 +1347,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
            ironlake_edp_backlight_off(intel_dp);
    }
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_disable_ddi(struct intel_encoder *intel_encoder) · line 1355

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -3
-   tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-   tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-   I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+   if (intel_crtc->eld_vld) {
+           tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+           tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+                    (pipe * 4));
+           I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+   }

We set eld_vld=false before disabling the crtc in intel_crtc_disable(). I think you need to rearrange that so that we clear eld_vld only after ->crtc_disable has been called.

Quoted 6 lines

I've forgotten to drop my bikeshed on the patch itself:

This looks a bit fishy since currently we assume that disabling something just works (especially clearing a few registers). And I don't really understand how we can hit unclaimed register issues since the pipe should be enabled when we call this function here ...

The audio registers are on the power well. My test case is: eDP panel without sound. We don't hit unclaimed registers at the ->enable function because it's protected by eld_vld (which is false, because we don't have sound), but then at the disable path we just unconditionally touch the registers which are on the power down well, so "unclaimed register".

Quoted 1 line
Quoted 5 lines
Quoted 3 lines

So either transcoder eDP doesn't have audio, in which case I think it'd be better to check for that here (plus ensure that we yell at callers for integrated eDP in e.g. hsw_write_eld).

The eld_vld is the "check for audio" which you're asking for.

Ok, now I've been slightly less lazy and quickly checked the docs. If I'm reading the diagrams and audio connections correctly, then there's _no_ audio support at all for the eDP transcoder. Which means we'd need to protect both the enable and disable side in trancoder != TRANS_EDP checks.

That's what I've meant with proper check. The eld_vld thing is a bit ad-hoc and imo due to our ddi encoder/connector split: Only the connector has the edid and so knows whether the sync claims to support audio, but we need that information in the ddi encoder functions.

But since our current ddi code is full of such little control inversions where the ddi code has to dig out some piece of information about the current connector from somewhere, I don't care and postpone this to a time when hsw support has really settled.
-Daniel

Quoted 24 lines
Quoted 3 lines

Or it _does_ have audio, but the
audio stuff is in the power well. In which case we need to add a check.

We need to patch haswell_modeset_global_resources to enable the power well in case eDP has sound, but this is an unrelated bug with a different patch. It's on my TODO list too.

Still, Ville's comment is valid, so I need to resend.

Quoted 9 lines

Yes, I'm too lazy to check the docs myself, but tbh it's still w/e here so don't want to fire up the work machine ;-)

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

Signature · 1 line
Paulo Zanoni
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw

PATCH 2/7 drm/i915: only disable DDI sound if intel_crtc->eld_vld

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

V2: Reset intel_crtc->eld_vld to false after the mode_set function.

---
 drivers/gpu/drm/i915/intel_ddi.c     |    9 ++++++---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -3
index bfcc58f..cb0d0f7 100644
@@ -1341,9 +1341,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t tmp;
 
-	tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-	tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	if (intel_crtc->eld_vld) {
+		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+			 (pipe * 4));
+		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	}
 
 	if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
drivers/gpu/drm/i915/intel_display.c +1 -1
index ec26a85..188e31f 100644
@@ -3822,8 +3822,8 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
 	/* crtc should still be enabled when we disable it. */
 	WARN_ON(!crtc->enabled);
 
-	intel_crtc->eld_vld = false;
 	dev_priv->display.crtc_disable(crtc);
+	intel_crtc->eld_vld = false;
 	intel_crtc_update_sarea(crtc, false);
 	dev_priv->display.off(crtc);
 
Signature · 1 line
1.7.10.4
Reviewed-by on v1 2/7
#8 lore raw

Re: [PATCH 2/7] drm/i915: only disable DDI sound if intel_crtc->eld_vld

Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We already have the same check on intel_enable_ddi. This patch prevents "unclaimed register" messages when the power well is disabled.

V2: Reset intel_crtc->eld_vld to false after the mode_set function.

Quoted 46 lines
---
 drivers/gpu/drm/i915/intel_ddi.c     |    9 ++++++---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -3
index bfcc58f..cb0d0f7 100644
@@ -1341,9 +1341,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t tmp;
 
-	tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
-	tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4));
-	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	if (intel_crtc->eld_vld) {
+		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
+		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
+			 (pipe * 4));
+		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
+	}
 
 	if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
drivers/gpu/drm/i915/intel_display.c +1 -1
index ec26a85..188e31f 100644
@@ -3822,8 +3822,8 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
 	/* crtc should still be enabled when we disable it. */
 	WARN_ON(!crtc->enabled);
 
-	intel_crtc->eld_vld = false;
 	dev_priv->display.crtc_disable(crtc);
+	intel_crtc->eld_vld = false;
 	intel_crtc_update_sarea(crtc, false);
 	dev_priv->display.off(crtc);
 
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#9 lore raw

PATCH 2/15 drm/i915: disable sound first on intel_disable_ddi

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Our mode set sequence documentation says audio must be disabled before the backlight.

---
 drivers/gpu/drm/i915/intel_ddi.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -6
index cd2f519..c4c0e7e 100644
@@ -1341,18 +1341,18 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t tmp;
 
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-
-		ironlake_edp_backlight_off(intel_dp);
-	}
-
 	if (intel_crtc->eld_vld) {
 		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
 		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
 			 (pipe * 4));
 		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
 	}
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+		ironlake_edp_backlight_off(intel_dp);
+	}
 }
 
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
Signature · 1 line
1.7.10.4
Reviewed-by on v1 2/15
#10 lore raw

Re: [PATCH 02/15] drm/i915: disable sound first on intel_disable_ddi

Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Our mode set sequence documentation says audio must be disabled before the backlight.

At least what I see it says, Audio must be disabled, "first." So I'd recommend modifying the commit message to not mention backlight specifically

Quoted 40 lines
---
 drivers/gpu/drm/i915/intel_ddi.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -6
index cd2f519..c4c0e7e 100644
@@ -1341,18 +1341,18 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t tmp;
 
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-
-		ironlake_edp_backlight_off(intel_dp);
-	}
-
 	if (intel_crtc->eld_vld) {
 		tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
 		tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) <<
 			 (pipe * 4));
 		I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
 	}
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+		ironlake_edp_backlight_off(intel_dp);
+	}
 }
 
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#11 lore raw

Re: [PATCH 02/15] drm/i915: disable sound first on intel_disable_ddi

Quoted 6 lines · Ben Widawsky
Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Our mode set sequence documentation says audio must be disabled before the backlight.

Quoted 7 lines
Quoted 1 line

At least what I see it says, Audio must be disabled, "first." So I'd recommend modifying the commit message to not mention backlight specifically

Queued for -next with Ben's bikeshed, thanks for the patch. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#12 lore raw

PATCH 3/15 drm/i915: add intel_power_well_is_down

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we're not supposed to touch the registers on the power down well.

For now there's just one caller, but I'm going to add more.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 502cb28..bd27336 100644
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
 	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
 		state = true;
 
-	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+	if (intel_power_well_is_down(dev_priv->dev) &&
+	    cpu_transcoder != TRANSCODER_EDP) {
 		cur_state = false;
 	} else {
 		reg = PIPECONF(cpu_transcoder);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 010e998..28c4789 100644
@@ -671,6 +671,7 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+extern bool intel_power_well_is_down(struct drm_device *dev);
 extern void intel_init_power_well(struct drm_device *dev);
 extern void intel_set_power_well(struct drm_device *dev, bool enable);
 extern void intel_enable_gt_powersave(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +16 -0
index 5479363..90562bc 100644
@@ -4070,6 +4070,22 @@ void intel_init_clock_gating(struct drm_device *dev)
 	dev_priv->display.init_clock_gating(dev);
 }
 
+/**
+ * Returns true if we're not supposed to touch the registers on the power down
+ * well. Notice that we don't check whether the power well is actually off, we
+ * just check if our driver told the hardware that it doesn't need the power
+ * well enabled.
+ */
+bool intel_power_well_is_down(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (IS_HASWELL(dev))
+		return !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE);
+	else
+		return false;
+}
+
 void intel_set_power_well(struct drm_device *dev, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 1 line
1.7.10.4
#13 lore raw

Re: [PATCH 03/15] drm/i915: add intel_power_well_is_down

Quoted 19 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we're not supposed to touch the registers on the power down well.

For now there's just one caller, but I'm going to add more.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 502cb28..bd27336 100644

drivers/gpu/drm/i915/intel_display.c void assert_pipe(struct drm_i915_private *dev_priv, · line 1230

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
 	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
 		state = true;
 
-	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+	if (intel_power_well_is_down(dev_priv->dev) &&

The name here feels a bit too generic given that we already have on hsw different display c states with different requirements and different pieces of hw not working.

Can't thinkg of anything better than intel_display_power_well_is_down though ...
-Daniel

Quoted 50 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
+	    cpu_transcoder != TRANSCODER_EDP) {
 		cur_state = false;
 	} else {
 		reg = PIPECONF(cpu_transcoder);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 010e998..28c4789 100644
@@ -671,6 +671,7 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+extern bool intel_power_well_is_down(struct drm_device *dev);
 extern void intel_init_power_well(struct drm_device *dev);
 extern void intel_set_power_well(struct drm_device *dev, bool enable);
 extern void intel_enable_gt_powersave(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +16 -0
index 5479363..90562bc 100644
@@ -4070,6 +4070,22 @@ void intel_init_clock_gating(struct drm_device *dev)
 	dev_priv->display.init_clock_gating(dev);
 }
 
+/**
+ * Returns true if we're not supposed to touch the registers on the power down
+ * well. Notice that we don't check whether the power well is actually off, we
+ * just check if our driver told the hardware that it doesn't need the power
+ * well enabled.
+ */
+bool intel_power_well_is_down(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (IS_HASWELL(dev))
+		return !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE);
+	else
+		return false;
+}
+
 void intel_set_power_well(struct drm_device *dev, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#14 lore raw

Re: [PATCH 03/15] drm/i915: add intel_power_well_is_down

Quoted 31 lines · Daniel Vetter
Quoted 19 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we're not supposed to touch the registers on the power down well.

For now there's just one caller, but I'm going to add more.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 502cb28..bd27336 100644

drivers/gpu/drm/i915/intel_display.c void assert_pipe(struct drm_i915_private *dev_priv, · line 1230

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
 	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
 		state = true;
 
-	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+	if (intel_power_well_is_down(dev_priv->dev) &&

The name here feels a bit too generic given that we already have on hsw different display c states with different requirements and different pieces of hw not working.

Quoted 2 lines

Can't thinkg of anything better than intel_display_power_well_is_down though ...

Also maybe make the function assure that the power well is on i.e. power_well_enabled to avoid double-negation logic in a bunch of places. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by
#15 lore raw

Re: [PATCH 03/15] drm/i915: add intel_power_well_is_down

In reply to Daniel Vetter
Quoted 59 lines · Daniel Vetter
Quoted 19 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we're not supposed to touch the registers on the power down well.

For now there's just one caller, but I'm going to add more.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 502cb28..bd27336 100644

drivers/gpu/drm/i915/intel_display.c void assert_pipe(struct drm_i915_private *dev_priv, · line 1230

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
 	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
 		state = true;
 
-	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+	if (intel_power_well_is_down(dev_priv->dev) &&

The name here feels a bit too generic given that we already have on hsw different display c states with different requirements and different pieces of hw not working.

Can't thinkg of anything better than intel_display_power_well_is_down though ...
-Daniel

Quoted 24 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
+	    cpu_transcoder != TRANSCODER_EDP) {
 		cur_state = false;
 	} else {
 		reg = PIPECONF(cpu_transcoder);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 010e998..28c4789 100644
@@ -671,6 +671,7 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+extern bool intel_power_well_is_down(struct drm_device *dev);
 extern void intel_init_power_well(struct drm_device *dev);
 extern void intel_set_power_well(struct drm_device *dev, bool enable);
 extern void intel_enable_gt_powersave(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 5479363..90562bc 100644
@@ -4070,6 +4070,22 @@ void intel_init_clock_gating(struct drm_device *dev)
 	dev_priv->display.init_clock_gating(dev);
 }
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_pm.c void intel_init_clock_gating(struct drm_device *dev) · line 4078

Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
+/**
+ * Returns true if we're not supposed to touch the registers on the power down
+ * well. Notice that we don't check whether the power well is actually off, we
+ * just check if our driver told the hardware that it doesn't need the power
+ * well enabled.
+ */

I agree with Denial that the name sucks because your comment clearly contradicts what the function is actually called. Can't think of anything better either.

In the bikeshed realm, I think it makes more sense to do the IS_HASWELL check in your pipe assertion, but I'll assume that you have a good usage as you mention later.

Quoted 29 lines
Quoted 20 lines
drivers/gpu/drm/i915/intel_pm.c +10 -0
+bool intel_power_well_is_down(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (IS_HASWELL(dev))
+		return !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE);
+	else
+		return false;
+}
+
 void intel_set_power_well(struct drm_device *dev, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#16 lore raw

Re: [PATCH 03/15] drm/i915: add intel_power_well_is_down

Hi

2013/3/15 Ben Widawsky <[email protected]>:

Quoted 60 lines · Daniel Vetter
Quoted 59 lines · Paulo Zanoni
Quoted 19 lines

From: Paulo Zanoni <[email protected]>

It returns true if we're not supposed to touch the registers on the power down well.

For now there's just one caller, but I'm going to add more.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 502cb28..bd27336 100644

drivers/gpu/drm/i915/intel_display.c void assert_pipe(struct drm_i915_private *dev_priv, · line 1230

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
    if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
            state = true;
 
-   if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-       !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+   if (intel_power_well_is_down(dev_priv->dev) &&

The name here feels a bit too generic given that we already have on hsw different display c states with different requirements and different pieces of hw not working.

Can't thinkg of anything better than intel_display_power_well_is_down though ...
-Daniel

Quoted 24 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
+       cpu_transcoder != TRANSCODER_EDP) {
            cur_state = false;
    } else {
            reg = PIPECONF(cpu_transcoder);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 010e998..28c4789 100644
@@ -671,6 +671,7 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+extern bool intel_power_well_is_down(struct drm_device *dev);
 extern void intel_init_power_well(struct drm_device *dev);
 extern void intel_set_power_well(struct drm_device *dev, bool enable);
 extern void intel_enable_gt_powersave(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 5479363..90562bc 100644
@@ -4070,6 +4070,22 @@ void intel_init_clock_gating(struct drm_device *dev)
    dev_priv->display.init_clock_gating(dev);
 }
 
Quoted 10 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_pm.c void intel_init_clock_gating(struct drm_device *dev) · line 4078

Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
+/**
+ * Returns true if we're not supposed to touch the registers on the power down
+ * well. Notice that we don't check whether the power well is actually off, we
+ * just check if our driver told the hardware that it doesn't need the power
+ * well enabled.
+ */

I agree with Denial that the name sucks because your comment clearly contradicts what the function is actually called. Can't think of anything better either.

intel_using_power_well?

Quoted 4 lines

In the bikeshed realm, I think it makes more sense to do the IS_HASWELL check in your pipe assertion, but I'll assume that you have a good usage as you mention later.

I want to make all the power well functions work correctly on Gens that don't have a power well. We already introduced bugs related to this in the past, so let's be defensive.

Quoted 35 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_pm.c +10 -1
+bool intel_power_well_is_down(struct drm_device *dev)
+{
+   struct drm_i915_private *dev_priv = dev->dev_private;
+
+   if (IS_HASWELL(dev))
+           return !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE);
+   else
+           return false;
+}
+
 void intel_set_power_well(struct drm_device *dev, bool enable)
 {
    struct drm_i915_private *dev_priv = dev->dev_private;
--

1.7.10.4

Quoted 13 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ben Widawsky, Intel Open Source Technology Center

Signature · 1 line
Paulo Zanoni
#17 lore raw

PATCH 3/7 drm/i915: add intel_using_power_well

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we've requested to turn the power well on and it's really on. It also returns true for all the previous gens.

For now there's just one caller, but I'm going to add more.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 188e31f..be70f2d 100644
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
 	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
 		state = true;
 
-	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+	if (!intel_using_power_well(dev_priv->dev) &&
+	    cpu_transcoder != TRANSCODER_EDP) {
 		cur_state = false;
 	} else {
 		reg = PIPECONF(cpu_transcoder);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index e6f84d0..40733d9 100644
@@ -671,6 +671,7 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+extern bool intel_using_power_well(struct drm_device *dev);
 extern void intel_init_power_well(struct drm_device *dev);
 extern void intel_set_power_well(struct drm_device *dev, bool enable);
 extern void intel_enable_gt_powersave(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +16 -0
index 2de6da6..13404f6 100644
@@ -4086,6 +4086,22 @@ void intel_init_clock_gating(struct drm_device *dev)
 	dev_priv->display.init_clock_gating(dev);
 }
 
+/**
+ * We should only use the power well if we explicitly asked the hardware to
+ * enable it, so check if it's enabled and also check if we've requested it to
+ * be enabled.
+ */
+bool intel_using_power_well(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (IS_HASWELL(dev))
+		return I915_READ(HSW_PWR_WELL_DRIVER) ==
+		       (HSW_PWR_WELL_ENABLE | HSW_PWR_WELL_STATE);
+	else
+		return true;
+}
+
 void intel_set_power_well(struct drm_device *dev, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 1 line
1.7.10.4
#18 lore raw

Re: [PATCH 3/7] drm/i915: add intel_using_power_well

Hi Paulo,

Quoted 8 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we've requested to turn the power well on and it's really on. It also returns true for all the previous gens.

For now there's just one caller, but I'm going to add more.

Yeah, I've merged this but just stumbled over it again while rebasing the -internal tree. And I'm still unhappy with the name a bit, since power_well is a bit generic. I know it's what bspec uses, but still I'd like to have some notion in it that this is about display stuff

The other thing which always irked me is that sprinkling power wells checks all over the place just feels ugly. What we actually want to check is whether the display hw is powered on, which feels much less platform-specific.

So what about a s/intel_using_power_well/intel_display_power_enabled? It's not perfect since the actual piece of hw we care about is still platform specific, so I'd suggest to throw an enum on top:

enum intel_display_power_domains {
POWER_DOMAIN_EDP,
POWER_DOMAIN_EDP_PFIT,
POWER_DOMAIN_OTHER
};

bool intel_display_power_enabled(struct drm_device *dev,

				 enum intel_display_power_domain domain);

We could easily add new domains for e.g. the pc8 stuff with a POWER_DOMAIN_CONNECTOR_AUX or so if we need to work around more unclaimed register warnings.

With that piece of infrastructure I think I'll stop being grumpy about power wells checks and unclaimed register fixup patches and just merge them all.

Comments?

Cheers, Daniel

Quoted 67 lines
---
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 drivers/gpu/drm/i915/intel_pm.c      |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 188e31f..be70f2d 100644
@@ -1227,8 +1227,8 @@ void assert_pipe(struct drm_i915_private *dev_priv,
 	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
 		state = true;
 
-	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
+	if (!intel_using_power_well(dev_priv->dev) &&
+	    cpu_transcoder != TRANSCODER_EDP) {
 		cur_state = false;
 	} else {
 		reg = PIPECONF(cpu_transcoder);
drivers/gpu/drm/i915/intel_drv.h +1 -0
index e6f84d0..40733d9 100644
@@ -671,6 +671,7 @@ extern void intel_update_fbc(struct drm_device *dev);
 extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 extern void intel_gpu_ips_teardown(void);
 
+extern bool intel_using_power_well(struct drm_device *dev);
 extern void intel_init_power_well(struct drm_device *dev);
 extern void intel_set_power_well(struct drm_device *dev, bool enable);
 extern void intel_enable_gt_powersave(struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +16 -0
index 2de6da6..13404f6 100644
@@ -4086,6 +4086,22 @@ void intel_init_clock_gating(struct drm_device *dev)
 	dev_priv->display.init_clock_gating(dev);
 }
 
+/**
+ * We should only use the power well if we explicitly asked the hardware to
+ * enable it, so check if it's enabled and also check if we've requested it to
+ * be enabled.
+ */
+bool intel_using_power_well(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (IS_HASWELL(dev))
+		return I915_READ(HSW_PWR_WELL_DRIVER) ==
+		       (HSW_PWR_WELL_ENABLE | HSW_PWR_WELL_STATE);
+	else
+		return true;
+}
+
 void intel_set_power_well(struct drm_device *dev, bool enable)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#19 lore raw

Re: [PATCH 3/7] drm/i915: add intel_using_power_well

Quoted 35 lines · Daniel Vetter

Hi Paulo,

Quoted 8 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

It returns true if we've requested to turn the power well on and it's really on. It also returns true for all the previous gens.

For now there's just one caller, but I'm going to add more.

Yeah, I've merged this but just stumbled over it again while rebasing the -internal tree. And I'm still unhappy with the name a bit, since power_well is a bit generic. I know it's what bspec uses, but still I'd like to have some notion in it that this is about display stuff

The other thing which always irked me is that sprinkling power wells checks all over the place just feels ugly. What we actually want to check is whether the display hw is powered on, which feels much less platform-specific.

So what about a s/intel_using_power_well/intel_display_power_enabled? It's not perfect since the actual piece of hw we care about is still platform specific, so I'd suggest to throw an enum on top:

enum intel_display_power_domains {
POWER_DOMAIN_EDP,
POWER_DOMAIN_EDP_PFIT,
POWER_DOMAIN_OTHER
};

bool intel_display_power_enabled(struct drm_device *dev, enum intel_display_power_domain domain);

Quoted 7 lines

We could easily add new domains for e.g. the pc8 stuff with a POWER_DOMAIN_CONNECTOR_AUX or so if we need to work around more unclaimed register warnings.

With that piece of infrastructure I think I'll stop being grumpy about power wells checks and unclaimed register fixup patches and just merge them all.

Also, that function should probably use HAS_POWER_WELL instead of the manual IS_HASWELL check.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#20 lore raw

PATCH 4/15 drm/i915: don't touch the PF regs if the power well is down

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when booting the machine with eDP attached.

---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index bd27336..9a9f6d7 100644
@@ -3584,8 +3584,10 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
 	/* Disable PF */
-	I915_WRITE(PF_CTL(pipe), 0);
-	I915_WRITE(PF_WIN_SZ(pipe), 0);
+	if (!intel_power_well_is_down(dev)) {
+		I915_WRITE(PF_CTL(pipe), 0);
+		I915_WRITE(PF_WIN_SZ(pipe), 0);
+	}
 
 	intel_ddi_disable_pipe_clock(intel_crtc);
 
Signature · 1 line
1.7.10.4
#21 lore raw

Re: [PATCH 04/15] drm/i915: don't touch the PF regs if the power well is down

Quoted 15 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when booting the machine with eDP attached.

---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index bd27336..9a9f6d7 100644

drivers/gpu/drm/i915/intel_display.c static void haswell_crtc_disable(struct drm_crtc *crtc) · line 3590

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +4 -2
@@ -3584,8 +3584,10 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
 	/* Disable PF */
-	I915_WRITE(PF_CTL(pipe), 0);
-	I915_WRITE(PF_WIN_SZ(pipe), 0);
+	if (!intel_power_well_is_down(dev)) {
+		I915_WRITE(PF_CTL(pipe), 0);
+		I915_WRITE(PF_WIN_SZ(pipe), 0);
+	}

I'd vote for a /* XXX: Once we have proper pfit state tracking implemented with hw state read/check support we should switch to only disable the pfit when we know it's used */

The idea is that the power well code here irks me a bit, after all if something is on and we want to disable it, it can't be also off due to the power well being down ;-)
-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 	intel_ddi_disable_pipe_clock(intel_crtc);
 
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#22 lore raw

Re: [PATCH 04/15] drm/i915: don't touch the PF regs if the power well is down

Quoted 30 lines · Daniel Vetter
Quoted 15 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when booting the machine with eDP attached.

---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index bd27336..9a9f6d7 100644

drivers/gpu/drm/i915/intel_display.c static void haswell_crtc_disable(struct drm_crtc *crtc) · line 3590

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +4 -2
@@ -3584,8 +3584,10 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
 	/* Disable PF */
-	I915_WRITE(PF_CTL(pipe), 0);
-	I915_WRITE(PF_WIN_SZ(pipe), 0);
+	if (!intel_power_well_is_down(dev)) {
+		I915_WRITE(PF_CTL(pipe), 0);
+		I915_WRITE(PF_WIN_SZ(pipe), 0);
+	}

I'd vote for a /* XXX: Once we have proper pfit state tracking implemented with hw state read/check support we should switch to only disable the pfit when we know it's used */

Quoted 4 lines

The idea is that the power well code here irks me a bit, after all if something is on and we want to disable it, it can't be also off due to the power well being down ;-)
-Daniel

Daniel, your second paragraph doesn't make sense to me. I agree with the first paragraph, but I like that this fixes a real error message in the meantime. As best I can tell, there is nothing wrong with the code on the existing d-i-n.

Paulo: P.S. This doesn't help my previous bikeshed about not needing an IS_HASWELL check in intel_power_well_is_down() ;-).

Quoted 20 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 	intel_ddi_disable_pipe_clock(intel_crtc);
 
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#23 lore raw

PATCH 4/7 drm/i915: don't touch the PF regs if the power well is down

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when booting the machine with eDP attached.

V2: Rebase and add the comment requested by Daniel.

---
 drivers/gpu/drm/i915/intel_display.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -3
index be70f2d..36e0445 100644
@@ -3594,9 +3594,13 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
-	/* Disable PF */
-	I915_WRITE(PF_CTL(pipe), 0);
-	I915_WRITE(PF_WIN_SZ(pipe), 0);
+	/* XXX: Once we have proper panel fitter state tracking implemented with
+	 * hardware state read/check support we should switch to only disable
+	 * the panel fitter when we know it's used. */
+	if (intel_using_power_well(dev)) {
+		I915_WRITE(PF_CTL(pipe), 0);
+		I915_WRITE(PF_WIN_SZ(pipe), 0);
+	}
 
 	intel_ddi_disable_pipe_clock(intel_crtc);
 
Signature · 1 line
1.7.10.4
#24 lore raw

Re: [PATCH 4/7] drm/i915: don't touch the PF regs if the power well is down

Quoted 8 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when booting the machine with eDP attached.

V2: Rebase and add the comment requested by Daniel.

Merged this one and the previous prep patch to dinq, thanks. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#25 lore raw

PATCH 5/15 drm/i915: capture the correct cursor registers on IVB

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when there's a GPU hang on Haswell.

---
 drivers/gpu/drm/i915/intel_display.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -3
index 9a9f6d7..789a95a 100644
@@ -9336,9 +9336,15 @@ intel_display_capture_error_state(struct drm_device *dev)
 	for_each_pipe(i) {
 		cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
 
-		error->cursor[i].control = I915_READ(CURCNTR(i));
-		error->cursor[i].position = I915_READ(CURPOS(i));
-		error->cursor[i].base = I915_READ(CURBASE(i));
+		if (INTEL_INFO(dev)->gen <= 6) {
+			error->cursor[i].control = I915_READ(CURCNTR(i));
+			error->cursor[i].position = I915_READ(CURPOS(i));
+			error->cursor[i].base = I915_READ(CURBASE(i));
+		} else {
+			error->cursor[i].control = I915_READ(CURCNTR_IVB(i));
+			error->cursor[i].position = I915_READ(CURPOS_IVB(i));
+			error->cursor[i].base = I915_READ(CURBASE_IVB(i));
+		}
 
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
Signature · 1 line
1.7.10.4
#26 lore raw

Re: [PATCH 05/15] drm/i915: capture the correct cursor registers on IVB

Quoted 20 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when there's a GPU hang on Haswell.

---
 drivers/gpu/drm/i915/intel_display.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -2
index 9a9f6d7..789a95a 100644
@@ -9336,9 +9336,15 @@ intel_display_capture_error_state(struct drm_device *dev)
 	for_each_pipe(i) {
 		cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
 
-		error->cursor[i].control = I915_READ(CURCNTR(i));
-		error->cursor[i].position = I915_READ(CURPOS(i));

drivers/gpu/drm/i915/intel_display.c intel_display_capture_error_state(struct drm_device *dev) · line 9347

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +9 -1
-		error->cursor[i].base = I915_READ(CURBASE(i));
+		if (INTEL_INFO(dev)->gen <= 6) {
+			error->cursor[i].control = I915_READ(CURCNTR(i));
+			error->cursor[i].position = I915_READ(CURPOS(i));
+			error->cursor[i].base = I915_READ(CURBASE(i));
+		} else {
+			error->cursor[i].control = I915_READ(CURCNTR_IVB(i));
+			error->cursor[i].position = I915_READ(CURPOS_IVB(i));
+			error->cursor[i].base = I915_READ(CURBASE_IVB(i));
+		}

Needs a VLV check.

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
Reviewed-by
#27 lore raw

Re: [PATCH 05/15] drm/i915: capture the correct cursor registers on IVB

Quoted 19 lines · Ville Syrjälä
Quoted 18 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when there's a GPU hang on Haswell.

---
 drivers/gpu/drm/i915/intel_display.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 9a9f6d7..789a95a 100644
@@ -9336,9 +9336,15 @@ intel_display_capture_error_state(struct drm_device *dev)
 	for_each_pipe(i) {
 		cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
 
Quoted 14 lines

drivers/gpu/drm/i915/intel_display.c intel_display_capture_error_state(struct drm_device *dev) · line 9347

Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +9 -3
-		error->cursor[i].control = I915_READ(CURCNTR(i));
-		error->cursor[i].position = I915_READ(CURPOS(i));
-		error->cursor[i].base = I915_READ(CURBASE(i));
+		if (INTEL_INFO(dev)->gen <= 6) {
+			error->cursor[i].control = I915_READ(CURCNTR(i));
+			error->cursor[i].position = I915_READ(CURPOS(i));
+			error->cursor[i].base = I915_READ(CURBASE(i));
+		} else {
+			error->cursor[i].control = I915_READ(CURCNTR_IVB(i));
+			error->cursor[i].position = I915_READ(CURPOS_IVB(i));
+			error->cursor[i].base = I915_READ(CURBASE_IVB(i));
+		}

Needs a VLV check.

Has anyone ever used this to actually debug an issue?

Ville's right, I suppose (I'm too lazy to find VLV docs). The non-VLV part of the patch is:

Quoted 19 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#28 lore raw

Re: [PATCH 05/15] drm/i915: capture the correct cursor registers on IVB

Quoted 35 lines · Ben Widawsky
Quoted 19 lines · Ville Syrjälä
Quoted 18 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves some "unclaimed register" messages when there's a GPU hang on Haswell.

---
 drivers/gpu/drm/i915/intel_display.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 9a9f6d7..789a95a 100644
@@ -9336,9 +9336,15 @@ intel_display_capture_error_state(struct drm_device *dev)
 	for_each_pipe(i) {
 		cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
 
Quoted 14 lines

drivers/gpu/drm/i915/intel_display.c intel_display_capture_error_state(struct drm_device *dev) · line 9347

Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +9 -3
-		error->cursor[i].control = I915_READ(CURCNTR(i));
-		error->cursor[i].position = I915_READ(CURPOS(i));
-		error->cursor[i].base = I915_READ(CURBASE(i));
+		if (INTEL_INFO(dev)->gen <= 6) {
+			error->cursor[i].control = I915_READ(CURCNTR(i));
+			error->cursor[i].position = I915_READ(CURPOS(i));
+			error->cursor[i].base = I915_READ(CURBASE(i));
+		} else {
+			error->cursor[i].control = I915_READ(CURCNTR_IVB(i));
+			error->cursor[i].position = I915_READ(CURPOS_IVB(i));
+			error->cursor[i].base = I915_READ(CURBASE_IVB(i));
+		}

Needs a VLV check.

Quoted 5 lines

Has anyone ever used this to actually debug an issue?

Ville's right, I suppose (I'm too lazy to find VLV docs). The non-VLV part of the patch is:

Queued for -next with the IS_VLV check added, thanks for the patch. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#29 lore raw

PATCH 6/15 drm/i915: there's no DSPSIZE register on gen4+

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index 789a95a..56cca6e 100644
@@ -9348,7 +9348,8 @@ intel_display_capture_error_state(struct drm_device *dev)
 
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
-		error->plane[i].size = I915_READ(DSPSIZE(i));
+		if (INTEL_INFO(dev)->gen <= 3)
+			error->plane[i].size = I915_READ(DSPSIZE(i));
 		error->plane[i].pos = I915_READ(DSPPOS(i));
 		error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9392,7 +9393,8 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "Plane [%d]:\n", i);
 		seq_printf(m, "  CNTR: %08x\n", error->plane[i].control);
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
-		seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
+		if (INTEL_INFO(dev)->gen <= 3)
+			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
 		seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 1 line
1.7.10.4
#30 lore raw

Re: [PATCH 06/15] drm/i915: there's no DSPSIZE register on gen4+

Quoted 4 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

You're sure about gen4? I haven't really checked but my impression is that gen4 is more like gen3, and gen4.5 more like gen5 as far as the display is concerned (eg. gen4 would have the old video overlay, and 4.5 would have video sprites). Can anyone confirm?

Quoted 37 lines
---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index 789a95a..56cca6e 100644
@@ -9348,7 +9348,8 @@ intel_display_capture_error_state(struct drm_device *dev)
 
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
-		error->plane[i].size = I915_READ(DSPSIZE(i));
+		if (INTEL_INFO(dev)->gen <= 3)
+			error->plane[i].size = I915_READ(DSPSIZE(i));
 		error->plane[i].pos = I915_READ(DSPPOS(i));
 		error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9392,7 +9393,8 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "Plane [%d]:\n", i);
 		seq_printf(m, "  CNTR: %08x\n", error->plane[i].control);
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
-		seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
+		if (INTEL_INFO(dev)->gen <= 3)
+			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
 		seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#31 lore raw

Re: [PATCH 06/15] drm/i915: there's no DSPSIZE register on gen4+

Quoted 10 lines · Ville Syrjälä
Quoted 4 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

You're sure about gen4? I haven't really checked but my impression is that gen4 is more like gen3, and gen4.5 more like gen5 as far as the display is concerned (eg. gen4 would have the old video overlay, and 4.5 would have video sprites). Can anyone confirm?

This register isn't anywhere in modern docs, what's up?

Quoted 46 lines
Quoted 38 lines
---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index 789a95a..56cca6e 100644
@@ -9348,7 +9348,8 @@ intel_display_capture_error_state(struct drm_device *dev)
 
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
-		error->plane[i].size = I915_READ(DSPSIZE(i));
+		if (INTEL_INFO(dev)->gen <= 3)
+			error->plane[i].size = I915_READ(DSPSIZE(i));
 		error->plane[i].pos = I915_READ(DSPPOS(i));
 		error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9392,7 +9393,8 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "Plane [%d]:\n", i);
 		seq_printf(m, "  CNTR: %08x\n", error->plane[i].control);
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
-		seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
+		if (INTEL_INFO(dev)->gen <= 3)
+			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
 		seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#32 lore raw

Re: [PATCH 06/15] drm/i915: there's no DSPSIZE register on gen4+

Quoted 7 lines · Ben Widawsky
Quoted 6 lines · Ville Syrjälä
Quoted 4 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

Quoted 6 lines
Quoted 4 lines

You're sure about gen4? I haven't really checked but my impression is that gen4 is more like gen3, and gen4.5 more like gen5 as far as the display is concerned (eg. gen4 would have the old video overlay, and 4.5 would have video sprites). Can anyone confirm?

This register isn't anywhere in modern docs, what's up?

Ooops, inverted the logic in my head. If you make the check for gen <=6 which I can lazily check with modern docs:

Quoted 54 lines
Quoted 47 lines
Quoted 39 lines
---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index 789a95a..56cca6e 100644
@@ -9348,7 +9348,8 @@ intel_display_capture_error_state(struct drm_device *dev)
 
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
-		error->plane[i].size = I915_READ(DSPSIZE(i));
+		if (INTEL_INFO(dev)->gen <= 3)
+			error->plane[i].size = I915_READ(DSPSIZE(i));
 		error->plane[i].pos = I915_READ(DSPPOS(i));
 		error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9392,7 +9393,8 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "Plane [%d]:\n", i);
 		seq_printf(m, "  CNTR: %08x\n", error->plane[i].control);
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
-		seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
+		if (INTEL_INFO(dev)->gen <= 3)
+			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
 		seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#33 lore raw

Re: [PATCH 06/15] drm/i915: there's no DSPSIZE register on gen4+

Quoted 13 lines · Ben Widawsky
Quoted 12 lines · Ben Widawsky
Quoted 10 lines · Ville Syrjälä
Quoted 4 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

You're sure about gen4? I haven't really checked but my impression is that gen4 is more like gen3, and gen4.5 more like gen5 as far as the display is concerned (eg. gen4 would have the old video overlay, and 4.5 would have video sprites). Can anyone confirm?

Quoted 5 lines
Quoted 1 line

This register isn't anywhere in modern docs, what's up?

Ooops, inverted the logic in my head. If you make the check for gen <=6 which I can lazily check with modern docs:

I've also checked vanilla gen4 docs and that offset is already marked as reserved, so we're good here.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#34 lore raw

PATCH 7/15 drm/i915: there's no DSPADDR register on Haswell

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when we hang the GPU. This solves "unclaimed register" messages.

---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index 56cca6e..0451056 100644
@@ -9351,7 +9351,8 @@ intel_display_capture_error_state(struct drm_device *dev)
 		if (INTEL_INFO(dev)->gen <= 3)
 			error->plane[i].size = I915_READ(DSPSIZE(i));
 		error->plane[i].pos = I915_READ(DSPPOS(i));
-		error->plane[i].addr = I915_READ(DSPADDR(i));
+		if (!IS_HASWELL(dev))
+			error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
 			error->plane[i].surface = I915_READ(DSPSURF(i));
 			error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i));
@@ -9396,7 +9397,8 @@ intel_display_print_error_state(struct seq_file *m,
 		if (INTEL_INFO(dev)->gen <= 3)
 			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
-		seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
+		if (!IS_HASWELL(dev))
+			seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
 			seq_printf(m, "  SURF: %08x\n", error->plane[i].surface);
 			seq_printf(m, "  TILEOFF: %08x\n", error->plane[i].tile_offset);
Signature · 1 line
1.7.10.4
Reviewed-by on v1 7/15
#35 lore raw

Re: [PATCH 07/15] drm/i915: there's no DSPADDR register on Haswell

Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when we hang the GPU. This solves "unclaimed register" messages.

It would be nice if you could make this a bit more future proof, but looks correct to me:

Quoted 35 lines
---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -2
index 56cca6e..0451056 100644
@@ -9351,7 +9351,8 @@ intel_display_capture_error_state(struct drm_device *dev)
 		if (INTEL_INFO(dev)->gen <= 3)
 			error->plane[i].size = I915_READ(DSPSIZE(i));
 		error->plane[i].pos = I915_READ(DSPPOS(i));
-		error->plane[i].addr = I915_READ(DSPADDR(i));
+		if (!IS_HASWELL(dev))
+			error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
 			error->plane[i].surface = I915_READ(DSPSURF(i));
 			error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i));
@@ -9396,7 +9397,8 @@ intel_display_print_error_state(struct seq_file *m,
 		if (INTEL_INFO(dev)->gen <= 3)
 			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
-		seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
+		if (!IS_HASWELL(dev))
+			seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
 			seq_printf(m, "  SURF: %08x\n", error->plane[i].surface);
 			seq_printf(m, "  TILEOFF: %08x\n", error->plane[i].tile_offset);
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#36 lore raw

Re: [PATCH 07/15] drm/i915: there's no DSPADDR register on Haswell

Quoted 9 lines · Ben Widawsky
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when we hang the GPU. This solves "unclaimed register" messages.

It would be nice if you could make this a bit more future proof, but looks correct to me:

Done.

Quoted 1 line

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#37 lore raw

Re: [PATCH 07/15] drm/i915: there's no DSPADDR register on Haswell

Hi

2013/3/17 Daniel Vetter <[email protected]>:

Quoted 12 lines · Ben Widawsky
Quoted 9 lines · Paulo Zanoni
Quoted 6 lines

From: Paulo Zanoni <[email protected]>

So don't read it when we hang the GPU. This solves "unclaimed register" messages.

It would be nice if you could make this a bit more future proof, but looks correct to me:

Done.

"Done" for intel_display_capture_error_state but not for intel_display_print_error_state. Do you want to fix this or do you want me to send a patch on top of dinq?

Thanks for the reviews!
Paulo

Quoted 8 lines
Quoted 2 lines

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

Signature · 1 line
Paulo Zanoni
#38 lore raw

Re: [PATCH 07/15] drm/i915: there's no DSPADDR register on Haswell

Quoted 11 lines · Paulo Zanoni

Hi

2013/3/17 Daniel Vetter <[email protected]>:

Quoted 8 lines · Ben Widawsky
Quoted 7 lines · Paulo Zanoni
Quoted 6 lines

From: Paulo Zanoni <[email protected]>

So don't read it when we hang the GPU. This solves "unclaimed register" messages.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It would be nice if you could make this a bit more future proof, but looks correct to me:

Done.

"Done" for intel_display_capture_error_state but not for intel_display_print_error_state. Do you want to fix this or do you want me to send a patch on top of dinq?

Oh, I've failed again ;-) Yes, please submit a patch since due to the backmerge it'll be a mess to rebase this one out.

Thanks, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#39 lore raw

PATCH 5/7 drm/i915: fix DSPADDR Gen check

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

The first version of commit "drm/i915: there's no DSPADDR register on Haswell" added 2 "!IS_HASWELL" checks. When reviewing the patch, Ben suggested to make these checks more future-proof, so when Daniel applied the patch he fixed the first check but not the second. This commit makes the second check also "future-proof".

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 36e0445..98ac3bd 100644
@@ -9416,7 +9416,7 @@ intel_display_print_error_state(struct seq_file *m,
 		if (INTEL_INFO(dev)->gen <= 3)
 			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
 		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
-		if (!IS_HASWELL(dev))
+		if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev))
 			seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
 			seq_printf(m, "  SURF: %08x\n", error->plane[i].surface);
Signature · 1 line
1.7.10.4
#40 lore raw

Re: [PATCH 5/7] drm/i915: fix DSPADDR Gen check

Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

The first version of commit "drm/i915: there's no DSPADDR register on Haswell" added 2 "!IS_HASWELL" checks. When reviewing the patch, Ben suggested to make these checks more future-proof, so when Daniel applied the patch he fixed the first check but not the second. This commit makes the second check also "future-proof".

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#41 lore raw

PATCH 8/15 drm/i915: remove DSPPOS register

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

I couldn't find any evidence that this register exists on Gen2+. On Gen 2/3/4 documents this register is listed as reserved and read-only. On the newer Gens this register is not even documented.

Also all we do with this register is:
- Write 0 to it on i9xx_crtc_mode_set
- Save/restore its value on the UMS code
- Read it on intel_display_capture_error_state

This commit fixes "unclaimed register" messages when there's a GPU hang on Haswell.

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 --
 drivers/gpu/drm/i915/i915_reg.h      |    3 ---
 drivers/gpu/drm/i915/i915_ums.c      |    4 ----
 drivers/gpu/drm/i915/intel_display.c |    4 ----
 4 files changed, 13 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index ca6b215..9bf15e5 100644
@@ -513,7 +513,6 @@ struct i915_suspend_saved_registers {
 	u32 savePIPEASTAT;
 	u32 saveDSPASTRIDE;
 	u32 saveDSPASIZE;
-	u32 saveDSPAPOS;
 	u32 saveDSPAADDR;
 	u32 saveDSPASURF;
 	u32 saveDSPATILEOFF;
@@ -544,7 +543,6 @@ struct i915_suspend_saved_registers {
 	u32 savePIPEBSTAT;
 	u32 saveDSPBSTRIDE;
 	u32 saveDSPBSIZE;
-	u32 saveDSPBPOS;
 	u32 saveDSPBADDR;
 	u32 saveDSPBSURF;
 	u32 saveDSPBTILEOFF;
drivers/gpu/drm/i915/i915_reg.h +0 -3
index 4cf3ece..26e4b86 100644
@@ -3051,7 +3051,6 @@
 #define   DISPPLANE_TILED			(1<<10)
 #define _DSPAADDR		(dev_priv->info->display_mmio_offset + 0x70184)
 #define _DSPASTRIDE		(dev_priv->info->display_mmio_offset + 0x70188)
-#define _DSPAPOS		(dev_priv->info->display_mmio_offset + 0x7018C) /* reserved */
 #define _DSPASIZE		(dev_priv->info->display_mmio_offset + 0x70190)
 #define _DSPASURF		(dev_priv->info->display_mmio_offset + 0x7019C) /* 965+ only */
 #define _DSPATILEOFF		(dev_priv->info->display_mmio_offset + 0x701A4) /* 965+ only */
@@ -3061,7 +3060,6 @@
 #define DSPCNTR(plane) _PIPE(plane, _DSPACNTR, _DSPBCNTR)
 #define DSPADDR(plane) _PIPE(plane, _DSPAADDR, _DSPBADDR)
 #define DSPSTRIDE(plane) _PIPE(plane, _DSPASTRIDE, _DSPBSTRIDE)
-#define DSPPOS(plane) _PIPE(plane, _DSPAPOS, _DSPBPOS)
 #define DSPSIZE(plane) _PIPE(plane, _DSPASIZE, _DSPBSIZE)
 #define DSPSURF(plane) _PIPE(plane, _DSPASURF, _DSPBSURF)
 #define DSPTILEOFF(plane) _PIPE(plane, _DSPATILEOFF, _DSPBTILEOFF)
@@ -3109,7 +3107,6 @@
 #define   DISPPLANE_SPRITE_ABOVE_OVERLAY	(1)
 #define _DSPBADDR		(dev_priv->info->display_mmio_offset + 0x71184)
 #define _DSPBSTRIDE		(dev_priv->info->display_mmio_offset + 0x71188)
-#define _DSPBPOS		(dev_priv->info->display_mmio_offset + 0x7118C)
 #define _DSPBSIZE		(dev_priv->info->display_mmio_offset + 0x71190)
 #define _DSPBSURF		(dev_priv->info->display_mmio_offset + 0x7119C)
 #define _DSPBTILEOFF		(dev_priv->info->display_mmio_offset + 0x711A4)
drivers/gpu/drm/i915/i915_ums.c +0 -4
index 985a097..0e21925 100644
@@ -160,7 +160,6 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPACNTR = I915_READ(_DSPACNTR);
 	dev_priv->regfile.saveDSPASTRIDE = I915_READ(_DSPASTRIDE);
 	dev_priv->regfile.saveDSPASIZE = I915_READ(_DSPASIZE);
-	dev_priv->regfile.saveDSPAPOS = I915_READ(_DSPAPOS);
 	dev_priv->regfile.saveDSPAADDR = I915_READ(_DSPAADDR);
 	if (INTEL_INFO(dev)->gen >= 4) {
 		dev_priv->regfile.saveDSPASURF = I915_READ(_DSPASURF);
@@ -217,7 +216,6 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPBCNTR = I915_READ(_DSPBCNTR);
 	dev_priv->regfile.saveDSPBSTRIDE = I915_READ(_DSPBSTRIDE);
 	dev_priv->regfile.saveDSPBSIZE = I915_READ(_DSPBSIZE);
-	dev_priv->regfile.saveDSPBPOS = I915_READ(_DSPBPOS);
 	dev_priv->regfile.saveDSPBADDR = I915_READ(_DSPBADDR);
 	if (INTEL_INFO(dev)->gen >= 4) {
 		dev_priv->regfile.saveDSPBSURF = I915_READ(_DSPBSURF);
@@ -390,7 +388,6 @@ void i915_restore_display_reg(struct drm_device *dev)
 
 	/* Restore plane info */
 	I915_WRITE(_DSPASIZE, dev_priv->regfile.saveDSPASIZE);
-	I915_WRITE(_DSPAPOS, dev_priv->regfile.saveDSPAPOS);
 	I915_WRITE(_PIPEASRC, dev_priv->regfile.savePIPEASRC);
 	I915_WRITE(_DSPAADDR, dev_priv->regfile.saveDSPAADDR);
 	I915_WRITE(_DSPASTRIDE, dev_priv->regfile.saveDSPASTRIDE);
@@ -459,7 +456,6 @@ void i915_restore_display_reg(struct drm_device *dev)
 
 	/* Restore plane info */
 	I915_WRITE(_DSPBSIZE, dev_priv->regfile.saveDSPBSIZE);
-	I915_WRITE(_DSPBPOS, dev_priv->regfile.saveDSPBPOS);
 	I915_WRITE(_PIPEBSRC, dev_priv->regfile.savePIPEBSRC);
 	I915_WRITE(_DSPBADDR, dev_priv->regfile.saveDSPBADDR);
 	I915_WRITE(_DSPBSTRIDE, dev_priv->regfile.saveDSPBSTRIDE);
drivers/gpu/drm/i915/intel_display.c +0 -4
index 0451056..b319cd3 100644
@@ -4781,7 +4781,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	I915_WRITE(DSPSIZE(plane),
 		   ((mode->vdisplay - 1) << 16) |
 		   (mode->hdisplay - 1));
-	I915_WRITE(DSPPOS(plane), 0);
 
 	I915_WRITE(PIPECONF(pipe), pipeconf);
 	POSTING_READ(PIPECONF(pipe));
@@ -9314,7 +9313,6 @@ struct intel_display_error_state {
 		u32 control;
 		u32 stride;
 		u32 size;
-		u32 pos;
 		u32 addr;
 		u32 surface;
 		u32 tile_offset;
@@ -9350,7 +9348,6 @@ intel_display_capture_error_state(struct drm_device *dev)
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
 		if (INTEL_INFO(dev)->gen <= 3)
 			error->plane[i].size = I915_READ(DSPSIZE(i));
-		error->plane[i].pos = I915_READ(DSPPOS(i));
 		if (!IS_HASWELL(dev))
 			error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9396,7 +9393,6 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
 		if (INTEL_INFO(dev)->gen <= 3)
 			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
-		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
 		if (!IS_HASWELL(dev))
 			seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 1 line
1.7.10.4
#42 lore raw

Re: [PATCH 08/15] drm/i915: remove DSPPOS register

Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

I couldn't find any evidence that this register exists on Gen2+. On Gen 2/3/4 documents this register is listed as reserved and read-only. On the newer Gens this register is not even documented.

DSPPOS goes hand in hand with DSPSIZE. IIRC DSPA never had the windowing capability, but DSPB and DSPC on older gens had it.

Quoted 143 lines

Also all we do with this register is:
- Write 0 to it on i9xx_crtc_mode_set
- Save/restore its value on the UMS code
- Read it on intel_display_capture_error_state

This commit fixes "unclaimed register" messages when there's a GPU hang on Haswell.

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 --
 drivers/gpu/drm/i915/i915_reg.h      |    3 ---
 drivers/gpu/drm/i915/i915_ums.c      |    4 ----
 drivers/gpu/drm/i915/intel_display.c |    4 ----
 4 files changed, 13 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index ca6b215..9bf15e5 100644
@@ -513,7 +513,6 @@ struct i915_suspend_saved_registers {
 	u32 savePIPEASTAT;
 	u32 saveDSPASTRIDE;
 	u32 saveDSPASIZE;
-	u32 saveDSPAPOS;
 	u32 saveDSPAADDR;
 	u32 saveDSPASURF;
 	u32 saveDSPATILEOFF;
@@ -544,7 +543,6 @@ struct i915_suspend_saved_registers {
 	u32 savePIPEBSTAT;
 	u32 saveDSPBSTRIDE;
 	u32 saveDSPBSIZE;
-	u32 saveDSPBPOS;
 	u32 saveDSPBADDR;
 	u32 saveDSPBSURF;
 	u32 saveDSPBTILEOFF;
drivers/gpu/drm/i915/i915_reg.h +0 -3
index 4cf3ece..26e4b86 100644
@@ -3051,7 +3051,6 @@
 #define   DISPPLANE_TILED			(1<<10)
 #define _DSPAADDR		(dev_priv->info->display_mmio_offset + 0x70184)
 #define _DSPASTRIDE		(dev_priv->info->display_mmio_offset + 0x70188)
-#define _DSPAPOS		(dev_priv->info->display_mmio_offset + 0x7018C) /* reserved */
 #define _DSPASIZE		(dev_priv->info->display_mmio_offset + 0x70190)
 #define _DSPASURF		(dev_priv->info->display_mmio_offset + 0x7019C) /* 965+ only */
 #define _DSPATILEOFF		(dev_priv->info->display_mmio_offset + 0x701A4) /* 965+ only */
@@ -3061,7 +3060,6 @@
 #define DSPCNTR(plane) _PIPE(plane, _DSPACNTR, _DSPBCNTR)
 #define DSPADDR(plane) _PIPE(plane, _DSPAADDR, _DSPBADDR)
 #define DSPSTRIDE(plane) _PIPE(plane, _DSPASTRIDE, _DSPBSTRIDE)
-#define DSPPOS(plane) _PIPE(plane, _DSPAPOS, _DSPBPOS)
 #define DSPSIZE(plane) _PIPE(plane, _DSPASIZE, _DSPBSIZE)
 #define DSPSURF(plane) _PIPE(plane, _DSPASURF, _DSPBSURF)
 #define DSPTILEOFF(plane) _PIPE(plane, _DSPATILEOFF, _DSPBTILEOFF)
@@ -3109,7 +3107,6 @@
 #define   DISPPLANE_SPRITE_ABOVE_OVERLAY	(1)
 #define _DSPBADDR		(dev_priv->info->display_mmio_offset + 0x71184)
 #define _DSPBSTRIDE		(dev_priv->info->display_mmio_offset + 0x71188)
-#define _DSPBPOS		(dev_priv->info->display_mmio_offset + 0x7118C)
 #define _DSPBSIZE		(dev_priv->info->display_mmio_offset + 0x71190)
 #define _DSPBSURF		(dev_priv->info->display_mmio_offset + 0x7119C)
 #define _DSPBTILEOFF		(dev_priv->info->display_mmio_offset + 0x711A4)
drivers/gpu/drm/i915/i915_ums.c +0 -4
index 985a097..0e21925 100644
@@ -160,7 +160,6 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPACNTR = I915_READ(_DSPACNTR);
 	dev_priv->regfile.saveDSPASTRIDE = I915_READ(_DSPASTRIDE);
 	dev_priv->regfile.saveDSPASIZE = I915_READ(_DSPASIZE);
-	dev_priv->regfile.saveDSPAPOS = I915_READ(_DSPAPOS);
 	dev_priv->regfile.saveDSPAADDR = I915_READ(_DSPAADDR);
 	if (INTEL_INFO(dev)->gen >= 4) {
 		dev_priv->regfile.saveDSPASURF = I915_READ(_DSPASURF);
@@ -217,7 +216,6 @@ void i915_save_display_reg(struct drm_device *dev)
 	dev_priv->regfile.saveDSPBCNTR = I915_READ(_DSPBCNTR);
 	dev_priv->regfile.saveDSPBSTRIDE = I915_READ(_DSPBSTRIDE);
 	dev_priv->regfile.saveDSPBSIZE = I915_READ(_DSPBSIZE);
-	dev_priv->regfile.saveDSPBPOS = I915_READ(_DSPBPOS);
 	dev_priv->regfile.saveDSPBADDR = I915_READ(_DSPBADDR);
 	if (INTEL_INFO(dev)->gen >= 4) {
 		dev_priv->regfile.saveDSPBSURF = I915_READ(_DSPBSURF);
@@ -390,7 +388,6 @@ void i915_restore_display_reg(struct drm_device *dev)
 
 	/* Restore plane info */
 	I915_WRITE(_DSPASIZE, dev_priv->regfile.saveDSPASIZE);
-	I915_WRITE(_DSPAPOS, dev_priv->regfile.saveDSPAPOS);
 	I915_WRITE(_PIPEASRC, dev_priv->regfile.savePIPEASRC);
 	I915_WRITE(_DSPAADDR, dev_priv->regfile.saveDSPAADDR);
 	I915_WRITE(_DSPASTRIDE, dev_priv->regfile.saveDSPASTRIDE);
@@ -459,7 +456,6 @@ void i915_restore_display_reg(struct drm_device *dev)
 
 	/* Restore plane info */
 	I915_WRITE(_DSPBSIZE, dev_priv->regfile.saveDSPBSIZE);
-	I915_WRITE(_DSPBPOS, dev_priv->regfile.saveDSPBPOS);
 	I915_WRITE(_PIPEBSRC, dev_priv->regfile.savePIPEBSRC);
 	I915_WRITE(_DSPBADDR, dev_priv->regfile.saveDSPBADDR);
 	I915_WRITE(_DSPBSTRIDE, dev_priv->regfile.saveDSPBSTRIDE);
drivers/gpu/drm/i915/intel_display.c +0 -4
index 0451056..b319cd3 100644
@@ -4781,7 +4781,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	I915_WRITE(DSPSIZE(plane),
 		   ((mode->vdisplay - 1) << 16) |
 		   (mode->hdisplay - 1));
-	I915_WRITE(DSPPOS(plane), 0);
 
 	I915_WRITE(PIPECONF(pipe), pipeconf);
 	POSTING_READ(PIPECONF(pipe));
@@ -9314,7 +9313,6 @@ struct intel_display_error_state {
 		u32 control;
 		u32 stride;
 		u32 size;
-		u32 pos;
 		u32 addr;
 		u32 surface;
 		u32 tile_offset;
@@ -9350,7 +9348,6 @@ intel_display_capture_error_state(struct drm_device *dev)
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
 		if (INTEL_INFO(dev)->gen <= 3)
 			error->plane[i].size = I915_READ(DSPSIZE(i));
-		error->plane[i].pos = I915_READ(DSPPOS(i));
 		if (!IS_HASWELL(dev))
 			error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9396,7 +9393,6 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
 		if (INTEL_INFO(dev)->gen <= 3)
 			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
-		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
 		if (!IS_HASWELL(dev))
 			seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#43 lore raw

Re: [PATCH 08/15] drm/i915: remove DSPPOS register

Quoted 9 lines · Ville Syrjälä
Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

I couldn't find any evidence that this register exists on Gen2+. On Gen 2/3/4 documents this register is listed as reserved and read-only. On the newer Gens this register is not even documented.

DSPPOS goes hand in hand with DSPSIZE. IIRC DSPA never had the windowing capability, but DSPB and DSPC on older gens had it.

Indeed Ville's right here, gen2/3 have this on sprite B/C (you could move those things around back then to different pipes ...). So I think we want a gen <= 3 check here (gen4+ lost this apparently with the fixed pipe->plane mapping).
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by on v1 8/15
#44 lore raw

Re: [PATCH 08/15] drm/i915: remove DSPPOS register

In reply to Paulo Zanoni
Quoted 11 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

I couldn't find any evidence that this register exists on Gen2+. On Gen 2/3/4 documents this register is listed as reserved and read-only. On the newer Gens this register is not even documented.

Also all we do with this register is:
- Write 0 to it on i9xx_crtc_mode_set
- Save/restore its value on the UMS code
- Read it on intel_display_capture_error_state

Quoted 4 lines

This commit fixes "unclaimed register" messages when there's a GPU hang on Haswell.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#45 lore raw

PATCH 6/7 drm/i915: there's no DSPPOS register on gen4+

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

---
 drivers/gpu/drm/i915/intel_display.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -4
index 98ac3bd..e8fc0ac 100644
@@ -9368,9 +9368,10 @@ intel_display_capture_error_state(struct drm_device *dev)
 
 		error->plane[i].control = I915_READ(DSPCNTR(i));
 		error->plane[i].stride = I915_READ(DSPSTRIDE(i));
-		if (INTEL_INFO(dev)->gen <= 3)
+		if (INTEL_INFO(dev)->gen <= 3) {
 			error->plane[i].size = I915_READ(DSPSIZE(i));
-		error->plane[i].pos = I915_READ(DSPPOS(i));
+			error->plane[i].pos = I915_READ(DSPPOS(i));
+		}
 		if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev))
 			error->plane[i].addr = I915_READ(DSPADDR(i));
 		if (INTEL_INFO(dev)->gen >= 4) {
@@ -9413,9 +9414,10 @@ intel_display_print_error_state(struct seq_file *m,
 		seq_printf(m, "Plane [%d]:\n", i);
 		seq_printf(m, "  CNTR: %08x\n", error->plane[i].control);
 		seq_printf(m, "  STRIDE: %08x\n", error->plane[i].stride);
-		if (INTEL_INFO(dev)->gen <= 3)
+		if (INTEL_INFO(dev)->gen <= 3) {
 			seq_printf(m, "  SIZE: %08x\n", error->plane[i].size);
-		seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
+			seq_printf(m, "  POS: %08x\n", error->plane[i].pos);
+		}
 		if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev))
 			seq_printf(m, "  ADDR: %08x\n", error->plane[i].addr);
 		if (INTEL_INFO(dev)->gen >= 4) {
Signature · 1 line
1.7.10.4
#46 lore raw

Re: [PATCH 6/7] drm/i915: there's no DSPPOS register on gen4+

Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves some "unclaimed register" messages on Haswell when we hang the GPU.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#47 lore raw

PATCH 9/15 drm/i915: there's no PIPESTAT on Gen5+

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves "unclaimed register" messages on Haswell when we have a GPU hang.

---
 drivers/gpu/drm/i915/i915_irq.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -2
index 2139714..29b1bb1 100644
@@ -1366,8 +1366,9 @@ static void i915_capture_error_state(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen == 6)
 		error->forcewake = I915_READ(FORCEWAKE);
 
-	for_each_pipe(pipe)
-		error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
+	if (INTEL_INFO(dev)->gen <= 4)
+		for_each_pipe(pipe)
+			error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
 
 	if (INTEL_INFO(dev)->gen >= 6) {
 		error->error = I915_READ(ERROR_GEN6);
Signature · 1 line
1.7.10.4
#48 lore raw

Re: [PATCH 09/15] drm/i915: there's no PIPESTAT on Gen5+

Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves "unclaimed register" messages on Haswell when we have a GPU hang.

Iirc pipestat exists on vlv, so I think this needs a !HAS_PCH_SPLIT test. Ville should know for sure.
-Daniel

Quoted 27 lines
---
 drivers/gpu/drm/i915/i915_irq.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -2
index 2139714..29b1bb1 100644
@@ -1366,8 +1366,9 @@ static void i915_capture_error_state(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen == 6)
 		error->forcewake = I915_READ(FORCEWAKE);
 
-	for_each_pipe(pipe)
-		error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
+	if (INTEL_INFO(dev)->gen <= 4)
+		for_each_pipe(pipe)
+			error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
 
 	if (INTEL_INFO(dev)->gen >= 6) {
 		error->error = I915_READ(ERROR_GEN6);
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#49 lore raw

Re: [PATCH 09/15] drm/i915: there's no PIPESTAT on Gen5+

Quoted 10 lines · Daniel Vetter
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves "unclaimed register" messages on Haswell when we have a GPU hang.

Iirc pipestat exists on vlv, so I think this needs a !HAS_PCH_SPLIT test. Ville should know for sure.

Yes, that's right.

Quoted 38 lines

-Daniel

Quoted 27 lines
---
 drivers/gpu/drm/i915/i915_irq.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -2
index 2139714..29b1bb1 100644
@@ -1366,8 +1366,9 @@ static void i915_capture_error_state(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen == 6)
 		error->forcewake = I915_READ(FORCEWAKE);
 
-	for_each_pipe(pipe)
-		error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
+	if (INTEL_INFO(dev)->gen <= 4)
+		for_each_pipe(pipe)
+			error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
 
 	if (INTEL_INFO(dev)->gen >= 6) {
 		error->error = I915_READ(ERROR_GEN6);
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#50 lore raw

PATCH 7/7 drm/i915: there's no PIPESTAT on HAS_PCH_SPLIT platforms

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves "unclaimed register" messages on Haswell when we have a GPU hang.

V2: Check for HAS_PCH_SPLIT instead of Gen5+ because VLV still has this register.

---
 drivers/gpu/drm/i915/i915_irq.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -2
index 5fc178e..3c2b05c 100644
@@ -1387,8 +1387,9 @@ static void i915_capture_error_state(struct drm_device *dev)
 	else if (INTEL_INFO(dev)->gen == 6)
 		error->forcewake = I915_READ(FORCEWAKE);
 
-	for_each_pipe(pipe)
-		error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
+	if (!HAS_PCH_SPLIT(dev))
+		for_each_pipe(pipe)
+			error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
 
 	if (INTEL_INFO(dev)->gen >= 6) {
 		error->error = I915_READ(ERROR_GEN6);
Signature · 1 line
1.7.10.4
#51 lore raw

Re: [PATCH 7/7] drm/i915: there's no PIPESTAT on HAS_PCH_SPLIT platforms

Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't read it when capturing the error state. This solves "unclaimed register" messages on Haswell when we have a GPU hang.

V2: Check for HAS_PCH_SPLIT instead of Gen5+ because VLV still has this register.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#52 lore raw

PATCH 10/15 drm/i915: check the power well when capturing error state

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves many "unclaimed register" messages when the power well is down and we get a GPU hang.

Also print the power well register and each pipe's CPU transcoder on the error state to allow proper interpratation of the registers. And kzalloc the error state structure since we may not read some of the registers (to avoid the "unclaimed register" messages).

---
 drivers/gpu/drm/i915/intel_display.c |   42 ++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_display.c +32 -10
index b319cd3..835bec2 100644
@@ -9290,6 +9290,9 @@ int intel_modeset_vga_set_state(struct drm_device *dev, bool state)
 #include <linux/seq_file.h>
 
 struct intel_display_error_state {
+
+	u32 power_well_driver;
+
 	struct intel_cursor_error_state {
 		u32 control;
 		u32 position;
@@ -9298,6 +9301,7 @@ struct intel_display_error_state {
 	} cursor[I915_MAX_PIPES];
 
 	struct intel_pipe_error_state {
+		enum transcoder cpu_transcoder;
 		u32 conf;
 		u32 source;
 
@@ -9324,15 +9328,35 @@ intel_display_capture_error_state(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	struct intel_display_error_state *error;
-	enum transcoder cpu_transcoder;
+	enum transcoder transcoder;
+	bool power_well_is_down;
 	int i;
 
-	error = kmalloc(sizeof(*error), GFP_ATOMIC);
+	error = kzalloc(sizeof(*error), GFP_ATOMIC);
 	if (error == NULL)
 		return NULL;
 
+	power_well_is_down = intel_power_well_is_down(dev);
+
+	if (IS_HASWELL(dev))
+		error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER);
+
 	for_each_pipe(i) {
-		cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
+		transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
+		error->pipe[i].cpu_transcoder = transcoder;
+
+		if (transcoder == TRANSCODER_EDP || !power_well_is_down) {
+			error->pipe[i].conf = I915_READ(PIPECONF(transcoder));
+			error->pipe[i].htotal = I915_READ(HTOTAL(transcoder));
+			error->pipe[i].hblank = I915_READ(HBLANK(transcoder));
+			error->pipe[i].hsync = I915_READ(HSYNC(transcoder));
+			error->pipe[i].vtotal = I915_READ(VTOTAL(transcoder));
+			error->pipe[i].vblank = I915_READ(VBLANK(transcoder));
+			error->pipe[i].vsync = I915_READ(VSYNC(transcoder));
+		}
+
+		if (power_well_is_down)
+			continue;
 
 		if (INTEL_INFO(dev)->gen <= 6) {
 			error->cursor[i].control = I915_READ(CURCNTR(i));
@@ -9355,14 +9379,7 @@ intel_display_capture_error_state(struct drm_device *dev)
 			error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i));
 		}
 
-		error->pipe[i].conf = I915_READ(PIPECONF(cpu_transcoder));
 		error->pipe[i].source = I915_READ(PIPESRC(i));
-		error->pipe[i].htotal = I915_READ(HTOTAL(cpu_transcoder));
-		error->pipe[i].hblank = I915_READ(HBLANK(cpu_transcoder));
-		error->pipe[i].hsync = I915_READ(HSYNC(cpu_transcoder));
-		error->pipe[i].vtotal = I915_READ(VTOTAL(cpu_transcoder));
-		error->pipe[i].vblank = I915_READ(VBLANK(cpu_transcoder));
-		error->pipe[i].vsync = I915_READ(VSYNC(cpu_transcoder));
 	}
 
 	return error;
@@ -9377,8 +9394,13 @@ intel_display_print_error_state(struct seq_file *m,
 	int i;
 
 	seq_printf(m, "Num Pipes: %d\n", dev_priv->num_pipe);
+	if (IS_HASWELL(dev))
+		seq_printf(m, "PWR_WELL_CTL2: %08x\n",
+			   error->power_well_driver);
 	for_each_pipe(i) {
 		seq_printf(m, "Pipe [%d]:\n", i);
+		seq_printf(m, "  CPU transcoder: %c\n",
+			   transcoder_name(error->pipe[i].cpu_transcoder));
 		seq_printf(m, "  CONF: %08x\n", error->pipe[i].conf);
 		seq_printf(m, "  SRC: %08x\n", error->pipe[i].source);
 		seq_printf(m, "  HTOTAL: %08x\n", error->pipe[i].htotal);
Signature · 1 line
1.7.10.4
#53 lore raw

Re: [PATCH 10/15] drm/i915: check the power well when capturing error state

Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves many "unclaimed register" messages when the power well is down and we get a GPU hang.

Also print the power well register and each pipe's CPU transcoder on the error state to allow proper interpratation of the registers. And kzalloc the error state structure since we may not read some of the registers (to avoid the "unclaimed register" messages).

Just a thought, but trying to bring the power well up and reading the registers could also be interesting.

Quoted 22 lines
---
 drivers/gpu/drm/i915/intel_display.c |   42 ++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -0
index b319cd3..835bec2 100644
@@ -9290,6 +9290,9 @@ int intel_modeset_vga_set_state(struct drm_device *dev, bool state)
 #include <linux/seq_file.h>
 
 struct intel_display_error_state {
+
+	u32 power_well_driver;
+
 	struct intel_cursor_error_state {
 		u32 control;
 		u32 position;

drivers/gpu/drm/i915/intel_display.c struct intel_display_error_state { · line 9307

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -9298,6 +9301,7 @@ struct intel_display_error_state {
 	} cursor[I915_MAX_PIPES];
 
 	struct intel_pipe_error_state {
+		enum transcoder cpu_transcoder;
 		u32 conf;
 		u32 source;
 

Putting this in the error state looks like a nice touch to me.

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -9324,15 +9328,35 @@ intel_display_capture_error_state(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	struct intel_display_error_state *error;
-	enum transcoder cpu_transcoder;
+	enum transcoder transcoder;
+	bool power_well_is_down;
 	int i;

drivers/gpu/drm/i915/intel_display.c intel_display_capture_error_state(struct drm_device *dev) · line 9342

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +5 -1
 
-	error = kmalloc(sizeof(*error), GFP_ATOMIC);
+	error = kzalloc(sizeof(*error), GFP_ATOMIC);
 	if (error == NULL)
 		return NULL;
 
+	power_well_is_down = intel_power_well_is_down(dev);
+
+	if (IS_HASWELL(dev))
+		error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER);

This is still not a stunning reason to have to pass in dev to intel_power_well_is_down() since you have an IS_HASWELL check anyway (from my original bikeshed so many patches ago).

Quoted 37 lines
drivers/gpu/drm/i915/intel_display.c +16 -8
+
 	for_each_pipe(i) {
-		cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
+		transcoder = intel_pipe_to_cpu_transcoder(dev_priv, i);
+		error->pipe[i].cpu_transcoder = transcoder;
+
+		if (transcoder == TRANSCODER_EDP || !power_well_is_down) {
+			error->pipe[i].conf = I915_READ(PIPECONF(transcoder));
+			error->pipe[i].htotal = I915_READ(HTOTAL(transcoder));
+			error->pipe[i].hblank = I915_READ(HBLANK(transcoder));
+			error->pipe[i].hsync = I915_READ(HSYNC(transcoder));
+			error->pipe[i].vtotal = I915_READ(VTOTAL(transcoder));
+			error->pipe[i].vblank = I915_READ(VBLANK(transcoder));
+			error->pipe[i].vsync = I915_READ(VSYNC(transcoder));
+		}
+
+		if (power_well_is_down)
+			continue;
 
 		if (INTEL_INFO(dev)->gen <= 6) {
 			error->cursor[i].control = I915_READ(CURCNTR(i));
@@ -9355,14 +9379,7 @@ intel_display_capture_error_state(struct drm_device *dev)
 			error->plane[i].tile_offset = I915_READ(DSPTILEOFF(i));
 		}
 
-		error->pipe[i].conf = I915_READ(PIPECONF(cpu_transcoder));
 		error->pipe[i].source = I915_READ(PIPESRC(i));
-		error->pipe[i].htotal = I915_READ(HTOTAL(cpu_transcoder));
-		error->pipe[i].hblank = I915_READ(HBLANK(cpu_transcoder));
-		error->pipe[i].hsync = I915_READ(HSYNC(cpu_transcoder));
-		error->pipe[i].vtotal = I915_READ(VTOTAL(cpu_transcoder));
-		error->pipe[i].vblank = I915_READ(VBLANK(cpu_transcoder));
-		error->pipe[i].vsync = I915_READ(VSYNC(cpu_transcoder));
 	}
 
 	return error;

drivers/gpu/drm/i915/intel_display.c intel_display_print_error_state(struct seq_file *m, · line 9399

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -9377,8 +9394,13 @@ intel_display_print_error_state(struct seq_file *m,
 	int i;
 
 	seq_printf(m, "Num Pipes: %d\n", dev_priv->num_pipe);
+	if (IS_HASWELL(dev))
+		seq_printf(m, "PWR_WELL_CTL2: %08x\n",
+			   error->power_well_driver);

I wouldn't bother with the IS_HASWELL check since it's kind of nice to have error register dumps which are the same length.

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
 	for_each_pipe(i) {
 		seq_printf(m, "Pipe [%d]:\n", i);
+		seq_printf(m, "  CPU transcoder: %c\n",
+			   transcoder_name(error->pipe[i].cpu_transcoder));
 		seq_printf(m, "  CONF: %08x\n", error->pipe[i].conf);
 		seq_printf(m, "  SRC: %08x\n", error->pipe[i].source);
 		seq_printf(m, "  HTOTAL: %08x\n", error->pipe[i].htotal);
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#54 lore raw

Re: [PATCH 10/15] drm/i915: check the power well when capturing error state

In reply to Paulo Zanoni
Quoted 11 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves many "unclaimed register" messages when the power well is down and we get a GPU hang.

Also print the power well register and each pipe's CPU transcoder on the error state to allow proper interpratation of the registers. And kzalloc the error state structure since we may not read some of the registers (to avoid the "unclaimed register" messages).

Ok, I've thought some more about all and you're all going to hate me.

Essentially I don't like that we have rather invasive patches for a minor feature with _very_ delicate limits as to what hits the debug yelling and what doesn't. Furthermore the debug feature isn't that clear-cut since interrupts get in the way (and we cant fix that since that would also disable underrun interrupts, which we want). And the audio driver also randomly inteferes.

Now where it's justified that a register doesn't exist I don't mind merging the patches - it's always good to have accurate documentation of what's really used by the hw. But for debug features I'm really uneasy with runtime checks, since it might very well be that those are wrong.

Hence I vote for a I915_READ_NOCHECK to avoid all this madness. This one will never check for errors, but silently clear them after a read. Note that we don't need a I915_WRITE_NOCHECK, and imo that's good since writing random crap could indeed be a serious bug.

So I'll punt on this patch since imo it's too messy for future maintenance. Same for the other debug patches (e.g. the assert_pipe_enabled check).

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#55 lore raw

Re: [PATCH 10/15] drm/i915: check the power well when capturing error state

Quoted 27 lines · Daniel Vetter
Quoted 11 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This solves many "unclaimed register" messages when the power well is down and we get a GPU hang.

Also print the power well register and each pipe's CPU transcoder on the error state to allow proper interpratation of the registers. And kzalloc the error state structure since we may not read some of the registers (to avoid the "unclaimed register" messages).

Ok, I've thought some more about all and you're all going to hate me.

Essentially I don't like that we have rather invasive patches for a minor feature with _very_ delicate limits as to what hits the debug yelling and what doesn't. Furthermore the debug feature isn't that clear-cut since interrupts get in the way (and we cant fix that since that would also disable underrun interrupts, which we want). And the audio driver also randomly inteferes.

Now where it's justified that a register doesn't exist I don't mind merging the patches - it's always good to have accurate documentation of what's really used by the hw. But for debug features I'm really uneasy with runtime checks, since it might very well be that those are wrong.

Quoted 8 lines

Hence I vote for a I915_READ_NOCHECK to avoid all this madness. This one will never check for errors, but silently clear them after a read. Note that we don't need a I915_WRITE_NOCHECK, and imo that's good since writing random crap could indeed be a serious bug.

So I'll punt on this patch since imo it's too messy for future maintenance. Same for the other debug patches (e.g. the assert_pipe_enabled check).

Forgotten to add: I like the powerwell related additions to the error state, but that's imo a separate patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#56 lore raw

Re: [PATCH 10/15] drm/i915: check the power well when capturing error state

In reply to Daniel Vetter

Hi

2013/3/17 Daniel Vetter <[email protected]>:

Quoted 27 lines · Paulo Zanoni
Quoted 11 lines

From: Paulo Zanoni <[email protected]>

This solves many "unclaimed register" messages when the power well is down and we get a GPU hang.

Also print the power well register and each pipe's CPU transcoder on the error state to allow proper interpratation of the registers. And kzalloc the error state structure since we may not read some of the registers (to avoid the "unclaimed register" messages).

Ok, I've thought some more about all and you're all going to hate me.

Essentially I don't like that we have rather invasive patches for a minor feature with _very_ delicate limits as to what hits the debug yelling and what doesn't. Furthermore the debug feature isn't that clear-cut since interrupts get in the way (and we cant fix that since that would also disable underrun interrupts, which we want). And the audio driver also randomly inteferes.

Now where it's justified that a register doesn't exist I don't mind merging the patches - it's always good to have accurate documentation of what's really used by the hw. But for debug features I'm really uneasy with runtime checks, since it might very well be that those are wrong.

Quoted 4 lines

Hence I vote for a I915_READ_NOCHECK to avoid all this madness. This one will never check for errors, but silently clear them after a read. Note that we don't need a I915_WRITE_NOCHECK, and imo that's good since writing random crap could indeed be a serious bug.

I don't understand your way of thinking: your argument is that "this is difficult to maintain", but then you're proposing the addition of a new i915_read, which IMHO is way much more complex and feels like a hackish solution to the problem. Every patch to the "normal" i915_read#x will have to also patch i915_read_nocheck#x. And on patch 0014, which you also suggested to use the "I915_READ_NOCHECK" function, our code will be relying on the _coincidence_ that when we read a register that does not exist, we read 0. I really don't think this is a sane approach.

Our hardware is getting much more complex with respect to these reads, and I think we should never read ever read from a register that does not exist or is powered off. I'm open to more suggestions on how to write this patch, but I really think we shouldn't read registers that don't exist or are powered off.

Quoted 10 lines

So I'll punt on this patch since imo it's too messy for future maintenance. Same for the other debug patches (e.g. the assert_pipe_enabled check).

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

Signature · 1 line
Paulo Zanoni
#57 lore raw

Re: [PATCH 10/15] drm/i915: check the power well when capturing error state

Quoted 9 lines · Paulo Zanoni

I don't understand your way of thinking: your argument is that "this is difficult to maintain", but then you're proposing the addition of a new i915_read, which IMHO is way much more complex and feels like a hackish solution to the problem. Every patch to the "normal" i915_read#x will have to also patch i915_read_nocheck#x. And on patch 0014, which you also suggested to use the "I915_READ_NOCHECK" function, our code will be relying on the _coincidence_ that when we read a register that does not exist, we read 0. I really don't think this is a sane approach.

I915_READ_NOCHECK already exists, it's called I915_READ_NOTRACE ;-) We'd lose the tracepoint when just using that, but imo that's no too horrible for debug checks.

Wrt the assert_pipe check relying on the fact that the hw returns 0, I'm totally ok on relying on that. If that ever changes in a future product, we can fix it.

Quoted 5 lines

Our hardware is getting much more complex with respect to these reads, and I think we should never read ever read from a register that does not exist or is powered off. I'm open to more suggestions on how to write this patch, but I really think we shouldn't read registers that don't exist or are powered off.

The "much more complex" part is actually why I've looked into different options for the _debug_ functions. I agree with you for all the real display code. But debug code (especially the gpu hang stuff) tends to not be run too often, hence I'm leaning more towards a "just do it, I know what I'm doing" kind of approach. Currently it's fairly simple, but with future hw we'll have more chances to screw up and not dump a few regs we actually want. So I just want to avoid getting a bug report where the first thing we have to do is patch up the reg dumper (and we can't really test this any other way than by human inspection of a dump).
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#58 lore raw

PATCH 11/15 drm/i915: add HAS_POWER_WELL

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We're starting to add many IS_HASWELL checks for the power well code, so add a HAS_POWER_WELL macro to properly document that we're checking for hardware that has the power down well.

---
 drivers/gpu/drm/i915/i915_drv.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |    4 ++--
 drivers/gpu/drm/i915/intel_pm.c      |    6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 9bf15e5..60e24d7 100644
@@ -1337,6 +1337,7 @@ struct drm_i915_file_private {
 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
 #define HAS_DDI(dev)		(IS_HASWELL(dev))
+#define HAS_POWER_WELL(dev)	(IS_HASWELL(dev))
 
 #define INTEL_PCH_DEVICE_ID_MASK		0xff00
 #define INTEL_PCH_IBX_DEVICE_ID_TYPE		0x3b00
drivers/gpu/drm/i915/intel_display.c +2 -2
index 835bec2..39f5f72 100644
@@ -9338,7 +9338,7 @@ intel_display_capture_error_state(struct drm_device *dev)
 
 	power_well_is_down = intel_power_well_is_down(dev);
 
-	if (IS_HASWELL(dev))
+	if (HAS_POWER_WELL(dev))
 		error->power_well_driver = I915_READ(HSW_PWR_WELL_DRIVER);
 
 	for_each_pipe(i) {
@@ -9394,7 +9394,7 @@ intel_display_print_error_state(struct seq_file *m,
 	int i;
 
 	seq_printf(m, "Num Pipes: %d\n", dev_priv->num_pipe);
-	if (IS_HASWELL(dev))
+	if (HAS_POWER_WELL(dev))
 		seq_printf(m, "PWR_WELL_CTL2: %08x\n",
 			   error->power_well_driver);
 	for_each_pipe(i) {
drivers/gpu/drm/i915/intel_pm.c +3 -3
index 90562bc..9e22ad3 100644
@@ -4080,7 +4080,7 @@ bool intel_power_well_is_down(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (IS_HASWELL(dev))
+	if (HAS_POWER_WELL(dev))
 		return !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE);
 	else
 		return false;
@@ -4092,7 +4092,7 @@ void intel_set_power_well(struct drm_device *dev, bool enable)
 	bool is_enabled, enable_requested;
 	uint32_t tmp;
 
-	if (!IS_HASWELL(dev))
+	if (!HAS_POWER_WELL(dev))
 		return;
 
 	tmp = I915_READ(HSW_PWR_WELL_DRIVER);
@@ -4127,7 +4127,7 @@ void intel_init_power_well(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (!IS_HASWELL(dev))
+	if (!HAS_POWER_WELL(dev))
 		return;
 
 	/* For now, we need the power well to be always enabled. */
Signature · 1 line
1.7.10.4
#59 lore raw

Re: [PATCH 11/15] drm/i915: add HAS_POWER_WELL

Quoted 6 lines · On Wed, 6 Mar 2013 20:03:18 -0300 Paulo Zanoni <[email protected]> wrote:

From: Paulo Zanoni <[email protected]>

We're starting to add many IS_HASWELL checks for the power well code, so add a HAS_POWER_WELL macro to properly document that we're checking for hardware that has the power down well.

To be more future proof, we'll need to differentiate multiple power wells. Not sure we have good names for them though...

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#60 lore raw

Re: [PATCH 11/15] drm/i915: add HAS_POWER_WELL

Quoted 5 lines · Jesse Barnes
Quoted 2 lines · On Wed, 6 Mar 2013 20:03:18 -0300 Paulo Zanoni <[email protected]> wrote:

From: Paulo Zanoni <[email protected]>

Quoted 7 lines
Quoted 4 lines

We're starting to add many IS_HASWELL checks for the power well code, so add a HAS_POWER_WELL macro to properly document that we're checking for hardware that has the power down well.

To be more future proof, we'll need to differentiate multiple power wells. Not sure we have good names for them though...

I think we'll just invent names once they show up ... Queued for -next, thanks for the patch. I've had to drop the first hunk though since that has been introduced by the previous patch, which I've rejected. -Daniel

Quoted 7 lines
Signature · 6 lines
-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#61 lore raw

PATCH 12/15 drm/i915: reorganize intel_lvds_supported

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Now it returns false for all platforms unless they're explicitly listed on the function. There should be no real difference, except for the fact that it now returns false on Haswell.

---
 drivers/gpu/drm/i915/intel_lvds.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +5 -5
index 6b24fc5..53bd5fd 100644
@@ -1020,15 +1020,15 @@ static bool intel_lvds_supported(struct drm_device *dev)
 {
 	/* With the introduction of the PCH we gained a dedicated
 	 * LVDS presence pin, use it. */
-	if (HAS_PCH_SPLIT(dev))
+	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		return true;
 
-	if (IS_VALLEYVIEW(dev))
-		return false;
-
 	/* Otherwise LVDS was only attached to mobile products,
 	 * except for the inglorious 830gm */
-	return IS_MOBILE(dev) && !IS_I830(dev);
+	if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+		return true;
+
+	return false;
 }
 
 /**
Signature · 1 line
1.7.10.4
Reviewed-by on v1 12/15
#62 lore raw

Re: [PATCH 12/15] drm/i915: reorganize intel_lvds_supported

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Now it returns false for all platforms unless they're explicitly listed on the function. There should be no real difference, except for the fact that it now returns false on Haswell.

I wouldn't mind comments in the commit or code reminding me that IBX and CPT cover ILk->IVB, and gm45 counts as gen4, but that's just 'cause I have a bad memory.

Quoted 27 lines
---
 drivers/gpu/drm/i915/intel_lvds.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +5 -5
index 6b24fc5..53bd5fd 100644
@@ -1020,15 +1020,15 @@ static bool intel_lvds_supported(struct drm_device *dev)
 {
 	/* With the introduction of the PCH we gained a dedicated
 	 * LVDS presence pin, use it. */
-	if (HAS_PCH_SPLIT(dev))
+	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		return true;
 
-	if (IS_VALLEYVIEW(dev))
-		return false;
-
 	/* Otherwise LVDS was only attached to mobile products,
 	 * except for the inglorious 830gm */
-	return IS_MOBILE(dev) && !IS_I830(dev);
+	if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
+		return true;
+
+	return false;
 }
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#63 lore raw

Re: [PATCH 12/15] drm/i915: reorganize intel_lvds_supported

Quoted 7 lines · Ben Widawsky
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Now it returns false for all platforms unless they're explicitly listed on the function. There should be no real difference, except for the fact that it now returns false on Haswell.

Quoted 6 lines
Quoted 1 line

I wouldn't mind comments in the commit or code reminding me that IBX and CPT cover ILk->IVB, and gm45 counts as gen4, but that's just 'cause I have a bad memory.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#64 lore raw

PATCH 13/15 drm/i915: don't save/restore PCH_LVDS on LPT

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because the register does not exist on LPT. The interesting fact is that reading/writing PCH_LVDS on LPT does *not* give us "unclaimed register" messages, but the register value is always 0.

---
 drivers/gpu/drm/i915/i915_suspend.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +4 -3
index c1e02b0..41f0fde 100644
@@ -209,7 +209,8 @@ static void i915_save_display(struct drm_device *dev)
 		dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2);
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL);
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2);
-		dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
+		if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
+			dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
 	} else {
 		dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
 		dev_priv->regfile.savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS);
@@ -271,9 +272,9 @@ static void i915_restore_display(struct drm_device *dev)
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		mask = ~LVDS_PORT_EN;
 
-	if (HAS_PCH_SPLIT(dev)) {
+	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
-	} else if (IS_MOBILE(dev) && !IS_I830(dev))
+	else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))
Signature · 1 line
1.7.10.4
#65 lore raw

Re: [PATCH 13/15] drm/i915: don't save/restore PCH_LVDS on LPT

Quoted 27 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because the register does not exist on LPT. The interesting fact is that reading/writing PCH_LVDS on LPT does *not* give us "unclaimed register" messages, but the register value is always 0.

---
 drivers/gpu/drm/i915/i915_suspend.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +2 -1
index c1e02b0..41f0fde 100644
@@ -209,7 +209,8 @@ static void i915_save_display(struct drm_device *dev)
 		dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2);
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL);
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2);
-		dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
+		if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
+			dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
 	} else {
 		dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
 		dev_priv->regfile.savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS);
@@ -271,9 +272,9 @@ static void i915_restore_display(struct drm_device *dev)
 	if (drm_core_check_feature(dev, DRIVER_MODESET))

drivers/gpu/drm/i915/i915_suspend.c static void i915_restore_display(struct drm_device *dev) · line 280

Quoted 10 lines
drivers/gpu/drm/i915/i915_suspend.c +2 -2
 		mask = ~LVDS_PORT_EN;
 
-	if (HAS_PCH_SPLIT(dev)) {
+	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
-	} else if (IS_MOBILE(dev) && !IS_I830(dev))
+	else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))

We don't support UMS on gen6+ so yuo can probably just check IS_GEN5 instead of if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#66 lore raw

Re: [PATCH 13/15] drm/i915: don't save/restore PCH_LVDS on LPT

Quoted 37 lines · Ben Widawsky
Quoted 36 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because the register does not exist on LPT. The interesting fact is that reading/writing PCH_LVDS on LPT does *not* give us "unclaimed register" messages, but the register value is always 0.

---
 drivers/gpu/drm/i915/i915_suspend.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +4 -3
index c1e02b0..41f0fde 100644
@@ -209,7 +209,8 @@ static void i915_save_display(struct drm_device *dev)
 		dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2);
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL);
 		dev_priv->regfile.saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2);
-		dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
+		if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
+			dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
 	} else {
 		dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
 		dev_priv->regfile.savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS);
@@ -271,9 +272,9 @@ static void i915_restore_display(struct drm_device *dev)
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		mask = ~LVDS_PORT_EN;
 
-	if (HAS_PCH_SPLIT(dev)) {
+	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
 		I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
-	} else if (IS_MOBILE(dev) && !IS_I830(dev))
+	else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
 		I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
 
Quoted 4 lines

drivers/gpu/drm/i915/i915_suspend.c static void i915_restore_display(struct drm_device *dev) · line 280

Quoted 1 line
drivers/gpu/drm/i915/i915_suspend.c +0 -0
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))

We don't support UMS on gen6+ so yuo can probably just check IS_GEN5 instead of if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))

Hah, trapped! We need to restore the LVDS reg even on kms safe for bit31 (which would enable the panel port) since we don't track all the bits of the panel state. And the bios doesn't really restore that ...

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#67 lore raw

PATCH 14/15 drm/i915: check the power well on i915_pipe_enabled

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This fixes "unclaimed register" messages when the power well is disabled and there's a GPU hang.

---
 drivers/gpu/drm/i915/i915_irq.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +3 -0
index 29b1bb1..aefc674 100644
@@ -129,6 +129,9 @@ i915_pipe_enabled(struct drm_device *dev, int pipe)
 	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
 								      pipe);
 
+	if (intel_power_well_is_down(dev) && cpu_transcoder != TRANSCODER_EDP)
+		return false;
+
 	return I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_ENABLE;
 }
 
Signature · 1 line
1.7.10.4
Reviewed-by on v1 14/15
#68 lore raw

Re: [PATCH 14/15] drm/i915: check the power well on i915_pipe_enabled

Quoted 4 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This fixes "unclaimed register" messages when the power well is disabled and there's a GPU hang.

This is really beginning to smell like we need special display register reads which can do the check below.

Quoted 2 lines
Quoted 25 lines
---
 drivers/gpu/drm/i915/i915_irq.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +3 -0
index 29b1bb1..aefc674 100644
@@ -129,6 +129,9 @@ i915_pipe_enabled(struct drm_device *dev, int pipe)
 	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
 								      pipe);
 
+	if (intel_power_well_is_down(dev) && cpu_transcoder != TRANSCODER_EDP)
+		return false;
+
 	return I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_ENABLE;
 }
 
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#69 lore raw

Re: [PATCH 14/15] drm/i915: check the power well on i915_pipe_enabled

In reply to Paulo Zanoni
Quoted 15 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

This fixes "unclaimed register" messages when the power well is disabled and there's a GPU hang.

---
 drivers/gpu/drm/i915/i915_irq.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 29b1bb1..aefc674 100644

drivers/gpu/drm/i915/i915_irq.c i915_pipe_enabled(struct drm_device *dev, int pipe) · line 135

Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
@@ -129,6 +129,9 @@ i915_pipe_enabled(struct drm_device *dev, int pipe)
 	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
 								      pipe);
 
+	if (intel_power_well_is_down(dev) && cpu_transcoder != TRANSCODER_EDP)
+		return false;
+
 	return I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_ENABLE;

Again I vote for I915_READ_NOCHECK instead.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#70 lore raw

PATCH 15/15 drm/i915: add missing space in error message

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

To avoid this:

[  256.798060] [drm] capturing error event; look for more information

in/sys/kernel/debug/dri/0/i915_error_state

---
 drivers/gpu/drm/i915/i915_irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +1 -1
index aefc674..0abd8ec 100644
@@ -1340,7 +1340,7 @@ static void i915_capture_error_state(struct drm_device *dev)
 		return;
 	}
 
-	DRM_INFO("capturing error event; look for more information in"
+	DRM_INFO("capturing error event; look for more information in "
 		 "/sys/kernel/debug/dri/%d/i915_error_state\n",
 		 dev->primary->index);
 
Signature · 1 line
1.7.10.4
Reviewed-by on v1 15/15
#71 lore raw

Re: [PATCH 15/15] drm/i915: add missing space in error message

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

To avoid this:

[  256.798060] [drm] capturing error event; look for more information

in/sys/kernel/debug/dri/0/i915_error_state

You may want to add to the commit message that this fixes the issue introduced below:
commit 2f86f1916504525a6fdd6b412374b4ebf1102cbe

Author: Ben Widawsky <[email protected]>
Date:   Mon Jan 28 15:32:15 2013 -0800

drm/i915: Error state should print /sys/kernel/debug
...
[danvet: split up long line.] <----- he did it

I personally still believe we shouldn't chop up strings like this.

Quoted 24 lines
---
 drivers/gpu/drm/i915/i915_irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +1 -1
index aefc674..0abd8ec 100644
@@ -1340,7 +1340,7 @@ static void i915_capture_error_state(struct drm_device *dev)
 		return;
 	}
 
-	DRM_INFO("capturing error event; look for more information in"
+	DRM_INFO("capturing error event; look for more information in "
 		 "/sys/kernel/debug/dri/%d/i915_error_state\n",
 		 dev->primary->index);
 
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#72 lore raw

Re: [PATCH 15/15] drm/i915: add missing space in error message

Quoted 9 lines · Ben Widawsky
Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

To avoid this:

[  256.798060] [drm] capturing error event; look for more information

in/sys/kernel/debug/dri/0/i915_error_state

Queued for -next, thanks for the patch.

Quoted 11 lines

You may want to add to the commit message that this fixes the issue introduced below:
commit 2f86f1916504525a6fdd6b412374b4ebf1102cbe

Author: Ben Widawsky <[email protected]>
Date:   Mon Jan 28 15:32:15 2013 -0800

drm/i915: Error state should print /sys/kernel/debug
...
[danvet: split up long line.] <----- he did it

I personally still believe we shouldn't chop up strings like this.

/me hides in shame

-Daniel

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