Unverified Commit 841cc675 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[Impeller] add OpenGL GPU tracing to devicelab tests. (#136974)

Adds the metadata key required to enable OpenGLES GPU tracing. This is off by default because the API crashes on some GPU models, but it should be safe on the Pixel 7 (others TBD based on testing results).
parent abd9374f
......@@ -772,6 +772,9 @@ Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations
/// <meta-data
/// android:name="io.flutter.embedding.android.ImpellerBackend"
/// android:value="opengles" />
/// <meta-data
/// android:name="io.flutter.embedding.android.EnableOpenGLGPUTracing"
/// android:value="true" />
void _addOpenGLESToManifest(String testDirectory) {
final String manifestPath = path.join(
testDirectory, 'android', 'app', 'src', 'main', 'AndroidManifest.xml');
......@@ -783,13 +786,16 @@ void _addOpenGLESToManifest(String testDirectory) {
final String xmlStr = file.readAsStringSync();
final XmlDocument xmlDoc = XmlDocument.parse(xmlStr);
const String key = 'io.flutter.embedding.android.ImpellerBackend';
const String value = 'opengles';
final List<(String, String)> keyPairs = <(String, String)>[
('io.flutter.embedding.android.ImpellerBackend', 'opengles'),
('io.flutter.embedding.android.EnableOpenGLGPUTracing', 'true')
];
final XmlElement applicationNode =
xmlDoc.findAllElements('application').first;
// Check if the meta-data node already exists.
for (final (String key, String value) in keyPairs) {
final Iterable<XmlElement> existingMetaData = applicationNode
.findAllElements('meta-data')
.where((XmlElement node) => node.getAttribute('android:name') == key);
......@@ -808,6 +814,7 @@ void _addOpenGLESToManifest(String testDirectory) {
applicationNode.children.add(metaData);
}
}
file.writeAsStringSync(xmlDoc.toXmlString(pretty: true, indent: ' '));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment