-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Only repaint views that need to be painted (with external texture & platform view support) #179874
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
base: master
Are you sure you want to change the base?
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.
Code Review
This pull request introduces a performance optimization for multi-view scenarios by only repainting views that have dirty render objects. This is achieved by checking the needsPaint status of each view's pipeline owner before compositing.
A new mechanism is introduced to handle texture updates more efficiently. The engine now notifies the framework via an onTextureFrameAvailable callback when a texture has a new frame. This allows the framework to mark the specific TextureBox as needing paint without scheduling a full new frame, which is more efficient. On Android, this is implemented by replacing calls to scheduleEngineFrame with markTextureFrameAvailable.
Additionally, to ensure visual correctness, all views are now forced to be composited when the application returns from the background.
The changes span across the engine (C++, Java) and the framework (Dart), with corresponding updates to tests to validate the new behavior. New tests have been added to cover the dirty-view compositing logic and the texture update mechanism. The implementation appears solid and well-tested.
19da943 to
71bab07
Compare
|
@9AZX, it seems that |
71bab07 to
5a3ac8c
Compare
5835115 to
540f338
Compare
eaab6aa to
0059b33
Compare
My bad! I didn't know that web_ui has his own |
Fixes #164320
Based on @knopp work in #164322
This PR adds a dirty-view compositing optimization that skips compositing for views that don't have any dirty render objects, so it should improves performance in multi-view scenarios by avoiding unnessacery work.
When a texture has new content, the framework now gets notified via a new onTextureFrameAvailable callback from the engine. This marks the texture's render object as needing paint, so its view is included in compositing even when nothing else changed.
On Android, texture callbacks now use
markTextureFrameAvailableinstead ofscheduleEngineFrame. This is actually more efficient since it reuses the existing layer tree rather than regenerating it. Other platforms already used the correct path.It also forces all views to composite when returning from background, ensuring the display is properly refreshed after the app was paused.
On MacOS:
Screen.Recording.2025-12-15.at.11.54.17.mov
Pre-launch Checklist
///).