summaryrefslogtreecommitdiff
path: root/libs/graphicsenv/GraphicsEnv.cpp
diff options
context:
space:
mode:
author Ian Elliott <ianelliott@google.com> 2022-04-21 12:41:03 -0600
committer Ian Elliott <ianelliott@google.com> 2022-04-21 17:10:11 -0600
commit845fee957a26d3f10754df8b77dc868f6e8d2508 (patch)
treef35dd34867e6c40c438e8db57410e3ee7ce6e43b /libs/graphicsenv/GraphicsEnv.cpp
parentb0bf57233a0583702d31786bf2474b7c3041102c (diff)
Change Android platform for when ANGLE is default
Allow adb commands to select ANGLE vs the legacy GLES driver regardless of which driver is the system (default) driver, and to select between different versions of ANGLE if multiple versions are installed (e.g. the built-in system driver vs. an updated APK). Test: logcat Bug: 224558229 Change-Id: I83e59002b67181fda4da6070b80ffa595bc25ac4
Diffstat (limited to 'libs/graphicsenv/GraphicsEnv.cpp')
-rw-r--r--libs/graphicsenv/GraphicsEnv.cpp52
1 files changed, 48 insertions, 4 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 7f0cac5d4f..e4fbd6fe92 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -364,26 +364,51 @@ bool GraphicsEnv::shouldUseAngle() {
return (mUseAngle == YES) ? true : false;
}
+bool GraphicsEnv::forceLegacyDriver() {
+ // Make sure we are init'ed
+ if (mAngleAppName.empty()) {
+ ALOGV("NOT SETUP YET.");
+ return false;
+ }
+
+ return (mAngleIsSystemDriver == YES && mUseAngle == NO) ? true : false;
+}
+
+std::string GraphicsEnv::getLegacySuffix() {
+ return mLegacyDriverSuffix;
+}
+
void GraphicsEnv::updateUseAngle() {
mUseAngle = NO;
const char* ANGLE_PREFER_ANGLE = "angle";
+ const char* ANGLE_PREFER_LEGACY = "legacy";
+ // The following is a deprecated version of "legacy"
const char* ANGLE_PREFER_NATIVE = "native";
mUseAngle = NO;
if (mAngleDeveloperOptIn == ANGLE_PREFER_ANGLE) {
- ALOGV("User set \"Developer Options\" to force the use of ANGLE");
+ ALOGI("Using ANGLE, the %s GLES driver for package '%s'",
+ mAngleIsSystemDriver == YES ? "system" : "optional", mAngleAppName.c_str());
mUseAngle = YES;
- } else if (mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) {
- ALOGV("User set \"Developer Options\" to force the use of Native");
+ } else if (mAngleDeveloperOptIn == ANGLE_PREFER_LEGACY ||
+ mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) {
+ ALOGI("Using the (%s) Legacy GLES driver driver for package '%s'",
+ mAngleIsSystemDriver == YES ? "optional" : "system", mAngleAppName.c_str());
} else {
ALOGV("User set invalid \"Developer Options\": '%s'", mAngleDeveloperOptIn.c_str());
}
}
void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName,
- const std::string developerOptIn,
+ const bool angleIsSystemDriver, const std::string developerOptIn,
const std::vector<std::string> eglFeatures) {
+ // Set whether ANGLE is the system driver:
+ mAngleIsSystemDriver = angleIsSystemDriver ? YES : NO;
+
+ // Note: Given the current logic and lack of the old rules file processing,
+ // there seems to be little chance that mUseAngle != UNKNOWN. Leave this
+ // for now, even though it seems outdated.
if (mUseAngle != UNKNOWN) {
// We've already figured out an answer for this app, so just return.
ALOGV("Already evaluated the rules file for '%s': use ANGLE = %s", appName.c_str(),
@@ -404,6 +429,25 @@ void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName
updateUseAngle();
}
+void GraphicsEnv::setLegacyDriverInfo(const std::string appName, const bool angleIsSystemDriver,
+ const std::string legacyDriverName) {
+ ALOGV("setting ANGLE app name to '%s'", appName.c_str());
+ mAngleAppName = appName;
+
+ // Force the use of the legacy driver instead of ANGLE
+ const char* ANGLE_PREFER_LEGACY = "legacy";
+ mAngleDeveloperOptIn = ANGLE_PREFER_LEGACY;
+ ALOGV("setting ANGLE application opt-in to 'legacy'");
+
+ // Set whether ANGLE is the system driver:
+ mAngleIsSystemDriver = angleIsSystemDriver ? YES : NO;
+
+ mLegacyDriverSuffix = legacyDriverName;
+
+ // Update the current status of whether we should use ANGLE or not
+ updateUseAngle();
+}
+
void GraphicsEnv::setLayerPaths(NativeLoaderNamespace* appNamespace, const std::string layerPaths) {
if (mLayerPaths.empty()) {
mLayerPaths = layerPaths;