Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 1 | /* |
| 2 | * include/linux/sync_file.h |
| 3 | * |
| 4 | * Copyright (C) 2012 Google, Inc. |
| 5 | * |
| 6 | * This program is distributed in the hope that it will be useful, |
| 7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 | * GNU General Public License for more details. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #ifndef _LINUX_SYNC_FILE_H |
| 14 | #define _LINUX_SYNC_FILE_H |
| 15 | |
| 16 | #include <linux/types.h> |
| 17 | #include <linux/kref.h> |
| 18 | #include <linux/ktime.h> |
| 19 | #include <linux/list.h> |
| 20 | #include <linux/spinlock.h> |
Chris Wilson | f54d186 | 2016-10-25 13:00:45 +0100 | [diff] [blame] | 21 | #include <linux/dma-fence.h> |
| 22 | #include <linux/dma-fence-array.h> |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * struct sync_file - sync file to export to the userspace |
| 26 | * @file: file representing this fence |
| 27 | * @kref: reference count on fence. |
| 28 | * @name: name of sync_file. Useful for debugging |
| 29 | * @sync_file_list: membership in global file list |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 30 | * @wq: wait queue for fence signaling |
Gustavo Padovan | a02b9dc | 2016-08-05 10:39:35 -0300 | [diff] [blame] | 31 | * @fence: fence with the fences in the sync_file |
| 32 | * @cb: fence callback information |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 33 | */ |
| 34 | struct sync_file { |
| 35 | struct file *file; |
| 36 | struct kref kref; |
| 37 | char name[32]; |
| 38 | #ifdef CONFIG_DEBUG_FS |
| 39 | struct list_head sync_file_list; |
| 40 | #endif |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 41 | |
| 42 | wait_queue_head_t wq; |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 43 | |
Chris Wilson | f54d186 | 2016-10-25 13:00:45 +0100 | [diff] [blame] | 44 | struct dma_fence *fence; |
| 45 | struct dma_fence_cb cb; |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 46 | }; |
| 47 | |
Chris Wilson | f54d186 | 2016-10-25 13:00:45 +0100 | [diff] [blame] | 48 | #define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS |
Gustavo Padovan | e241655 | 2016-08-05 10:39:38 -0300 | [diff] [blame] | 49 | |
Chris Wilson | f54d186 | 2016-10-25 13:00:45 +0100 | [diff] [blame] | 50 | struct sync_file *sync_file_create(struct dma_fence *fence); |
| 51 | struct dma_fence *sync_file_get_fence(int fd); |
Gustavo Padovan | d4cab38 | 2016-04-28 10:46:54 -0300 | [diff] [blame] | 52 | |
| 53 | #endif /* _LINUX_SYNC_H */ |