diff options
author | Lingfeng Yang <lfy@google.com> | 2018-01-18 19:47:40 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-01-18 19:47:40 +0000 |
commit | f785fcdd0019ee0a445d8bc11fd349a941e339a1 (patch) | |
tree | bcc9fcd280ded994d4bb12962469daabc44593be | |
parent | 9fd37ff364f7ec15fc626f41bcf22f815636738b (diff) | |
parent | 9f8ef705330ccc5bc9cc98a2fc7ac8afb4a4aca7 (diff) | |
download | device_generic_goldfish-opengl-f785fcdd0019ee0a445d8bc11fd349a941e339a1.tar.gz device_generic_goldfish-opengl-f785fcdd0019ee0a445d8bc11fd349a941e339a1.tar.bz2 device_generic_goldfish-opengl-f785fcdd0019ee0a445d8bc11fd349a941e339a1.zip |
goldfish_sync: detect when running on a 64-bit kernel am: 4546cf071d
am: 9f8ef70533
Change-Id: If915fcc5a7845d4a99e776bef9a1e0ec55a9436f
-rw-r--r-- | system/egl/goldfish_sync.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/system/egl/goldfish_sync.h b/system/egl/goldfish_sync.h index 6b30fe5b..5dcc449e 100644 --- a/system/egl/goldfish_sync.h +++ b/system/egl/goldfish_sync.h @@ -47,6 +47,11 @@ static __inline__ int goldfish_sync_close(int sync_fd) { return close(sync_fd); } +static unsigned int sQueueWorkIoctlCmd = GOLDFISH_SYNC_IOC_QUEUE_WORK; + +// If we are running on a 64-bit kernel. +static unsigned int sQueueWorkIoctlCmd64Kernel = 0xc0184000; + static __inline__ int goldfish_sync_queue_work(int goldfish_sync_fd, uint64_t host_glsync, uint64_t host_thread, @@ -59,7 +64,15 @@ static __inline__ int goldfish_sync_queue_work(int goldfish_sync_fd, info.host_syncthread_handle_in = host_thread; info.fence_fd_out = -1; - err = ioctl(goldfish_sync_fd, GOLDFISH_SYNC_IOC_QUEUE_WORK, &info); + err = ioctl(goldfish_sync_fd, sQueueWorkIoctlCmd, &info); + + if (err < 0 && errno == ENOTTY) { + sQueueWorkIoctlCmd = sQueueWorkIoctlCmd64Kernel; + err = ioctl(goldfish_sync_fd, sQueueWorkIoctlCmd, &info); + if (err < 0) { + sQueueWorkIoctlCmd = GOLDFISH_SYNC_IOC_QUEUE_WORK; + } + } if (fd_out) *fd_out = info.fence_fd_out; |