mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / include / drm / drm_vblank_work.h
blobeb41d0810c4ff89f0a03bc62c3f9c4d294f40f25
1 /* SPDX-License-Identifier: MIT */
3 #ifndef _DRM_VBLANK_WORK_H_
4 #define _DRM_VBLANK_WORK_H_
6 #include <linux/kthread.h>
8 struct drm_crtc;
10 /**
11 * struct drm_vblank_work - A delayed work item which delays until a target
12 * vblank passes, and then executes at realtime priority outside of IRQ
13 * context.
15 * See also:
16 * drm_vblank_work_schedule()
17 * drm_vblank_work_init()
18 * drm_vblank_work_cancel_sync()
19 * drm_vblank_work_flush()
21 struct drm_vblank_work {
22 /**
23 * @base: The base &kthread_work item which will be executed by
24 * &drm_vblank_crtc.worker. Drivers should not interact with this
25 * directly, and instead rely on drm_vblank_work_init() to initialize
26 * this.
28 struct kthread_work base;
30 /**
31 * @vblank: A pointer to &drm_vblank_crtc this work item belongs to.
33 struct drm_vblank_crtc *vblank;
35 /**
36 * @count: The target vblank this work will execute on. Drivers should
37 * not modify this value directly, and instead use
38 * drm_vblank_work_schedule()
40 u64 count;
42 /**
43 * @cancelling: The number of drm_vblank_work_cancel_sync() calls that
44 * are currently running. A work item cannot be rescheduled until all
45 * calls have finished.
47 int cancelling;
49 /**
50 * @node: The position of this work item in
51 * &drm_vblank_crtc.pending_work.
53 struct list_head node;
56 /**
57 * to_drm_vblank_work - Retrieve the respective &drm_vblank_work item from a
58 * &kthread_work
59 * @_work: The &kthread_work embedded inside a &drm_vblank_work
61 #define to_drm_vblank_work(_work) \
62 container_of((_work), struct drm_vblank_work, base)
64 int drm_vblank_work_schedule(struct drm_vblank_work *work,
65 u64 count, bool nextonmiss);
66 void drm_vblank_work_init(struct drm_vblank_work *work, struct drm_crtc *crtc,
67 void (*func)(struct kthread_work *work));
68 bool drm_vblank_work_cancel_sync(struct drm_vblank_work *work);
69 void drm_vblank_work_flush(struct drm_vblank_work *work);
71 #endif /* !_DRM_VBLANK_WORK_H_ */