Skip to contentSkip to conversation

drm/i915/bdw: Add 42ms delay for IPS disable

PATCH Superseded Ben Widawsky 5 participants 7 messages Apr 10, 2014 – Apr 11, 2014

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

PATCH 1/1 drm/i915/bdw: Add 42ms delay for IPS disable

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will present persistent corruption on the display.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +5 -1
index 7f02444..ebc84ee 100644
@@ -3583,7 +3583,7 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);
@@ -3594,6 +3594,10 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 
 	/* We need to wait for a vblank before we can disable the plane. */
 	intel_wait_for_vblank(dev, crtc->pipe);
+
+	/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+	if (IS_BROADWELL(dev))
+		msleep(42);
 }
 
 /** Loads the palette/gamma unit for the CRTC with the prepared values */
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Ben Widawsky

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will present persistent corruption on the display.

Prevent? I don't think we want to start showing corruption to the user.

Quoted 20 lines
---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 7f02444..ebc84ee 100644
@@ -3583,7 +3583,7 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);

drivers/gpu/drm/i915/intel_display.c void hsw_disable_ips(struct intel_crtc *crtc) · line 3600

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +4 -0
@@ -3594,6 +3594,10 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 
 	/* We need to wait for a vblank before we can disable the plane. */
 	intel_wait_for_vblank(dev, crtc->pipe);
+
+	/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+	if (IS_BROADWELL(dev))
+		msleep(42);

Reading too much Douglas Adams?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 5 lines · Chris Wilson
Quoted 4 lines · Ben Widawsky

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will present persistent corruption on the display.

s/present/prevent

Quoted 24 lines

Prevent? I don't think we want to start showing corruption to the user.

Quoted 21 lines
---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 7f02444..ebc84ee 100644
@@ -3583,7 +3583,7 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);
@@ -3594,6 +3594,10 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 
Quoted 10 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_ips(struct intel_crtc *crtc) · line 3600

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +4 -0
 	/* We need to wait for a vblank before we can disable the plane. */
 	intel_wait_for_vblank(dev, crtc->pipe);
+
+	/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+	if (IS_BROADWELL(dev))
+		msleep(42);

Reading too much Douglas Adams?
-Chris

It's those damn display arTchitects

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#3 lore raw
Quoted 42 lines

-----Original Message-----
From: Ben Widawsky [mailto:[email protected]]
Sent: Thursday, April 10, 2014 11:41 AM
To: Chris Wilson; Widawsky, Benjamin; Intel GFX; Runyan, Arthur J
Subject: Re: [Intel-gfx] [PATCH] drm/i915/bdw: Add 42ms delay for IPS disable

Quoted 5 lines · Chris Wilson
Quoted 4 lines · Ben Widawsky

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will present persistent corruption on the display.

s/present/prevent

Quoted 16 lines

Prevent? I don't think we want to start showing corruption to the user.

Quoted 13 lines
---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 7f02444..ebc84ee 100644
@@ -3583,7 +3583,7 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
Quoted 5 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_ips(struct intel_crtc *crtc)

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL,

0));

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 		mutex_unlock(&dev_priv->rps.hw_lock);
@@ -3594,6 +3594,10 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_ips(struct intel_crtc *crtc) · line 3600

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +4 -0
 	/* We need to wait for a vblank before we can disable the plane. */
 	intel_wait_for_vblank(dev, crtc->pipe);
+
+	/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+	if (IS_BROADWELL(dev))
+		msleep(42);

The added delay for broadwell should come before the wait for vblank.
Also, you should check for IPS_CTL bit 31 (Enable IPS) to become 0, just in case the 42ms was a lie, or something got stuck.

Quoted 6 lines
Quoted 4 lines

Reading too much Douglas Adams?
-Chris

It's those damn display arTchitects

Hah.... I am an Art, but not one of those lofty architects.

Quoted 3 lines

--
Ben Widawsky, Intel Open Source Technology Center

#4 lore raw

PATCH v2 1/1 drm/i915/bdw: Add 42ms delay for IPS disable

In reply to Ben Widawsky

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will prevent persistent corruption on the display.

v2: Make the wait before the vblank wait. (Art)
Try to finish early by polling the register
s/present/prevent (Chris)

---
 drivers/gpu/drm/i915/intel_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
index 7f02444..05c60b1 100644
@@ -3583,10 +3583,13 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);
+		/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+		if (wait_for((I915_READ(IPS_CTL) & IPS_ENABLE) == 0, 42))
+			DRM_DEBUG_KMS("Timed out waiting for IPS disable\n");
 	} else {
 		I915_WRITE(IPS_CTL, 0);
 		POSTING_READ(IPS_CTL);
Signature · 1 line
1.9.1
Reviewed-by on v2 1/1
#5 lore raw

Ben explained some of the fine details of the code to me, and I'm happy.

Quoted 38 lines

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will prevent persistent corruption on the display.

v2: Make the wait before the vblank wait. (Art)
Try to finish early by polling the register
s/present/prevent (Chris)

---
drivers/gpu/drm/i915/intel_display.c | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
index 7f02444..05c60b1 100644
@@ -3583,10 +3583,13 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL,
 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);
+		/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+		if (wait_for((I915_READ(IPS_CTL) & IPS_ENABLE) == 0, 42))
+			DRM_DEBUG_KMS("Timed out waiting for IPS disable\n");
 	} else {
 		I915_WRITE(IPS_CTL, 0);
		POSTING_READ(IPS_CTL);

--
1.9.1

#6 lore raw
Quoted 15 lines · Arthur J

Ben explained some of the fine details of the code to me, and I'm happy.

Quoted 12 lines

From: Ben Widawsky <[email protected]>

This is a requirement added to the spec. This patch will prevent persistent corruption on the display.

v2: Make the wait before the vblank wait. (Art)
Try to finish early by polling the register
s/present/prevent (Chris)

Queued for -next, thanks for the patch.

Quoted 11 lines
Quoted 11 lines

---
drivers/gpu/drm/i915/intel_display.c | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 7f02444..05c60b1 100644
@@ -3583,10 +3583,13 @@ void hsw_disable_ips(struct intel_crtc *crtc)
 		return;
 
Quoted 10 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_ips(struct intel_crtc *crtc) · line 3592

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +4 -1
 	assert_plane_enabled(dev_priv, crtc->plane);
-	if (IS_BROADWELL(crtc->base.dev)) {
+	if (IS_BROADWELL(dev)) {
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL,
 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);
+		/* wait for pcode to finish disabling IPS, which may take up to 42ms */
+		if (wait_for((I915_READ(IPS_CTL) & IPS_ENABLE) == 0, 42))
+			DRM_DEBUG_KMS("Timed out waiting for IPS disable\n");

I've upgraded this to an ERROR to make sure we'll get noticed if it happens.
-Daniel

Quoted 10 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 	} else {
 		I915_WRITE(IPS_CTL, 0);
		POSTING_READ(IPS_CTL);

--
1.9.1

_______________________________________________
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