Merge "Refactor ANGLE usage code." into udc-dev
This commit is contained in:
@@ -107,42 +107,22 @@ public class GraphicsEnvironment {
|
|||||||
private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER = 2;
|
private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER = 2;
|
||||||
private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_OFF = 3;
|
private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_OFF = 3;
|
||||||
|
|
||||||
// System properties related to ANGLE and legacy GLES graphics drivers.
|
|
||||||
private static final String PROPERTY_EGL_SYSTEM_DRIVER = "ro.hardware.egl";
|
|
||||||
// TODO (b/224558229): Properly add this to the list of system properties for a device:
|
|
||||||
private static final String PROPERTY_EGL_LEGACY_DRIVER = "ro.hardware.egl_legacy";
|
|
||||||
|
|
||||||
// Values for ANGLE_GL_DRIVER_ALL_ANGLE
|
// Values for ANGLE_GL_DRIVER_ALL_ANGLE
|
||||||
private static final int ANGLE_GL_DRIVER_ALL_ANGLE_ON = 1;
|
private static final int ANGLE_GL_DRIVER_ALL_ANGLE_ON = 1;
|
||||||
private static final int ANGLE_GL_DRIVER_ALL_ANGLE_OFF = 0;
|
private static final int ANGLE_GL_DRIVER_ALL_ANGLE_OFF = 0;
|
||||||
private static final int ANGLE_GL_DRIVER_ALL_LEGACY = -1;
|
|
||||||
|
|
||||||
// Values for ANGLE_GL_DRIVER_SELECTION_VALUES
|
// Values for ANGLE_GL_DRIVER_SELECTION_VALUES
|
||||||
private static final String ANGLE_GL_DRIVER_CHOICE_DEFAULT = "default";
|
private static final String ANGLE_GL_DRIVER_CHOICE_DEFAULT = "default";
|
||||||
private static final String ANGLE_GL_DRIVER_CHOICE_ANGLE = "angle";
|
private static final String ANGLE_GL_DRIVER_CHOICE_ANGLE = "angle";
|
||||||
private static final String ANGLE_GL_DRIVER_CHOICE_LEGACY = "legacy";
|
|
||||||
// The following value is a deprecated choice for "legacy"
|
|
||||||
private static final String ANGLE_GL_DRIVER_CHOICE_NATIVE = "native";
|
private static final String ANGLE_GL_DRIVER_CHOICE_NATIVE = "native";
|
||||||
|
|
||||||
// Values returned by getDriverForPackage() and getDefaultDriverToUse() (avoid returning
|
|
||||||
// strings for performance reasons)
|
|
||||||
private static final int ANGLE_GL_DRIVER_TO_USE_LEGACY = 0;
|
|
||||||
private static final int ANGLE_GL_DRIVER_TO_USE_ANGLE = 1;
|
|
||||||
|
|
||||||
private ClassLoader mClassLoader;
|
private ClassLoader mClassLoader;
|
||||||
private String mLibrarySearchPaths;
|
private String mLibrarySearchPaths;
|
||||||
private String mLibraryPermittedPaths;
|
private String mLibraryPermittedPaths;
|
||||||
private GameManager mGameManager;
|
private GameManager mGameManager;
|
||||||
|
|
||||||
private boolean mAngleIsSystemDriver = false;
|
|
||||||
private boolean mNoLegacyDriver = false;
|
|
||||||
// When ANGLE is the system driver, this is the name of the legacy driver.
|
|
||||||
//
|
|
||||||
// TODO (b/224558229): This is temporarily set to a value that works for testing, until
|
|
||||||
// PROPERTY_EGL_LEGACY_DRIVER has been properly plumbed and this becomes broadly available.
|
|
||||||
private String mEglLegacyDriver = "mali";
|
|
||||||
|
|
||||||
private int mAngleOptInIndex = -1;
|
private int mAngleOptInIndex = -1;
|
||||||
|
private boolean mEnabledByGameMode = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up GraphicsEnvironment
|
* Set up GraphicsEnvironment
|
||||||
@@ -159,24 +139,6 @@ public class GraphicsEnvironment {
|
|||||||
setupGpuLayers(context, coreSettings, pm, packageName, appInfoWithMetaData);
|
setupGpuLayers(context, coreSettings, pm, packageName, appInfoWithMetaData);
|
||||||
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS);
|
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS);
|
||||||
|
|
||||||
// Determine if ANGLE is the system driver, as this will determine other logic
|
|
||||||
final String eglSystemDriver = SystemProperties.get(PROPERTY_EGL_SYSTEM_DRIVER);
|
|
||||||
Log.v(TAG, "GLES system driver is '" + eglSystemDriver + "'");
|
|
||||||
mAngleIsSystemDriver = eglSystemDriver.equals(ANGLE_DRIVER_NAME);
|
|
||||||
if (mAngleIsSystemDriver) {
|
|
||||||
// Lookup the legacy driver, to send down to the EGL loader
|
|
||||||
final String eglLegacyDriver = SystemProperties.get(PROPERTY_EGL_LEGACY_DRIVER);
|
|
||||||
if (eglLegacyDriver.isEmpty()) {
|
|
||||||
mNoLegacyDriver = true;
|
|
||||||
// TBD/TODO: Do we need this?:
|
|
||||||
mEglLegacyDriver = eglSystemDriver;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// TBD/TODO: Do we need this?:
|
|
||||||
mEglLegacyDriver = eglSystemDriver;
|
|
||||||
}
|
|
||||||
Log.v(TAG, "Legacy GLES driver is '" + mEglLegacyDriver + "'");
|
|
||||||
|
|
||||||
// Setup ANGLE and pass down ANGLE details to the C++ code
|
// Setup ANGLE and pass down ANGLE details to the C++ code
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "setupAngle");
|
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "setupAngle");
|
||||||
boolean useAngle = false;
|
boolean useAngle = false;
|
||||||
@@ -185,10 +147,6 @@ public class GraphicsEnvironment {
|
|||||||
useAngle = true;
|
useAngle = true;
|
||||||
setGpuStats(ANGLE_DRIVER_NAME, ANGLE_DRIVER_VERSION_NAME, ANGLE_DRIVER_VERSION_CODE,
|
setGpuStats(ANGLE_DRIVER_NAME, ANGLE_DRIVER_VERSION_NAME, ANGLE_DRIVER_VERSION_CODE,
|
||||||
0, packageName, getVulkanVersion(pm));
|
0, packageName, getVulkanVersion(pm));
|
||||||
} else if (mNoLegacyDriver) {
|
|
||||||
// TBD: The following should never happen--does it?
|
|
||||||
Log.e(TAG, "Unexpected problem with the ANGLE for use with: '" + packageName + "'");
|
|
||||||
useAngle = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS);
|
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS);
|
||||||
@@ -242,12 +200,10 @@ public class GraphicsEnvironment {
|
|||||||
private boolean shouldUseAngle(Context context, Bundle coreSettings, String packageName) {
|
private boolean shouldUseAngle(Context context, Bundle coreSettings, String packageName) {
|
||||||
if (TextUtils.isEmpty(packageName)) {
|
if (TextUtils.isEmpty(packageName)) {
|
||||||
Log.v(TAG, "No package name specified; use the system driver");
|
Log.v(TAG, "No package name specified; use the system driver");
|
||||||
return mAngleIsSystemDriver ? true : false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int driverToUse = getDriverForPackage(context, coreSettings, packageName);
|
return shouldUseAngleInternal(context, coreSettings, packageName);
|
||||||
boolean yesOrNo = driverToUse == ANGLE_GL_DRIVER_TO_USE_ANGLE;
|
|
||||||
return yesOrNo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getVulkanVersion(PackageManager pm) {
|
private int getVulkanVersion(PackageManager pm) {
|
||||||
@@ -455,43 +411,25 @@ public class GraphicsEnvironment {
|
|||||||
return ai;
|
return ai;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the appropriate "default" driver, unless overridden by isAngleEnabledByGameMode().
|
|
||||||
*/
|
|
||||||
private int getDefaultDriverToUse(Context context, String packageName) {
|
|
||||||
if (mAngleIsSystemDriver || isAngleEnabledByGameMode(context, packageName)) {
|
|
||||||
return ANGLE_GL_DRIVER_TO_USE_ANGLE;
|
|
||||||
} else {
|
|
||||||
return ANGLE_GL_DRIVER_TO_USE_LEGACY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine which GLES "driver" should be used for the package, taking into account the
|
* Determine which GLES "driver" should be used for the package, taking into account the
|
||||||
* following factors (in priority order):
|
* following factors (in priority order):
|
||||||
*
|
*
|
||||||
* 1) The semi-global switch (i.e. Settings.Global.ANGLE_GL_DRIVER_ALL_ANGLE; which is set by
|
* 1) The semi-global switch (i.e. Settings.Global.ANGLE_GL_DRIVER_ALL_ANGLE; which is set by
|
||||||
* the "angle_gl_driver_all_angle" setting; which forces a driver for all processes that
|
* the "angle_gl_driver_all_angle" setting; which forces a driver for all processes that
|
||||||
* start after the Java run time is up), if it forces a choice; otherwise ...
|
* start after the Java run time is up), if it forces a choice;
|
||||||
* 2) The per-application switch (i.e. Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS and
|
* 2) The per-application switch (i.e. Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS and
|
||||||
* Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES; which corresponds to the
|
* Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES; which corresponds to the
|
||||||
* “angle_gl_driver_selection_pkgs” and “angle_gl_driver_selection_values” settings); if it
|
* “angle_gl_driver_selection_pkgs” and “angle_gl_driver_selection_values” settings); if it
|
||||||
* forces a choice;
|
* forces a choice;
|
||||||
* - Workaround Note: ANGLE and Vulkan currently have issues with applications that use YUV
|
* 3) Use ANGLE if isAngleEnabledByGameMode() returns true;
|
||||||
* target functionality. The ANGLE broadcast receiver code will apply a "deferlist" at
|
|
||||||
* the first boot of a newly-flashed device. However, there is a gap in time between
|
|
||||||
* when applications can start and when the deferlist is applied. For now, assume that
|
|
||||||
* if ANGLE is the system driver and Settings.Global.ANGLE_DEFERLIST is empty, that the
|
|
||||||
* deferlist has not yet been applied. In this case, select the Legacy driver.
|
|
||||||
* otherwise ...
|
|
||||||
* 3) Use ANGLE if isAngleEnabledByGameMode() returns true; otherwise ...
|
|
||||||
* 4) The global switch (i.e. use the system driver, whether ANGLE or legacy;
|
|
||||||
* a.k.a. mAngleIsSystemDriver, which is set by the device’s “ro.hardware.egl” property)
|
|
||||||
*
|
|
||||||
* Factors 1 and 2 are decided by this method. Factors 3 and 4 are decided by
|
|
||||||
* getDefaultDriverToUse().
|
|
||||||
*/
|
*/
|
||||||
private int getDriverForPackage(Context context, Bundle bundle, String packageName) {
|
private boolean shouldUseAngleInternal(Context context, Bundle bundle, String packageName) {
|
||||||
|
// Make sure we have a good package name
|
||||||
|
if (TextUtils.isEmpty(packageName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check the semi-global switch (i.e. once system has booted enough) for whether ANGLE
|
// Check the semi-global switch (i.e. once system has booted enough) for whether ANGLE
|
||||||
// should be forced on or off for "all appplications"
|
// should be forced on or off for "all appplications"
|
||||||
final int allUseAngle;
|
final int allUseAngle;
|
||||||
@@ -504,16 +442,7 @@ public class GraphicsEnvironment {
|
|||||||
}
|
}
|
||||||
if (allUseAngle == ANGLE_GL_DRIVER_ALL_ANGLE_ON) {
|
if (allUseAngle == ANGLE_GL_DRIVER_ALL_ANGLE_ON) {
|
||||||
Log.v(TAG, "Turn on ANGLE for all applications.");
|
Log.v(TAG, "Turn on ANGLE for all applications.");
|
||||||
return ANGLE_GL_DRIVER_TO_USE_ANGLE;
|
return true;
|
||||||
}
|
|
||||||
if (allUseAngle == ANGLE_GL_DRIVER_ALL_LEGACY) {
|
|
||||||
Log.v(TAG, "Disable ANGLE for all applications.");
|
|
||||||
return ANGLE_GL_DRIVER_TO_USE_LEGACY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have a good package name
|
|
||||||
if (TextUtils.isEmpty(packageName)) {
|
|
||||||
return getDefaultDriverToUse(context, packageName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the per-application settings lists
|
// Get the per-application settings lists
|
||||||
@@ -522,61 +451,46 @@ public class GraphicsEnvironment {
|
|||||||
contentResolver, bundle, Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS);
|
contentResolver, bundle, Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS);
|
||||||
final List<String> optInValues = getGlobalSettingsString(
|
final List<String> optInValues = getGlobalSettingsString(
|
||||||
contentResolver, bundle, Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES);
|
contentResolver, bundle, Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES);
|
||||||
final List<String> angleDeferlist = getGlobalSettingsString(
|
|
||||||
contentResolver, bundle, Settings.Global.ANGLE_DEFERLIST);
|
|
||||||
Log.v(TAG, "Currently set values for:");
|
Log.v(TAG, "Currently set values for:");
|
||||||
Log.v(TAG, " angle_gl_driver_selection_pkgs =" + optInPackages);
|
Log.v(TAG, " angle_gl_driver_selection_pkgs=" + optInPackages);
|
||||||
Log.v(TAG, " angle_gl_driver_selection_values =" + optInValues);
|
Log.v(TAG, " angle_gl_driver_selection_values=" + optInValues);
|
||||||
|
|
||||||
// If ANGLE is the system driver AND the deferlist has not yet been applied, select the
|
mEnabledByGameMode = isAngleEnabledByGameMode(context, packageName);
|
||||||
// Legacy driver
|
|
||||||
if (mAngleIsSystemDriver && angleDeferlist.size() == 0) {
|
|
||||||
Log.v(TAG, "ANGLE deferlist (" + Settings.Global.ANGLE_DEFERLIST + ") has not been "
|
|
||||||
+ "applied, defaulting to legacy driver");
|
|
||||||
return ANGLE_GL_DRIVER_TO_USE_LEGACY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have good settings to use
|
// Make sure we have good settings to use
|
||||||
if (optInPackages.size() != optInValues.size()) {
|
if (optInPackages.size() != optInValues.size()) {
|
||||||
Log.w(TAG,
|
Log.v(TAG,
|
||||||
"Global.Settings values are invalid: "
|
"Global.Settings values are invalid: "
|
||||||
+ "number of packages: "
|
+ "number of packages: "
|
||||||
+ optInPackages.size() + ", "
|
+ optInPackages.size() + ", "
|
||||||
+ "number of values: "
|
+ "number of values: "
|
||||||
+ optInValues.size());
|
+ optInValues.size());
|
||||||
return getDefaultDriverToUse(context, packageName);
|
return mEnabledByGameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if this application is listed in the per-application settings lists
|
// See if this application is listed in the per-application settings list
|
||||||
final int pkgIndex = getPackageIndex(packageName, optInPackages);
|
final int pkgIndex = getPackageIndex(packageName, optInPackages);
|
||||||
|
|
||||||
if (pkgIndex < 0) {
|
if (pkgIndex < 0) {
|
||||||
// The application is NOT listed in the per-application settings lists; and so use the
|
Log.v(TAG, packageName + " is not listed in per-application setting");
|
||||||
// system driver (i.e. either ANGLE or the Legacy driver)
|
return mEnabledByGameMode;
|
||||||
Log.v(TAG, "getDriverForPackage(): No per-application setting");
|
|
||||||
return getDefaultDriverToUse(context, packageName);
|
|
||||||
}
|
}
|
||||||
mAngleOptInIndex = pkgIndex;
|
mAngleOptInIndex = pkgIndex;
|
||||||
|
|
||||||
Log.v(TAG,
|
// The application IS listed in the per-application settings list; and so use the
|
||||||
"getDriverForPackage(): using per-application switch: "
|
// setting--choosing the current system driver if the setting is "default"
|
||||||
+ optInValues.get(pkgIndex));
|
String optInValue = optInValues.get(pkgIndex);
|
||||||
// The application IS listed in the per-application settings lists; and so use the
|
|
||||||
// setting--choosing the current system driver if the setting is "default" (i.e. either
|
|
||||||
// ANGLE or the Legacy driver)
|
|
||||||
String rtnValue = optInValues.get(pkgIndex);
|
|
||||||
Log.v(TAG,
|
Log.v(TAG,
|
||||||
"ANGLE Developer option for '" + packageName + "' "
|
"ANGLE Developer option for '" + packageName + "' "
|
||||||
+ "set to: '" + rtnValue + "'");
|
+ "set to: '" + optInValue + "'");
|
||||||
if (rtnValue.equals(ANGLE_GL_DRIVER_CHOICE_ANGLE)) {
|
if (optInValue.equals(ANGLE_GL_DRIVER_CHOICE_ANGLE)) {
|
||||||
return ANGLE_GL_DRIVER_TO_USE_ANGLE;
|
return true;
|
||||||
} else if (rtnValue.equals(ANGLE_GL_DRIVER_CHOICE_NATIVE)
|
} else if (optInValue.equals(ANGLE_GL_DRIVER_CHOICE_NATIVE)) {
|
||||||
|| rtnValue.equals(ANGLE_GL_DRIVER_CHOICE_LEGACY)) {
|
return false;
|
||||||
return ANGLE_GL_DRIVER_TO_USE_LEGACY;
|
|
||||||
} else {
|
} else {
|
||||||
// The user either chose default or an invalid value; go with the default driver or what
|
// The user either chose default or an invalid value; go with the default driver or what
|
||||||
// the game dashboard indicates
|
// the game mode indicates
|
||||||
return getDefaultDriverToUse(context, packageName);
|
return mEnabledByGameMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,9 +545,7 @@ public class GraphicsEnvironment {
|
|||||||
* the C++ GraphicsEnv class.
|
* the C++ GraphicsEnv class.
|
||||||
*
|
*
|
||||||
* If ANGLE will be used, GraphicsEnv::setAngleInfo() will be called to enable ANGLE to be
|
* If ANGLE will be used, GraphicsEnv::setAngleInfo() will be called to enable ANGLE to be
|
||||||
* properly used. Otherwise, GraphicsEnv::setLegacyDriverInfo() will be called to
|
* properly used.
|
||||||
* enable the legacy GLES driver (e.g. when ANGLE is the system driver) to be identified and
|
|
||||||
* used.
|
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* @param bundle
|
* @param bundle
|
||||||
@@ -646,7 +558,6 @@ public class GraphicsEnvironment {
|
|||||||
String packageName) {
|
String packageName) {
|
||||||
|
|
||||||
if (!shouldUseAngle(context, bundle, packageName)) {
|
if (!shouldUseAngle(context, bundle, packageName)) {
|
||||||
setLegacyDriverInfo(packageName, mAngleIsSystemDriver, mEglLegacyDriver);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,13 +566,13 @@ public class GraphicsEnvironment {
|
|||||||
// If the developer has specified a debug package over ADB, attempt to find it
|
// If the developer has specified a debug package over ADB, attempt to find it
|
||||||
String anglePkgName = getAngleDebugPackage(context, bundle);
|
String anglePkgName = getAngleDebugPackage(context, bundle);
|
||||||
if (!anglePkgName.isEmpty()) {
|
if (!anglePkgName.isEmpty()) {
|
||||||
Log.i(TAG, "ANGLE debug package enabled: " + anglePkgName);
|
Log.v(TAG, "ANGLE debug package enabled: " + anglePkgName);
|
||||||
try {
|
try {
|
||||||
// Note the debug package does not have to be pre-installed
|
// Note the debug package does not have to be pre-installed
|
||||||
angleInfo = pm.getApplicationInfo(anglePkgName, 0);
|
angleInfo = pm.getApplicationInfo(anglePkgName, 0);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(TAG, "ANGLE debug package '" + anglePkgName + "' not installed");
|
// If the debug package is specified but not found, abort.
|
||||||
setLegacyDriverInfo(packageName, mAngleIsSystemDriver, mEglLegacyDriver);
|
Log.v(TAG, "ANGLE debug package '" + anglePkgName + "' not installed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,8 +581,7 @@ public class GraphicsEnvironment {
|
|||||||
if (angleInfo == null) {
|
if (angleInfo == null) {
|
||||||
anglePkgName = getAnglePackageName(pm);
|
anglePkgName = getAnglePackageName(pm);
|
||||||
if (TextUtils.isEmpty(anglePkgName)) {
|
if (TextUtils.isEmpty(anglePkgName)) {
|
||||||
Log.w(TAG, "Failed to find ANGLE package.");
|
Log.v(TAG, "Failed to find ANGLE package.");
|
||||||
setLegacyDriverInfo(packageName, mAngleIsSystemDriver, mEglLegacyDriver);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,8 +591,7 @@ public class GraphicsEnvironment {
|
|||||||
angleInfo = pm.getApplicationInfo(anglePkgName,
|
angleInfo = pm.getApplicationInfo(anglePkgName,
|
||||||
PackageManager.MATCH_SYSTEM_ONLY);
|
PackageManager.MATCH_SYSTEM_ONLY);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(TAG, "ANGLE package '" + anglePkgName + "' not installed");
|
Log.v(TAG, "ANGLE package '" + anglePkgName + "' not installed");
|
||||||
setLegacyDriverInfo(packageName, mAngleIsSystemDriver, mEglLegacyDriver);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -697,14 +606,13 @@ public class GraphicsEnvironment {
|
|||||||
+ abi;
|
+ abi;
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.v(TAG, "ANGLE package libs: " + paths);
|
Log.d(TAG, "ANGLE package libs: " + paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we make it to here, ANGLE will be used. Call setAngleInfo() with the package name,
|
// If we make it to here, ANGLE will be used. Call setAngleInfo() with the package name,
|
||||||
// and features to use.
|
// and features to use.
|
||||||
final String[] features = getAngleEglFeatures(context, bundle);
|
final String[] features = getAngleEglFeatures(context, bundle);
|
||||||
setAngleInfo(
|
setAngleInfo(paths, packageName, ANGLE_GL_DRIVER_CHOICE_ANGLE, features);
|
||||||
paths, packageName, mAngleIsSystemDriver, ANGLE_GL_DRIVER_CHOICE_ANGLE, features);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -994,9 +902,7 @@ public class GraphicsEnvironment {
|
|||||||
private static native void setGpuStats(String driverPackageName, String driverVersionName,
|
private static native void setGpuStats(String driverPackageName, String driverVersionName,
|
||||||
long driverVersionCode, long driverBuildTime, String appPackageName, int vulkanVersion);
|
long driverVersionCode, long driverBuildTime, String appPackageName, int vulkanVersion);
|
||||||
private static native void setAngleInfo(String path, String appPackage,
|
private static native void setAngleInfo(String path, String appPackage,
|
||||||
boolean angleIsSystemDriver, String devOptIn, String[] features);
|
String devOptIn, String[] features);
|
||||||
private static native void setLegacyDriverInfo(
|
|
||||||
String appPackage, boolean angleIsSystemDriver, String legacyDriverName);
|
|
||||||
private static native boolean getShouldUseAngle(String packageName);
|
private static native boolean getShouldUseAngle(String packageName);
|
||||||
private static native boolean setInjectLayersPrSetDumpable();
|
private static native boolean setInjectLayersPrSetDumpable();
|
||||||
private static native void nativeToggleAngleAsSystemDriver(boolean enabled);
|
private static native void nativeToggleAngleAsSystemDriver(boolean enabled);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void setGpuStats_native(JNIEnv* env, jobject clazz, jstring driverPackageName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAngleInfo_native(JNIEnv* env, jobject clazz, jstring path, jstring appName,
|
void setAngleInfo_native(JNIEnv* env, jobject clazz, jstring path, jstring appName,
|
||||||
jboolean angleIsSystemDriver, jstring devOptIn, jobjectArray featuresObj) {
|
jstring devOptIn, jobjectArray featuresObj) {
|
||||||
ScopedUtfChars pathChars(env, path);
|
ScopedUtfChars pathChars(env, path);
|
||||||
ScopedUtfChars appNameChars(env, appName);
|
ScopedUtfChars appNameChars(env, appName);
|
||||||
ScopedUtfChars devOptInChars(env, devOptIn);
|
ScopedUtfChars devOptInChars(env, devOptIn);
|
||||||
@@ -74,18 +74,7 @@ void setAngleInfo_native(JNIEnv* env, jobject clazz, jstring path, jstring appNa
|
|||||||
}
|
}
|
||||||
|
|
||||||
android::GraphicsEnv::getInstance().setAngleInfo(pathChars.c_str(), appNameChars.c_str(),
|
android::GraphicsEnv::getInstance().setAngleInfo(pathChars.c_str(), appNameChars.c_str(),
|
||||||
angleIsSystemDriver, devOptInChars.c_str(),
|
devOptInChars.c_str(), features);
|
||||||
features);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setLegacyDriverInfo_native(JNIEnv* env, jobject clazz, jstring appName,
|
|
||||||
jboolean angleIsSystemDriver, jstring legacyDriverName) {
|
|
||||||
ScopedUtfChars appNameChars(env, appName);
|
|
||||||
ScopedUtfChars legacyDriverNameChars(env, legacyDriverName);
|
|
||||||
|
|
||||||
android::GraphicsEnv::getInstance().setLegacyDriverInfo(appNameChars.c_str(),
|
|
||||||
angleIsSystemDriver,
|
|
||||||
legacyDriverNameChars.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldUseAngle_native(JNIEnv* env, jobject clazz, jstring appName) {
|
bool shouldUseAngle_native(JNIEnv* env, jobject clazz, jstring appName) {
|
||||||
@@ -135,10 +124,8 @@ const JNINativeMethod g_methods[] = {
|
|||||||
{"setInjectLayersPrSetDumpable", "()Z",
|
{"setInjectLayersPrSetDumpable", "()Z",
|
||||||
reinterpret_cast<void*>(setInjectLayersPrSetDumpable_native)},
|
reinterpret_cast<void*>(setInjectLayersPrSetDumpable_native)},
|
||||||
{"setAngleInfo",
|
{"setAngleInfo",
|
||||||
"(Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;[Ljava/lang/String;)V",
|
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V",
|
||||||
reinterpret_cast<void*>(setAngleInfo_native)},
|
reinterpret_cast<void*>(setAngleInfo_native)},
|
||||||
{"setLegacyDriverInfo", "(Ljava/lang/String;ZLjava/lang/String;)V",
|
|
||||||
reinterpret_cast<void*>(setLegacyDriverInfo_native)},
|
|
||||||
{"getShouldUseAngle", "(Ljava/lang/String;)Z",
|
{"getShouldUseAngle", "(Ljava/lang/String;)Z",
|
||||||
reinterpret_cast<void*>(shouldUseAngle_native)},
|
reinterpret_cast<void*>(shouldUseAngle_native)},
|
||||||
{"setLayerPaths", "(Ljava/lang/ClassLoader;Ljava/lang/String;)V",
|
{"setLayerPaths", "(Ljava/lang/ClassLoader;Ljava/lang/String;)V",
|
||||||
|
|||||||
Reference in New Issue
Block a user