From 1f0911e6a13ce402c9d9514813b5c7a772735cb4 Mon Sep 17 00:00:00 2001 From: Ian Elliott Date: Fri, 9 Sep 2022 16:31:47 -0600 Subject: Add SkiaVk backend to RenderEngine This CL adds a new backend, SkiaVk, to RenderEngine. The new functionality is to create a Vulkan device/instance (possibly protected) and handle flush/waitFence via VkSemaphores fed to GrBackendSemaphores. + make ctors of GLES/Vk RE's private so as to ensure GrContexts are created Test: atest librenderengine_test Bug: 236390072 Change-Id: I69119623b194885bcc4cf2ddc8e592576b713b19 --- libs/gui/SyncFeatures.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libs/gui/SyncFeatures.cpp') 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(), 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(), mString.append(" EGL_KHR_wait_sync"); } mString.append("]"); + // Terminate EGL to match the eglInitialize above + eglTerminate(dpy); } bool SyncFeatures::useNativeFenceSync() const { -- cgit v1.2.3-59-g8ed1b