Re: [PATCH] Revert "drm/i915: fix vblank wait test condition"

From: Pekka Enberg
Date: Sat Sep 04 2010 - 12:29:25 EST


On Sat,  4 Sep 2010 11:17:14 +0300, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
>> This reverts commit 9559fcdbff4f93d29af04478bbc48294519424f5. The commit causes
>> wrong screen resolution on some i915 machines such as MacBook which is a
>> regression from 2.6.35. The issue has been reported multiple times but no fix
>> has emerged:

On Sat, Sep 4, 2010 at 12:21 PM, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> NAK. You can't simply hide one bug by introducing a much bigger one.

Dude, it's a nasty regression from 2.6.35. What exactly are you NAK'ing here?

> As you have an affected machine, find which wait_for_vblank() needs to be
> replaced with a msleep(20|50).

The attached patch fixes things here. I'm not a drm developer so I
don't know if it makes technical sense.
From 53e5840a6abb50f12f9d2b32efa2a472b203d52f Mon Sep 17 00:00:00 2001
From: Pekka Enberg <penberg@xxxxxxxxxx>
Date: Sat, 4 Sep 2010 19:24:04 +0300
Subject: [PATCH] i915: Fix wrong resolution after boot problem

Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
drivers/gpu/drm/i915/intel_tv.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d2029ef..7784ff8 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1231,7 +1231,6 @@ intel_tv_detect_type (struct intel_tv *intel_tv)
struct drm_encoder *encoder = &intel_tv->base.enc;
struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
- struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
unsigned long irqflags;
u32 tv_ctl, save_tv_ctl;
u32 tv_dac, save_tv_dac;
@@ -1268,11 +1267,11 @@ intel_tv_detect_type (struct intel_tv *intel_tv)
DAC_C_0_7_V);
I915_WRITE(TV_CTL, tv_ctl);
I915_WRITE(TV_DAC, tv_dac);
- intel_wait_for_vblank(dev, intel_crtc->pipe);
+ msleep(20);
tv_dac = I915_READ(TV_DAC);
I915_WRITE(TV_DAC, save_tv_dac);
I915_WRITE(TV_CTL, save_tv_ctl);
- intel_wait_for_vblank(dev, intel_crtc->pipe);
+ msleep(20);
/*
* A B C
* 0 1 1 Composite
--
1.6.3.3