diff options
author | Derek Sollenberger <djsollen@google.com> | 2016-10-25 10:25:45 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2016-10-25 19:43:00 +0000 |
commit | 98f75d53dbe243b1661c616643698e025d4978f6 (patch) | |
tree | d37de311ac71a901b87d08cc45356ba2fe99fce8 /libs/hwui/renderthread/EglManager.cpp | |
parent | 817695589c80cfc0913d94e3dd52dac2782e8ed6 (diff) |
Store GrContext on RenderThread for use by Skia-based renderers.
Test: built and booted on device
Change-Id: I4c1060ec72bc67e54e6b2d25b1f2c13aaa513f89
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index beda0455c145..ce48bc094b09 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -25,6 +25,8 @@ #include <cutils/log.h> #include <cutils/properties.h> #include <EGL/eglext.h> +#include <GrContextOptions.h> +#include <gl/GrGLInterface.h> #include <string> #define GLES_VERSION 2 @@ -126,6 +128,17 @@ void EglManager::initialize() { makeCurrent(mPBufferSurface); DeviceInfo::initialize(); mRenderThread.renderState().onGLContextCreated(); + + if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL) { + sk_sp<const GrGLInterface> glInterface(GrGLCreateNativeInterface()); + LOG_ALWAYS_FATAL_IF(!glInterface.get()); + + GrContextOptions options; + options.fDisableDistanceFieldPaths = true; + options.fAllowPathMaskCaching = true; + mRenderThread.setGrContext(GrContext::Create(GrBackend::kOpenGL_GrBackend, + (GrBackendContext)glInterface.get(), options)); + } } void EglManager::initExtensions() { @@ -235,6 +248,7 @@ void EglManager::destroySurface(EGLSurface surface) { void EglManager::destroy() { if (mEglDisplay == EGL_NO_DISPLAY) return; + mRenderThread.setGrContext(nullptr); mRenderThread.renderState().onGLContextDestroyed(); eglDestroyContext(mEglDisplay, mEglContext); eglDestroySurface(mEglDisplay, mPBufferSurface); |