blob: e964c751f6b8f6149617be8ffb9f0758afe84b7f [file] [log] [blame]
Christopher Ferris6ea19f62013-11-20 19:48:48 -08001/*
2 * Copyright (C) 2012 Google, Inc.
3 *
4 * This program is distributed in the hope that it will be useful,
5 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 * GNU General Public License for more details.
8 *
9 */
10
11#ifndef _UAPI_LINUX_SYNC_H
12#define _UAPI_LINUX_SYNC_H
13
14#include <linux/ioctl.h>
15#include <linux/types.h>
16
17/**
18 * struct sync_merge_data - data passed to merge ioctl
19 * @fd2: file descriptor of second fence
20 * @name: name of new fence
21 * @fence: returns the fd of the new fence to userspace
22 */
23struct sync_merge_data {
24 __s32 fd2; /* fd of second fence */
25 char name[32]; /* name of new fence */
26 __s32 fence; /* fd on newly created fence */
27};
28
29/**
30 * struct sync_pt_info - detailed sync_pt information
31 * @len: length of sync_pt_info including any driver_data
32 * @obj_name: name of parent sync_timeline
Christopher Ferris31475242014-09-02 17:43:51 -070033 * @driver_name: name of driver implementing the parent
Christopher Ferris6ea19f62013-11-20 19:48:48 -080034 * @status: status of the sync_pt 0:active 1:signaled <0:error
35 * @timestamp_ns: timestamp of status change in nanoseconds
Christopher Ferris31475242014-09-02 17:43:51 -070036 * @driver_data: any driver dependent data
Christopher Ferris6ea19f62013-11-20 19:48:48 -080037 */
38struct sync_pt_info {
39 __u32 len;
40 char obj_name[32];
41 char driver_name[32];
42 __s32 status;
43 __u64 timestamp_ns;
44
45 __u8 driver_data[0];
46};
47
48/**
49 * struct sync_fence_info_data - data returned from fence info ioctl
50 * @len: ioctl caller writes the size of the buffer its passing in.
Christopher Ferris31475242014-09-02 17:43:51 -070051 * ioctl returns length of sync_fence_data returned to userspace
Christopher Ferris6ea19f62013-11-20 19:48:48 -080052 * including pt_info.
53 * @name: name of fence
54 * @status: status of fence. 1: signaled 0:active <0:error
55 * @pt_info: a sync_pt_info struct for every sync_pt in the fence
56 */
57struct sync_fence_info_data {
58 __u32 len;
59 char name[32];
60 __s32 status;
61
62 __u8 pt_info[0];
63};
64
65#define SYNC_IOC_MAGIC '>'
66
67/**
68 * DOC: SYNC_IOC_WAIT - wait for a fence to signal
69 *
70 * pass timeout in milliseconds. Waits indefinitely timeout < 0.
71 */
72#define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32)
73
74/**
75 * DOC: SYNC_IOC_MERGE - merge two fences
76 *
77 * Takes a struct sync_merge_data. Creates a new fence containing copies of
78 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
79 * new fence's fd in sync_merge_data.fence
80 */
81#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 1, struct sync_merge_data)
82
83/**
84 * DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence
85 *
86 * Takes a struct sync_fence_info_data with extra space allocated for pt_info.
87 * Caller should write the size of the buffer into len. On return, len is
88 * updated to reflect the total size of the sync_fence_info_data including
89 * pt_info.
90 *
91 * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
Christopher Ferris31475242014-09-02 17:43:51 -070092 * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
Christopher Ferris6ea19f62013-11-20 19:48:48 -080093 */
94#define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
95 struct sync_fence_info_data)
96
97#endif /* _UAPI_LINUX_SYNC_H */