[Intel-gfx] [PATCH] drm/i915: Check whether the output is running after completing the modeswitch
Chris Wilson
chris at chris-wilson.co.uk
Tue Mar 29 15:43:46 CEST 2011
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
More information about the Intel-gfx
mailing list