public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Check whether the output is running after completing the modeswitch
@ 2011-03-29 13:43 Chris Wilson
  2011-03-29 16:48 ` Jesse Barnes
  2011-03-29 17:07 ` Eric Anholt
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Wilson @ 2011-03-29 13:43 UTC (permalink / raw)
  To: intel-gfx

Proof-of-concept sanity check to see if we did successfully enable the
pipe. Without a means of report back the error and forcibly reverting back
to the previous configuration, the error message is a little useless.
---
 drivers/gpu/drm/i915/intel_display.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5c7385b..ac9050d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3161,7 +3161,22 @@ static void i9xx_crtc_prepare(struct drm_crtc *crtc)
 
 static void i9xx_crtc_commit(struct drm_crtc *crtc)
 {
+	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+	int pipe = to_intel_crtc(crtc)->pipe;
+
 	i9xx_crtc_enable(crtc);
+
+	if (INTEL_INFO(crtc->dev)->gen >= 4) {
+		u32 reg = PIPEDSL(pipe);
+		u32 line = I915_READ(reg);
+		if (wait_for(I915_READ(reg) != line, 50))
+			DRM_ERROR("failed to switch modes, output not running\n");
+	} else {
+		u32 reg = PIPEFRAMEPIXEL(pipe);
+		u32 pixel = I915_READ(reg) & PIPE_PIXEL_MASK;
+		if (wait_for((I915_READ(reg) & PIPE_PIXEL_MASK) != pixel, 50))
+			DRM_ERROR("failed to switch modes, output not running\n");
+	}
 }
 
 static void ironlake_crtc_prepare(struct drm_crtc *crtc)
@@ -3171,7 +3186,16 @@ static void ironlake_crtc_prepare(struct drm_crtc *crtc)
 
 static void ironlake_crtc_commit(struct drm_crtc *crtc)
 {
+	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+	int pipe = to_intel_crtc(crtc)->pipe;
+	u32 reg = PIPEDSL(pipe);
+	u32 line;
+
 	ironlake_crtc_enable(crtc);
+
+	line = I915_READ(reg);
+	if (wait_for(I915_READ(reg) != line, 50))
+		DRM_ERROR("failed to switch modes, output not running\n");
 }
 
 void intel_encoder_prepare (struct drm_encoder *encoder)
-- 
1.7.4.1

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

end of thread, other threads:[~2011-03-29 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 13:43 [PATCH] drm/i915: Check whether the output is running after completing the modeswitch Chris Wilson
2011-03-29 16:48 ` Jesse Barnes
2011-03-29 16:58   ` Chris Wilson
2011-03-29 17:07 ` Eric Anholt
2011-03-29 17:17   ` Chris Wilson

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