Erik Gilling | 9d1906e | 2013-02-28 16:42:58 -0800 | [diff] [blame] | 1 | /* |
| 2 | * include/linux/sw_sync.h |
| 3 | * |
| 4 | * Copyright (C) 2012 Google, Inc. |
| 5 | * |
| 6 | * This software is licensed under the terms of the GNU General Public |
| 7 | * License version 2, as published by the Free Software Foundation, and |
| 8 | * may be copied, distributed, and modified under those terms. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #ifndef _LINUX_SW_SYNC_H |
| 18 | #define _LINUX_SW_SYNC_H |
| 19 | |
| 20 | #include <linux/types.h> |
| 21 | |
| 22 | #ifdef __KERNEL__ |
| 23 | |
| 24 | #include "sync.h" |
| 25 | |
| 26 | struct sw_sync_timeline { |
| 27 | struct sync_timeline obj; |
| 28 | |
| 29 | u32 value; |
| 30 | }; |
| 31 | |
| 32 | struct sw_sync_pt { |
| 33 | struct sync_pt pt; |
| 34 | |
| 35 | u32 value; |
| 36 | }; |
| 37 | |
Greg Hackmann | bbd9ae8 | 2014-02-04 16:08:34 -0800 | [diff] [blame] | 38 | #if IS_ENABLED(CONFIG_SW_SYNC) |
Erik Gilling | 9d1906e | 2013-02-28 16:42:58 -0800 | [diff] [blame] | 39 | struct sw_sync_timeline *sw_sync_timeline_create(const char *name); |
| 40 | void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc); |
| 41 | |
| 42 | struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value); |
Greg Hackmann | bbd9ae8 | 2014-02-04 16:08:34 -0800 | [diff] [blame] | 43 | #else |
| 44 | static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name) |
| 45 | { |
| 46 | return NULL; |
| 47 | } |
| 48 | |
| 49 | static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, |
| 54 | u32 value) |
| 55 | { |
| 56 | return NULL; |
| 57 | } |
| 58 | #endif /* IS_ENABLED(CONFIG_SW_SYNC) */ |
Erik Gilling | 9d1906e | 2013-02-28 16:42:58 -0800 | [diff] [blame] | 59 | |
| 60 | #endif /* __KERNEL __ */ |
| 61 | |
| 62 | struct sw_sync_create_fence_data { |
| 63 | __u32 value; |
| 64 | char name[32]; |
| 65 | __s32 fence; /* fd of new fence */ |
| 66 | }; |
| 67 | |
| 68 | #define SW_SYNC_IOC_MAGIC 'W' |
| 69 | |
| 70 | #define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0,\ |
| 71 | struct sw_sync_create_fence_data) |
| 72 | #define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32) |
| 73 | |
| 74 | |
| 75 | #endif /* _LINUX_SW_SYNC_H */ |