summaryrefslogtreecommitdiffstats
path: root/libsync
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.com>2016-06-10 16:24:49 -0300
committerDmitry Shmidt <dimitrysh@google.com>2017-01-17 14:28:26 -0800
commit6786575d42e78c8faa51393871eb958d87d57e08 (patch)
treea02b3e2883566bec3a1edbe70e25537c8f5b5e1b /libsync
parentd6bbc5de66fc7ac51773bc92d6a48a94e622f9b1 (diff)
downloadsystem_core-6786575d42e78c8faa51393871eb958d87d57e08.tar.gz
system_core-6786575d42e78c8faa51393871eb958d87d57e08.tar.bz2
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 {
#define SYNC_IOC_LEGACY_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
struct sync_fence_info_data)
+struct sync_merge_data {
+ char name[32];
+ int32_t fd2;
+ int32_t fence;
+ uint32_t flags;
+ uint32_t pad;
+};
+
+struct sync_file_info {
+ char name[32];
+ int32_t status;
+ uint32_t flags;
+ uint32_t num_fences;
+ uint32_t pad;
+
+ uint64_t sync_fence_info;
+};
+
+struct sync_fence_info {
+ char obj_name[32];
+ char driver_name[32];
+ int32_t status;
+ uint32_t flags;
+ uint64_t timestamp_ns;
+};
+
+/**
+ * Mainline API:
+ *
+ * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
+ * old API to get weird errors when trying to handling sync_files. The API
+ * change happened during the de-stage of the Sync Framework when there was
+ * no upstream users available.
+ */
+
+/**
+ * DOC: SYNC_IOC_MERGE - merge two fences
+ *
+ * Takes a struct sync_merge_data. Creates a new fence containing copies of
+ * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
+ * new fence's fd in sync_merge_data.fence
+ *
+ * This is the new version of the Sync API after the de-stage that happened
+ * on Linux kernel 4.7.
+ */
+#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
+
+/**
+ * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file
+ *
+ * Takes a struct sync_file_info. If num_fences is 0, the field is updated
+ * with the actual number of fences. If num_fences is > 0, the system will
+ * use the pointer provided on sync_fence_info to return up to num_fences of
+ * struct sync_fence_info, with detailed fence information.
+ *
+ * This is the new version of the Sync API after the de-stage that happened
+ * on Linux kernel 4.7.
+ */
+#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
+
/* timeout in msecs */
int sync_wait(int fd, int timeout);
int sync_merge(const char *name, int fd1, int fd2);