public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: time out of load detect busy-waits
@ 2012-04-20 19:03 Daniel Vetter
  2012-04-20 19:03 ` [PATCH 2/2] drm/i915: fixup load-detect on enabled, but not active pipe Daniel Vetter
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Daniel Vetter @ 2012-04-20 19:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

If we try to do that and the scanlines just wouldn't advance, we
busy-hang the machine holding the modeset mutex. Not great for
debugging.

References: https://bugzilla.kernel.org/show_bug.cgi?id=43020
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_crt.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 0976137..d30779e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -383,6 +383,7 @@ intel_crt_load_detect(struct intel_crt *crt)
 	} else {
 		bool restore_vblank = false;
 		int count, detect;
+		unsigned long timeout;
 
 		/*
 		* If there isn't any border, add some.
@@ -407,22 +408,32 @@ intel_crt_load_detect(struct intel_crt *crt)
 		/*
 		 * Wait for the border to be displayed
 		 */
-		while (I915_READ(pipe_dsl_reg) >= vactive)
-			;
-		while ((dsl = I915_READ(pipe_dsl_reg)) <= vsample)
-			;
+		if (wait_for(I915_READ(pipe_dsl_reg) >= vactive, 1000))
+			DRM_ERROR("timed out waiting for vactive in "
+				  "load_detect, scanline: %u\n",
+				  I915_READ(pipe_dsl_reg));
+		if (wait_for((dsl = I915_READ(pipe_dsl_reg)) <= vsample, 1000))
+			DRM_ERROR("timed out waiting for vsample in "
+				  "load_detect, scanline: %u\n",
+				  I915_READ(pipe_dsl_reg));
 		/*
 		 * Watch ST00 for an entire scanline
 		 */
 		detect = 0;
 		count = 0;
+		timeout = jiffies + msecs_to_jiffies(1000);
 		do {
 			count++;
 			/* Read the ST00 VGA status register */
 			st00 = I915_READ8(VGA_MSR_WRITE);
 			if (st00 & (1 << 4))
 				detect++;
-		} while ((I915_READ(pipe_dsl_reg) == dsl));
+		} while ((I915_READ(pipe_dsl_reg) == dsl) &&
+			 !time_after(jiffies, timeout));
+
+		if (time_after(jiffies, timeout))
+			DRM_ERROR("timed out while load-detecting, scanline: %u\n",
+				  I915_READ(pipe_dsl_reg));
 
 		/* restore vblank if necessary */
 		if (restore_vblank)
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-05-01 17:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-20 19:03 [PATCH 1/2] drm/i915: time out of load detect busy-waits Daniel Vetter
2012-04-20 19:03 ` [PATCH 2/2] drm/i915: fixup load-detect on enabled, but not active pipe Daniel Vetter
2012-04-20 19:44   ` Chris Wilson
2012-04-22  9:17     ` Daniel Vetter
2012-04-20 19:25 ` [PATCH] drm/fixup: fixup tv load-detect on enabled but not active crtc Daniel Vetter
2012-04-20 19:42 ` [PATCH 1/2] drm/i915: time out of load detect busy-waits Chris Wilson
2012-04-25 17:14 ` Chris Wilson
2012-04-25 19:26   ` Daniel Vetter
2012-04-28 21:00     ` Chris Wilson
2012-05-01 17:26       ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox