1 /* SPDX-License-Identifier: MIT */
3 #ifndef _DRM_VBLANK_WORK_H_
4 #define _DRM_VBLANK_WORK_H_
6 #include <linux/kthread.h>
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
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 {
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
28 struct kthread_work base;
31 * @vblank: A pointer to &drm_vblank_crtc this work item belongs to.
33 struct drm_vblank_crtc *vblank;
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()
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.
50 * @node: The position of this work item in
51 * &drm_vblank_crtc.pending_work.
53 struct list_head node;
57 * to_drm_vblank_work - Retrieve the respective &drm_vblank_work item from a
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_ */