aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 00214c123ec2..a2e8e15b8f5a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1017,8 +1017,8 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)
1017 DRM_DEBUG_KMS("vblank wait timed out\n"); 1017 DRM_DEBUG_KMS("vblank wait timed out\n");
1018} 1018}
1019 1019
1020/** 1020/*
1021 * intel_wait_for_vblank_off - wait for vblank after disabling a pipe 1021 * intel_wait_for_pipe_off - wait for pipe to turn off
1022 * @dev: drm device 1022 * @dev: drm device
1023 * @pipe: pipe to wait for 1023 * @pipe: pipe to wait for
1024 * 1024 *
@@ -1026,26 +1026,39 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)
1026 * spinning on the vblank interrupt status bit, since we won't actually 1026 * spinning on the vblank interrupt status bit, since we won't actually
1027 * see an interrupt when the pipe is disabled. 1027 * see an interrupt when the pipe is disabled.
1028 * 1028 *
1029 * So this function waits for the display line value to settle (it 1029 * On Gen4 and above:
1030 * usually ends up stopping at the start of the next frame). 1030 * wait for the pipe register state bit to turn off
1031 *
1032 * Otherwise:
1033 * wait for the display line value to settle (it usually
1034 * ends up stopping at the start of the next frame).
1035 *
1031 */ 1036 */
1032void intel_wait_for_vblank_off(struct drm_device *dev, int pipe) 1037void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)
1033{ 1038{
1034 struct drm_i915_private *dev_priv = dev->dev_private; 1039 struct drm_i915_private *dev_priv = dev->dev_private;
1035 int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); 1040
1036 unsigned long timeout = jiffies + msecs_to_jiffies(100); 1041 if (INTEL_INFO(dev)->gen >= 4) {
1037 u32 last_line, line; 1042 int reg = PIPECONF(pipe);
1038 1043
1039 /* Wait for the display line to settle */ 1044 /* Wait for the Pipe State to go off */
1040 line = I915_READ(pipedsl_reg) & DSL_LINEMASK; 1045 if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0,
1041 do { 1046 100))
1042 last_line = line; 1047 DRM_DEBUG_KMS("pipe_off wait timed out\n");
1043 MSLEEP(5); 1048 } else {
1044 line = I915_READ(pipedsl_reg) & DSL_LINEMASK; 1049 u32 last_line;
1045 } while (line != last_line && time_after(timeout, jiffies)); 1050 int reg = PIPEDSL(pipe);
1046 1051 unsigned long timeout = jiffies + msecs_to_jiffies(100);
1047 if (line != last_line) 1052
1048 DRM_DEBUG_KMS("vblank wait timed out\n"); 1053 /* Wait for the display line to settle */
1054 do {
1055 last_line = I915_READ(reg) & DSL_LINEMASK;
1056 mdelay(5);
1057 } while (((I915_READ(reg) & DSL_LINEMASK) != last_line) &&
1058 time_after(timeout, jiffies));
1059 if (time_after(jiffies, timeout))
1060 DRM_DEBUG_KMS("pipe_off wait timed out\n");
1061 }
1049} 1062}
1050 1063
1051static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval) 1064static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
@@ -2406,7 +2419,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2406 2419
2407 /* Wait for vblank for the disable to take effect */ 2420 /* Wait for vblank for the disable to take effect */
2408 if (IS_GEN2(dev)) 2421 if (IS_GEN2(dev))
2409 intel_wait_for_vblank_off(dev, pipe); 2422 intel_wait_for_vblank(dev, pipe);
2410 } 2423 }
2411 2424
2412 /* Don't disable pipe A or pipe A PLLs if needed */ 2425 /* Don't disable pipe A or pipe A PLLs if needed */
@@ -2419,9 +2432,9 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2419 if (temp & PIPECONF_ENABLE) { 2432 if (temp & PIPECONF_ENABLE) {
2420 I915_WRITE(reg, temp & ~PIPECONF_ENABLE); 2433 I915_WRITE(reg, temp & ~PIPECONF_ENABLE);
2421 2434
2422 /* Wait for vblank for the disable to take effect. */ 2435 /* Wait for the pipe to turn off */
2423 POSTING_READ(reg); 2436 POSTING_READ(reg);
2424 intel_wait_for_vblank_off(dev, pipe); 2437 intel_wait_for_pipe_off(dev, pipe);
2425 } 2438 }
2426 2439
2427 reg = DPLL(pipe); 2440 reg = DPLL(pipe);