Lines Matching refs:cnx
188 static bool should_unload_system_driver(egl_connection_t* cnx) { in should_unload_system_driver() argument
190 if (cnx->systemDriverUnloaded) { in should_unload_system_driver()
218 void Loader::unload_system_driver(egl_connection_t* cnx) { in unload_system_driver() argument
222 (__eglMustCastToProperFunctionPointerType*)&cnx in unload_system_driver()
226 (__eglMustCastToProperFunctionPointerType*)&cnx in unload_system_driver()
229 uninit_api(egl_names, (__eglMustCastToProperFunctionPointerType*)&cnx->egl); in unload_system_driver()
231 if (cnx->dso) { in unload_system_driver()
233 driver_t* hnd = (driver_t*)cnx->dso; in unload_system_driver()
243 cnx->dso = nullptr; in unload_system_driver()
246 cnx->systemDriverUnloaded = true; in unload_system_driver()
249 void* Loader::open(egl_connection_t* cnx) in open() argument
254 if (should_unload_system_driver(cnx)) { in open()
255 unload_system_driver(cnx); in open()
259 if (cnx->dso) { in open()
260 return cnx->dso; in open()
267 cnx->shouldUseAngle = true; in open()
269 cnx->shouldUseAngle = false; in open()
273 driver_t* hnd = attempt_to_load_angle(cnx); in open()
276 hnd = attempt_to_load_updated_driver(cnx); in open()
291 hnd = attempt_to_load_system_driver(cnx, prop, true); in open()
306 hnd = attempt_to_load_system_driver(cnx, nullptr, true); in open()
310 hnd = attempt_to_load_system_driver(cnx, nullptr, false); in open()
322 if (!cnx->libEgl) { in open()
323 cnx->libEgl = load_wrapper(EGL_WRAPPER_DIR "/libEGL.so"); in open()
325 if (!cnx->libGles1) { in open()
326 cnx->libGles1 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv1_CM.so"); in open()
328 if (!cnx->libGles2) { in open()
329 cnx->libGles2 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv2.so"); in open()
332 if (!cnx->libEgl || !cnx->libGles2 || !cnx->libGles1) { in open()
337 LOG_ALWAYS_FATAL_IF(!cnx->libEgl, in open()
340 LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1, in open()
349 void Loader::close(egl_connection_t* cnx) in close() argument
351 driver_t* hnd = (driver_t*) cnx->dso; in close()
353 cnx->dso = nullptr; in close()
355 cnx->shouldUseAngle = false; in close()
356 cnx->angleDecided = false; in close()
357 cnx->useAngle = false; in close()
359 if (cnx->vendorEGL) { in close()
360 dlclose(cnx->vendorEGL); in close()
361 cnx->vendorEGL = nullptr; in close()
549 static void* load_angle(const char* kind, android_namespace_t* ns, egl_connection_t* cnx) { in load_angle() argument
552 if ((cnx->shouldUseAngle) || android::GraphicsEnv::getInstance().shouldUseAngle()) { in load_angle()
554 cnx->shouldUseAngle = true; in load_angle()
556 cnx->shouldUseAngle = false; in load_angle()
562 cnx->useAngle = true; in load_angle()
584 cnx->angleBackend = angleBackendDefault; in load_angle()
585 if (!cnx->vendorEGL && (cnx->angleBackend == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE)) { in load_angle()
594 cnx->vendorEGL = dso; in load_angle()
598 if (!cnx->vendorEGL) { in load_angle()
599 cnx->vendorEGL = load_system_driver("EGL", nullptr, true); in load_angle()
605 cnx->useAngle = false; in load_angle()
607 cnx->angleDecided = true; in load_angle()
633 Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) { in attempt_to_load_angle() argument
644 void* dso = load_angle("EGL", ns, cnx); in attempt_to_load_angle()
646 initialize_api(dso, cnx, EGL); in attempt_to_load_angle()
649 dso = load_angle("GLESv1_CM", ns, cnx); in attempt_to_load_angle()
650 initialize_api(dso, cnx, GLESv1_CM); in attempt_to_load_angle()
653 dso = load_angle("GLESv2", ns, cnx); in attempt_to_load_angle()
654 initialize_api(dso, cnx, GLESv2); in attempt_to_load_angle()
660 Loader::driver_t* Loader::attempt_to_load_updated_driver(egl_connection_t* cnx) { in attempt_to_load_updated_driver() argument
673 initialize_api(dso, cnx, EGL | GLESv1_CM | GLESv2); in attempt_to_load_updated_driver()
680 initialize_api(dso, cnx, EGL); in attempt_to_load_updated_driver()
684 initialize_api(dso, cnx, GLESv1_CM); in attempt_to_load_updated_driver()
688 initialize_api(dso, cnx, GLESv2); in attempt_to_load_updated_driver()
697 Loader::driver_t* Loader::attempt_to_load_system_driver(egl_connection_t* cnx, const char* suffix, in attempt_to_load_system_driver() argument
704 initialize_api(dso, cnx, EGL | GLESv1_CM | GLESv2); in attempt_to_load_system_driver()
710 initialize_api(dso, cnx, EGL); in attempt_to_load_system_driver()
714 initialize_api(dso, cnx, GLESv1_CM); in attempt_to_load_system_driver()
718 initialize_api(dso, cnx, GLESv2); in attempt_to_load_system_driver()
724 void Loader::initialize_api(void* dso, egl_connection_t* cnx, uint32_t mask) { in initialize_api() argument
731 egl_t* egl = &cnx->egl; in initialize_api()
754 &cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl, in initialize_api()
761 &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl, in initialize_api()