summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'libsync')
-rw-r--r--libsync/include/sync/sync.h53
-rw-r--r--libsync/sync.c39
2 files changed, 39 insertions, 53 deletions
diff --git a/libsync/include/sync/sync.h b/libsync/include/sync/sync.h
index 8755d2b5d..d29ed8541 100644
--- a/libsync/include/sync/sync.h
+++ b/libsync/include/sync/sync.h
@@ -32,19 +32,8 @@
32 32
33#include "../ndk/sync.h" 33#include "../ndk/sync.h"
34 34
35#include <sys/cdefs.h>
36#include <stdint.h>
37
38#include <linux/types.h>
39
40__BEGIN_DECLS 35__BEGIN_DECLS
41 36
42struct sync_legacy_merge_data {
43 int32_t fd2;
44 char name[32];
45 int32_t fence;
46};
47
48struct sync_fence_info_data { 37struct sync_fence_info_data {
49 uint32_t len; 38 uint32_t len;
50 char name[32]; 39 char name[32];
@@ -61,48 +50,6 @@ struct sync_pt_info {
61 uint8_t driver_data[0]; 50 uint8_t driver_data[0];
62}; 51};
63 52
64#define SYNC_IOC_MAGIC '>'
65
66/**
67 * DOC: SYNC_IOC_LEGACY_WAIT - wait for a fence to signal
68 *
69 * pass timeout in milliseconds. Waits indefinitely timeout < 0.
70 *
71 * This is the legacy version of the Sync API before the de-stage that happened
72 * on Linux kernel 4.7.
73 */
74#define SYNC_IOC_LEGACY_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32)
75
76/**
77 * DOC: SYNC_IOC_MERGE - merge two fences
78 *
79 * Takes a struct sync_merge_data. Creates a new fence containing copies of
80 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
81 * new fence's fd in sync_merge_data.fence
82 *
83 * This is the legacy version of the Sync API before the de-stage that happened
84 * on Linux kernel 4.7.
85 */
86#define SYNC_IOC_LEGACY_MERGE _IOWR(SYNC_IOC_MAGIC, 1, \
87 struct sync_legacy_merge_data)
88
89/**
90 * DOC: SYNC_IOC_LEGACY_FENCE_INFO - get detailed information on a fence
91 *
92 * Takes a struct sync_fence_info_data with extra space allocated for pt_info.
93 * Caller should write the size of the buffer into len. On return, len is
94 * updated to reflect the total size of the sync_fence_info_data including
95 * pt_info.
96 *
97 * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
98 * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
99 *
100 * This is the legacy version of the Sync API before the de-stage that happened
101 * on Linux kernel 4.7.
102 */
103#define SYNC_IOC_LEGACY_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
104 struct sync_fence_info_data)
105
106/* timeout in msecs */ 53/* timeout in msecs */
107int sync_wait(int fd, int timeout); 54int sync_wait(int fd, int timeout);
108struct sync_fence_info_data *sync_fence_info(int fd); 55struct sync_fence_info_data *sync_fence_info(int fd);
diff --git a/libsync/sync.c b/libsync/sync.c
index f3e26e111..e68cc899d 100644
--- a/libsync/sync.c
+++ b/libsync/sync.c
@@ -29,6 +29,45 @@
29 29
30#include <sync/sync.h> 30#include <sync/sync.h>
31 31
32/* Legacy Sync API */
33
34struct sync_legacy_merge_data {
35 int32_t fd2;
36 char name[32];
37 int32_t fence;
38};
39
40/**
41 * DOC: SYNC_IOC_MERGE - merge two fences
42 *
43 * Takes a struct sync_merge_data. Creates a new fence containing copies of
44 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
45 * new fence's fd in sync_merge_data.fence
46 *
47 * This is the legacy version of the Sync API before the de-stage that happened
48 * on Linux kernel 4.7.
49 */
50#define SYNC_IOC_LEGACY_MERGE _IOWR(SYNC_IOC_MAGIC, 1, \
51 struct sync_legacy_merge_data)
52
53/**
54 * DOC: SYNC_IOC_LEGACY_FENCE_INFO - get detailed information on a fence
55 *
56 * Takes a struct sync_fence_info_data with extra space allocated for pt_info.
57 * Caller should write the size of the buffer into len. On return, len is
58 * updated to reflect the total size of the sync_fence_info_data including
59 * pt_info.
60 *
61 * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
62 * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
63 *
64 * This is the legacy version of the Sync API before the de-stage that happened
65 * on Linux kernel 4.7.
66 */
67#define SYNC_IOC_LEGACY_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
68 struct sync_fence_info_data)
69
70/* SW Sync API */
32 71
33struct sw_sync_create_fence_data { 72struct sw_sync_create_fence_data {
34 __u32 value; 73 __u32 value;