[GL Loader] Split loading logic based on API set and driver choices.
Previously, the order of loading the graphics driver is:
1) Try to load libGLES from ANGLE -> Driver apk -> emulation driver -> system;
2) If 1) fails, fall back to load [libEGL, libGLESv1_CM, libGLESv2] from ANGLE
-> Driver apk -> emulation driver -> system.
However, there might be multiple variants of the same library exist in the
device and they all follow the same naming convention, which makes the driver
loading choice unpredictable. This patch refactors this ordering such that, we
loop over driver choices first, and for each driver choice, we try to see if we
can load either libGLES or [libEGL, libGLESv1_CM, libGLESv2] from it, if fails,
proceed to the next driver choice.
Minor: Code clean up here and there.
BUG: 127353494
Test: Build, verified with Developer Options and emulator
Test: atest CtsAngleIntegrationHostTestCases
Change-Id: I408dc20d8e41f69eac25c943e7c79af559d3d160
diff --git a/opengl/libs/EGL/Loader.h b/opengl/libs/EGL/Loader.h
index 083c84e..c0f1b75 100644
--- a/opengl/libs/EGL/Loader.h
+++ b/opengl/libs/EGL/Loader.h
@@ -55,7 +55,10 @@
private:
Loader();
- void *load_driver(const char* kind, egl_connection_t* cnx, uint32_t mask);
+ driver_t* attempt_to_load_angle(egl_connection_t* cnx);
+ driver_t* attempt_to_load_updated_driver(egl_connection_t* cnx);
+ driver_t* attempt_to_load_emulation_driver(egl_connection_t* cnx);
+ driver_t* attempt_to_load_system_driver(egl_connection_t* cnx);
void initialize_api(void* dso, egl_connection_t* cnx, uint32_t mask);
static __attribute__((noinline))