zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

sync_file.h (3448B) - Raw


      1 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
      2 /*
      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 _LINUX_SYNC_H
     13 #define _LINUX_SYNC_H
     14 
     15 #include <linux/ioctl.h>
     16 #include <linux/types.h>
     17 
     18 /**
     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
     25  *
     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
     29  */
     30 struct sync_merge_data {
     31 	char	name[32];
     32 	__s32	fd2;
     33 	__s32	fence;
     34 	__u32	flags;
     35 	__u32	pad;
     36 };
     37 
     38 /**
     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
     45  */
     46 struct sync_fence_info {
     47 	char	obj_name[32];
     48 	char	driver_name[32];
     49 	__s32	status;
     50 	__u32	flags;
     51 	__u64	timestamp_ns;
     52 };
     53 
     54 /**
     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
     63  *
     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.
     68  */
     69 struct sync_file_info {
     70 	char	name[32];
     71 	__s32	status;
     72 	__u32	flags;
     73 	__u32	num_fences;
     74 	__u32	pad;
     75 
     76 	__u64	sync_fence_info;
     77 };
     78 
     79 /**
     80  * struct sync_set_deadline - SYNC_IOC_SET_DEADLINE - set a deadline hint on a fence
     81  * @deadline_ns: absolute time of the deadline
     82  * @pad:	must be zero
     83  *
     84  * Allows userspace to set a deadline on a fence, see &dma_fence_set_deadline
     85  *
     86  * The timebase for the deadline is CLOCK_MONOTONIC (same as vblank).  For
     87  * example
     88  *
     89  *     clock_gettime(CLOCK_MONOTONIC, &t);
     90  *     deadline_ns = (t.tv_sec * 1000000000L) + t.tv_nsec + ns_until_deadline
     91  */
     92 struct sync_set_deadline {
     93 	__u64	deadline_ns;
     94 	/* Not strictly needed for alignment but gives some possibility
     95 	 * for future extension:
     96 	 */
     97 	__u64	pad;
     98 };
     99 
    100 #define SYNC_IOC_MAGIC		'>'
    101 
    102 /*
    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.
    107  */
    108 
    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)
    112 
    113 #endif /* _LINUX_SYNC_H */