summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Padovan2016-06-10 14:24:49 -0500
committerDmitry Shmidt2017-01-17 16:28:26 -0600
commit6786575d42e78c8faa51393871eb958d87d57e08 (patch)
treea02b3e2883566bec3a1edbe70e25537c8f5b5e1b /libsync
parentd6bbc5de66fc7ac51773bc92d6a48a94e622f9b1 (diff)
downloadplatform-system-core-6786575d42e78c8faa51393871eb958d87d57e08.tar.gz
platform-system-core-6786575d42e78c8faa51393871eb958d87d57e08.tar.xz
platform-system-core-6786575d42e78c8faa51393871eb958d87d57e08.zip
libsync: add new Sync kernel API
Add the new API to the internal sync.h file. As there is two different APIs we will need to discovery dynamically which one to use. v2: Fix Documentation Test: Sync unit tests still passes. Change-Id: I2ab3cd46e48ba5d9c73d54f9583b1a8141566581
Diffstat (limited to 'libsync')
-rw-r--r--libsync/include/sync/sync.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/libsync/include/sync/sync.h b/libsync/include/sync/sync.h
index 60989f2e3..50ed0ac57 100644
--- a/libsync/include/sync/sync.h
+++ b/libsync/include/sync/sync.h
@@ -90,6 +90,66 @@ struct sync_pt_info {
90#define SYNC_IOC_LEGACY_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\ 90#define SYNC_IOC_LEGACY_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
91 struct sync_fence_info_data) 91 struct sync_fence_info_data)
92 92
93struct sync_merge_data {
94 char name[32];
95 int32_t fd2;
96 int32_t fence;
97 uint32_t flags;
98 uint32_t pad;
99};
100
101struct sync_file_info {
102 char name[32];
103 int32_t status;
104 uint32_t flags;
105 uint32_t num_fences;
106 uint32_t pad;
107
108 uint64_t sync_fence_info;
109};
110
111struct sync_fence_info {
112 char obj_name[32];
113 char driver_name[32];
114 int32_t status;
115 uint32_t flags;
116 uint64_t timestamp_ns;
117};
118
119/**
120 * Mainline API:
121 *
122 * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
123 * old API to get weird errors when trying to handling sync_files. The API
124 * change happened during the de-stage of the Sync Framework when there was
125 * no upstream users available.
126 */
127
128/**
129 * DOC: SYNC_IOC_MERGE - merge two fences
130 *
131 * Takes a struct sync_merge_data. Creates a new fence containing copies of
132 * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
133 * new fence's fd in sync_merge_data.fence
134 *
135 * This is the new version of the Sync API after the de-stage that happened
136 * on Linux kernel 4.7.
137 */
138#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
139
140/**
141 * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
142 *
143 * Takes a struct sync_file_info. If num_fences is 0, the field is updated
144 * with the actual number of fences. If num_fences is > 0, the system will
145 * use the pointer provided on sync_fence_info to return up to num_fences of
146 * struct sync_fence_info, with detailed fence information.
147 *
148 * This is the new version of the Sync API after the de-stage that happened
149 * on Linux kernel 4.7.
150 */
151#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
152
93/* timeout in msecs */ 153/* timeout in msecs */
94int sync_wait(int fd, int timeout); 154int sync_wait(int fd, int timeout);
95int sync_merge(const char *name, int fd1, int fd2); 155int sync_merge(const char *name, int fd1, int fd2);