2 * This confidential and proprietary software may be used only as
3 * authorised by a licensing agreement from ARM Limited
4 * (C) COPYRIGHT 2012-2014 ARM Limited
6 * The entire notice above must be reproduced on all authorised
7 * copies and copies may only be made to the extent permitted
8 * by a licensing agreement from ARM Limited.
14 * Mali interface for Linux sync objects.
20 #if defined(CONFIG_SYNC)
22 #include <linux/seq_file.h>
23 #include <linux/version.h>
24 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
25 #include <linux/sync.h>
33 struct mali_sync_flag;
36 * Create a sync timeline.
38 * @param name Name of the sync timeline.
39 * @return The new sync timeline if successful, NULL if not.
41 struct sync_timeline *mali_sync_timeline_create(const char *name);
44 * Check if sync timeline belongs to Mali.
46 * @param sync_tl Sync timeline to check.
47 * @return MALI_TRUE if sync timeline belongs to Mali, MALI_FALSE if not.
49 mali_bool mali_sync_timeline_is_ours(struct sync_timeline *sync_tl);
52 * Creates a file descriptor representing the sync fence. Will release sync fence if allocation of
53 * file descriptor fails.
55 * @param sync_fence Sync fence.
56 * @return File descriptor representing sync fence if successful, or -1 if not.
58 s32 mali_sync_fence_fd_alloc(struct sync_fence *sync_fence);
61 * Merges two sync fences. Both input sync fences will be released.
63 * @param sync_fence1 First sync fence.
64 * @param sync_fence2 Second sync fence.
65 * @return New sync fence that is the result of the merger if successful, or NULL if not.
67 struct sync_fence *mali_sync_fence_merge(struct sync_fence *sync_fence1, struct sync_fence *sync_fence2);
70 * Create a sync fence that is already signaled.
72 * @param tl Sync timeline.
73 * @return New signaled sync fence if successful, NULL if not.
75 struct sync_fence *mali_sync_timeline_create_signaled_fence(struct sync_timeline *sync_tl);
80 * @param sync_tl Sync timeline.
81 * @param point Point on Mali timeline.
82 * @return New sync flag if successful, NULL if not.
84 struct mali_sync_flag *mali_sync_flag_create(struct sync_timeline *sync_tl, u32 point);
87 * Grab sync flag reference.
89 * @param flag Sync flag.
91 void mali_sync_flag_get(struct mali_sync_flag *flag);
94 * Release sync flag reference. If this was the last reference, the sync flag will be freed.
96 * @param flag Sync flag.
98 void mali_sync_flag_put(struct mali_sync_flag *flag);
101 * Signal sync flag. All sync fences created from this flag will be signaled.
103 * @param flag Sync flag to signal.
104 * @param error Negative error code, or 0 if no error.
106 void mali_sync_flag_signal(struct mali_sync_flag *flag, int error);
109 * Create a sync fence attached to given sync flag.
111 * @param flag Sync flag.
112 * @return New sync fence if successful, NULL if not.
114 struct sync_fence *mali_sync_flag_create_fence(struct mali_sync_flag *flag);
116 #endif /* defined(CONFIG_SYNC) */
118 #endif /* _MALI_SYNC_H_ */