summaryrefslogtreecommitdiff
path: root/libs/gui/SyncFeatures.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2023-10-06 05:34:14 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-10-06 05:34:14 +0000
commit8b919d0eb0e816bdd67f11855e649ce3723930ee (patch)
treeb9785db180fb54b3a776f645cbb2a7ef480e0cb9 /libs/gui/SyncFeatures.cpp
parente4b64ebecf894e3047e46894a83ab8d37feabd3e (diff)
parent1961b2f7b191744f3fc6bb4d32f0da0ce3ee0567 (diff)
Merge "Merge Android 14" into main
Diffstat (limited to 'libs/gui/SyncFeatures.cpp')
-rw-r--r--libs/gui/SyncFeatures.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/gui/SyncFeatures.cpp b/libs/gui/SyncFeatures.cpp
index 1a8fc1a00a..2d863c2585 100644
--- a/libs/gui/SyncFeatures.cpp
+++ b/libs/gui/SyncFeatures.cpp
@@ -36,8 +36,12 @@ SyncFeatures::SyncFeatures() : Singleton<SyncFeatures>(),
mHasFenceSync(false),
mHasWaitSync(false) {
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- // This can only be called after EGL has been initialized; otherwise the
- // check below will abort.
+ // eglQueryString can only be called after EGL has been initialized;
+ // otherwise the check below will abort. If RenderEngine is using SkiaVk,
+ // EGL will not have been initialized. There's no problem with initializing
+ // it again here (it is ref counted), and then terminating it later.
+ EGLBoolean initialized = eglInitialize(dpy, nullptr, nullptr);
+ LOG_ALWAYS_FATAL_IF(!initialized, "eglInitialize failed");
const char* exts = eglQueryString(dpy, EGL_EXTENSIONS);
LOG_ALWAYS_FATAL_IF(exts == nullptr, "eglQueryString failed");
if (strstr(exts, "EGL_ANDROID_native_fence_sync")) {
@@ -63,6 +67,8 @@ SyncFeatures::SyncFeatures() : Singleton<SyncFeatures>(),
mString.append(" EGL_KHR_wait_sync");
}
mString.append("]");
+ // Terminate EGL to match the eglInitialize above
+ eglTerminate(dpy);
}
bool SyncFeatures::useNativeFenceSync() const {