Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dhina17
platform_frameworks_base
Commits
2aa1b380
Commit
2aa1b380
authored
1 year ago
by
Treehugger Robot
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "[Cherry-pick] Revert "Revert "Load native GLES driver when specified.""" into main
parents
985c8dcf
c4500de4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/java/android/os/GraphicsEnvironment.java
+32
-22
32 additions, 22 deletions
core/java/android/os/GraphicsEnvironment.java
core/jni/android_os_GraphicsEnvironment.cpp
+3
-3
3 additions, 3 deletions
core/jni/android_os_GraphicsEnvironment.cpp
with
35 additions
and
25 deletions
core/java/android/os/GraphicsEnvironment.java
+
32
−
22
View file @
2aa1b380
...
...
@@ -115,6 +115,7 @@ public class GraphicsEnvironment {
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_NATIVE
=
"native"
;
private
static
final
String
SYSTEM_ANGLE_STRING
=
"system"
;
private
static
final
String
PROPERTY_RO_ANGLE_SUPPORTED
=
"ro.gfx.angle.supported"
;
...
...
@@ -195,15 +196,16 @@ public class GraphicsEnvironment {
}
/**
* Query to determine
if
ANGLE
should be used
* Query to determine
the
ANGLE
driver choice.
*/
private
boolean
shouldUseAngle
(
Context
context
,
Bundle
coreSettings
,
String
packageName
)
{
private
String
queryAngleChoice
(
Context
context
,
Bundle
coreSettings
,
String
packageName
)
{
if
(
TextUtils
.
isEmpty
(
packageName
))
{
Log
.
v
(
TAG
,
"No package name specified; use the system driver"
);
return
false
;
return
ANGLE_GL_DRIVER_CHOICE_DEFAULT
;
}
return
shouldUseAngl
eInternal
(
context
,
coreSettings
,
packageName
);
return
queryAngleChoic
eInternal
(
context
,
coreSettings
,
packageName
);
}
private
int
getVulkanVersion
(
PackageManager
pm
)
{
...
...
@@ -424,10 +426,11 @@ public class GraphicsEnvironment {
* forces a choice;
* 3) Use ANGLE if isAngleEnabledByGameMode() returns true;
*/
private
boolean
shouldUseAngleInternal
(
Context
context
,
Bundle
bundle
,
String
packageName
)
{
private
String
queryAngleChoiceInternal
(
Context
context
,
Bundle
bundle
,
String
packageName
)
{
// Make sure we have a good package name
if
(
TextUtils
.
isEmpty
(
packageName
))
{
return
false
;
return
ANGLE_GL_DRIVER_CHOICE_DEFAULT
;
}
// Check the semi-global switch (i.e. once system has booted enough) for whether ANGLE
...
...
@@ -442,7 +445,7 @@ public class GraphicsEnvironment {
}
if
(
allUseAngle
==
ANGLE_GL_DRIVER_ALL_ANGLE_ON
)
{
Log
.
v
(
TAG
,
"Turn on ANGLE for all applications."
);
return
true
;
return
ANGLE_GL_DRIVER_CHOICE_ANGLE
;
}
// Get the per-application settings lists
...
...
@@ -465,7 +468,8 @@ public class GraphicsEnvironment {
+
optInPackages
.
size
()
+
", "
+
"number of values: "
+
optInValues
.
size
());
return
mEnabledByGameMode
;
return
mEnabledByGameMode
?
ANGLE_GL_DRIVER_CHOICE_ANGLE
:
ANGLE_GL_DRIVER_CHOICE_DEFAULT
;
}
// See if this application is listed in the per-application settings list
...
...
@@ -473,7 +477,8 @@ public class GraphicsEnvironment {
if
(
pkgIndex
<
0
)
{
Log
.
v
(
TAG
,
packageName
+
" is not listed in per-application setting"
);
return
mEnabledByGameMode
;
return
mEnabledByGameMode
?
ANGLE_GL_DRIVER_CHOICE_ANGLE
:
ANGLE_GL_DRIVER_CHOICE_DEFAULT
;
}
mAngleOptInIndex
=
pkgIndex
;
...
...
@@ -484,13 +489,14 @@ public class GraphicsEnvironment {
"ANGLE Developer option for '"
+
packageName
+
"' "
+
"set to: '"
+
optInValue
+
"'"
);
if
(
optInValue
.
equals
(
ANGLE_GL_DRIVER_CHOICE_ANGLE
))
{
return
true
;
return
ANGLE_GL_DRIVER_CHOICE_ANGLE
;
}
else
if
(
optInValue
.
equals
(
ANGLE_GL_DRIVER_CHOICE_NATIVE
))
{
return
false
;
return
ANGLE_GL_DRIVER_CHOICE_NATIVE
;
}
else
{
// The user either chose default or an invalid value; go with the default driver or what
// the game mode indicates
return
mEnabledByGameMode
;
return
mEnabledByGameMode
?
ANGLE_GL_DRIVER_CHOICE_ANGLE
:
ANGLE_GL_DRIVER_CHOICE_DEFAULT
;
}
}
...
...
@@ -557,8 +563,12 @@ public class GraphicsEnvironment {
*/
private
boolean
setupAngle
(
Context
context
,
Bundle
bundle
,
PackageManager
packageManager
,
String
packageName
)
{
if
(!
shouldUseAngle
(
context
,
bundle
,
packageName
))
{
final
String
angleChoice
=
queryAngleChoice
(
context
,
bundle
,
packageName
);
if
(
angleChoice
.
equals
(
ANGLE_GL_DRIVER_CHOICE_DEFAULT
))
{
return
false
;
}
if
(
angleChoice
.
equals
(
ANGLE_GL_DRIVER_CHOICE_NATIVE
))
{
nativeSetAngleInfo
(
""
,
true
,
packageName
,
null
);
return
false
;
}
...
...
@@ -627,10 +637,10 @@ public class GraphicsEnvironment {
Log
.
d
(
TAG
,
"ANGLE package libs: "
+
paths
);
}
// If we make it to here, ANGLE will be used. Call
s
etAngleInfo() with the
package name,
// a
nd
features to use.
// If we make it to here, ANGLE
apk
will be used. Call
nativeS
etAngleInfo() with the
// a
pplication package name and ANGLE
features to use.
final
String
[]
features
=
getAngleEglFeatures
(
context
,
bundle
);
s
etAngleInfo
(
paths
,
false
,
packageName
,
features
);
nativeS
etAngleInfo
(
paths
,
false
,
packageName
,
features
);
return
true
;
}
...
...
@@ -652,10 +662,10 @@ public class GraphicsEnvironment {
return
false
;
}
// If we make it to here, ANGLE will be used. Call
s
etAngleInfo() with
the package name,
//
and
features to use.
// If we make it to here,
system
ANGLE will be used. Call
nativeS
etAngleInfo() with
//
the application package name and ANGLE
features to use.
final
String
[]
features
=
getAngleEglFeatures
(
context
,
bundle
);
s
etAngleInfo
(
""
,
tru
e
,
packageName
,
features
);
nativeS
etAngleInfo
(
SYSTEM_ANGLE_STRING
,
fals
e
,
packageName
,
features
);
return
true
;
}
...
...
@@ -936,8 +946,8 @@ public class GraphicsEnvironment {
private
static
native
void
setDriverPathAndSphalLibraries
(
String
path
,
String
sphalLibraries
);
private
static
native
void
setGpuStats
(
String
driverPackageName
,
String
driverVersionName
,
long
driverVersionCode
,
long
driverBuildTime
,
String
appPackageName
,
int
vulkanVersion
);
private
static
native
void
s
etAngleInfo
(
String
path
,
boolean
use
SystemAngle
,
String
packageName
,
String
[]
features
);
private
static
native
void
nativeS
etAngleInfo
(
String
path
,
boolean
use
NativeDriver
,
String
packageName
,
String
[]
features
);
private
static
native
boolean
setInjectLayersPrSetDumpable
();
private
static
native
void
nativeToggleAngleAsSystemDriver
(
boolean
enabled
);
...
...
This diff is collapsed.
Click to expand it.
core/jni/android_os_GraphicsEnvironment.cpp
+
3
−
3
View file @
2aa1b380
...
...
@@ -50,7 +50,7 @@ void setGpuStats_native(JNIEnv* env, jobject clazz, jstring driverPackageName,
appPackageNameChars
.
c_str
(),
vulkanVersion
);
}
void
setAngleInfo_native
(
JNIEnv
*
env
,
jobject
clazz
,
jstring
path
,
jboolean
use
SystemAngle
,
void
setAngleInfo_native
(
JNIEnv
*
env
,
jobject
clazz
,
jstring
path
,
jboolean
use
NativeDriver
,
jstring
packageName
,
jobjectArray
featuresObj
)
{
ScopedUtfChars
pathChars
(
env
,
path
);
ScopedUtfChars
packageNameChars
(
env
,
packageName
);
...
...
@@ -73,7 +73,7 @@ void setAngleInfo_native(JNIEnv* env, jobject clazz, jstring path, jboolean useS
}
}
android
::
GraphicsEnv
::
getInstance
().
setAngleInfo
(
pathChars
.
c_str
(),
use
SystemAngle
,
android
::
GraphicsEnv
::
getInstance
().
setAngleInfo
(
pathChars
.
c_str
(),
use
NativeDriver
,
packageNameChars
.
c_str
(),
features
);
}
...
...
@@ -118,7 +118,7 @@ const JNINativeMethod g_methods[] = {
reinterpret_cast
<
void
*>
(
setGpuStats_native
)},
{
"setInjectLayersPrSetDumpable"
,
"()Z"
,
reinterpret_cast
<
void
*>
(
setInjectLayersPrSetDumpable_native
)},
{
"
s
etAngleInfo"
,
"(Ljava/lang/String;ZLjava/lang/String;[Ljava/lang/String;)V"
,
{
"
nativeS
etAngleInfo"
,
"(Ljava/lang/String;ZLjava/lang/String;[Ljava/lang/String;)V"
,
reinterpret_cast
<
void
*>
(
setAngleInfo_native
)},
{
"setLayerPaths"
,
"(Ljava/lang/ClassLoader;Ljava/lang/String;)V"
,
reinterpret_cast
<
void
*>
(
setLayerPaths_native
)},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment