2 * Copyright (C) 2012 ARM Limited. All rights reserved.
4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7 * A copy of the licence is included with the program, and can also be obtained from Free Software
8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 * Mali interface for Linux sync objects.
20 #if defined(CONFIG_SYNC)
22 #include <linux/seq_file.h>
23 #include <linux/sync.h>
27 struct mali_sync_flag;
30 * Create a sync timeline.
32 * @param name Name of the sync timeline.
33 * @return The new sync timeline if successful, NULL if not.
35 struct sync_timeline *mali_sync_timeline_create(const char *name);
38 * Check if sync timeline belongs to Mali.
40 * @param sync_tl Sync timeline to check.
41 * @return MALI_TRUE if sync timeline belongs to Mali, MALI_FALSE if not.
43 mali_bool mali_sync_timeline_is_ours(struct sync_timeline *sync_tl);
46 * Creates a file descriptor representing the sync fence. Will release sync fence if allocation of
47 * file descriptor fails.
49 * @param sync_fence Sync fence.
50 * @return File descriptor representing sync fence if successful, or -1 if not.
52 s32 mali_sync_fence_fd_alloc(struct sync_fence *sync_fence);
55 * Merges two sync fences. Both input sync fences will be released.
57 * @param sync_fence1 First sync fence.
58 * @param sync_fence2 Second sync fence.
59 * @return New sync fence that is the result of the merger if successful, or NULL if not.
61 struct sync_fence *mali_sync_fence_merge(struct sync_fence *sync_fence1, struct sync_fence *sync_fence2);
64 * Create a sync fence that is already signaled.
66 * @param tl Sync timeline.
67 * @return New signaled sync fence if successful, NULL if not.
69 struct sync_fence *mali_sync_timeline_create_signaled_fence(struct sync_timeline *sync_tl);
74 * @param sync_tl Sync timeline.
75 * @param point Point on Mali timeline.
76 * @return New sync flag if successful, NULL if not.
78 struct mali_sync_flag *mali_sync_flag_create(struct sync_timeline *sync_tl, u32 point);
81 * Grab sync flag reference.
83 * @param flag Sync flag.
85 void mali_sync_flag_get(struct mali_sync_flag *flag);
88 * Release sync flag reference. If this was the last reference, the sync flag will be freed.
90 * @param flag Sync flag.
92 void mali_sync_flag_put(struct mali_sync_flag *flag);
95 * Signal sync flag. All sync fences created from this flag will be signaled.
97 * @param flag Sync flag to signal.
98 * @param error Negative error code, or 0 if no error.
100 void mali_sync_flag_signal(struct mali_sync_flag *flag, int error);
103 * Create a sync fence attached to given sync flag.
105 * @param flag Sync flag.
106 * @return New sync fence if successful, NULL if not.
108 struct sync_fence *mali_sync_flag_create_fence(struct mali_sync_flag *flag);
110 #endif /* defined(CONFIG_SYNC) */
112 #endif /* _MALI_SYNC_H_ */