Commit 2839d45c authored by Russell King's avatar Russell King

drm/armada: add work cancel callback

Add a work cancel callback, so that work items can add functionality to
clean themselves up when they are cancelled.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent eaab0130
...@@ -216,6 +216,19 @@ static unsigned armada_drm_crtc_calc_fb(struct drm_framebuffer *fb, ...@@ -216,6 +216,19 @@ static unsigned armada_drm_crtc_calc_fb(struct drm_framebuffer *fb,
return i; return i;
} }
static void armada_drm_plane_work_call(struct armada_crtc *dcrtc,
struct armada_plane_work *work,
void (*fn)(struct armada_crtc *, struct armada_plane_work *))
{
struct armada_plane *dplane = drm_to_armada_plane(work->plane);
if (fn)
fn(dcrtc, work);
drm_crtc_vblank_put(&dcrtc->crtc);
wake_up(&dplane->frame_wait);
}
static void armada_drm_plane_work_run(struct armada_crtc *dcrtc, static void armada_drm_plane_work_run(struct armada_crtc *dcrtc,
struct drm_plane *plane) struct drm_plane *plane)
{ {
...@@ -223,12 +236,8 @@ static void armada_drm_plane_work_run(struct armada_crtc *dcrtc, ...@@ -223,12 +236,8 @@ static void armada_drm_plane_work_run(struct armada_crtc *dcrtc,
struct armada_plane_work *work = xchg(&dplane->work, NULL); struct armada_plane_work *work = xchg(&dplane->work, NULL);
/* Handle any pending frame work. */ /* Handle any pending frame work. */
if (work) { if (work)
work->fn(dcrtc, work); armada_drm_plane_work_call(dcrtc, work, work->fn);
drm_crtc_vblank_put(&dcrtc->crtc);
}
wake_up(&dplane->frame_wait);
} }
int armada_drm_plane_work_queue(struct armada_crtc *dcrtc, int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
...@@ -261,7 +270,7 @@ void armada_drm_plane_work_cancel(struct armada_crtc *dcrtc, ...@@ -261,7 +270,7 @@ void armada_drm_plane_work_cancel(struct armada_crtc *dcrtc,
struct armada_plane_work *work = xchg(&dplane->work, NULL); struct armada_plane_work *work = xchg(&dplane->work, NULL);
if (work) if (work)
drm_crtc_vblank_put(&dcrtc->crtc); armada_drm_plane_work_call(dcrtc, work, work->cancel);
} }
static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc, static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc,
......
...@@ -37,6 +37,7 @@ struct armada_variant; ...@@ -37,6 +37,7 @@ struct armada_variant;
struct armada_plane_work { struct armada_plane_work {
void (*fn)(struct armada_crtc *, struct armada_plane_work *); void (*fn)(struct armada_crtc *, struct armada_plane_work *);
void (*cancel)(struct armada_crtc *, struct armada_plane_work *);
struct drm_plane *plane; struct drm_plane *plane;
}; };
......
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