diff options
author | Eric Anholt <eric@anholt.net> | 2020-09-22 13:02:37 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-10-19 18:41:50 +0000 |
commit | 27b888794624225343287e57f5fcea63f94850b3 (patch) | |
tree | 2bdda3060e4b40886a35cfde4e09c2bba3b3a761 | |
parent | e8c89a9bcbaf85bd8772991151cbef7c0a2ddd76 (diff) |
android: Add pre-4.7 Android kernel compatibility to our libsync header.
The downstream Android kernels had a different API than was merged
upstream, and libsync on Android abstracts over that for us. Use their
sync_merge() and sync_wait(), at the cost of linking against libsync
(which Android.mk and meson both do).
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
-rw-r--r-- | src/util/libsync.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/libsync.h b/src/util/libsync.h index f1a2f96d36b..2e9f499200b 100644 --- a/src/util/libsync.h +++ b/src/util/libsync.h @@ -40,6 +40,14 @@ extern "C" { #endif +#ifdef ANDROID +/* On Android, rely on the system's libsync instead of rolling our own + * sync_wait() and sync_merge(). This gives us compatibility with pre-4.7 + * Android kernels. + */ +#include <android/sync.h> +#else + #ifndef SYNC_IOC_MERGE /* duplicated from linux/sync_file.h to avoid build-time dependency * on new (v4.7) kernel headers. Once distro's are mostly using @@ -101,6 +109,8 @@ static inline int sync_merge(const char *name, int fd1, int fd2) return data.fence; } +#endif /* !ANDROID */ + /* accumulate fd2 into fd1. If *fd1 is not a valid fd then dup fd2, * otherwise sync_merge() and close the old *fd1. This can be used * to implement the pattern: |