![]() |
|
|||
0001 /* 0002 * Copyright (C) 2013 Red Hat 0003 * 0004 * Permission is hereby granted, free of charge, to any person obtaining a 0005 * copy of this software and associated documentation files (the "Software"), 0006 * to deal in the Software without restriction, including without limitation 0007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0008 * and/or sell copies of the Software, and to permit persons to whom the 0009 * Software is furnished to do so, subject to the following conditions: 0010 * 0011 * The above copyright notice and this permission notice (including the next 0012 * paragraph) shall be included in all copies or substantial portions of the 0013 * Software. 0014 * 0015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0018 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 0020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 0021 * SOFTWARE. 0022 */ 0023 0024 #ifndef DRM_FLIP_WORK_H 0025 #define DRM_FLIP_WORK_H 0026 0027 #include <linux/kfifo.h> 0028 #include <linux/spinlock.h> 0029 #include <linux/workqueue.h> 0030 0031 /** 0032 * DOC: flip utils 0033 * 0034 * Util to queue up work to run from work-queue context after flip/vblank. 0035 * Typically this can be used to defer unref of framebuffer's, cursor 0036 * bo's, etc until after vblank. The APIs are all thread-safe. 0037 * Moreover, drm_flip_work_queue_task and drm_flip_work_queue can be called 0038 * in atomic context. 0039 */ 0040 0041 struct drm_flip_work; 0042 0043 /* 0044 * drm_flip_func_t - callback function 0045 * 0046 * @work: the flip work 0047 * @val: value queued via drm_flip_work_queue() 0048 * 0049 * Callback function to be called for each of the queue'd work items after 0050 * drm_flip_work_commit() is called. 0051 */ 0052 typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val); 0053 0054 /** 0055 * struct drm_flip_task - flip work task 0056 * @node: list entry element 0057 * @data: data to pass to &drm_flip_work.func 0058 */ 0059 struct drm_flip_task { 0060 struct list_head node; 0061 void *data; 0062 }; 0063 0064 /** 0065 * struct drm_flip_work - flip work queue 0066 * @name: debug name 0067 * @func: callback fxn called for each committed item 0068 * @worker: worker which calls @func 0069 * @queued: queued tasks 0070 * @commited: commited tasks 0071 * @lock: lock to access queued and commited lists 0072 */ 0073 struct drm_flip_work { 0074 const char *name; 0075 drm_flip_func_t func; 0076 struct work_struct worker; 0077 struct list_head queued; 0078 struct list_head commited; 0079 spinlock_t lock; 0080 }; 0081 0082 struct drm_flip_task *drm_flip_work_allocate_task(void *data, gfp_t flags); 0083 void drm_flip_work_queue_task(struct drm_flip_work *work, 0084 struct drm_flip_task *task); 0085 void drm_flip_work_queue(struct drm_flip_work *work, void *val); 0086 void drm_flip_work_commit(struct drm_flip_work *work, 0087 struct workqueue_struct *wq); 0088 void drm_flip_work_init(struct drm_flip_work *work, 0089 const char *name, drm_flip_func_t func); 0090 void drm_flip_work_cleanup(struct drm_flip_work *work); 0091 0092 #endif /* DRM_FLIP_WORK_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |