-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[Impeller] acquire the gpu sync switch when flush stored GPU tasks. #169596
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach is looking good to me.
for (const auto& task : tasks_awaiting_gpu) { | ||
task.task(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should acquire the lock inside the loop? My concern is that if this takes too much time the OS might kill the process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, yeah that is a good point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
@jonahwilliams The internal customer is reporting that after this change, the images still briefly show up as pink before loading in correctly. Does that sound plausible? |
We can do #169378 too.
There is no automated retry built into this system, likely they have some business logic that is refreshing the images which covers up the images that were incorrectly decoded. |
…lutter#169596) Potential fix for flutter#166668 See: * https://github.com/flutter/flutter/blob/master/engine/src/flutter/impeller/renderer/backend/metal/context_mtl.mm#L429 * https://github.com/flutter/flutter/blob/5d013c73baa70a8b3e1c541cb63e4c22654aa3cc/engine/src/flutter/fml/synchronization/sync_switch.cc#L41 We don't hold the sync switch lock when we flush tasks. So if we start flushing then immediately go to the background, then we might execute while backgrounded.
Includes: * flutter/flutter#169596 * flutter/flutter#169378 Fix image decode errors on iOS that could occur if a push notification triggered image decoding while the app is backgrounded.
Potential fix for #166668
See:
flutter/engine/src/flutter/fml/synchronization/sync_switch.cc
Line 41 in 5d013c7
We don't hold the sync switch lock when we flush tasks. So if we start flushing then immediately go to the background, then we might execute while backgrounded.