Loading libs/hwui/Properties.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ constexpr bool resample_gainmap_regions() { constexpr bool query_global_priority() { return false; } constexpr bool early_preload_gl_context() { return false; } } // namespace hwui_flags #endif Loading Loading @@ -291,5 +294,10 @@ bool Properties::resampleGainmapRegions() { return sResampleGainmapRegions; } bool Properties::earlyPreloadGlContext() { return base::GetBoolProperty(PROPERTY_EARLY_PRELOAD_GL_CONTEXT, hwui_flags::early_preload_gl_context()); } } // namespace uirenderer } // namespace android libs/hwui/Properties.h +3 −0 Original line number Diff line number Diff line Loading @@ -236,6 +236,8 @@ enum DebugLevel { #define PROPERTY_SKIP_EGLMANAGER_TELEMETRY "debug.hwui.skip_eglmanager_telemetry" #define PROPERTY_EARLY_PRELOAD_GL_CONTEXT "debug.hwui.early_preload_gl_context" /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -381,6 +383,7 @@ public: static bool initializeGlAlways(); static bool resampleGainmapRegions(); static bool earlyPreloadGlContext(); private: static StretchEffectBehavior stretchEffectBehavior; Loading libs/hwui/aconfig/hwui_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -167,3 +167,10 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "early_preload_gl_context" namespace: "core_graphics" description: "Initialize GL context and GraphicBufferAllocater init on renderThread preload. This improves app startup time for apps using GL." bug: "383612849" } No newline at end of file libs/hwui/renderthread/RenderThread.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <private/android/choreographer.h> #include <sys/resource.h> #include <ui/FatVector.h> #include <ui/GraphicBufferAllocator.h> #include <utils/Condition.h> #include <utils/Log.h> #include <utils/Mutex.h> Loading Loading @@ -518,11 +519,18 @@ bool RenderThread::isCurrent() { void RenderThread::preload() { // EGL driver is always preloaded only if HWUI renders with GL. if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL) { if (Properties::earlyPreloadGlContext()) { queue().post([this]() { requireGlContext(); }); } else { std::thread eglInitThread([]() { eglGetDisplay(EGL_DEFAULT_DISPLAY); }); eglInitThread.detach(); } } else { requireVkContext(); } if (Properties::earlyPreloadGlContext()) { queue().post([]() { GraphicBufferAllocator::getInstance(); }); } HardwareBitmapUploader::initialize(); } Loading Loading
libs/hwui/Properties.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ constexpr bool resample_gainmap_regions() { constexpr bool query_global_priority() { return false; } constexpr bool early_preload_gl_context() { return false; } } // namespace hwui_flags #endif Loading Loading @@ -291,5 +294,10 @@ bool Properties::resampleGainmapRegions() { return sResampleGainmapRegions; } bool Properties::earlyPreloadGlContext() { return base::GetBoolProperty(PROPERTY_EARLY_PRELOAD_GL_CONTEXT, hwui_flags::early_preload_gl_context()); } } // namespace uirenderer } // namespace android
libs/hwui/Properties.h +3 −0 Original line number Diff line number Diff line Loading @@ -236,6 +236,8 @@ enum DebugLevel { #define PROPERTY_SKIP_EGLMANAGER_TELEMETRY "debug.hwui.skip_eglmanager_telemetry" #define PROPERTY_EARLY_PRELOAD_GL_CONTEXT "debug.hwui.early_preload_gl_context" /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -381,6 +383,7 @@ public: static bool initializeGlAlways(); static bool resampleGainmapRegions(); static bool earlyPreloadGlContext(); private: static StretchEffectBehavior stretchEffectBehavior; Loading
libs/hwui/aconfig/hwui_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -167,3 +167,10 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "early_preload_gl_context" namespace: "core_graphics" description: "Initialize GL context and GraphicBufferAllocater init on renderThread preload. This improves app startup time for apps using GL." bug: "383612849" } No newline at end of file
libs/hwui/renderthread/RenderThread.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <private/android/choreographer.h> #include <sys/resource.h> #include <ui/FatVector.h> #include <ui/GraphicBufferAllocator.h> #include <utils/Condition.h> #include <utils/Log.h> #include <utils/Mutex.h> Loading Loading @@ -518,11 +519,18 @@ bool RenderThread::isCurrent() { void RenderThread::preload() { // EGL driver is always preloaded only if HWUI renders with GL. if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL) { if (Properties::earlyPreloadGlContext()) { queue().post([this]() { requireGlContext(); }); } else { std::thread eglInitThread([]() { eglGetDisplay(EGL_DEFAULT_DISPLAY); }); eglInitThread.detach(); } } else { requireVkContext(); } if (Properties::earlyPreloadGlContext()) { queue().post([]() { GraphicBufferAllocator::getInstance(); }); } HardwareBitmapUploader::initialize(); } Loading