Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cc92518 authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "Initialize GL even when HWUI is running Vulkan" into main

parents 82ac88fb bac8706b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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

@@ -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
+7 −0
Original line number Diff line number Diff line
@@ -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
///////////////////////////////////////////////////////////////////////////////
@@ -368,6 +373,8 @@ public:
    static bool isDrawingEnabled();
    static void setDrawingEnabled(bool enable);

    static bool initializeGlAlways();

private:
    static StretchEffectBehavior stretchEffectBehavior;
    static ProfileType sProfileType;
+7 −0
Original line number Diff line number Diff line
@@ -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"
}
+9 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
}