Lines Matching full:work
46 static void drm_flip_work_queue_task(struct drm_flip_work *work, struct drm_flip_task *task) in drm_flip_work_queue_task() argument
50 spin_lock_irqsave(&work->lock, flags); in drm_flip_work_queue_task()
51 list_add_tail(&task->node, &work->queued); in drm_flip_work_queue_task()
52 spin_unlock_irqrestore(&work->lock, flags); in drm_flip_work_queue_task()
56 * drm_flip_work_queue - queue work
57 * @work: the flip-work
60 * Queues work, that will later be run (passed back to drm_flip_func_t
61 * func) on a work queue after drm_flip_work_commit() is called.
63 void drm_flip_work_queue(struct drm_flip_work *work, void *val) in drm_flip_work_queue() argument
70 drm_flip_work_queue_task(work, task); in drm_flip_work_queue()
72 DRM_ERROR("%s could not allocate task!\n", work->name); in drm_flip_work_queue()
73 work->func(work, val); in drm_flip_work_queue()
79 * drm_flip_work_commit - commit queued work
80 * @work: the flip-work
81 * @wq: the work-queue to run the queued work on
83 * Trigger work previously queued by drm_flip_work_queue() to run
84 * on a workqueue. The typical usage would be to queue work (via
86 * prior), and then from vblank irq commit the queued work.
88 void drm_flip_work_commit(struct drm_flip_work *work, in drm_flip_work_commit() argument
93 spin_lock_irqsave(&work->lock, flags); in drm_flip_work_commit()
94 list_splice_tail(&work->queued, &work->commited); in drm_flip_work_commit()
95 INIT_LIST_HEAD(&work->queued); in drm_flip_work_commit()
96 spin_unlock_irqrestore(&work->lock, flags); in drm_flip_work_commit()
97 queue_work(wq, &work->worker); in drm_flip_work_commit()
103 struct drm_flip_work *work = container_of(w, struct drm_flip_work, worker); in flip_worker() local
111 spin_lock_irqsave(&work->lock, flags); in flip_worker()
112 list_splice_tail(&work->commited, &tasks); in flip_worker()
113 INIT_LIST_HEAD(&work->commited); in flip_worker()
114 spin_unlock_irqrestore(&work->lock, flags); in flip_worker()
120 work->func(work, task->data); in flip_worker()
127 * drm_flip_work_init - initialize flip-work
128 * @work: the flip-work to initialize
130 * @func: the callback work function
132 * Initializes/allocates resources for the flip-work
134 void drm_flip_work_init(struct drm_flip_work *work, in drm_flip_work_init() argument
137 work->name = name; in drm_flip_work_init()
138 INIT_LIST_HEAD(&work->queued); in drm_flip_work_init()
139 INIT_LIST_HEAD(&work->commited); in drm_flip_work_init()
140 spin_lock_init(&work->lock); in drm_flip_work_init()
141 work->func = func; in drm_flip_work_init()
143 INIT_WORK(&work->worker, flip_worker); in drm_flip_work_init()
148 * drm_flip_work_cleanup - cleans up flip-work
149 * @work: the flip-work to cleanup
151 * Destroy resources allocated for the flip-work
153 void drm_flip_work_cleanup(struct drm_flip_work *work) in drm_flip_work_cleanup() argument
155 WARN_ON(!list_empty(&work->queued) || !list_empty(&work->commited)); in drm_flip_work_cleanup()