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

iOS: Started initializing the gpu disable sync switch based on the app state. #24503

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Feb 19, 2021

We've seen a few issues related to flutter apps launching in the background (flutter/flutter#76068 and flutter/flutter#71074). I've been unable to reproduce these bugs but I theorize that there is a race condition between launching the app and actually having the ability to access the GPU. In both cases it appears to be a result of the io thread using the GPU, possibly before the surface is created. This PR will make any accidental usage of the GPU fallback to the CPU if it happens before the app has actually become active.

I place a print statement in -[FlutterEngine createShell:libraryURI:initialRoute:] and it appears even during normal app launching that the app state is not active which offers further support that this is possible.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke changed the title Started initializing the gpu disable sync switch based on the app state. iOS: Started initializing the gpu disable sync switch based on the app state. Feb 19, 2021
@gaaclarke gaaclarke marked this pull request as ready for review February 19, 2021 02:03
@gaaclarke
Copy link
Member Author

I have 2 outstanding requests to verify that this addresses customer issues (since I can't reproduce the problem). I'll wait a bit longer to land to give those customers a chance to respond.

@gaaclarke
Copy link
Member Author

This shouldn't hurt. I have a theory that it fixes a few issues but was unable to verify the fix. I waited around to see if I could get some feedback from customers. I'm going to land it since that will help users test it.

@gaaclarke gaaclarke merged commit 183b6b9 into flutter:master Feb 25, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 25, 2021
Wooder pushed a commit to Wooder/engine that referenced this pull request Feb 26, 2021
Started initializing the gpu disable syncswitch based on the app state. (flutter#24503)
Wooder pushed a commit to Wooder/engine that referenced this pull request Mar 2, 2021
@mmoaay
Copy link

mmoaay commented Mar 8, 2021

It seems Flutter 2.0 didn't include this PR, So will there be a 1.22.6.hotfix version to fix this problem?

@gaaclarke
Copy link
Member Author

With no definitive reproduction steps it was impossible for me to know if this fixed the couple of issues I suspect it might fix. In the absence of proof I couldn't recommend it for cherry-picking.

@gaaclarke
Copy link
Member Author

I've finally been able to reproduce the bug and after #24958 lands the issue should be fixed. It was a hard issue to reproduce...

cc @danielSafeNow @Wooder @luca-safenow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants