drm/i915: Use msleep instead of mdelay during wait_vblank_off

Avoid a potentially long busy-wait if we not in the process of
atomically switching to the kdb console.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2010-09-12 13:34:08 +01:00
parent c9f9ccc150
commit ec5da01e23
2 changed files with 14 additions and 6 deletions

View File

@ -1034,16 +1034,17 @@ void intel_wait_for_vblank_off(struct drm_device *dev, int pipe)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL);
unsigned long timeout = jiffies + msecs_to_jiffies(100); unsigned long timeout = jiffies + msecs_to_jiffies(100);
u32 last_line; u32 last_line, line;
/* Wait for the display line to settle */ /* Wait for the display line to settle */
line = I915_READ(pipedsl_reg) & DSL_LINEMASK;
do { do {
last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK; last_line = line;
mdelay(5); MSLEEP(5);
} while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) && line = I915_READ(pipedsl_reg) & DSL_LINEMASK;
time_after(timeout, jiffies)); } while (line != last_line && time_after(timeout, jiffies));
if (time_after(jiffies, timeout)) if (line != last_line)
DRM_DEBUG_KMS("vblank wait timed out\n"); DRM_DEBUG_KMS("vblank wait timed out\n");
} }

View File

@ -49,6 +49,13 @@
#define wait_for(COND, MS) _wait_for(COND, MS, 1) #define wait_for(COND, MS) _wait_for(COND, MS, 1)
#define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0) #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
#define MSLEEP(x) do { \
if (in_dbg_master()) \
mdelay(x); \
else \
msleep(x); \
} while(0)
#define KHz(x) (1000*x) #define KHz(x) (1000*x)
#define MHz(x) KHz(1000*x) #define MHz(x) KHz(1000*x)