Re: [Intel-gfx] [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset

2014-06-17 Thread Daniel Vetter
On Tue, Jun 10, 2014 at 01:46:55PM +0100, Chris Wilson wrote:
 If we successfully confuse the hardware, and cause it to drop a queued
 pageflip, we wait for 60s and issue a warning before continuing on with
 the modeset. However, this leaves the pending pageflip still stuck
 indefinitely. Pretend to userspace that it does complete, and let us
 start afresh following the modeset.
 
 v2: Rebase after refactor
 
 Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
 Cc: Daniel Vetter daniel.vet...@ffwll.ch
 Cc: Ville Syrjälä ville.syrj...@linux.intel.com

Since I've shredded a few machines with this ...

Queued for -next, thanks for the patch.
-Daniel
 ---
  drivers/gpu/drm/i915/intel_display.c | 16 +---
  1 file changed, 13 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index ec166e41a27e..5261c145e633 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -3363,9 +3363,19 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc 
 *crtc)
  
   WARN_ON(waitqueue_active(dev_priv-pending_flip_queue));
  
 - WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
 -!intel_crtc_has_pending_flip(crtc),
 -60*HZ) == 0);
 + if (WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
 +!intel_crtc_has_pending_flip(crtc),
 +60*HZ) == 0)) {
 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 + unsigned long flags;
 +
 + spin_lock_irqsave(dev-event_lock, flags);
 + if (intel_crtc-unpin_work) {
 + WARN_ONCE(1, Removing stuck page flip\n);
 + page_flip_completed(intel_crtc);
 + }
 + spin_unlock_irqrestore(dev-event_lock, flags);
 + }
  
   mutex_lock(dev-struct_mutex);
   intel_finish_fb(crtc-primary-fb);
 -- 
 2.0.0
 

-- 
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


[Intel-gfx] [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset

2014-06-10 Thread Chris Wilson
If we successfully confuse the hardware, and cause it to drop a queued
pageflip, we wait for 60s and issue a warning before continuing on with
the modeset. However, this leaves the pending pageflip still stuck
indefinitely. Pretend to userspace that it does complete, and let us
start afresh following the modeset.

v2: Rebase after refactor

Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_display.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index b87b4ce..9ecc6bf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3363,9 +3363,19 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc 
*crtc)
 
WARN_ON(waitqueue_active(dev_priv-pending_flip_queue));
 
-   WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
-  !intel_crtc_has_pending_flip(crtc),
-  60*HZ) == 0);
+   if (WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
+  !intel_crtc_has_pending_flip(crtc),
+  60*HZ) == 0)) {
+   struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+   unsigned long flags;
+
+   spin_lock_irqsave(dev-event_lock, flags);
+   if (intel_crtc-unpin_work) {
+   WARN_ONCE(1, Removing stuck page flip\n);
+   page_flip_completed(intel_crtc);
+   }
+   spin_unlock_irqrestore(dev-event_lock, flags);
+   }
 
mutex_lock(dev-struct_mutex);
intel_finish_fb(crtc-primary-fb);
-- 
1.7.9.5

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


Re: [Intel-gfx] [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset

2014-06-10 Thread Ville Syrjälä
On Tue, Jun 10, 2014 at 11:04:01AM +0100, Chris Wilson wrote:
 If we successfully confuse the hardware, and cause it to drop a queued
 pageflip, we wait for 60s and issue a warning before continuing on with
 the modeset. However, this leaves the pending pageflip still stuck
 indefinitely. Pretend to userspace that it does complete, and let us
 start afresh following the modeset.
 
 v2: Rebase after refactor
 
 Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
 Cc: Daniel Vetter daniel.vet...@ffwll.ch
 Cc: Ville Syrjälä ville.syrj...@linux.intel.com

Reviewed-by: Ville Syrjälä ville.syrj...@linux.intel.com

still stands.

 ---
  drivers/gpu/drm/i915/intel_display.c |   16 +---
  1 file changed, 13 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index b87b4ce..9ecc6bf 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -3363,9 +3363,19 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc 
 *crtc)
  
   WARN_ON(waitqueue_active(dev_priv-pending_flip_queue));
  
 - WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
 -!intel_crtc_has_pending_flip(crtc),
 -60*HZ) == 0);
 + if (WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
 +!intel_crtc_has_pending_flip(crtc),
 +60*HZ) == 0)) {
 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 + unsigned long flags;
 +
 + spin_lock_irqsave(dev-event_lock, flags);
 + if (intel_crtc-unpin_work) {
 + WARN_ONCE(1, Removing stuck page flip\n);
 + page_flip_completed(intel_crtc);
 + }
 + spin_unlock_irqrestore(dev-event_lock, flags);
 + }
  
   mutex_lock(dev-struct_mutex);
   intel_finish_fb(crtc-primary-fb);
 -- 
 1.7.9.5

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset

2014-06-10 Thread Chris Wilson
If we successfully confuse the hardware, and cause it to drop a queued
pageflip, we wait for 60s and issue a warning before continuing on with
the modeset. However, this leaves the pending pageflip still stuck
indefinitely. Pretend to userspace that it does complete, and let us
start afresh following the modeset.

v2: Rebase after refactor

Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_display.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index ec166e41a27e..5261c145e633 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3363,9 +3363,19 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc 
*crtc)
 
WARN_ON(waitqueue_active(dev_priv-pending_flip_queue));
 
-   WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
-  !intel_crtc_has_pending_flip(crtc),
-  60*HZ) == 0);
+   if (WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
+  !intel_crtc_has_pending_flip(crtc),
+  60*HZ) == 0)) {
+   struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+   unsigned long flags;
+
+   spin_lock_irqsave(dev-event_lock, flags);
+   if (intel_crtc-unpin_work) {
+   WARN_ONCE(1, Removing stuck page flip\n);
+   page_flip_completed(intel_crtc);
+   }
+   spin_unlock_irqrestore(dev-event_lock, flags);
+   }
 
mutex_lock(dev-struct_mutex);
intel_finish_fb(crtc-primary-fb);
-- 
2.0.0

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


Re: [Intel-gfx] [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset

2014-06-09 Thread Ville Syrjälä
On Fri, May 30, 2014 at 05:16:35PM +0100, Chris Wilson wrote:
 If we successfully confuse the hardware, and cause it to drop a queued
 pageflip, we wait for 60s and issue a warning before continuing on with
 the modeset. However, this leaves the pending pageflip still stuck
 indefinitely. Pretend to userspace that it does complete, and let us
 start afresh following the modeset.
 
 Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
 Cc: Daniel Vetter daniel.vet...@ffwll.ch
 Cc: Ville Syrjälä ville.syrj...@linux.intel.com
 ---
  drivers/gpu/drm/i915/intel_display.c | 18 +++---
  1 file changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/gpu/drm/i915/intel_display.c 
 b/drivers/gpu/drm/i915/intel_display.c
 index 764b277e5937..54b69838e2de 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -3329,9 +3329,21 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc 
 *crtc)
  
   WARN_ON(waitqueue_active(dev_priv-pending_flip_queue));
  
 - WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
 -!intel_crtc_has_pending_flip(crtc),
 -60*HZ) == 0);
 + if (WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
 +!intel_crtc_has_pending_flip(crtc),
 +60*HZ) == 0)) {
 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 + unsigned long flags;
 +
 + spin_lock_irqsave(dev-event_lock, flags);
 + if (intel_crtc-unpin_work) {
 + WARN_ONCE(1, Removing stuck page flip\n);
 + drm_vblank_put(dev, intel_crtc-pipe);
 + page_flip_completed(dev_priv, intel_crtc, 
 intel_crtc-unpin_work);
 + intel_crtc-unpin_work = NULL;
 + }
 + spin_unlock_irqrestore(dev-event_lock, flags);
 + }

Seems like a decent idea.

Reviewed-by: Ville Syrjälä ville.syrj...@linux.intel.com

Though my comment (to the other patch) about moving drm_vblank_put()
into page_flip_completed() still seems valid.

  
   mutex_lock(dev-struct_mutex);
   intel_finish_fb(crtc-primary-fb);
 -- 
 2.0.0.rc4

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/3] drm/i915: Decouple the stuck pageflip on modeset

2014-05-30 Thread Chris Wilson
If we successfully confuse the hardware, and cause it to drop a queued
pageflip, we wait for 60s and issue a warning before continuing on with
the modeset. However, this leaves the pending pageflip still stuck
indefinitely. Pretend to userspace that it does complete, and let us
start afresh following the modeset.

Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_display.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 764b277e5937..54b69838e2de 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3329,9 +3329,21 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc 
*crtc)
 
WARN_ON(waitqueue_active(dev_priv-pending_flip_queue));
 
-   WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
-  !intel_crtc_has_pending_flip(crtc),
-  60*HZ) == 0);
+   if (WARN_ON(wait_event_timeout(dev_priv-pending_flip_queue,
+  !intel_crtc_has_pending_flip(crtc),
+  60*HZ) == 0)) {
+   struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+   unsigned long flags;
+
+   spin_lock_irqsave(dev-event_lock, flags);
+   if (intel_crtc-unpin_work) {
+   WARN_ONCE(1, Removing stuck page flip\n);
+   drm_vblank_put(dev, intel_crtc-pipe);
+   page_flip_completed(dev_priv, intel_crtc, 
intel_crtc-unpin_work);
+   intel_crtc-unpin_work = NULL;
+   }
+   spin_unlock_irqrestore(dev-event_lock, flags);
+   }
 
mutex_lock(dev-struct_mutex);
intel_finish_fb(crtc-primary-fb);
-- 
2.0.0.rc4

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