Loading libs/hwui/renderthread/CanvasContext.h +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public: * If Properties::isSkiaEnabled() is true then this will return the Skia * grContext associated with the current RenderPipeline. */ GrContext* getGrContext() const { return mRenderPipeline->getGrContext(); } GrContext* getGrContext() const { return mRenderThread.getGrContext(); } // Won't take effect until next EGLSurface creation void setSwapBehavior(SwapBehavior swapBehavior); Loading libs/hwui/renderthread/EglManager.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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() { Loading Loading @@ -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); Loading libs/hwui/renderthread/IRenderPipeline.h +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ public: virtual TaskManager* getTaskManager() = 0; virtual bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator) = 0; virtual GrContext* getGrContext() = 0; virtual ~IRenderPipeline() {} }; Loading libs/hwui/renderthread/OpenGLPipeline.h +0 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ public: bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator) override; static void destroyLayer(RenderNode* node); GrContext* getGrContext() override { return nullptr; } private: EglManager& mEglManager; Loading libs/hwui/renderthread/RenderThread.h +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "../JankTracker.h" #include "TimeLord.h" #include <GrContext.h> #include <cutils/compiler.h> #include <ui/DisplayInfo.h> #include <utils/Looper.h> Loading Loading @@ -94,6 +95,9 @@ public: const DisplayInfo& mainDisplayInfo() { return mDisplayInfo; } GrContext* getGrContext() const { return mGrContext.get(); } void setGrContext(GrContext* cxt) { mGrContext.reset(cxt); } protected: virtual bool threadLoop() override; Loading Loading @@ -144,6 +148,8 @@ private: EglManager* mEglManager; JankTracker* mJankTracker = nullptr; sk_sp<GrContext> mGrContext; }; } /* namespace renderthread */ Loading Loading
libs/hwui/renderthread/CanvasContext.h +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public: * If Properties::isSkiaEnabled() is true then this will return the Skia * grContext associated with the current RenderPipeline. */ GrContext* getGrContext() const { return mRenderPipeline->getGrContext(); } GrContext* getGrContext() const { return mRenderThread.getGrContext(); } // Won't take effect until next EGLSurface creation void setSwapBehavior(SwapBehavior swapBehavior); Loading
libs/hwui/renderthread/EglManager.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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() { Loading Loading @@ -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); Loading
libs/hwui/renderthread/IRenderPipeline.h +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ public: virtual TaskManager* getTaskManager() = 0; virtual bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator) = 0; virtual GrContext* getGrContext() = 0; virtual ~IRenderPipeline() {} }; Loading
libs/hwui/renderthread/OpenGLPipeline.h +0 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ public: bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator) override; static void destroyLayer(RenderNode* node); GrContext* getGrContext() override { return nullptr; } private: EglManager& mEglManager; Loading
libs/hwui/renderthread/RenderThread.h +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "../JankTracker.h" #include "TimeLord.h" #include <GrContext.h> #include <cutils/compiler.h> #include <ui/DisplayInfo.h> #include <utils/Looper.h> Loading Loading @@ -94,6 +95,9 @@ public: const DisplayInfo& mainDisplayInfo() { return mDisplayInfo; } GrContext* getGrContext() const { return mGrContext.get(); } void setGrContext(GrContext* cxt) { mGrContext.reset(cxt); } protected: virtual bool threadLoop() override; Loading Loading @@ -144,6 +148,8 @@ private: EglManager* mEglManager; JankTracker* mJankTracker = nullptr; sk_sp<GrContext> mGrContext; }; } /* namespace renderthread */ Loading