Only return EBUSY after we've established we need to schedule a new swap.
authorMichel Dänzer <michel@tungstengraphics.com>
Fri, 1 Sep 2006 09:48:07 +0000 (11:48 +0200)
committerMichel Dänzer <michel@tungstengraphics.com>
Thu, 28 Sep 2006 13:41:36 +0000 (15:41 +0200)
shared-core/i915_irq.c

index 9cd8ece..d32f592 100644 (file)
@@ -395,11 +395,6 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
                return DRM_ERR(EINVAL);
        }
 
-       if (dev_priv->swaps_pending >= 100) {
-               DRM_DEBUG("Too many swaps queued\n");
-               return DRM_ERR(EBUSY);
-       }
-
        DRM_COPY_FROM_USER_IOCTL(swap, (drm_i915_vblank_swap_t __user *) data,
                                 sizeof(swap));
 
@@ -464,6 +459,11 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
 
        spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
 
+       if (dev_priv->swaps_pending >= 100) {
+               DRM_DEBUG("Too many swaps queued\n");
+               return DRM_ERR(EBUSY);
+       }
+
        vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER);
 
        if (!vbl_swap) {