aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLingfeng Yang <lfy@google.com>2018-01-17 10:38:19 -0800
committerbohu <bohu@google.com>2018-01-18 10:16:05 -0800
commit4546cf071dbcbe146373794f9de6eed4e2d15ec9 (patch)
treebcc9fcd280ded994d4bb12962469daabc44593be
parent5f81367c6f53f63b7e4238c43cccf7f6744f57d4 (diff)
downloaddevice_generic_goldfish-opengl-4546cf071dbcbe146373794f9de6eed4e2d15ec9.tar.gz
device_generic_goldfish-opengl-4546cf071dbcbe146373794f9de6eed4e2d15ec9.tar.bz2
device_generic_goldfish-opengl-4546cf071dbcbe146373794f9de6eed4e2d15ec9.zip
goldfish_sync: detect when running on a 64-bit kernelandroid-wear-8.0.0_r1
bug: 71861550 The goldfish sync ioctl cmd for QUEUE_WORK is different when running a 64-bit kernel. Use that magic number instead if we get a negative return code and ENOTTY from ioctl. Change-Id: I23b1f6d0d8be9e97f3d14105882d4c8d9c4435df Merged-In: I23b1f6d0d8be9e97f3d14105882d4c8d9c4435df
-rw-r--r--system/egl/goldfish_sync.h15
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;