-
Notifications
You must be signed in to change notification settings - Fork 29.7k
impeller: makes deferred display list images trash their display lists after they are realized #178259
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: makes deferred display list images trash their display lists after they are realized #178259
Conversation
jason-simmons
left a comment
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.
One potential issue is that this may result in usages of toImageSync that are safe when using Impeller but consume excessive resources on platforms that are still using Skia. App developers will need to be aware of this as long as Skia remains in use.
engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.cc
Outdated
Show resolved
Hide resolved
engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.cc
Outdated
Show resolved
Hide resolved
I think that's fine because this isn't the only place this happens. Impeller was created with the intention to be a renderer with better performance for Flutter's use case. That means there are all sorts of usages that are supposed to be better on impeller than on skia. We don't want logical changes, but performance changes are expected. |
| } | ||
|
|
||
| void DlDeferredImageGPUImpeller::ImageWrapper::SnapshotDisplayList( | ||
| sk_sp<DisplayList> display_list, |
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.
Declare this parameter as a std::variant to indicate that this takes either a DisplayList or a LayerTree but not both.
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
|
|
||
| // If a layer tree is provided, it will be flattened during the raster | ||
| // thread task spawned by this method. After being flattened into a display | ||
| // list, the image wrapper will be updated to hold this display list and the |
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.
Delete the part of this comment saying that the image wrapper will hold the display list.
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
| display_list = layer_tree->Flatten( | ||
| DlRect::MakeWH(wrapper->size_.width, wrapper->size_.height), | ||
| wrapper->texture_registry_); | ||
| texture_registry); |
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.
The texture_registry variable can be removed and snapshot_delegate->GetTextureRegistry() can be passed here
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
| namespace testing { | ||
| namespace { | ||
|
|
||
| void PostTaskSync(const fml::RefPtr<fml::TaskRunner>& task_runner, |
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.
Remove the local version of this function and use the one from #include "flutter/testing/post_task_sync.h"
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
| fml::TaskRunnerAffineWeakPtr<SnapshotDelegate> snapshot_delegate, | ||
| fml::RefPtr<fml::TaskRunner> raster_task_runner) | ||
| : size_(size), | ||
| display_list_(std::move(display_list)), |
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.
Remove the display_list parameter from the ImageWrapper constructor
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
std::variant removed posttasksync inlined variable removed arg update comment
| void SnapshotDisplayList( | ||
| std::variant<sk_sp<DisplayList>, std::unique_ptr<LayerTree>> content); |
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.
Looking at this now, we probably should have just overloaded the constructor. Oh well, that was fun.
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…splay lists after they are realized (flutter/flutter#178259)
…s after they are realized (flutter#178259) fixes flutter#138627 This stops ballooning recursive display_lists that can happen in animations. The display list actually can be larger than the image so keeping the display list around is no benefit. In rare cases this could make the memory size of backgrounded apps be larger but this keeps images made with toImageSync have the same semantics as toImage on impeller. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…s after they are realized (flutter#178259) fixes flutter#138627 This stops ballooning recursive display_lists that can happen in animations. The display list actually can be larger than the image so keeping the display list around is no benefit. In rare cases this could make the memory size of backgrounded apps be larger but this keeps images made with toImageSync have the same semantics as toImage on impeller. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…s after they are realized (flutter#178259) fixes flutter#138627 This stops ballooning recursive display_lists that can happen in animations. The display list actually can be larger than the image so keeping the display list around is no benefit. In rare cases this could make the memory size of backgrounded apps be larger but this keeps images made with toImageSync have the same semantics as toImage on impeller. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
fixes #138627
This stops ballooning recursive display_lists that can happen in animations. The display list actually can be larger than the image so keeping the display list around is no benefit. In rare cases this could make the memory size of backgrounded apps be larger but this keeps images made with toImageSync have the same semantics as toImage on impeller.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.