Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 
0003 #ifndef _DRM_VBLANK_WORK_H_
0004 #define _DRM_VBLANK_WORK_H_
0005 
0006 #include <linux/kthread.h>
0007 
0008 struct drm_crtc;
0009 
0010 /**
0011  * struct drm_vblank_work - A delayed work item which delays until a target
0012  * vblank passes, and then executes at realtime priority outside of IRQ
0013  * context.
0014  *
0015  * See also:
0016  * drm_vblank_work_schedule()
0017  * drm_vblank_work_init()
0018  * drm_vblank_work_cancel_sync()
0019  * drm_vblank_work_flush()
0020  */
0021 struct drm_vblank_work {
0022     /**
0023      * @base: The base &kthread_work item which will be executed by
0024      * &drm_vblank_crtc.worker. Drivers should not interact with this
0025      * directly, and instead rely on drm_vblank_work_init() to initialize
0026      * this.
0027      */
0028     struct kthread_work base;
0029 
0030     /**
0031      * @vblank: A pointer to &drm_vblank_crtc this work item belongs to.
0032      */
0033     struct drm_vblank_crtc *vblank;
0034 
0035     /**
0036      * @count: The target vblank this work will execute on. Drivers should
0037      * not modify this value directly, and instead use
0038      * drm_vblank_work_schedule()
0039      */
0040     u64 count;
0041 
0042     /**
0043      * @cancelling: The number of drm_vblank_work_cancel_sync() calls that
0044      * are currently running. A work item cannot be rescheduled until all
0045      * calls have finished.
0046      */
0047     int cancelling;
0048 
0049     /**
0050      * @node: The position of this work item in
0051      * &drm_vblank_crtc.pending_work.
0052      */
0053     struct list_head node;
0054 };
0055 
0056 /**
0057  * to_drm_vblank_work - Retrieve the respective &drm_vblank_work item from a
0058  * &kthread_work
0059  * @_work: The &kthread_work embedded inside a &drm_vblank_work
0060  */
0061 #define to_drm_vblank_work(_work) \
0062     container_of((_work), struct drm_vblank_work, base)
0063 
0064 int drm_vblank_work_schedule(struct drm_vblank_work *work,
0065                  u64 count, bool nextonmiss);
0066 void drm_vblank_work_init(struct drm_vblank_work *work, struct drm_crtc *crtc,
0067               void (*func)(struct kthread_work *work));
0068 bool drm_vblank_work_cancel_sync(struct drm_vblank_work *work);
0069 void drm_vblank_work_flush(struct drm_vblank_work *work);
0070 
0071 #endif /* !_DRM_VBLANK_WORK_H_ */