1 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
3 * Copyright (C) 2012 Google, Inc.
5 * This program is distributed in the hope that it will be useful,
6 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 * GNU General Public License for more details.
12 #ifndef _UAPI_LINUX_SYNC_H
13 #define _UAPI_LINUX_SYNC_H
15 #include <linux/ioctl.h>
16 #include <linux/types.h>
19 * struct sync_merge_data - SYNC_IOC_MERGE: merge two fences
20 * @name: name of new fence
21 * @fd2: file descriptor of second fence
22 * @fence: returns the fd of the new fence to userspace
23 * @flags: merge_data flags
24 * @pad: padding for 64-bit alignment, should always be zero
26 * Creates a new fence containing copies of the sync_pts in both
27 * the calling fd and sync_merge_data.fd2. Returns the new fence's
28 * fd in sync_merge_data.fence
30 struct sync_merge_data {
39 * struct sync_fence_info - detailed fence information
40 * @obj_name: name of parent sync_timeline
41 * @driver_name: name of driver implementing the parent
42 * @status: status of the fence 0:active 1:signaled <0:error
43 * @flags: fence_info flags
44 * @timestamp_ns: timestamp of status change in nanoseconds
46 struct sync_fence_info {
55 * struct sync_file_info - SYNC_IOC_FILE_INFO: get detailed information on a sync_file
56 * @name: name of fence
57 * @status: status of fence. 1: signaled 0:active <0:error
58 * @flags: sync_file_info flags
59 * @num_fences: number of fences in the sync_file
60 * @pad: padding for 64-bit alignment, should always be zero
61 * @sync_fence_info: pointer to array of struct &sync_fence_info with all
62 * fences in the sync_file
64 * Takes a struct sync_file_info. If num_fences is 0, the field is updated
65 * with the actual number of fences. If num_fences is > 0, the system will
66 * use the pointer provided on sync_fence_info to return up to num_fences of
67 * struct sync_fence_info, with detailed fence information.
69 struct sync_file_info {
76 __u64 sync_fence_info;
80 * struct sync_set_deadline - SYNC_IOC_SET_DEADLINE - set a deadline hint on a fence
81 * @deadline_ns: absolute time of the deadline
84 * Allows userspace to set a deadline on a fence, see &dma_fence_set_deadline
86 * The timebase for the deadline is CLOCK_MONOTONIC (same as vblank). For
89 * clock_gettime(CLOCK_MONOTONIC, &t);
90 * deadline_ns = (t.tv_sec * 1000000000L) + t.tv_nsec + ns_until_deadline
92 struct sync_set_deadline {
94 /* Not strictly needed for alignment but gives some possibility
95 * for future extension:
100 #define SYNC_IOC_MAGIC '>'
103 * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
104 * old API to get weird errors when trying to handling sync_files. The API
105 * change happened during the de-stage of the Sync Framework when there was
106 * no upstream users available.
109 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
110 #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
111 #define SYNC_IOC_SET_DEADLINE _IOW(SYNC_IOC_MAGIC, 5, struct sync_set_deadline)
113 #endif /* _UAPI_LINUX_SYNC_H */