1 /* 2 * SPDX-License-Identifier: GPL-1.0-or-later WITH Linux-syscall-note 3 * Copyright 2012 Google, Inc. 4 */ 5 6 #ifndef _UAPI_LINUX_SYNC_H 7 #define _UAPI_LINUX_SYNC_H 8 9 #if defined(__linux__) 10 11 #include <linux/ioctl.h> 12 #include <linux/types.h> 13 14 #else /* One of the BSDs */ 15 16 #include <stdint.h> 17 #include <sys/types.h> 18 #include <sys/ioccom.h> 19 20 typedef int8_t __s8; 21 typedef uint8_t __u8; 22 typedef int16_t __s16; 23 typedef uint16_t __u16; 24 typedef int32_t __s32; 25 typedef uint32_t __u32; 26 typedef int64_t __s64; 27 typedef uint64_t __u64; 28 29 #endif 30 31 /** 32 * struct sync_merge_data - data passed to merge ioctl 33 * @name: name of new fence 34 * @fd2: file descriptor of second fence 35 * @fence: returns the fd of the new fence to userspace 36 * @flags: merge_data flags 37 * @pad: padding for 64-bit alignment, should always be zero 38 */ 39 struct sync_merge_data { 40 char name[32]; 41 __s32 fd2; 42 __s32 fence; 43 __u32 flags; 44 __u32 pad; 45 }; 46 47 /** 48 * struct sync_fence_info - detailed fence information 49 * @obj_name: name of parent sync_timeline 50 * @driver_name: name of driver implementing the parent 51 * @status: status of the fence 0:active 1:signaled <0:error 52 * @flags: fence_info flags 53 * @timestamp_ns: timestamp of status change in nanoseconds 54 */ 55 struct sync_fence_info { 56 char obj_name[32]; 57 char driver_name[32]; 58 __s32 status; 59 __u32 flags; 60 __u64 timestamp_ns; 61 }; 62 63 /** 64 * struct sync_file_info - data returned from fence info ioctl 65 * @name: name of fence 66 * @status: status of fence. 1: signaled 0:active <0:error 67 * @flags: sync_file_info flags 68 * @num_fences number of fences in the sync_file 69 * @pad: padding for 64-bit alignment, should always be zero 70 * @sync_fence_info: pointer to array of structs sync_fence_info with all 71 * fences in the sync_file 72 */ 73 struct sync_file_info { 74 char name[32]; 75 __s32 status; 76 __u32 flags; 77 __u32 num_fences; 78 __u32 pad; 79 80 __u64 sync_fence_info; 81 }; 82 83 #define SYNC_IOC_MAGIC '>' 84 85 /** 86 * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the 87 * old API to get weird errors when trying to handling sync_files. The API 88 * change happened during the de-stage of the Sync Framework when there was 89 * no upstream users available. 90 */ 91 92 /** 93 * DOC: SYNC_IOC_MERGE - merge two fences 94 * 95 * Takes a struct sync_merge_data. Creates a new fence containing copies of 96 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the 97 * new fence's fd in sync_merge_data.fence 98 */ 99 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) 100 101 /** 102 * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file 103 * 104 * Takes a struct sync_file_info. If num_fences is 0, the field is updated 105 * with the actual number of fences. If num_fences is > 0, the system will 106 * use the pointer provided on sync_fence_info to return up to num_fences of 107 * struct sync_fence_info, with detailed fence information. 108 */ 109 #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info) 110 111 #endif /* _UAPI_LINUX_SYNC_H */ 112