- frameworks/base/core/java/com/android/internal/os/ZygoteInit.java
private static void maybePreloadGraphicsDriver() {
if (!SystemProperties.getBoolean(PROPERTY_DISABLE_GRAPHICS_DRIVER_PRELOADING, false)) {
nativePreloadGraphicsDriver();
}
}
- frameworks/base/core/jni/com_android_internal_os_ZygoteInit.cpp
void android_internal_os_ZygoteInit_nativePreloadGraphicsDriver(JNIEnv* env, jclass) {
zygote_preload_graphics();
}
- frameworks/base/libs/hwui/apex/jni_runtime.cpp
void zygote_preload_graphics() {
if (Properties::peekRenderPipelineType() == RenderPipelineType::SkiaGL) {
// Preload GL driver if HWUI renders with GL backend.
eglGetDisplay(EGL_DEFAULT_DISPLAY);
} else {
// Preload Vulkan driver if HWUI renders with Vulkan backend.
uint32_t apiVersion;
vkEnumerateInstanceVersion(&apiVersion);
}
}
- frameworks/native/opengl/libs/EGL/eglApi.cpp
EGLDisplay eglGetDisplay(EGLNativeDisplayType display) {
ATRACE_CALL();
if (egl_init_drivers() == EGL_FALSE) {
return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
}
// Call down the chain, which usually points directly to the impl
// but may also be routed through layers
clearError();
egl_connection_t* const cnx = &gEGLImpl;
return cnx->platform.eglGetDisplay(display);
}
- frameworks/native/opengl/libs/EGL/egl.cpp
EGLBoolean egl_init_drivers() {
EGLBoolean res;
pthread_mutex_lock(&sInitDriverMutex);
res = egl_init_drivers_locked();
pthread_mutex_unlock(&sInitDriverMutex);
return res;
}
static EGLBoolean egl_init_drivers_locked() {
if (sEarlyInitState) {
// initialized by static ctor. should be set here.
return EGL_FALSE;
}
// get our driver loader
Loader& loader(Loader::getInstance());
// dynamically load our EGL implementation
egl_connection_t* cnx = &gEGLImpl;
cnx->hooks[egl_connection_t::GLESv1_INDEX] = &gHooks[egl_connection_t::GLESv1_INDEX];
cnx->hooks[egl_connection_t::GLESv2_INDEX] = &gHooks[egl_connection_t::GLESv2_INDEX];
cnx->dso = loader.open(cnx);
// Check to see if any layers are enabled and route functions through them
if (cnx->dso) {
// Layers can be enabled long after the drivers have been loaded.
// They will only be initialized once.
LayerLoader& layer_loader(LayerLoader::getInstance());
layer_loader.InitLayers(cnx);
}
return cnx->dso ? EGL_TRUE : EGL_FALSE;
}
- frameworks/native/opengl/libs/EGL/Loader.cpp
void* Loader::open(egl_connection_t* cnx) {...}
where the libEGL.so files will be loaded