diff options
author | 2023-10-05 15:40:38 -0700 | |
---|---|---|
committer | 2023-10-05 15:40:38 -0700 | |
commit | 1961b2f7b191744f3fc6bb4d32f0da0ce3ee0567 (patch) | |
tree | b9785db180fb54b3a776f645cbb2a7ef480e0cb9 /libs/gui/SyncFeatures.cpp | |
parent | e4b64ebecf894e3047e46894a83ab8d37feabd3e (diff) | |
parent | 313d1596d818bc94fbab3d42b8c50306871f74a5 (diff) |
Merge Android 14
Bug: 298295554
Merged-In: I114a4cf83978f152959a6ec244d322603ff5257b
Change-Id: Ia35ae6e11052fcc3b2bdaabd6dc57d0d223de269
Diffstat (limited to 'libs/gui/SyncFeatures.cpp')
-rw-r--r-- | libs/gui/SyncFeatures.cpp | 10 |
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 { |