diff options
author | Stan Iliev <stani@google.com> | 2019-02-14 14:57:44 -0500 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2019-02-20 02:10:52 +0000 |
commit | 898123b6a37b778acf59edbfdab9af28ae3f1a22 (patch) | |
tree | d0c691a2c51a1a0c0dc382b89c8b086091fb4c82 /libs/hwui/renderthread/RenderThread.cpp | |
parent | c7e26f7fbb87a62fb6a92973543a04e7d901dc28 (diff) |
Start RenderThread earlier to preload Vulkan/EGL drivers
This CL should fix application startup regression for Vulkan
detected by "Hermetic Startup: EmptyActivity" test.
EGL drivers are loaded in a temp thread to leave more time
in RenderThread for other work. Loading EGL drivers
on the RenderThread may cause a perf regression.
Test: Ran cold-dropcache-test test.
Bug: 122659224
Bug: 123361175
Change-Id: I8ca818e98fac196a41d079be15594caca5cb1bab
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderThread.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp index bfae80f4698a..08edd20c0a0d 100644 --- a/libs/hwui/renderthread/RenderThread.cpp +++ b/libs/hwui/renderthread/RenderThread.cpp @@ -41,6 +41,7 @@ #include <utils/Condition.h> #include <utils/Log.h> #include <utils/Mutex.h> +#include <thread> namespace android { namespace uirenderer { @@ -175,9 +176,6 @@ void RenderThread::initThreadLocals() { mRenderState = new RenderState(*this); mVkManager = new VulkanManager(); mCacheManager = new CacheManager(mDisplayInfo); - if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) { - requireVkContext(); - } } void RenderThread::requireGlContext() { @@ -409,6 +407,17 @@ bool RenderThread::isCurrent() { return gettid() == getInstance().getTid(); } +void RenderThread::preload() { + std::thread eglInitThread([]() { + //TODO: don't load EGL drivers for Vulkan, when HW bitmap uploader is refactored. + eglGetDisplay(EGL_DEFAULT_DISPLAY); + }); + eglInitThread.detach(); + if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) { + requireVkContext(); + } +} + } /* namespace renderthread */ } /* namespace uirenderer */ } /* namespace android */ |