blob: 35ec6c45e190464035619edafce532898d8e8bcb [file] [log] [blame]
Gustavo Padovand4cab382016-04-28 10:46:54 -03001/*
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>
21#include <linux/fence.h>
Gustavo Padovana02b9dc2016-08-05 10:39:35 -030022#include <linux/fence-array.h>
Gustavo Padovand4cab382016-04-28 10:46:54 -030023
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 Padovand4cab382016-04-28 10:46:54 -030030 * @wq: wait queue for fence signaling
Gustavo Padovana02b9dc2016-08-05 10:39:35 -030031 * @fence: fence with the fences in the sync_file
32 * @cb: fence callback information
Gustavo Padovand4cab382016-04-28 10:46:54 -030033 */
34struct 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 Padovand4cab382016-04-28 10:46:54 -030041
42 wait_queue_head_t wq;
Chris Wilson74fa0af2017-07-28 22:29:51 +010043 unsigned long flags;
Gustavo Padovand4cab382016-04-28 10:46:54 -030044
Gustavo Padovana02b9dc2016-08-05 10:39:35 -030045 struct fence *fence;
46 struct fence_cb cb;
Gustavo Padovand4cab382016-04-28 10:46:54 -030047};
48
Chris Wilson74fa0af2017-07-28 22:29:51 +010049#define POLL_ENABLED 0
Gustavo Padovane2416552016-08-05 10:39:38 -030050
Gustavo Padovand4cab382016-04-28 10:46:54 -030051struct sync_file *sync_file_create(struct fence *fence);
Gustavo Padovan972526a2016-08-05 10:39:36 -030052struct fence *sync_file_get_fence(int fd);
Gustavo Padovand4cab382016-04-28 10:46:54 -030053
54#endif /* _LINUX_SYNC_H */