114 lines · c
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 of7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 * GNU General Public License for more details.9 *10 */11 12#ifndef _UAPI_LINUX_SYNC_H13#define _UAPI_LINUX_SYNC_H14 15#include <linux/ioctl.h>16#include <linux/types.h>17 18/**19 * struct sync_merge_data - SYNC_IOC_MERGE: merge two fences20 * @name: name of new fence21 * @fd2: file descriptor of second fence22 * @fence: returns the fd of the new fence to userspace23 * @flags: merge_data flags24 * @pad: padding for 64-bit alignment, should always be zero25 *26 * Creates a new fence containing copies of the sync_pts in both27 * the calling fd and sync_merge_data.fd2. Returns the new fence's28 * fd in sync_merge_data.fence29 */30struct 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 information40 * @obj_name: name of parent sync_timeline41 * @driver_name: name of driver implementing the parent42 * @status: status of the fence 0:active 1:signaled <0:error43 * @flags: fence_info flags44 * @timestamp_ns: timestamp of status change in nanoseconds45 */46struct 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_file56 * @name: name of fence57 * @status: status of fence. 1: signaled 0:active <0:error58 * @flags: sync_file_info flags59 * @num_fences: number of fences in the sync_file60 * @pad: padding for 64-bit alignment, should always be zero61 * @sync_fence_info: pointer to array of struct &sync_fence_info with all62 * fences in the sync_file63 *64 * Takes a struct sync_file_info. If num_fences is 0, the field is updated65 * with the actual number of fences. If num_fences is > 0, the system will66 * use the pointer provided on sync_fence_info to return up to num_fences of67 * struct sync_fence_info, with detailed fence information.68 */69struct 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 fence81 * @deadline_ns: absolute time of the deadline82 * @pad: must be zero83 *84 * Allows userspace to set a deadline on a fence, see &dma_fence_set_deadline85 *86 * The timebase for the deadline is CLOCK_MONOTONIC (same as vblank). For87 * example88 *89 * clock_gettime(CLOCK_MONOTONIC, &t);90 * deadline_ns = (t.tv_sec * 1000000000L) + t.tv_nsec + ns_until_deadline91 */92struct sync_set_deadline {93 __u64 deadline_ns;94 /* Not strictly needed for alignment but gives some possibility95 * 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 the104 * old API to get weird errors when trying to handling sync_files. The API105 * change happened during the de-stage of the Sync Framework when there was106 * 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 /* _UAPI_LINUX_SYNC_H */114