vrend: poll egl fence fd to avoid mesa's global-display-lock
Mesa's egl implementation synchronizes all multi-threaded API interaction, which causes vrend's sync_thread and the VMMs main thread to synchronize around eglMakeCurrent() and eglClientWaitSyncKHR().
Instead, we can export an fd from the EGL_SYNC_NATIVE_FENCE_ANDROID and poll it during fence waits to avoid taking mesa's internal global-display-lock from the sync_thread.
Signed-off-by: Ryan Neph ryanneph@google.com
For VMs that use host GLES + mesa's EGL (e.g. ARCVM), use of the vrend-sync
thread (first enabled together with async_fence_cb on ChromeOS) causes a large performance regression up to 30% in some offscreen benchmarks. The root cause is multithreaded contention of mesa's eglapi global display lock (same as described in mesa/mesa#7039 (closed)). vrend's EGL integration already assumes support for EGL_ANDROID_native_fence_sync, so we just wait on the fd directly instead to avoid taking the lock in the vrend-sync
thread.