Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-07-07 Thread Daniel Vetter
On Fri, Jun 27, 2014 at 09:38:52PM +0300, Imre Deak wrote:
 Hi Egbert,
 
 On Fri, 2014-06-27 at 15:55 +0200, Egbert Eich wrote:
  Chris Wilson writes:
On Fri, Jun 27, 2014 at 12:07:47AM +0200, Egbert Eich wrote:
 
 Hi Daniel, hi Imre,
 
 Daniel Vetter writes:
   Adding Egbert since he's done the original hack here. Imre please 
  keep
   him on cc.
   -Daniel
 
 I finally managed to get this set of patches tested on the platform 
  that
 exhibited the intermittent blanking problem when terminating the 
  Xserver.
 
 I can confirm that Imre's patches resolve the issue and that 
  g4x_fixup_plane()
 which I had introduced after extensive experiments is no longer needed 
  to
 prevent the blanking from happening.
 If you want I can provide a patch to back this out with the appropriate
 comments once Imre's patches are in.

That would be ideal.
  
  Is there a chance that Imre's patches will go into the
  Intel repo any time soon? Then I could use the commit Id in
  the patch description.
 
 Yes, Deepak promised to review it early next week, so it could be
 applied after that. I guess we could add your Tested-by too.

Back from my vacation and patches are merged. Egbert, please submit your
patch so that I can merge it.

Thanks for patches, reviewtesting.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-29 Thread Vijay Purushothaman

On 6/13/2014 5:24 PM, Imre Deak wrote:

Blanking/unblanking the console in a loop on an Asus T100 sometimes
leaves the console blank. After some digging I found that applying

commit 61bc95c1fbbb6a08b55bbe161fdf1ea5493fc595
Author: Egbert Eich e...@suse.com
Date:   Mon Mar 4 09:24:38 2013 -0500

 DRM/i915: On G45 enable cursor plane briefly after enabling the display 
plane.

fixed VLV too.

In my case the problem seemed to happen already during the previous crtc
disabling and went away if I disabled self-refresh mode before disabling
the primary plane.

The root cause for this is that updates from the shadow to live plane
control register are blocked at vblank time if the memory self-refresh
mode (aka max-fifo mode on VLV) is active at that moment. The controller
checks at frame start time if the CPU is in C0 and the self-refresh mode
enable bit is set and if so activates self-reresh mode, otherwise
deactivates it. So to make sure that the plane truly gets disabled before
pipe-off we have to:

1. disable memory self-refresh mode
2. disable plane
3. wait for vblank
4. disable pipe
5. wait for pipe-off

v2:
- add explanation for the root cause from HW team (Cesar Mancini et al)
- remove note about the CPU C7S state, in my latest tests disabling it
   alone didn't make a difference
- add vblank between disabling plane and pipe (Ville)
- apply the same workaround for all gmch platforms (Ville)

Signed-off-by: Imre Deak imre.d...@intel.com
---
  drivers/gpu/drm/i915/intel_display.c | 15 +--
  1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index b9251c8..5eb8afe 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4799,6 +4799,16 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
if (IS_GEN2(dev))
intel_set_cpu_fifo_underrun_reporting(dev, pipe, false);

+   /*
+* Vblank time updates from the shadow to live plane control register
+* are blocked if the memory self-refresh mode is active at that
+* moment. So to make sure the plane gets truly disabled, disable
+* first the self-refresh mode. The self-refresh enable bit in turn
+* will be checked/applied by the HW only at the next frame start
+* event which is after the vblank start event, so we need to have a
+* wait-for-vblank between disabling the plane and the pipe.
+*/
+   intel_set_memory_cxsr(dev_priv, false);
intel_crtc_disable_planes(crtc);

for_each_encoder_on_crtc(dev, crtc, encoder)
@@ -4807,9 +4817,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
/*
 * On gen2 planes are double buffered but the pipe isn't, so we must
 * wait for planes to fully turn off before disabling the pipe.
+* We also need to wait on all gmch platforms because of the
+* self-refresh mode constraint explained above.
 */
-   if (IS_GEN2(dev))
-   intel_wait_for_vblank(dev, pipe);
+   intel_wait_for_vblank(dev, pipe);

intel_disable_pipe(dev_priv, pipe);




Reviewed-by: Vijay Purushothaman vijay.a.purushotha...@intel.com


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-29 Thread Deepak S


On Friday 13 June 2014 05:24 PM, Imre Deak wrote:

Blanking/unblanking the console in a loop on an Asus T100 sometimes
leaves the console blank. After some digging I found that applying

commit 61bc95c1fbbb6a08b55bbe161fdf1ea5493fc595
Author: Egbert Eich e...@suse.com
Date:   Mon Mar 4 09:24:38 2013 -0500

 DRM/i915: On G45 enable cursor plane briefly after enabling the display 
plane.

fixed VLV too.

In my case the problem seemed to happen already during the previous crtc
disabling and went away if I disabled self-refresh mode before disabling
the primary plane.

The root cause for this is that updates from the shadow to live plane
control register are blocked at vblank time if the memory self-refresh
mode (aka max-fifo mode on VLV) is active at that moment. The controller
checks at frame start time if the CPU is in C0 and the self-refresh mode
enable bit is set and if so activates self-reresh mode, otherwise
deactivates it. So to make sure that the plane truly gets disabled before
pipe-off we have to:

1. disable memory self-refresh mode
2. disable plane
3. wait for vblank
4. disable pipe
5. wait for pipe-off

v2:
- add explanation for the root cause from HW team (Cesar Mancini et al)
- remove note about the CPU C7S state, in my latest tests disabling it
   alone didn't make a difference
- add vblank between disabling plane and pipe (Ville)
- apply the same workaround for all gmch platforms (Ville)

Signed-off-by: Imre Deak imre.d...@intel.com
---
  drivers/gpu/drm/i915/intel_display.c | 15 +--
  1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index b9251c8..5eb8afe 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4799,6 +4799,16 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
if (IS_GEN2(dev))
intel_set_cpu_fifo_underrun_reporting(dev, pipe, false);
  
+	/*

+* Vblank time updates from the shadow to live plane control register
+* are blocked if the memory self-refresh mode is active at that
+* moment. So to make sure the plane gets truly disabled, disable
+* first the self-refresh mode. The self-refresh enable bit in turn
+* will be checked/applied by the HW only at the next frame start
+* event which is after the vblank start event, so we need to have a
+* wait-for-vblank between disabling the plane and the pipe.
+*/
+   intel_set_memory_cxsr(dev_priv, false);
intel_crtc_disable_planes(crtc);
  
  	for_each_encoder_on_crtc(dev, crtc, encoder)

@@ -4807,9 +4817,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
/*
 * On gen2 planes are double buffered but the pipe isn't, so we must
 * wait for planes to fully turn off before disabling the pipe.
+* We also need to wait on all gmch platforms because of the
+* self-refresh mode constraint explained above.
 */
-   if (IS_GEN2(dev))
-   intel_wait_for_vblank(dev, pipe);
+   intel_wait_for_vblank(dev, pipe);
  
  	intel_disable_pipe(dev_priv, pipe);
  


Reviewed-by: Deepak Sdeepa...@linux.intel.com

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-27 Thread Chris Wilson
On Fri, Jun 27, 2014 at 12:07:47AM +0200, Egbert Eich wrote:
 
 Hi Daniel, hi Imre,
 
 Daniel Vetter writes:
   Adding Egbert since he's done the original hack here. Imre please keep
   him on cc.
   -Daniel
 
 I finally managed to get this set of patches tested on the platform that
 exhibited the intermittent blanking problem when terminating the Xserver.
 
 I can confirm that Imre's patches resolve the issue and that g4x_fixup_plane()
 which I had introduced after extensive experiments is no longer needed to
 prevent the blanking from happening.
 If you want I can provide a patch to back this out with the appropriate
 comments once Imre's patches are in.

That would be ideal.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-27 Thread Egbert Eich
Chris Wilson writes:
  On Fri, Jun 27, 2014 at 12:07:47AM +0200, Egbert Eich wrote:
   
   Hi Daniel, hi Imre,
   
   Daniel Vetter writes:
 Adding Egbert since he's done the original hack here. Imre please keep
 him on cc.
 -Daniel
   
   I finally managed to get this set of patches tested on the platform that
   exhibited the intermittent blanking problem when terminating the Xserver.
   
   I can confirm that Imre's patches resolve the issue and that 
   g4x_fixup_plane()
   which I had introduced after extensive experiments is no longer needed to
   prevent the blanking from happening.
   If you want I can provide a patch to back this out with the appropriate
   comments once Imre's patches are in.
  
  That would be ideal.

Is there a chance that Imre's patches will go into the
Intel repo any time soon? Then I could use the commit Id in
the patch description.

Cheers,
Egbert.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-26 Thread Egbert Eich

Hi Daniel, hi Imre,

Daniel Vetter writes:
  Adding Egbert since he's done the original hack here. Imre please keep
  him on cc.
  -Daniel

I finally managed to get this set of patches tested on the platform that
exhibited the intermittent blanking problem when terminating the Xserver.

I can confirm that Imre's patches resolve the issue and that g4x_fixup_plane()
which I had introduced after extensive experiments is no longer needed to
prevent the blanking from happening.
If you want I can provide a patch to back this out with the appropriate
comments once Imre's patches are in.

Cheers,
Egbert.

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-13 Thread Imre Deak
Blanking/unblanking the console in a loop on an Asus T100 sometimes
leaves the console blank. After some digging I found that applying

commit 61bc95c1fbbb6a08b55bbe161fdf1ea5493fc595
Author: Egbert Eich e...@suse.com
Date:   Mon Mar 4 09:24:38 2013 -0500

DRM/i915: On G45 enable cursor plane briefly after enabling the display 
plane.

fixed VLV too.

In my case the problem seemed to happen already during the previous crtc
disabling and went away if I disabled self-refresh mode before disabling
the primary plane.

The root cause for this is that updates from the shadow to live plane
control register are blocked at vblank time if the memory self-refresh
mode (aka max-fifo mode on VLV) is active at that moment. The controller
checks at frame start time if the CPU is in C0 and the self-refresh mode
enable bit is set and if so activates self-reresh mode, otherwise
deactivates it. So to make sure that the plane truly gets disabled before
pipe-off we have to:

1. disable memory self-refresh mode
2. disable plane
3. wait for vblank
4. disable pipe
5. wait for pipe-off

v2:
- add explanation for the root cause from HW team (Cesar Mancini et al)
- remove note about the CPU C7S state, in my latest tests disabling it
  alone didn't make a difference
- add vblank between disabling plane and pipe (Ville)
- apply the same workaround for all gmch platforms (Ville)

Signed-off-by: Imre Deak imre.d...@intel.com
---
 drivers/gpu/drm/i915/intel_display.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index b9251c8..5eb8afe 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4799,6 +4799,16 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
if (IS_GEN2(dev))
intel_set_cpu_fifo_underrun_reporting(dev, pipe, false);
 
+   /*
+* Vblank time updates from the shadow to live plane control register
+* are blocked if the memory self-refresh mode is active at that
+* moment. So to make sure the plane gets truly disabled, disable
+* first the self-refresh mode. The self-refresh enable bit in turn
+* will be checked/applied by the HW only at the next frame start
+* event which is after the vblank start event, so we need to have a
+* wait-for-vblank between disabling the plane and the pipe.
+*/
+   intel_set_memory_cxsr(dev_priv, false);
intel_crtc_disable_planes(crtc);
 
for_each_encoder_on_crtc(dev, crtc, encoder)
@@ -4807,9 +4817,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
/*
 * On gen2 planes are double buffered but the pipe isn't, so we must
 * wait for planes to fully turn off before disabling the pipe.
+* We also need to wait on all gmch platforms because of the
+* self-refresh mode constraint explained above.
 */
-   if (IS_GEN2(dev))
-   intel_wait_for_vblank(dev, pipe);
+   intel_wait_for_vblank(dev, pipe);
 
intel_disable_pipe(dev_priv, pipe);
 
-- 
1.8.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 3/3] drm/i915: gmch: fix stuck primary plane due to memory self-refresh mode

2014-06-13 Thread Daniel Vetter
Adding Egbert since he's done the original hack here. Imre please keep
him on cc.
-Daniel

On Fri, Jun 13, 2014 at 1:54 PM, Imre Deak imre.d...@intel.com wrote:
 Blanking/unblanking the console in a loop on an Asus T100 sometimes
 leaves the console blank. After some digging I found that applying

 commit 61bc95c1fbbb6a08b55bbe161fdf1ea5493fc595
 Author: Egbert Eich e...@suse.com
 Date:   Mon Mar 4 09:24:38 2013 -0500

 DRM/i915: On G45 enable cursor plane briefly after enabling the display 
 plane.

 fixed VLV too.

 In my case the problem seemed to happen already during the previous crtc
 disabling and went away if I disabled self-refresh mode before disabling
 the primary plane.

 The root cause for this is that updates from the shadow to live plane
 control register are blocked at vblank time if the memory self-refresh
 mode (aka max-fifo mode on VLV) is active at that moment. The controller
 checks at frame start time if the CPU is in C0 and the self-refresh mode
 enable bit is set and if so activates self-reresh mode, otherwise
 deactivates it. So to make sure that the plane truly gets disabled before
 pipe-off we have to:

 1. disable memory self-refresh mode
 2. disable plane
 3. wait for vblank
 4. disable pipe
 5. wait for pipe-off

 v2:
 - add explanation for the root cause from HW team (Cesar Mancini et al)
 - remove note about the CPU C7S state, in my latest tests disabling it
   alone didn't make a difference
 - add vblank between disabling plane and pipe (Ville)
 - apply the same workaround for all gmch platforms (Ville)

 Signed-off-by: Imre Deak imre.d...@intel.com
 ---
  drivers/gpu/drm/i915/intel_display.c | 15 +--
  1 file changed, 13 insertions(+), 2 deletions(-)

 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index b9251c8..5eb8afe 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -4799,6 +4799,16 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 if (IS_GEN2(dev))
 intel_set_cpu_fifo_underrun_reporting(dev, pipe, false);

 +   /*
 +* Vblank time updates from the shadow to live plane control register
 +* are blocked if the memory self-refresh mode is active at that
 +* moment. So to make sure the plane gets truly disabled, disable
 +* first the self-refresh mode. The self-refresh enable bit in turn
 +* will be checked/applied by the HW only at the next frame start
 +* event which is after the vblank start event, so we need to have a
 +* wait-for-vblank between disabling the plane and the pipe.
 +*/
 +   intel_set_memory_cxsr(dev_priv, false);
 intel_crtc_disable_planes(crtc);

 for_each_encoder_on_crtc(dev, crtc, encoder)
 @@ -4807,9 +4817,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 /*
  * On gen2 planes are double buffered but the pipe isn't, so we must
  * wait for planes to fully turn off before disabling the pipe.
 +* We also need to wait on all gmch platforms because of the
 +* self-refresh mode constraint explained above.
  */
 -   if (IS_GEN2(dev))
 -   intel_wait_for_vblank(dev, pipe);
 +   intel_wait_for_vblank(dev, pipe);

 intel_disable_pipe(dev_priv, pipe);

 --
 1.8.4

 ___
 Intel-gfx mailing list
 Intel-gfx@lists.freedesktop.org
 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
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx