From 6af5bcb158b0b4beed632f6a92f0f67174bf9025 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 23 Apr 2020 10:04:51 -0700 Subject: Remove unused egl_connection_t::angleDecided Test: build Bug: b/154237217 Change-Id: I81b7546cedd2925286b06d7805a1c85b5ab2e459 (cherry picked from commit 260d962505f8ecf6da23559a9b270327bec60b8c) --- opengl/libs/EGL/Loader.cpp | 2 -- opengl/libs/EGL/egldefs.h | 1 - 2 files changed, 3 deletions(-) (limited to 'opengl') diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index e19802b32f..5744182401 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -318,7 +318,6 @@ void Loader::close(egl_connection_t* cnx) cnx->dso = nullptr; cnx->shouldUseAngle = false; - cnx->angleDecided = false; cnx->useAngle = false; if (cnx->vendorEGL) { @@ -569,7 +568,6 @@ static void* load_angle(const char* kind, android_namespace_t* ns, egl_connectio android::GraphicsEnv::getInstance().getAngleAppName().c_str()); cnx->useAngle = false; } - cnx->angleDecided = true; return so; } diff --git a/opengl/libs/EGL/egldefs.h b/opengl/libs/EGL/egldefs.h index 7bb9b59ea4..11fefabaa9 100644 --- a/opengl/libs/EGL/egldefs.h +++ b/opengl/libs/EGL/egldefs.h @@ -82,7 +82,6 @@ struct egl_connection_t { bool systemDriverUnloaded; bool shouldUseAngle; // Should we attempt to load ANGLE - bool angleDecided; // Have we tried to load ANGLE bool useAngle; // Was ANGLE successfully loaded EGLint angleBackend; void* vendorEGL; -- cgit v1.2.3-59-g8ed1b From 09d2771d37822f3450e097f02383986da664ef8a Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 23 Apr 2020 10:40:24 -0700 Subject: Clean up egl_connection_t::shouldUseAngle If android::GraphicsEnv::getInstance().shouldUseAngle() returns false, then the ANGLE driver loading can bail out early. The choice should be made before the app starts loading the driver. If there's a change in the driver choice during driver loading, then it shouldn't affect the current loading process, but the next app fresh launch, otherwise crash will happen for the 3-part driver loading. Test: build Bug: b/154237217 Change-Id: I9ea202214bdbc4b70d068137c62d2b1f8ac8ebb5 (cherry picked from commit b22f08618971b0f94ca6ce479ca85e3f5e8833a6) --- opengl/libs/EGL/Loader.cpp | 22 ++++++---------------- opengl/libs/EGL/egldefs.h | 1 - 2 files changed, 6 insertions(+), 17 deletions(-) (limited to 'opengl') diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 5744182401..39bf329e81 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -222,13 +222,6 @@ void* Loader::open(egl_connection_t* cnx) return cnx->dso; } - // Check if we should use ANGLE early, so loading each driver doesn't require repeated queries. - if (android::GraphicsEnv::getInstance().shouldUseAngle()) { - cnx->shouldUseAngle = true; - } else { - cnx->shouldUseAngle = false; - } - // Firstly, try to load ANGLE driver. driver_t* hnd = attempt_to_load_angle(cnx); if (!hnd) { @@ -317,7 +310,6 @@ void Loader::close(egl_connection_t* cnx) delete hnd; cnx->dso = nullptr; - cnx->shouldUseAngle = false; cnx->useAngle = false; if (cnx->vendorEGL) { @@ -511,14 +503,7 @@ static void* load_angle_from_namespace(const char* kind, android_namespace_t* ns } static void* load_angle(const char* kind, android_namespace_t* ns, egl_connection_t* cnx) { - void* so = nullptr; - - if ((cnx->shouldUseAngle) || android::GraphicsEnv::getInstance().shouldUseAngle()) { - so = load_angle_from_namespace(kind, ns); - cnx->shouldUseAngle = true; - } else { - cnx->shouldUseAngle = false; - } + void* so = load_angle_from_namespace(kind, ns); if (so) { ALOGV("Loaded ANGLE %s library for '%s' (instead of native)", kind, @@ -595,6 +580,11 @@ static void* load_updated_driver(const char* kind, android_namespace_t* ns) { Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) { ATRACE_CALL(); + + if (!android::GraphicsEnv::getInstance().shouldUseAngle()) { + return nullptr; + } + android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace(); if (!ns) { return nullptr; diff --git a/opengl/libs/EGL/egldefs.h b/opengl/libs/EGL/egldefs.h index 11fefabaa9..18a39497d1 100644 --- a/opengl/libs/EGL/egldefs.h +++ b/opengl/libs/EGL/egldefs.h @@ -81,7 +81,6 @@ struct egl_connection_t { void* libGles2; bool systemDriverUnloaded; - bool shouldUseAngle; // Should we attempt to load ANGLE bool useAngle; // Was ANGLE successfully loaded EGLint angleBackend; void* vendorEGL; -- cgit v1.2.3-59-g8ed1b