-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desktop app frame rate isn't synced to display #49757
Comments
This is not just mac, I can also see it's 60 fps on Windows even tho my laptop is 144hz. It would be across all desktop apps flutter doctor -v[✓] Flutter (Channel master, 1.24.0-8.0.pre.97, on Microsoft Windows [Version 10.0.19042.610], locale en-US)
• Flutter version 1.24.0-8.0.pre.97 at C:\Code\flutter_master
• Framework revision 4c24eb10b8 (57 minutes ago), 2020-11-05 11:18:00 +0100
• Engine revision e66a720137
• Dart version 2.12.0 (build 2.12.0-21.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Code\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Code\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30621.155
• Windows 10 SDK version 10.0.18362.0
[✓] Android Studio (version 4.1.0)
• Android Studio at C:\Code\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 1.8.0_242-release-1644-b01)
[✓] VS Code (version 1.50.1)
• VS Code at C:\Users\taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.16.0
[✓] Connected device (5 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.610]
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.183
• Edge (web) • edge • web-javascript • Microsoft Edge 86.0.622.61
• No issues found! |
@stuartmorgan thoughts? |
@csells I would think @stuartmorgan might do the same for desktop, add a new plugin in https://github.com/google/flutter-desktop-embedding/tree/master/plugins or add higher frame rate sync ability in an existing plugin. Feel free to correct me Personally, I would love to see this support in the framework without depending on a third-party/first-party package for all platforms that Flutter supports. Most devices are higher rate now |
I'm not sure if this is related to the problem I'm having described at https://stackoverflow.com/questions/65066393/flutter-desktop-custom-game-loop-appears-to-drop-frames and |
This comment was marked as off-topic.
This comment was marked as off-topic.
See also #90675 |
Is there any ETA on this issue @stuartmorgan ? This is the only reason I'm not using Flutter for my gaming oriented desktop app |
what is the usual timeline for the latest engine to be rolled into the flutter dev channel? |
If needed, I can test on more distributions. The tests above were done in a Debian 12 environment (container hosted on NixOS) with |
@knopp FYI, it looks like
Example failure: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20Production%20Engine%20Drone/288087/overview |
I think the tolerances there are too tight for the runner. I'll make a PR soon. |
@cbracken is this still an issue after we landed the engine fix? |
It is fixed on macOS, but I believe while windows has the correct period the phase might be off. And I think linux might be running on fallback 60hz always? Edit: I think |
I thought Windows was resolved based on the comments in #49757 (comment) and just below that. |
That PR did resolve the framerate interval (period), but I don't think it solved the phase, i.e. the vsync timer is fired correct amount of times per second, but the relative position within vsync period might be wrong. |
On my Linux machine with 75 Hz monitor, but I see it's 60 FPS on Flutter app. Not sure if it's intended or not (based on Knopp's comment above), I'm updating labels for further investigation. flutter doctor -v (stable & master)[✓] Flutter (Channel stable, 3.19.6, on Ubuntu 22.04.3 LTS 6.5.0-26-generic, locale en_US.UTF-8)
• Flutter version 3.19.6 on channel stable at /home/huynq/Documents/Working/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (2 days ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
• Android SDK at /home/huynq/Android/Sdk/
• Platform android-33, build-tools 34.0.0-rc3
• Java binary at: /snap/android-studio/current/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 14.0.0-1ubuntu1.1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2021.1)
• Android Studio at /home/huynq/Documents/android-studio
• Flutter plugin version 67.0.1
• Dart plugin version 211.7817
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[!] Android Studio (version unknown)
• Android Studio at /snap/android-studio/current
• 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
✗ Unable to determine Android Studio version.
• android-studio-dir = /snap/android-studio/current
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
[✓] VS Code (version 1.84.2)
• VS Code at /usr/share/code
• Flutter extension version 3.86.0
[✓] VS Code (version 1.88.1)
• VS Code at /snap/code/current/usr/share/code
• Flutter extension version 3.86.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.3 LTS 6.5.0-26-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.199
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category. [!] Flutter (Channel master, 3.22.0-14.0.pre.35, on Ubuntu 22.04.3 LTS 6.5.0-26-generic, locale en_US.UTF-8)
• Flutter version 3.22.0-14.0.pre.35 on channel master at /home/huynq/Documents/Working/flutter_master
! Warning: `flutter` on your path resolves to /home/huynq/Documents/Working/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /home/huynq/Documents/Working/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9feccd5f3b (2 hours ago), 2024-04-19 05:08:40 -0400
• Engine revision 4ed7a2d6ae
• Dart version 3.5.0 (build 3.5.0-77.0.dev)
• DevTools version 2.35.0-dev.8
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
• Android SDK at /home/huynq/Android/Sdk/
• Platform android-33, build-tools 34.0.0-rc3
• Java binary at: /snap/android-studio/current/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 14.0.0-1ubuntu1.1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2021.1)
• Android Studio at /home/huynq/Documents/android-studio
• Flutter plugin version 67.0.1
• Dart plugin version 211.7817
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[!] Android Studio (version unknown)
• Android Studio at /snap/android-studio/current
• 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
✗ Unable to determine Android Studio version.
• android-studio-dir = /snap/android-studio/current
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
[✓] VS Code (version 1.84.2)
• VS Code at /usr/share/code
• Flutter extension version 3.86.0
[✓] VS Code (version 1.88.1)
• VS Code at /snap/code/current/usr/share/code
• Flutter extension version 3.86.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.3 LTS 6.5.0-26-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.199
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories. |
It seems that for Windows and macOS at least, there are solutions to retrieve the monitor refresh rate and sync the frame rate to the display. However, there is no confirmed solution for Linux. One potential approach for Linux could be using eglGetMscRateANGLE, which is supported by Mesa and also used in Chromium. |
I'm running on a 120hz monitor, I've scheduled a persistent frame callback and can see that I get ~60fps. It would be great if Flutter could use something like CADisplayLink on MacOS to sync frame rendering with the display.
Gist of a simple app showing this: https://gist.github.com/luigi-rosso/0e3ed273e52764bf1d7bdacca49cccd2
I can see in various sites, apps, and games that the display is actually refreshing at 120hz.
Previously filed here: google/flutter-desktop-embedding#656
Fix status:
The text was updated successfully, but these errors were encountered: