Skip to contentSkip to conversation

drm/i915: Fix initial pipe underrun state tracking

PATCH In review Daniel Vetter 3 participants 5 messages Mar 23, 2014 – Mar 24, 2014

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

PATCH 1/1 drm/i915: Fix initial pipe underrun state tracking

Since

commit 5c673b60a9b3b23486f4eda75c72e91d31d26a2b

Author: Daniel Vetter <[email protected]>
Date:   Fri Mar 7 20:34:46 2014 +0100

drm/i915: Don't enable display error interrupts from the start

we don't enable underrun interrupts any more at takeover time. Unfortunately I've forgotten to also adjust the sw-side tracking.

Since the code assumes that disabled pipes have underrun reporting enabled set the disable flag on all pipes which are active at takeover time. Without this underrun reporting wasn't enabled correctly on the first modeset. Note that for fastboot this is another piece of state that needs to be fixed up by enabling the underrung reporting after watermarks have beend fixed up.

On ivb/hsw an additional effect of this regression was that also all cpu crc reporting stopped working since the master error interrupt it shared across all pipes and sources.

Cc: Ville Syrjälä <[email protected]>
Cc: Jani Nikula <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76150

---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +8 -0
index 7e4ea8d4e388..9b24ae4fb7bd 100644
@@ -11502,6 +11502,14 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 			encoder->base.crtc = NULL;
 		}
 	}
+	if (crtc->active) {
+		/*
+		 * We start out with underrun reporting disabled to avoid races.
+		 * For correct bookkeeping mark this on active crtcs.
+		 */
+		crtc->cpu_fifo_underrun_disabled = true;
+		crtc->pch_fifo_underrun_disabled = true;
+	}
 }
 
 static void intel_sanitize_encoder(struct intel_encoder *encoder)
Signature · 6 lines
1.8.4.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 35 lines · Daniel Vetter

Since

commit 5c673b60a9b3b23486f4eda75c72e91d31d26a2b

Author: Daniel Vetter <[email protected]>
Date:   Fri Mar 7 20:34:46 2014 +0100

drm/i915: Don't enable display error interrupts from the start

we don't enable underrun interrupts any more at takeover time. Unfortunately I've forgotten to also adjust the sw-side tracking.

Since the code assumes that disabled pipes have underrun reporting enabled set the disable flag on all pipes which are active at takeover time. Without this underrun reporting wasn't enabled correctly on the first modeset. Note that for fastboot this is another piece of state that needs to be fixed up by enabling the underrung reporting after watermarks have beend fixed up.

On ivb/hsw an additional effect of this regression was that also all cpu crc reporting stopped working since the master error interrupt it shared across all pipes and sources.

Cc: Ville Syrjälä <[email protected]>
Cc: Jani Nikula <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76150

---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 7e4ea8d4e388..9b24ae4fb7bd 100644

drivers/gpu/drm/i915/intel_display.c static void intel_sanitize_crtc(struct intel_crtc *crtc) · line 11509

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -11502,6 +11502,14 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 			encoder->base.crtc = NULL;
 		}
 	}
+	if (crtc->active) {
+		/*
+		 * We start out with underrun reporting disabled to avoid races.
+		 * For correct bookkeeping mark this on active crtcs.
+		 */

Why only on active crtcs? The state remains in inactive crtcs. Won't the problem appear when such an crtc is actived?

Quoth a comment in struct intel_crtc:

/* Access to these should be protected by dev_priv->irq_lock. */

Either you need to hold the lock or explain in a comment why it's not necessary.

BR,
Jani.

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
+		crtc->cpu_fifo_underrun_disabled = true;
+		crtc->pch_fifo_underrun_disabled = true;
+	}
 }
 
 static void intel_sanitize_encoder(struct intel_encoder *encoder)
Signature · 1 line
1.8.4.rc3
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 31 lines · Jani Nikula
Quoted 30 lines · Daniel Vetter

Since

commit 5c673b60a9b3b23486f4eda75c72e91d31d26a2b

Author: Daniel Vetter <[email protected]>
Date:   Fri Mar 7 20:34:46 2014 +0100

drm/i915: Don't enable display error interrupts from the start

we don't enable underrun interrupts any more at takeover time. Unfortunately I've forgotten to also adjust the sw-side tracking.

Since the code assumes that disabled pipes have underrun reporting enabled set the disable flag on all pipes which are active at takeover time. Without this underrun reporting wasn't enabled correctly on the first modeset. Note that for fastboot this is another piece of state that needs to be fixed up by enabling the underrung reporting after watermarks have beend fixed up.

On ivb/hsw an additional effect of this regression was that also all cpu crc reporting stopped working since the master error interrupt it shared across all pipes and sources.

Cc: Ville Syrjälä <[email protected]>
Cc: Jani Nikula <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76150

---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Quoted 16 lines

drivers/gpu/drm/i915/intel_display.c static void intel_sanitize_crtc(struct intel_crtc *crtc) · line 11509

Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
index 7e4ea8d4e388..9b24ae4fb7bd 100644
@@ -11502,6 +11502,14 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 			encoder->base.crtc = NULL;
 		}
 	}
+	if (crtc->active) {
+		/*
+		 * We start out with underrun reporting disabled to avoid races.
+		 * For correct bookkeeping mark this on active crtcs.
+		 */

Why only on active crtcs? The state remains in inactive crtcs. Won't the problem appear when such an crtc is actived?

Setting this for inactive crtcs breaks the code, which I've learned the hard way ;-) The issue is that on ivb/hsw we can _only_ enable the err interrupt if all crtcs allow it. But if some disabled crtc disallows it that condition is never true until userspace has lit up all for crtcs at least once. I've tried to capture this in the commit message, but seem to have failed. Can you please suggest a rewording to clarify things?

Quoted 6 lines

Quoth a comment in struct intel_crtc:

/* Access to these should be protected by dev_priv->irq_lock. */

Either you need to hold the lock or explain in a comment why it's not necessary.

At worst the interrupt handler runs concurrently (on platforms where we don't yet hide fifo underruns from the start), also setting this to false in the case of an underrun. What about:

"No protection against concurrent access is required - at wors a fifo underrun happens which also sets this to false."

Thanks, Daniel

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

Since

commit 5c673b60a9b3b23486f4eda75c72e91d31d26a2b

Author: Daniel Vetter <[email protected]>
Date:   Fri Mar 7 20:34:46 2014 +0100

drm/i915: Don't enable display error interrupts from the start

we don't enable underrun interrupts any more at takeover time. Unfortunately I've forgotten to also adjust the sw-side tracking.

Since the code assumes that disabled pipes have underrun reporting enabled set the disable flag on all pipes which are active at takeover time. Without this underrun reporting wasn't enabled correctly on the first modeset. Note that for fastboot this is another piece of state that needs to be fixed up by enabling the underrung reporting after watermarks have beend fixed up.

On ivb/hsw an additional effect of this regression was that also all cpu crc reporting stopped working since the master error interrupt it shared across all pipes and sources.

Cc: Ville Syrjälä <[email protected]>
Cc: Jani Nikula <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76150

---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Quoted 16 lines

drivers/gpu/drm/i915/intel_display.c static void intel_sanitize_crtc(struct intel_crtc *crtc) · line 11509

Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
index 7e4ea8d4e388..9b24ae4fb7bd 100644
@@ -11502,6 +11502,14 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 			encoder->base.crtc = NULL;
 		}
 	}
+	if (crtc->active) {
+		/*
+		 * We start out with underrun reporting disabled to avoid races.
+		 * For correct bookkeeping mark this on active crtcs.
+		 */

Why only on active crtcs? The state remains in inactive crtcs. Won't the problem appear when such an crtc is actived?

Quoted 6 lines

Setting this for inactive crtcs breaks the code, which I've learned the hard way ;-) The issue is that on ivb/hsw we can _only_ enable the err interrupt if all crtcs allow it. But if some disabled crtc disallows it that condition is never true until userspace has lit up all for crtcs at least once. I've tried to capture this in the commit message, but seem to have failed. Can you please suggest a rewording to clarify things?

"Jani, please read the commit message" would clarify things. ;)

Quoted 8 lines
Quoted 7 lines

Quoth a comment in struct intel_crtc:

/* Access to these should be protected by dev_priv->irq_lock. */

Either you need to hold the lock or explain in a comment why it's not necessary.

Quoted 6 lines

At worst the interrupt handler runs concurrently (on platforms where we don't yet hide fifo underruns from the start), also setting this to false in the case of an underrun. What about:

"No protection against concurrent access is required - at wors a fifo underrun happens which also sets this to false."

s/wors/worst/

Quoted 6 lines

Thanks, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 50 lines · Jani Nikula
Quoted 49 lines · Daniel Vetter
Quoted 47 lines · Jani Nikula
Quoted 35 lines · Daniel Vetter

Since

commit 5c673b60a9b3b23486f4eda75c72e91d31d26a2b

Author: Daniel Vetter <[email protected]>
Date:   Fri Mar 7 20:34:46 2014 +0100

drm/i915: Don't enable display error interrupts from the start

we don't enable underrun interrupts any more at takeover time. Unfortunately I've forgotten to also adjust the sw-side tracking.

Since the code assumes that disabled pipes have underrun reporting enabled set the disable flag on all pipes which are active at takeover time. Without this underrun reporting wasn't enabled correctly on the first modeset. Note that for fastboot this is another piece of state that needs to be fixed up by enabling the underrung reporting after watermarks have beend fixed up.

On ivb/hsw an additional effect of this regression was that also all cpu crc reporting stopped working since the master error interrupt it shared across all pipes and sources.

Cc: Ville Syrjälä <[email protected]>
Cc: Jani Nikula <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76150

---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 7e4ea8d4e388..9b24ae4fb7bd 100644

drivers/gpu/drm/i915/intel_display.c static void intel_sanitize_crtc(struct intel_crtc *crtc) · line 11509

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -11502,6 +11502,14 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 			encoder->base.crtc = NULL;
 		}
 	}
+	if (crtc->active) {
+		/*
+		 * We start out with underrun reporting disabled to avoid races.
+		 * For correct bookkeeping mark this on active crtcs.
+		 */

Why only on active crtcs? The state remains in inactive crtcs. Won't the problem appear when such an crtc is actived?

Quoted 8 lines
Quoted 6 lines

Setting this for inactive crtcs breaks the code, which I've learned the hard way ;-) The issue is that on ivb/hsw we can _only_ enable the err interrupt if all crtcs allow it. But if some disabled crtc disallows it that condition is never true until userspace has lit up all for crtcs at least once. I've tried to capture this in the commit message, but seem to have failed. Can you please suggest a rewording to clarify things?

"Jani, please read the commit message" would clarify things. ;)

I've polished it a bit myself by adding an "only" to emphasis that only setting this for active crtc is indeed intentionally.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

Quoth a comment in struct intel_crtc:

/* Access to these should be protected by dev_priv->irq_lock. */

Either you need to hold the lock or explain in a comment why it's not necessary.

Quoted 8 lines
Quoted 6 lines

At worst the interrupt handler runs concurrently (on platforms where we don't yet hide fifo underruns from the start), also setting this to false in the case of an underrun. What about:

"No protection against concurrent access is required - at wors a fifo underrun happens which also sets this to false."

s/wors/worst/

Fixed and comment augmented.

Quoted 3 lines

Thanks for your review.
-Daniel

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