Skip to content
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

[impeller]: extreme jank on the first start but becomes normal when moving the app to the background and opening it back again #150880

Closed
1 task done
Nidal-Bakir opened this issue Jun 26, 2024 · 7 comments
Labels
r: invalid Issue is closed as not valid

Comments

@Nidal-Bakir
Copy link

Nidal-Bakir commented Jun 26, 2024

Steps to reproduce

  1. Use the latest stable release of Flutter 3.22.2
  2. Start the Andoird Emulator in GPU host mode like this ~/Android/Sdk/emulator/emulator -avd <emulator-name> -gpu host this will start the Emulator in GPU host mode in my case it will use the Integrated GPU
  3. Run the app in profile mode in Andoird Emulator with impeller enabled flutter run --enable-impeller

Note: Sometimes, when I move the app to the background and then reopen it, everything works fine. But other times, if I repeat this process—moving the app to the background and then bringing it to the foreground—junk appears. It alternates inconsistently between showing junk and not showing junk each time I switch between background and foreground. However, one thing I'm certain of is that on the initial run, junk will always appear.

My OS and hardware

Host: Inspiron 5567
Display: 1920x1080 @ 60Hz

OS: Ubuntu noble 24.04 x86_64
Kernel: Linux 6.8.0-35-generic

DE: GNOME 46.0
WM: Mutter (X11)

Memory: 7.62 GiB / 15.43 GiB (49%)

CPU: Intel(R) Core(TM) i7-7500U (4) @ 3.50 GHz

GPU: Intel HD Graphics 620 @ 1.05 GHz [Integrated]
GPU: AMD Radeon R5 M445 Series @ 0.66 GHz [Discrete]

OpenGL: 4.6 (Compatibility Profile) Mesa 24.0.5-1ubuntu1
Vulkan: 1.3.274 - Intel open-source Mesa driver [Mesa 24.0.5-1ubuntu1]

╰─ lspci -k | grep -EA3 'VGA|3D|Display'
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)
	DeviceName:  Onboard IGD
	Subsystem: Dell HD Graphics 620
	Kernel driver in use: i915
--
01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445 / 530/535 / 620/625 Mobile] (rev c3)
	Subsystem: Dell Radeon R7 M445
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu

Code sample

Code sample
void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: ListView.builder(
          itemBuilder: (context, index) {
            return Container(
              color: Colors.primaries[index % Colors.primaries.length],
              height: 150,
              width: double.infinity,
              child: Center(child: Text(index.toString())),
            );
          },
        ),
      ),
    ),
  );
}

Performance profiling on master channel

  • The issue still persists on the master channel

Timeline Traces

Timeline Traces JSON

dart_devtools_2024-06-26_23_52_47.732.json

Video demonstration

On Impeller notice that sometimes it's really laggy and other times it works just fine. It seems to alternate between these two modes

[Impeller] Video demonstration
2024-06-27_01-22-46.mp4
[Skia] Video demonstration
skia.mp4

What target platforms are you seeing this bug on?

Android

OS/Browser name and version | Device information

I can not test this on a physical device because my device does not support Vulkan so the flutter engine fallback to Skia

I'm testing on Android Emulator
Android 14
The normal emulator device with Google Play support and the recommended images tab in android studio

Does the problem occur on emulator/simulator as well as on physical devices?

Unknown

Is the problem only reproducible with Impeller?

Yes

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.22.2, on Ubuntu 24.04 LTS 6.8.0-35-generic, locale en_US.UTF-8)
    • Flutter version 3.22.2 on channel stable at /home/nidal/fvm/versions/3.22.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (3 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/nidal/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/nidal/program_files/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded
      from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded
      from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be
      downloaded from https://github.com/ninja-build/ninja/releases
    ✗ pkg-config is required for Linux development.
      It is likely available from your distribution (e.g.: apt install pkg-config), or can be
      downloaded from https://www.freedesktop.org/wiki/Software/pkg-config/

[✓] Android Studio (version 2024.1)
    • Android Studio at /home/nidal/program_files/android-studio
    • Flutter plugin version 80.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)

[✓] VS Code (version 1.90.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.90.0

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Ubuntu 24.04 LTS 6.8.0-35-generic

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

! Doctor found issues in 2 categories.
@Nidal-Bakir Nidal-Bakir added the from: performance template Issues created via a performance issue template label Jun 26, 2024
@jonahwilliams jonahwilliams changed the title [impeller]: extream junk on the first start but becomes normal when moving the app to the background and opning it back again [impeller]: extream jank on the first start but becomes normal when moving the app to the background and opening it back again Jun 26, 2024
@jonahwilliams
Copy link
Member

Just to set expectations here: our primary goal for Impeller is on device performance. Performance on the emulator in a passthrough configuration is going to have a lot of variables that are not really under our control, specifically things like how well the emulator emulates Vulkan.

@jonahwilliams jonahwilliams changed the title [impeller]: extream jank on the first start but becomes normal when moving the app to the background and opening it back again [impeller]: extreme jank on the first start but becomes normal when moving the app to the background and opening it back again Jun 26, 2024
@huycozy huycozy added in triage Presently being triaged by the triage team and removed from: performance template Issues created via a performance issue template labels Jun 27, 2024
@huycozy
Copy link
Member

huycozy commented Jun 27, 2024

@Nidal-Bakir I checked this on my physical device Pixel 7, Android 14, and I don't see janks there even on initial run or switching between foreground and background.

Screen.Recording.2024-06-27.at.14.46.37.mov

Also, I see janks also appear on your demo with Skia above. Since Profile mode is disabled on the emulator and simulator, you should re-check this on a physical device if any.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 27, 2024
@Nidal-Bakir
Copy link
Author

Nidal-Bakir commented Jun 27, 2024

Thanks for your feedback. I understand your point, and it's not a big deal. I can simply move the app to the background and then bring it back to the foreground to fix this issue.

As jonahwilliams mentioned, there are a lot of variables to consider. It might be a driver issue on my end or possibly a hardware issue due to my older device.

I will keep using Skia for the time being

Thanks again for your help!

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 27, 2024
@Nidal-Bakir
Copy link
Author

Nidal-Bakir commented Jun 27, 2024

[FIXED] For future reference and for anyone else having this issue on Linux (Wayland)

If you have a discrete GPU try running the emulator using the discrete GPU with:

DRI_PRIME=1 emulator -avd <avd-name> -gpu host -use-host-vulkan -no-metrics -no-boot-anim -accel on
There is still some frame dropping, but I think It might be due to my old laptop.

It seems the emulator will default and run on the Integrated GPU ( Intel HD Graphics or something like that)

And if keep seeing "Emulator/unknown is not responding (Force Quit / Wait)" also on Linux (Wayland)
try:
gsettings set org.gnome.mutter check-alive-timeout 0

I already filed a bug report on the Gnome mutter project for this:
https://gitlab.gnome.org/GNOME/mutter/-/issues/3543

@Nidal-Bakir
Copy link
Author

@huycozy
@jonahwilliams

You can close this if you want. I have nothing to add
thanks :)

@jonahwilliams
Copy link
Member

If moving to the background closes the app, then its possible that switches it back to Skia. I doubt its a driver a hardware issue, its almost certainly a problem with the Android emulator.

@huycozy
Copy link
Member

huycozy commented Jun 28, 2024

This looks like an emulator issue so I will close it from here. Thanks!

@huycozy huycozy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
@huycozy huycozy added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

3 participants