Skip to contentSkip to conversation

drm/i915: HSW PSR fix inverted sink DP_PSR_CFG link setup.

PATCH In review Rodrigo Vivi 3 participants 7 messages Feb 7, 2014

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

PATCH 1/2 drm/i915: HSW PSR fix inverted sink DP_PSR_CFG link setup.

As pointed out by Ville we were using inverted logic here. According to spec:
For link standby mode set 170h[1] = 1.
For full link disabling set 170h[1] = 0.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -4
index 50381f7..4ecda72 100644
@@ -1661,12 +1661,12 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
 	/* Enable PSR in sink */
 	if (intel_dp->psr_dpcd[1] & DP_PSR_NO_TRAIN_ON_EXIT)
 		intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
-					    DP_PSR_ENABLE &
-					    ~DP_PSR_MAIN_LINK_ACTIVE);
-	else
-		intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
 					    DP_PSR_ENABLE |
 					    DP_PSR_MAIN_LINK_ACTIVE);
+	else
+		intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
+					    DP_PSR_ENABLE &
+					    ~DP_PSR_MAIN_LINK_ACTIVE);
 
 	/* Setup AUX registers */
 	I915_WRITE(EDP_PSR_AUX_DATA1(dev), EDP_PSR_DPCD_COMMAND);
Signature · 6 lines
1.7.11.7

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

PATCH 2/2 drm/i915: PSR HSW: update after enabling sprite.

On the current structure HSW doesn't support PSR with sprites enabled but sprites can be enabled after PSR was enabled what would cause user to miss screen updates.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_sprite.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_sprite.c +2 -0
index 336ae6c..3132686 100644
@@ -318,6 +318,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	I915_WRITE(SPRSURF(pipe),
 		   i915_gem_obj_ggtt_offset(obj) + sprsurf_offset);
 	POSTING_READ(SPRSURF(pipe));
+
+	intel_edp_psr_update(dev);
 }
 
 static void
Signature · 6 lines
1.7.11.7

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

Re: [PATCH 2/2] drm/i915: PSR HSW: update after enabling sprite.

Quoted 6 lines · Rodrigo Vivi

On the current structure HSW doesn't support PSR with sprites enabled but sprites can be enabled after PSR was enabled what would cause user to miss screen updates.

Cc Ville Syrjälä <[email protected]>

Have you checked whether your current psr testcase hits this issue? If so please add the Testcase: tag with the right subtest to this patch. -Daniel

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_sprite.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_sprite.c +2 -0
index 336ae6c..3132686 100644
@@ -318,6 +318,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	I915_WRITE(SPRSURF(pipe),
 		   i915_gem_obj_ggtt_offset(obj) + sprsurf_offset);
 	POSTING_READ(SPRSURF(pipe));
+
+	intel_edp_psr_update(dev);
 }
 
 static void
Signature · 6 lines
1.7.11.7

_______________________________________________
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
#3 lore raw

Re: [PATCH 2/2] drm/i915: PSR HSW: update after enabling sprite.

In reply to Rodrigo Vivi
Quoted 15 lines · Rodrigo Vivi

On the current structure HSW doesn't support PSR with sprites enabled but sprites can be enabled after PSR was enabled what would cause user to miss screen updates.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_sprite.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_sprite.c +0 -0
index 336ae6c..3132686 100644

drivers/gpu/drm/i915/intel_sprite.c ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · line 322

Quoted 5 lines
drivers/gpu/drm/i915/intel_sprite.c +2 -0
@@ -318,6 +318,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	I915_WRITE(SPRSURF(pipe),
 		   i915_gem_obj_ggtt_offset(obj) + sprsurf_offset);
 	POSTING_READ(SPRSURF(pipe));
+
+	intel_edp_psr_update(dev);

I was thinking this might be better placed in intel_update_plane() since the fbc/ips stuff is there, but I can live with it being here too.

But should if have a HSW check on it? BDW doesn't have this restriction anymore, right?

Quoted 5 lines
drivers/gpu/drm/i915/intel_sprite.c +0 -0
 }
 
 static void
Signature · 1 line
1.7.11.7
Signature · 2 lines
Ville Syrjälä
Intel OTC
#4 lore raw

Re: [PATCH 2/2] drm/i915: PSR HSW: update after enabling sprite.

Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Rodrigo Vivi

On the current structure HSW doesn't support PSR with sprites enabled but sprites can be enabled after PSR was enabled what would cause user to miss screen updates.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_sprite.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 13 lines

drivers/gpu/drm/i915/intel_sprite.c ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · line 322

Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +2 -0
index 336ae6c..3132686 100644
@@ -318,6 +318,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
      I915_WRITE(SPRSURF(pipe),
                 i915_gem_obj_ggtt_offset(obj) + sprsurf_offset);
      POSTING_READ(SPRSURF(pipe));
+
+     intel_edp_psr_update(dev);

I was thinking this might be better placed in intel_update_plane() since the fbc/ips stuff is there, but I can live with it being here too.

I agree there is better.

Quoted 3 lines

But should if have a HSW check on it? BDW doesn't have this restriction anymore, right?

yes, it should... you are right!

Quoted 10 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_sprite.c +0 -1
 }
 
 static void
--

1.7.11.7

--
Ville Syrjälä
Intel OTC

I also agree with Daniel we need a test case for that... so, will provide this and a new patch version later

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#5 lore raw
In reply to Rodrigo Vivi
Quoted 19 lines · Rodrigo Vivi

As pointed out by Ville we were using inverted logic here. According to spec:
For link standby mode set 170h[1] = 1.
For full link disabling set 170h[1] = 0.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 50381f7..4ecda72 100644
@@ -1661,12 +1661,12 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
 	/* Enable PSR in sink */
 	if (intel_dp->psr_dpcd[1] & DP_PSR_NO_TRAIN_ON_EXIT)
 		intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,

drivers/gpu/drm/i915/intel_dp.c static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp) · line 1669

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +4 -4
-					    DP_PSR_ENABLE &
-					    ~DP_PSR_MAIN_LINK_ACTIVE);
-	else
-		intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
 					    DP_PSR_ENABLE |
 					    DP_PSR_MAIN_LINK_ACTIVE);
+	else
+		intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
+					    DP_PSR_ENABLE &
+					    ~DP_PSR_MAIN_LINK_ACTIVE);

I think this is now the opposite of what we want. Ie. if the sink doesn't require training we should disable the main link. Otherwise we should keep the main link on, and that way avoid the need to train on PSR exit.

Actually I'm not sure that's really what we want. I think the hardware can do the training on its own, so in theory we should just always disable the main link. Although the PM guide has a comment indicating that the hardware training can fail, in which case software must repeat it. We don't have code to do that, so I guess leaving the main link on is the safer option. Would be nice to have a comment in the code stating as much, if this is indeed the reason why the code was written this way.

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	/* Setup AUX registers */
 	I915_WRITE(EDP_PSR_AUX_DATA1(dev), EDP_PSR_DPCD_COMMAND);
Signature · 1 line
1.7.11.7
Signature · 2 lines
Ville Syrjälä
Intel OTC
#6 lore raw
Quoted 27 lines · Ville Syrjälä
Quoted 26 lines · Rodrigo Vivi

As pointed out by Ville we were using inverted logic here. According to spec:
For link standby mode set 170h[1] = 1.
For full link disabling set 170h[1] = 0.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +1 -4
index 50381f7..4ecda72 100644
@@ -1661,12 +1661,12 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
      /* Enable PSR in sink */
      if (intel_dp->psr_dpcd[1] & DP_PSR_NO_TRAIN_ON_EXIT)
              intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
-                                         DP_PSR_ENABLE &
-                                         ~DP_PSR_MAIN_LINK_ACTIVE);
-     else
-             intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
                                          DP_PSR_ENABLE |
                                          DP_PSR_MAIN_LINK_ACTIVE);
+     else
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp) · line 1669

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+             intel_dp_aux_native_write_1(intel_dp, DP_PSR_EN_CFG,
+                                         DP_PSR_ENABLE &
+                                         ~DP_PSR_MAIN_LINK_ACTIVE);

I think this is now the opposite of what we want. Ie. if the sink doesn't require training we should disable the main link. Otherwise we should keep the main link on, and that way avoid the need to train on PSR exit.

To be honest, I think I agree with you, but apparently performance counter inc improved on this way...

Quoted 8 lines

Actually I'm not sure that's really what we want. I think the hardware can do the training on its own, so in theory we should just always disable the main link. Although the PM guide has a comment indicating that the hardware training can fail, in which case software must repeat it. We don't have code to do that, so I guess leaving the main link on is the safer option. Would be nice to have a comment in the code stating as much, if this is indeed the reason why the code was written this way.

I'll do a carefull check and local tests and send new version fixed
or with good comments.

Quoted 10 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
      /* Setup AUX registers */
      I915_WRITE(EDP_PSR_AUX_DATA1(dev), EDP_PSR_DPCD_COMMAND);
--

1.7.11.7

--
Ville Syrjälä
Intel OTC

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br