summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsync/include/android/sync.h20
-rw-r--r--libsync/sync.c23
-rw-r--r--libsync/tests/sync_test.cpp29
3 files changed, 52 insertions, 20 deletions
diff --git a/libsync/include/android/sync.h b/libsync/include/android/sync.h
index 68f74a0b2..32bb878ba 100644
--- a/libsync/include/android/sync.h
+++ b/libsync/include/android/sync.h
@@ -41,28 +41,8 @@
41 41
42__BEGIN_DECLS 42__BEGIN_DECLS
43 43
44struct sync_fence_info_data {
45 uint32_t len;
46 char name[32];
47 int32_t status;
48 uint8_t pt_info[0];
49};
50
51struct sync_pt_info {
52 uint32_t len;
53 char obj_name[32];
54 char driver_name[32];
55 int32_t status;
56 uint64_t timestamp_ns;
57 uint8_t driver_data[0];
58};
59
60/* timeout in msecs */ 44/* timeout in msecs */
61int sync_wait(int fd, int timeout); 45int sync_wait(int fd, int timeout);
62struct sync_fence_info_data *sync_fence_info(int fd);
63struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
64 struct sync_pt_info *itr);
65void sync_fence_info_free(struct sync_fence_info_data *info);
66 46
67__END_DECLS 47__END_DECLS
68 48
diff --git a/libsync/sync.c b/libsync/sync.c
index 6b187faed..b8c48c7f7 100644
--- a/libsync/sync.c
+++ b/libsync/sync.c
@@ -30,6 +30,29 @@
30 30
31#include <android/sync.h> 31#include <android/sync.h>
32 32
33/* Prototypes for deprecated functions that used to be declared in the legacy
34 * android/sync.h. They've been moved here to make sure new code does not use
35 * them, but the functions are still defined to avoid breaking existing
36 * binaries. Eventually they can be removed altogether.
37 */
38struct sync_fence_info_data {
39 uint32_t len;
40 char name[32];
41 int32_t status;
42 uint8_t pt_info[0];
43};
44struct sync_pt_info {
45 uint32_t len;
46 char obj_name[32];
47 char driver_name[32];
48 int32_t status;
49 uint64_t timestamp_ns;
50 uint8_t driver_data[0];
51};
52struct sync_fence_info_data* sync_fence_info(int fd);
53struct sync_pt_info* sync_pt_info(struct sync_fence_info_data* info, struct sync_pt_info* itr);
54void sync_fence_info_free(struct sync_fence_info_data* info);
55
33/* Legacy Sync API */ 56/* Legacy Sync API */
34 57
35struct sync_legacy_merge_data { 58struct sync_legacy_merge_data {
diff --git a/libsync/tests/sync_test.cpp b/libsync/tests/sync_test.cpp
index 0fb86d6fc..011b09d00 100644
--- a/libsync/tests/sync_test.cpp
+++ b/libsync/tests/sync_test.cpp
@@ -15,6 +15,35 @@
15#include <random> 15#include <random>
16#include <unordered_map> 16#include <unordered_map>
17 17
18/* These deprecated declarations were in the legacy android/sync.h. They've been removed to
19 * encourage code to move to the modern equivalents. But they are still implemented in libsync.so
20 * to avoid breaking existing binaries; as long as that's true we should keep testing them here.
21 * That means making local copies of the declarations.
22 */
23extern "C" {
24
25struct sync_fence_info_data {
26 uint32_t len;
27 char name[32];
28 int32_t status;
29 uint8_t pt_info[0];
30};
31
32struct sync_pt_info {
33 uint32_t len;
34 char obj_name[32];
35 char driver_name[32];
36 int32_t status;
37 uint64_t timestamp_ns;
38 uint8_t driver_data[0];
39};
40
41struct sync_fence_info_data* sync_fence_info(int fd);
42struct sync_pt_info* sync_pt_info(struct sync_fence_info_data* info, struct sync_pt_info* itr);
43void sync_fence_info_free(struct sync_fence_info_data* info);
44
45} // extern "C"
46
18// TODO: better stress tests? 47// TODO: better stress tests?
19// Handle more than 64 fd's simultaneously, i.e. fix sync_fence_info's 4k limit. 48// Handle more than 64 fd's simultaneously, i.e. fix sync_fence_info's 4k limit.
20// Handle wraparound in timelines like nvidia. 49// Handle wraparound in timelines like nvidia.