blob: 5b287d6970b3a06677b8f55cfbd0bdc162c61181 [file] [log] [blame]
Christopher Ferrisccfaccd2016-08-24 12:11:31 -07001/*
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 * @name: name of new fence
20 * @fd2: file descriptor of second fence
21 * @fence: returns the fd of the new fence to userspace
22 * @flags: merge_data flags
23 * @pad: padding for 64-bit alignment, should always be zero
24 */
25struct sync_merge_data {
26 char name[32];
27 __s32 fd2;
28 __s32 fence;
29 __u32 flags;
30 __u32 pad;
31};
32
33/**
34 * struct sync_fence_info - detailed fence information
35 * @obj_name: name of parent sync_timeline
36* @driver_name: name of driver implementing the parent
37* @status: status of the fence 0:active 1:signaled <0:error
38 * @flags: fence_info flags
39 * @timestamp_ns: timestamp of status change in nanoseconds
40 */
41struct sync_fence_info {
42 char obj_name[32];
43 char driver_name[32];
44 __s32 status;
45 __u32 flags;
46 __u64 timestamp_ns;
47};
48
49/**
50 * struct sync_file_info - data returned from fence info ioctl
51 * @name: name of fence
52 * @status: status of fence. 1: signaled 0:active <0:error
53 * @flags: sync_file_info flags
54 * @num_fences number of fences in the sync_file
55 * @pad: padding for 64-bit alignment, should always be zero
56 * @sync_fence_info: pointer to array of structs sync_fence_info with all
57 * fences in the sync_file
58 */
59struct sync_file_info {
60 char name[32];
61 __s32 status;
62 __u32 flags;
63 __u32 num_fences;
64 __u32 pad;
65
66 __u64 sync_fence_info;
67};
68
69#define SYNC_IOC_MAGIC '>'
70
71/**
72 * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
73 * old API to get weird errors when trying to handling sync_files. The API
74 * change happened during the de-stage of the Sync Framework when there was
75 * no upstream users available.
76 */
77
78/**
79 * DOC: SYNC_IOC_MERGE - merge two fences
80 *
81 * Takes a struct sync_merge_data. Creates a new fence containing copies of
82 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
83 * new fence's fd in sync_merge_data.fence
84 */
85#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
86
87/**
Christopher Ferris33185402017-01-13 13:28:52 -080088 * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
Christopher Ferrisccfaccd2016-08-24 12:11:31 -070089 *
Christopher Ferris33185402017-01-13 13:28:52 -080090 * Takes a struct sync_file_info. If num_fences is 0, the field is updated
91 * with the actual number of fences. If num_fences is > 0, the system will
92 * use the pointer provided on sync_fence_info to return up to num_fences of
93 * struct sync_fence_info, with detailed fence information.
Christopher Ferrisccfaccd2016-08-24 12:11:31 -070094 */
95#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
96
97#endif /* _UAPI_LINUX_SYNC_H */