blob: 413303d37b56b554384cc59585db8fcf9654b639 [file] [log] [blame]
Colin Cross64907b92014-02-17 13:58:32 -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
Colin Cross64907b92014-02-17 13:58:32 -080019 * @name: name of new fence
Gustavo Padovan2d75c882016-04-26 12:32:28 -030020 * @fd2: file descriptor of second fence
Colin Cross64907b92014-02-17 13:58:32 -080021 * @fence: returns the fd of the new fence to userspace
Gustavo Padovan2d75c882016-04-26 12:32:28 -030022 * @flags: merge_data flags
23 * @pad: padding for 64-bit alignment, should always be zero
Colin Cross64907b92014-02-17 13:58:32 -080024 */
25struct sync_merge_data {
Gustavo Padovana64d6a62016-04-28 10:46:48 -030026 char name[32];
27 __s32 fd2;
28 __s32 fence;
Gustavo Padovan2d75c882016-04-26 12:32:28 -030029 __u32 flags;
30 __u32 pad;
Colin Cross64907b92014-02-17 13:58:32 -080031};
32
33/**
Gustavo Padovane1786342016-02-03 11:25:31 -020034 * struct sync_fence_info - detailed fence information
Colin Cross64907b92014-02-17 13:58:32 -080035 * @obj_name: name of parent sync_timeline
Gustavo Padovana64d6a62016-04-28 10:46:48 -030036* @driver_name: name of driver implementing the parent
37* @status: status of the fence 0:active 1:signaled <0:error
Gustavo Padovan2d75c882016-04-26 12:32:28 -030038 * @flags: fence_info flags
Colin Cross64907b92014-02-17 13:58:32 -080039 * @timestamp_ns: timestamp of status change in nanoseconds
Colin Cross64907b92014-02-17 13:58:32 -080040 */
Gustavo Padovane1786342016-02-03 11:25:31 -020041struct sync_fence_info {
Colin Cross64907b92014-02-17 13:58:32 -080042 char obj_name[32];
43 char driver_name[32];
44 __s32 status;
Gustavo Padovan2d75c882016-04-26 12:32:28 -030045 __u32 flags;
Colin Cross64907b92014-02-17 13:58:32 -080046 __u64 timestamp_ns;
Colin Cross64907b92014-02-17 13:58:32 -080047};
48
49/**
Gustavo Padovanb5b24ac2016-02-03 11:25:32 -020050 * struct sync_file_info - data returned from fence info ioctl
Colin Cross64907b92014-02-17 13:58:32 -080051 * @name: name of fence
52 * @status: status of fence. 1: signaled 0:active <0:error
Gustavo Padovan2d75c882016-04-26 12:32:28 -030053 * @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
Colin Cross64907b92014-02-17 13:58:32 -080058 */
Gustavo Padovanb5b24ac2016-02-03 11:25:32 -020059struct sync_file_info {
Colin Cross64907b92014-02-17 13:58:32 -080060 char name[32];
61 __s32 status;
Gustavo Padovan2d75c882016-04-26 12:32:28 -030062 __u32 flags;
63 __u32 num_fences;
64 __u32 pad;
Colin Cross64907b92014-02-17 13:58:32 -080065
Gustavo Padovan2d75c882016-04-26 12:32:28 -030066 __u64 sync_fence_info;
Colin Cross64907b92014-02-17 13:58:32 -080067};
68
69#define SYNC_IOC_MAGIC '>'
70
71/**
Gustavo Padovan2d75c882016-04-26 12:32:28 -030072 * 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/**
Colin Cross64907b92014-02-17 13:58:32 -080079 * 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 */
Gustavo Padovan2d75c882016-04-26 12:32:28 -030085#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
Colin Cross64907b92014-02-17 13:58:32 -080086
87/**
88 * DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence
89 *
Gustavo Padovand7fdb0a2016-01-21 10:49:19 -020090 * Takes a struct sync_file_info_data with extra space allocated for pt_info.
Colin Cross64907b92014-02-17 13:58:32 -080091 * Caller should write the size of the buffer into len. On return, len is
Gustavo Padovand7fdb0a2016-01-21 10:49:19 -020092 * updated to reflect the total size of the sync_file_info_data including
Colin Cross64907b92014-02-17 13:58:32 -080093 * pt_info.
94 *
95 * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
96 * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
97 */
Gustavo Padovan2d75c882016-04-26 12:32:28 -030098#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
Colin Cross64907b92014-02-17 13:58:32 -080099
100#endif /* _UAPI_LINUX_SYNC_H */