i915: Avoid mis-counting vblank interrupts when they're only enabled for pipe A.
authorMichel Dänzer <michel@tungstengraphics.com>
Wed, 27 Sep 2006 16:22:10 +0000 (18:22 +0200)
committerMichel Dänzer <michel@tungstengraphics.com>
Thu, 28 Sep 2006 13:41:36 +0000 (15:41 +0200)
It looks like 'after a while', I915REG_INT_IDENTITY_R for some reason always has
VSYNC_PIPEB_FLAG set in the interrupt handler, even though pipe B is disabled.
So we only increase dev->vbl_received if the corresponding bit is also set in
dev->vblank_pipe.

shared-core/i915_irq.c

index 9db3870..fbc6674 100644 (file)
@@ -153,14 +153,19 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
                DRM_WAKEUP(&dev_priv->irq_queue);
 
        if (temp & (VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG)) {
-               if ((dev_priv->vblank_pipe &
+               int vblank_pipe = dev_priv->vblank_pipe;
+
+               if ((vblank_pipe &
                     (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B))
                    == (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) {
                        if (temp & VSYNC_PIPEA_FLAG)
                                atomic_inc(&dev->vbl_received);
                        if (temp & VSYNC_PIPEB_FLAG)
                                atomic_inc(&dev->vbl_received2);
-               } else
+               } else if (((temp & VSYNC_PIPEA_FLAG) &&
+                           (vblank_pipe & DRM_I915_VBLANK_PIPE_A)) ||
+                          ((temp & VSYNC_PIPEB_FLAG) &&
+                           (vblank_pipe & DRM_I915_VBLANK_PIPE_B)))
                        atomic_inc(&dev->vbl_received);
 
                DRM_WAKEUP(&dev->vbl_queue);