tbm_module: make tbm_module_bufmgr_bind_native_display
[platform/core/uifw/libtbm.git] / include / tbm_sync.h
1 #ifndef _TBM_SYNC_H_
2 #define _TBM_SYNC_H_
3
4 #include <tbm_bufmgr.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 /**
11  * @brief Create timeline object.
12  * @return file descriptor for the created timeline on success, -1 otherwise
13  * @remarks close the fd when you no longer need it
14  */
15 tbm_fd tbm_sync_timeline_create(void);
16
17 /**
18  * @brief Increase the current value of the timeline.
19  * @param[in] timeline timeline object
20  * @param[in] count amount of increment
21  * @return 1 on success, 0 otherwise
22  */
23 int tbm_sync_timeline_inc(tbm_fd timeline, unsigned int count);
24
25 /**
26  * @brief Create fence object.
27  * @param[in] timeline timeline object on which the fence is created
28  * @param[in] name fence name (only first 31 characters will be used)
29  * @param[in] value timeline point value for the fence
30  * @return file descriptor for the created fence on success, -1 otherwise
31  * @remarks close the fd when you no longer need it
32  */
33 tbm_fd tbm_sync_fence_create(tbm_fd timeline, const char *name, unsigned int value);
34
35 /**
36  * @brief Wait for the given fence to be signaled
37  * @param[in] fence fence object
38  * @param[in] timeout timeout in milliseconds
39  * @return 1 on success, 0 on failure, -1 on timeout expire
40  * @remarks negative timeout means infinite, timeout 0 returns immediately
41  */
42 int tbm_sync_fence_wait(tbm_fd fence, int timeout);
43
44 /**
45  * @brief Merge two fences into one
46  * @param[in] name name of the new fence
47  * @param[in] fence1 fence to be merged
48  * @param[in] fence2 fence to be merged
49  * @return file descriptor for the new fence on success, -1 otherwise
50  * @remarks close the fd when you no longer need it
51  */
52 tbm_fd tbm_sync_fence_merge(const char *name, tbm_fd fence1, tbm_fd fence2);
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif /* _TBM_SYNC_H */