Skip to content

Commit

Permalink
[Impeller] opt vulkan tests into GPU tracing. (#142649)
Browse files Browse the repository at this point in the history
We're going to disable GPU tracing by default. Opt our benchmarks back in so that we have continuity.
  • Loading branch information
jonahwilliams authored Feb 1, 2024
1 parent 2652b9a commit 7208d3b
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions dev/devicelab/lib/tasks/perf_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -816,15 +816,7 @@ Future<void> _resetPlist(String testDirectory) async {
await exec('git', <String>['checkout', file.path]);
}

/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml'
/// and adds the following entry to the application.
/// <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) {
void _addMetadataToManifest(String testDirectory, List<(String, String)> keyPairs) {
final String manifestPath = path.join(
testDirectory, 'android', 'app', 'src', 'main', 'AndroidManifest.xml');
final File file = File(manifestPath);
Expand All @@ -835,11 +827,6 @@ void _addOpenGLESToManifest(String testDirectory) {

final String xmlStr = file.readAsStringSync();
final XmlDocument xmlDoc = XmlDocument.parse(xmlStr);
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;

Expand All @@ -860,14 +847,40 @@ void _addOpenGLESToManifest(String testDirectory) {
XmlAttribute(XmlName('android:value'), value)
],
);

applicationNode.children.add(metaData);
}
}

file.writeAsStringSync(xmlDoc.toXmlString(pretty: true, indent: ' '));
}

/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml'
/// <meta-data
/// android:name="io.flutter.embedding.android.EnableVulkanGPUTracing"
/// android:value="true" />
void _addVulkanGPUTracingToManifest(String testDirectory) {
final List<(String, String)> keyPairs = <(String, String)>[
('io.flutter.embedding.android.EnableVulkanGPUTracing', 'true'),
];
_addMetadataToManifest(testDirectory, keyPairs);
}

/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml'
/// and adds the following entry to the application.
/// <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 List<(String, String)> keyPairs = <(String, String)>[
('io.flutter.embedding.android.ImpellerBackend', 'opengles'),
('io.flutter.embedding.android.EnableOpenGLGPUTracing', 'true'),
];
_addMetadataToManifest(testDirectory, keyPairs);
}

Future<void> _resetManifest(String testDirectory) async {
final String manifestPath = path.join(
testDirectory, 'android', 'app', 'src', 'main', 'AndroidManifest.xml');
Expand Down Expand Up @@ -1311,10 +1324,12 @@ class PerfTest {
}

try {
if (forceOpenGLES ?? false) {
assert(enableImpeller!);
if (enableImpeller ?? false) {
changedManifest = true;
_addOpenGLESToManifest(testDirectory);
_addVulkanGPUTracingToManifest(testDirectory);
if (forceOpenGLES ?? false) {
_addOpenGLESToManifest(testDirectory);
}
}
if (disablePartialRepaint) {
changedPlist = true;
Expand Down

0 comments on commit 7208d3b

Please sign in to comment.