Loading libs/hwui/Properties.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ constexpr bool clip_surfaceviews() { constexpr bool hdr_10bit_plus() { return false; } constexpr bool initialize_gl_always() { return false; } } // namespace hwui_flags #endif Loading Loading @@ -257,5 +260,9 @@ bool Properties::isDrawingEnabled() { return drawingEnabled == DrawingEnabled::On; } bool Properties::initializeGlAlways() { return base::GetBoolProperty(PROPERTY_INITIALIZE_GL_ALWAYS, hwui_flags::initialize_gl_always()); } } // namespace uirenderer } // namespace android libs/hwui/Properties.h +7 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,11 @@ enum DebugLevel { #define PROPERTY_8BIT_HDR_HEADROOM "debug.hwui.8bit_hdr_headroom" /** * Whether to initialize GL even when HWUI is running Vulkan. */ #define PROPERTY_INITIALIZE_GL_ALWAYS "debug.hwui.initialize_gl_always" /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -368,6 +373,8 @@ public: static bool isDrawingEnabled(); static void setDrawingEnabled(bool enable); static bool initializeGlAlways(); private: static StretchEffectBehavior stretchEffectBehavior; static ProfileType sProfileType; Loading libs/hwui/aconfig/hwui_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -90,3 +90,10 @@ flag { description: "Add canvas#drawRegion API" bug: "318612129" } flag { name: "initialize_gl_always" namespace: "core_graphics" description: "Initialize GL even when HWUI is set to use Vulkan. This improves app startup time for apps using GL." bug: "335172671" } libs/hwui/apex/jni_runtime.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -192,5 +192,14 @@ void zygote_preload_graphics() { // Preload Vulkan driver if HWUI renders with Vulkan backend. uint32_t apiVersion; vkEnumerateInstanceVersion(&apiVersion); if (Properties::initializeGlAlways()) { // Even though HWUI is rendering with Vulkan, some apps still use // GL. Preload GL driver just in case. Since this happens prior to // forking from the zygote, apps that do not use GL are unaffected. // Any memory that (E)GL uses for this call is in shared memory, // and this call only happens once. eglGetDisplay(EGL_DEFAULT_DISPLAY); } } } Loading
libs/hwui/Properties.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ constexpr bool clip_surfaceviews() { constexpr bool hdr_10bit_plus() { return false; } constexpr bool initialize_gl_always() { return false; } } // namespace hwui_flags #endif Loading Loading @@ -257,5 +260,9 @@ bool Properties::isDrawingEnabled() { return drawingEnabled == DrawingEnabled::On; } bool Properties::initializeGlAlways() { return base::GetBoolProperty(PROPERTY_INITIALIZE_GL_ALWAYS, hwui_flags::initialize_gl_always()); } } // namespace uirenderer } // namespace android
libs/hwui/Properties.h +7 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,11 @@ enum DebugLevel { #define PROPERTY_8BIT_HDR_HEADROOM "debug.hwui.8bit_hdr_headroom" /** * Whether to initialize GL even when HWUI is running Vulkan. */ #define PROPERTY_INITIALIZE_GL_ALWAYS "debug.hwui.initialize_gl_always" /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -368,6 +373,8 @@ public: static bool isDrawingEnabled(); static void setDrawingEnabled(bool enable); static bool initializeGlAlways(); private: static StretchEffectBehavior stretchEffectBehavior; static ProfileType sProfileType; Loading
libs/hwui/aconfig/hwui_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -90,3 +90,10 @@ flag { description: "Add canvas#drawRegion API" bug: "318612129" } flag { name: "initialize_gl_always" namespace: "core_graphics" description: "Initialize GL even when HWUI is set to use Vulkan. This improves app startup time for apps using GL." bug: "335172671" }
libs/hwui/apex/jni_runtime.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -192,5 +192,14 @@ void zygote_preload_graphics() { // Preload Vulkan driver if HWUI renders with Vulkan backend. uint32_t apiVersion; vkEnumerateInstanceVersion(&apiVersion); if (Properties::initializeGlAlways()) { // Even though HWUI is rendering with Vulkan, some apps still use // GL. Preload GL driver just in case. Since this happens prior to // forking from the zygote, apps that do not use GL are unaffected. // Any memory that (E)GL uses for this call is in shared memory, // and this call only happens once. eglGetDisplay(EGL_DEFAULT_DISPLAY); } } }