Commit eb19be5b authored by Russell King's avatar Russell King

drm/armada: move event sending into armada_plane_work

Move the sending of events into the armada_plane_work structure, and
combine the processing in armada_drm_plane_work_call().
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent b972a80f
......@@ -22,7 +22,6 @@
struct armada_frame_work {
struct armada_plane_work work;
struct drm_pending_vblank_event *event;
struct armada_regs regs[4];
};
......@@ -220,15 +219,24 @@ static void armada_drm_plane_work_call(struct armada_crtc *dcrtc,
void (*fn)(struct armada_crtc *, struct armada_plane_work *))
{
struct armada_plane *dplane = drm_to_armada_plane(work->plane);
struct drm_pending_vblank_event *event = work->event;
struct drm_framebuffer *fb = work->old_fb;
if (fn)
fn(dcrtc, work);
drm_crtc_vblank_put(&dcrtc->crtc);
/* Finally, queue the process-half of the cleanup. */
if (fb)
armada_drm_queue_unref_work(dcrtc->crtc.dev, fb);
if (event || fb) {
struct drm_device *dev = dcrtc->crtc.dev;
unsigned long flags;
spin_lock_irqsave(&dev->event_lock, flags);
if (event)
drm_crtc_send_vblank_event(&dcrtc->crtc, event);
if (fb)
__armada_drm_queue_unref_work(dev, fb);
spin_unlock_irqrestore(&dev->event_lock, flags);
}
wake_up(&dplane->frame_wait);
}
......@@ -281,15 +289,6 @@ static void armada_drm_crtc_finish_frame_work(struct armada_crtc *dcrtc,
struct armada_plane_work *work)
{
struct armada_frame_work *fwork = container_of(work, struct armada_frame_work, work);
unsigned long flags;
if (fwork->event) {
struct drm_device *dev = dcrtc->crtc.dev;
spin_lock_irqsave(&dev->event_lock, flags);
drm_crtc_send_vblank_event(&dcrtc->crtc, fwork->event);
spin_unlock_irqrestore(&dev->event_lock, flags);
}
kfree(fwork);
}
......@@ -1032,7 +1031,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
if (!work)
return -ENOMEM;
work->event = event;
work->work.event = event;
work->work.old_fb = dcrtc->crtc.primary->fb;
i = armada_drm_crtc_calc_fb(fb, crtc->x, crtc->y, work->regs,
......
......@@ -40,6 +40,7 @@ struct armada_plane_work {
void (*cancel)(struct armada_crtc *, struct armada_plane_work *);
struct drm_plane *plane;
struct drm_framebuffer *old_fb;
struct drm_pending_vblank_event *event;
};
struct armada_plane_state {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment