blob: ee2dcfb3d66028993ccea134ea93e19f6d925314 [file] [log] [blame]
Greg Kroah-Hartmane2be04c2017-11-01 15:09:13 +01001/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
Colin Cross64907b92014-02-17 13:58:32 -08002/*
3 * Copyright (C) 2012 Google, Inc.
4 *
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.
9 *
10 */
11
12#ifndef _UAPI_LINUX_SYNC_H
13#define _UAPI_LINUX_SYNC_H
14
15#include <linux/ioctl.h>
16#include <linux/types.h>
17
18/**
19 * struct sync_merge_data - data passed to merge ioctl
Colin Cross64907b92014-02-17 13:58:32 -080020 * @name: name of new fence
Gustavo Padovan2d75c882016-04-26 12:32:28 -030021 * @fd2: file descriptor of second fence
Colin Cross64907b92014-02-17 13:58:32 -080022 * @fence: returns the fd of the new fence to userspace
Gustavo Padovan2d75c882016-04-26 12:32:28 -030023 * @flags: merge_data flags
24 * @pad: padding for 64-bit alignment, should always be zero
Colin Cross64907b92014-02-17 13:58:32 -080025 */
26struct sync_merge_data {
Gustavo Padovana64d6a62016-04-28 10:46:48 -030027 char name[32];
28 __s32 fd2;
29 __s32 fence;
Gustavo Padovan2d75c882016-04-26 12:32:28 -030030 __u32 flags;
31 __u32 pad;
Colin Cross64907b92014-02-17 13:58:32 -080032};
33
34/**
Gustavo Padovane1786342016-02-03 11:25:31 -020035 * struct sync_fence_info - detailed fence information
Colin Cross64907b92014-02-17 13:58:32 -080036 * @obj_name: name of parent sync_timeline
Gustavo Padovana64d6a62016-04-28 10:46:48 -030037* @driver_name: name of driver implementing the parent
38* @status: status of the fence 0:active 1:signaled <0:error
Gustavo Padovan2d75c882016-04-26 12:32:28 -030039 * @flags: fence_info flags
Colin Cross64907b92014-02-17 13:58:32 -080040 * @timestamp_ns: timestamp of status change in nanoseconds
Colin Cross64907b92014-02-17 13:58:32 -080041 */
Gustavo Padovane1786342016-02-03 11:25:31 -020042struct sync_fence_info {
Colin Cross64907b92014-02-17 13:58:32 -080043 char obj_name[32];
44 char driver_name[32];
45 __s32 status;
Gustavo Padovan2d75c882016-04-26 12:32:28 -030046 __u32 flags;
Colin Cross64907b92014-02-17 13:58:32 -080047 __u64 timestamp_ns;
Colin Cross64907b92014-02-17 13:58:32 -080048};
49
50/**
Gustavo Padovanb5b24ac2016-02-03 11:25:32 -020051 * struct sync_file_info - data returned from fence info ioctl
Colin Cross64907b92014-02-17 13:58:32 -080052 * @name: name of fence
53 * @status: status of fence. 1: signaled 0:active <0:error
Gustavo Padovan2d75c882016-04-26 12:32:28 -030054 * @flags: sync_file_info flags
55 * @num_fences number of fences in the sync_file
56 * @pad: padding for 64-bit alignment, should always be zero
57 * @sync_fence_info: pointer to array of structs sync_fence_info with all
58 * fences in the sync_file
Colin Cross64907b92014-02-17 13:58:32 -080059 */
Gustavo Padovanb5b24ac2016-02-03 11:25:32 -020060struct sync_file_info {
Colin Cross64907b92014-02-17 13:58:32 -080061 char name[32];
62 __s32 status;
Gustavo Padovan2d75c882016-04-26 12:32:28 -030063 __u32 flags;
64 __u32 num_fences;
65 __u32 pad;
Colin Cross64907b92014-02-17 13:58:32 -080066
Gustavo Padovan2d75c882016-04-26 12:32:28 -030067 __u64 sync_fence_info;
Colin Cross64907b92014-02-17 13:58:32 -080068};
69
70#define SYNC_IOC_MAGIC '>'
71
72/**
Gustavo Padovan2d75c882016-04-26 12:32:28 -030073 * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
74 * old API to get weird errors when trying to handling sync_files. The API
75 * change happened during the de-stage of the Sync Framework when there was
76 * no upstream users available.
77 */
78
79/**
Colin Cross64907b92014-02-17 13:58:32 -080080 * DOC: SYNC_IOC_MERGE - merge two fences
81 *
82 * Takes a struct sync_merge_data. Creates a new fence containing copies of
83 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
84 * new fence's fd in sync_merge_data.fence
85 */
Gustavo Padovan2d75c882016-04-26 12:32:28 -030086#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
Colin Cross64907b92014-02-17 13:58:32 -080087
88/**
Emilio López823d1bc2016-09-19 01:21:20 -030089 * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
Colin Cross64907b92014-02-17 13:58:32 -080090 *
Emilio López823d1bc2016-09-19 01:21:20 -030091 * Takes a struct sync_file_info. If num_fences is 0, the field is updated
92 * with the actual number of fences. If num_fences is > 0, the system will
93 * use the pointer provided on sync_fence_info to return up to num_fences of
94 * struct sync_fence_info, with detailed fence information.
Colin Cross64907b92014-02-17 13:58:32 -080095 */
Gustavo Padovan2d75c882016-04-26 12:32:28 -030096#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
Colin Cross64907b92014-02-17 13:58:32 -080097
98#endif /* _UAPI_LINUX_SYNC_H */