diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-07-07 10:56:20 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-12-08 07:17:23 -0500 |
commit | 2839d45c7d92a521364347dbd023d218a5913e26 (patch) | |
tree | 1b4db4aeca88a1029f7b577bd8e767e71c3d7c86 | |
parent | eaab01307554175a004ad60728beb691cc841a8c (diff) |
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: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.h | 1 |
2 files changed, 17 insertions, 7 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 4d3db441466e..f10ab0275ce7 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c | |||
@@ -216,6 +216,19 @@ static unsigned armada_drm_crtc_calc_fb(struct drm_framebuffer *fb, | |||
216 | return i; | 216 | return i; |
217 | } | 217 | } |
218 | 218 | ||
219 | static void armada_drm_plane_work_call(struct armada_crtc *dcrtc, | ||
220 | struct armada_plane_work *work, | ||
221 | void (*fn)(struct armada_crtc *, struct armada_plane_work *)) | ||
222 | { | ||
223 | struct armada_plane *dplane = drm_to_armada_plane(work->plane); | ||
224 | |||
225 | if (fn) | ||
226 | fn(dcrtc, work); | ||
227 | drm_crtc_vblank_put(&dcrtc->crtc); | ||
228 | |||
229 | wake_up(&dplane->frame_wait); | ||
230 | } | ||
231 | |||
219 | static void armada_drm_plane_work_run(struct armada_crtc *dcrtc, | 232 | static void armada_drm_plane_work_run(struct armada_crtc *dcrtc, |
220 | struct drm_plane *plane) | 233 | struct drm_plane *plane) |
221 | { | 234 | { |
@@ -223,12 +236,8 @@ static void armada_drm_plane_work_run(struct armada_crtc *dcrtc, | |||
223 | struct armada_plane_work *work = xchg(&dplane->work, NULL); | 236 | struct armada_plane_work *work = xchg(&dplane->work, NULL); |
224 | 237 | ||
225 | /* Handle any pending frame work. */ | 238 | /* Handle any pending frame work. */ |
226 | if (work) { | 239 | if (work) |
227 | work->fn(dcrtc, work); | 240 | armada_drm_plane_work_call(dcrtc, work, work->fn); |
228 | drm_crtc_vblank_put(&dcrtc->crtc); | ||
229 | } | ||
230 | |||
231 | wake_up(&dplane->frame_wait); | ||
232 | } | 241 | } |
233 | 242 | ||
234 | int armada_drm_plane_work_queue(struct armada_crtc *dcrtc, | 243 | 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 | struct armada_plane_work *work = xchg(&dplane->work, NULL); | 270 | struct armada_plane_work *work = xchg(&dplane->work, NULL); |
262 | 271 | ||
263 | if (work) | 272 | if (work) |
264 | drm_crtc_vblank_put(&dcrtc->crtc); | 273 | armada_drm_plane_work_call(dcrtc, work, work->cancel); |
265 | } | 274 | } |
266 | 275 | ||
267 | static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc, | 276 | static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc, |
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h index 821c0dd21e45..c26814c2ce08 100644 --- a/drivers/gpu/drm/armada/armada_crtc.h +++ b/drivers/gpu/drm/armada/armada_crtc.h | |||
@@ -37,6 +37,7 @@ struct armada_variant; | |||
37 | 37 | ||
38 | struct armada_plane_work { | 38 | struct armada_plane_work { |
39 | void (*fn)(struct armada_crtc *, struct armada_plane_work *); | 39 | void (*fn)(struct armada_crtc *, struct armada_plane_work *); |
40 | void (*cancel)(struct armada_crtc *, struct armada_plane_work *); | ||
40 | struct drm_plane *plane; | 41 | struct drm_plane *plane; |
41 | }; | 42 | }; |
42 | 43 | ||