drm/imx: use drm_send_vblank_event() helper
authorRob Clark <rob@ti.com>
Mon, 8 Oct 2012 19:50:46 +0000 (19:50 +0000)
committerDave Airlie <airlied@redhat.com>
Tue, 21 May 2013 23:13:42 +0000 (09:13 +1000)
Also, slightly changes the behavior to always put the vblank irq,
even if userspace did not request a vblank event.  As far as I
can tell, the previous code would leak a vblank irq refcnt if
userspace requested a pageflip without event.

Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/staging/imx-drm/ipuv3-crtc.c

index b028b0d1317b8c4d89967c64bd5d5e20cdfa9f35..1cd74f5e4c76497d7e2863a58e9ea9d9cc25a666 100644 (file)
@@ -311,31 +311,14 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
 
 static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc)
 {
-       struct drm_pending_vblank_event *e;
-       struct timeval now;
        unsigned long flags;
        struct drm_device *drm = ipu_crtc->base.dev;
 
        spin_lock_irqsave(&drm->event_lock, flags);
-
-       e = ipu_crtc->page_flip_event;
-       if (!e) {
-               spin_unlock_irqrestore(&drm->event_lock, flags);
-               return;
-       }
-
-       do_gettimeofday(&now);
-       e->event.sequence = 0;
-       e->event.tv_sec = now.tv_sec;
-       e->event.tv_usec = now.tv_usec;
+       if (ipu_crtc->page_flip_event)
+               drm_send_vblank_event(drm, -1, ipu_crtc->page_flip_event);
        ipu_crtc->page_flip_event = NULL;
-
        imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc);
-
-       list_add_tail(&e->base.link, &e->base.file_priv->event_list);
-
-       wake_up_interruptible(&e->base.file_priv->event_wait);
-
        spin_unlock_irqrestore(&drm->event_lock, flags);
 }