Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
0002 /*
0003  * Copyright (C) 2012 Google, Inc.
0004  *
0005  * This program is distributed in the hope that it will be useful,
0006  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0007  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0008  * GNU General Public License for more details.
0009  *
0010  */
0011 
0012 #ifndef _UAPI_LINUX_SYNC_H
0013 #define _UAPI_LINUX_SYNC_H
0014 
0015 #include <linux/ioctl.h>
0016 #include <linux/types.h>
0017 
0018 /**
0019  * struct sync_merge_data - data passed to merge ioctl
0020  * @name:   name of new fence
0021  * @fd2:    file descriptor of second fence
0022  * @fence:  returns the fd of the new fence to userspace
0023  * @flags:  merge_data flags
0024  * @pad:    padding for 64-bit alignment, should always be zero
0025  */
0026 struct sync_merge_data {
0027     char    name[32];
0028     __s32   fd2;
0029     __s32   fence;
0030     __u32   flags;
0031     __u32   pad;
0032 };
0033 
0034 /**
0035  * struct sync_fence_info - detailed fence information
0036  * @obj_name:       name of parent sync_timeline
0037 * @driver_name: name of driver implementing the parent
0038 * @status:      status of the fence 0:active 1:signaled <0:error
0039  * @flags:      fence_info flags
0040  * @timestamp_ns:   timestamp of status change in nanoseconds
0041  */
0042 struct sync_fence_info {
0043     char    obj_name[32];
0044     char    driver_name[32];
0045     __s32   status;
0046     __u32   flags;
0047     __u64   timestamp_ns;
0048 };
0049 
0050 /**
0051  * struct sync_file_info - data returned from fence info ioctl
0052  * @name:   name of fence
0053  * @status: status of fence. 1: signaled 0:active <0:error
0054  * @flags:  sync_file_info flags
0055  * @num_fences  number of fences in the sync_file
0056  * @pad:    padding for 64-bit alignment, should always be zero
0057  * @sync_fence_info: pointer to array of structs sync_fence_info with all
0058  *       fences in the sync_file
0059  */
0060 struct sync_file_info {
0061     char    name[32];
0062     __s32   status;
0063     __u32   flags;
0064     __u32   num_fences;
0065     __u32   pad;
0066 
0067     __u64   sync_fence_info;
0068 };
0069 
0070 #define SYNC_IOC_MAGIC      '>'
0071 
0072 /**
0073  * Opcodes  0, 1 and 2 were burned during a API change to avoid users of the
0074  * old API to get weird errors when trying to handling sync_files. The API
0075  * change happened during the de-stage of the Sync Framework when there was
0076  * no upstream users available.
0077  */
0078 
0079 /**
0080  * DOC: SYNC_IOC_MERGE - merge two fences
0081  *
0082  * Takes a struct sync_merge_data.  Creates a new fence containing copies of
0083  * the sync_pts in both the calling fd and sync_merge_data.fd2.  Returns the
0084  * new fence's fd in sync_merge_data.fence
0085  */
0086 #define SYNC_IOC_MERGE      _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
0087 
0088 /**
0089  * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
0090  *
0091  * Takes a struct sync_file_info. If num_fences is 0, the field is updated
0092  * with the actual number of fences. If num_fences is > 0, the system will
0093  * use the pointer provided on sync_fence_info to return up to num_fences of
0094  * struct sync_fence_info, with detailed fence information.
0095  */
0096 #define SYNC_IOC_FILE_INFO  _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
0097 
0098 #endif /* _UAPI_LINUX_SYNC_H */