Skip to content

Slow Vulkan performance on API 35 Android Emulator images. #160442

Closed

Description

@nytoan

Steps to reproduce

Create the demo app with :

flutter create my_app
flutter run

Expected results

Demo app and no logs

Actual results

Logs are filled with exportSyncFdForQSRILocked when pressing "+" button.

Code sample

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // TRY THIS: Try changing the color here to a specific color (to
        // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
        // change color while the other colors stay the same.
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          //
          // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
          // action in the IDE, or press "p" in the console), to see the
          // wireframe for each widget.
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}


Screenshots or Video

Capture d'écran 2024-12-17 162128

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.1, on Microsoft Windows [version 10.0.22631.4602], locale fr-FR)
    • Flutter version 3.27.1 on channel stable at C:\Users\anthony\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (21 hours ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\bob\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: D:\Program Files\Java\jdk-17\bin\java
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.12.0)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    • Visual Studio Build Tools 2022 version 17.12.35506.116
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2024.2)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[✓] VS Code (version 1.96.0)
    • VS Code at C:\Users\bob\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.102.0

[✓] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [version 10.0.22631.4602]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 131.0.6778.140
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 131.0.2903.70

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. mehmetfiskindal commented on Dec 17, 2024

    @mehmetfiskindal

    We are in the same situation.
    The debug screen cannot be read from these texts and the application may crash.

  2. mathieurousseau commented on Dec 17, 2024

    @mathieurousseau
  3. mehmetfiskindal commented on Dec 17, 2024

    @mehmetfiskindal

    The Flutter team supports and continues to develop the impeller rendering engine, so a scenario where it is not used may not be true. @mathieurousseau

  4. jonahwilliams commented on Dec 17, 2024

    @jonahwilliams
    Contributor

    I can reproduce this on 3.27.1 and on ToT on a API 35 Image on an arm mac. On the Impeller GLES backend (which is not available yet in the 3.27.X stable but will be in the next stable release) the performance is buttery smooth.

  5. ilyasarafathemvigo commented on Dec 18, 2024

    @ilyasarafathemvigo

    I got the same issue with flutter version 3.27.0 with android emulator image version API 35 (vanila Icecream) .
    But working fine with android emulator API 34 (upsidedowncake)

  6. jonahwilliams commented on Dec 18, 2024

    @jonahwilliams
    Contributor

    Running with API 34 android emulator image I can observe that the vulkan driver isn't available, so the engine falls back to Skia.

  7. changed the title [-]Android emulator's logs are filled with exportSyncFdForQSRILocked lines[/-] [+]Slow Vulkan performance on API 35 Android Emulator images.[/+] on Dec 18, 2024
  8. kyle-is-loading-please-wait commented on Dec 18, 2024

    @kyle-is-loading-please-wait
  9. jonahwilliams commented on Dec 18, 2024

    @jonahwilliams
    Contributor

    @kyle-is-loading-please-wait

    It appears there's some sort of issue with impeller which isn't limited to emulated devices

    So this is an issue about slow vulkan performance on a particular emulator image. The problem you are describing isn't slow vulkan performance on an emulator. Therefore you need to file a new bug with details so we can investigate it.

  10. kyle-is-loading-please-wait commented on Dec 18, 2024

    @kyle-is-loading-please-wait

    @jonahwilliams I submitted this to #160528

  11. DimasSalah commented on Dec 21, 2024

    @DimasSalah

    for my case solution is adding in .vscode/settings.json

    { "dart.flutterRunAdditionalArgs": [ "--no-enable-impeller" ] }

  12. kmanadkat commented on Dec 31, 2024

    @kmanadkat

    for my case solution is adding in .vscode/setting.json

    { "dart.flutterRunAdditionalArgs": [ "--no-enable-impeller" ] }

    .vscode/settings.json

    missed a 's' in settings.json

  13. 10 remaining items

  14. jonahwilliams commented on Jan 22, 2025

    @jonahwilliams
    Contributor

    Hey folks. This issue has been confirmed many times. When there is an update it will be provided here by me.

  15. deleted a comment from DimaLondon on Jan 23, 2025
  16. deleted a comment from Juanpabedoyav on Jan 31, 2025
  17. jonahwilliams commented on Jan 31, 2025

    @jonahwilliams
    Contributor

    Update: we've decided to disable the usage of Vulkan on Android emulators. Emulators will only use GLES with Impeller start with release 3.29.0. This fixes the performance and crash problems. We're continuning to engage with Android emulator team to determine how we can enable Vulkan support on emulators.

  18. github-actions commented on Feb 14, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecte: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions