Lines Matching full:vblank
13 * DOC: vblank works
39 * particular vblank has passed, and then executes the work at realtime
46 void drm_handle_vblank_works(struct drm_vblank_crtc *vblank) in drm_handle_vblank_works() argument
49 u64 count = atomic64_read(&vblank->count); in drm_handle_vblank_works()
52 assert_spin_locked(&vblank->dev->event_lock); in drm_handle_vblank_works()
54 list_for_each_entry_safe(work, next, &vblank->pending_work, node) { in drm_handle_vblank_works()
59 drm_vblank_put(vblank->dev, vblank->pipe); in drm_handle_vblank_works()
60 kthread_queue_work(vblank->worker, &work->base); in drm_handle_vblank_works()
64 wake_up_all(&vblank->work_wait_queue); in drm_handle_vblank_works()
67 /* Handle cancelling any pending vblank work items and drop respective vblank
68 * references in response to vblank interrupts being disabled.
70 void drm_vblank_cancel_pending_works(struct drm_vblank_crtc *vblank) in drm_vblank_cancel_pending_works() argument
74 assert_spin_locked(&vblank->dev->event_lock); in drm_vblank_cancel_pending_works()
76 list_for_each_entry_safe(work, next, &vblank->pending_work, node) { in drm_vblank_cancel_pending_works()
78 drm_vblank_put(vblank->dev, vblank->pipe); in drm_vblank_cancel_pending_works()
81 wake_up_all(&vblank->work_wait_queue); in drm_vblank_cancel_pending_works()
85 * drm_vblank_work_schedule - schedule a vblank work
86 * @work: vblank work to schedule
87 * @count: target vblank count
88 * @nextonmiss: defer until the next vblank if target vblank was missed
90 * Schedule @work for execution once the crtc vblank count reaches @count.
92 * If the crtc vblank count has already reached @count and @nextonmiss is
95 * If the crtc vblank count has already reached @count and @nextonmiss is
96 * %true the work is deferred until the next vblank (as if @count has been
97 * specified as crtc vblank count + 1).
109 struct drm_vblank_crtc *vblank = work->vblank; in drm_vblank_work_schedule() local
110 struct drm_device *dev = vblank->dev; in drm_vblank_work_schedule()
121 inmodeset = vblank->inmodeset; in drm_vblank_work_schedule()
127 ret = drm_vblank_get(dev, vblank->pipe); in drm_vblank_work_schedule()
138 cur_vbl = drm_vblank_count(dev, vblank->pipe); in drm_vblank_work_schedule()
142 "crtc %d vblank %llu already passed (current %llu)\n", in drm_vblank_work_schedule()
143 vblank->pipe, count, cur_vbl); in drm_vblank_work_schedule()
146 drm_vblank_put(dev, vblank->pipe); in drm_vblank_work_schedule()
147 ret = kthread_queue_work(vblank->worker, &work->base); in drm_vblank_work_schedule()
155 list_add_tail(&work->node, &vblank->pending_work); in drm_vblank_work_schedule()
162 wake_up_all(&vblank->work_wait_queue); in drm_vblank_work_schedule()
168 * drm_vblank_work_cancel_sync - cancel a vblank work and wait for it to
170 * @work: vblank work to cancel
172 * Cancel an already scheduled vblank work and wait for its
184 struct drm_vblank_crtc *vblank = work->vblank; in drm_vblank_work_cancel_sync() local
185 struct drm_device *dev = vblank->dev; in drm_vblank_work_cancel_sync()
191 drm_vblank_put(vblank->dev, vblank->pipe); in drm_vblank_work_cancel_sync()
198 wake_up_all(&vblank->work_wait_queue); in drm_vblank_work_cancel_sync()
212 * drm_vblank_work_flush - wait for a scheduled vblank work to finish
214 * @work: vblank work to flush
220 struct drm_vblank_crtc *vblank = work->vblank; in drm_vblank_work_flush() local
221 struct drm_device *dev = vblank->dev; in drm_vblank_work_flush()
224 wait_event_lock_irq(vblank->work_wait_queue, list_empty(&work->node), in drm_vblank_work_flush()
233 * drm_vblank_work_init - initialize a vblank work item
234 * @work: vblank work item
235 * @crtc: CRTC whose vblank will trigger the work execution
238 * Initialize a vblank work item for a specific crtc.
245 work->vblank = &crtc->dev->vblank[drm_crtc_index(crtc)]; in drm_vblank_work_init()
249 int drm_vblank_worker_init(struct drm_vblank_crtc *vblank) in drm_vblank_worker_init() argument
253 INIT_LIST_HEAD(&vblank->pending_work); in drm_vblank_worker_init()
254 init_waitqueue_head(&vblank->work_wait_queue); in drm_vblank_worker_init()
256 vblank->dev->primary->index, in drm_vblank_worker_init()
257 vblank->pipe); in drm_vblank_worker_init()
261 vblank->worker = worker; in drm_vblank_worker_init()