Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@flar
Copy link
Contributor

@flar flar commented Oct 20, 2021

Fixes: flutter/flutter#91621

This PR corrects a long-standing issue whereby we were counting only the ops in the top level picture object for determining its complexity. While this metric may eventually be replaced by more compute/GPU-aware metrics as we develop our support and optimizations for the DisplayList mechanism, for now we can at least fix the current complexity test so that it counts the ops for all nested pictures in the picture object being considered for caching.

This PR also fixes our nested counts to match the behavior of SkPicture nested op counts (mainly, don't count a drawPicture or drawDisplayList record as an op if you are going to include its nested ops in the count). Tests were also back-filled for testing the DisplayList variants of the RasterCache based on the existing tests for the SkPicture methods and new tests were added both for making sure our nested counts match the existing SkPicture results and that the nested metrics are used for the cache.

@flar flar added affects: engine perf: speed Performance issues related to (mostly rendering) speed labels Oct 20, 2021
@google-cla google-cla bot added the cla: yes label Oct 20, 2021
@zanderso
Copy link
Member

Do we already have a benchmark that will be improved by this change, or do we need to add one that will catch regressions in the performance that this change buys?

@ds84182
Copy link
Contributor

ds84182 commented Oct 21, 2021

Just wondering, does this conflict with #29155?

For instance, say you had an Outer Picture that's animating a property on Canvas.drawPicture for a complex static Inner Picture. Once the inner picture is cached the outer picture becomes relatively simple to draw, so it shouldn't be raster cached.

@flar
Copy link
Contributor Author

flar commented Oct 21, 2021

Just wondering, does this conflict with #29155?

For instance, say you had an Outer Picture that's animating a property on Canvas.drawPicture for a complex static Inner Picture. Once the inner picture is cached the outer picture becomes relatively simple to draw, so it shouldn't be raster cached.

No conceptual conflicts. If the outer picture is cacheable then we should cache that and this PR should help us identify more of those. If the outer picture is not cacheable then the other PR will help us cache identifiable and stable sub-pictures to cache instead.

We need to make sure we don't fumble and try to cache both in that situation, though.

@flar
Copy link
Contributor Author

flar commented Oct 21, 2021

Just wondering, does this conflict with #29155?
For instance, say you had an Outer Picture that's animating a property on Canvas.drawPicture for a complex static Inner Picture. Once the inner picture is cached the outer picture becomes relatively simple to draw, so it shouldn't be raster cached.

No conceptual conflicts. If the outer picture is cacheable then we should cache that and this PR should help us identify more of those. If the outer picture is not cacheable then the other PR will help us cache identifiable and stable sub-pictures to cache instead.

We need to make sure we don't fumble and try to cache both in that situation, though.

To be more clear, it is up to #29155 to avoid any double-caching conflict. Whether or not we change the metrics here, that other PR is introducing a parent/child caching situation that requires care. All this PR is doing is making sure we don't fool ourselves about the complexity of a given picture.

@flar flar changed the title used nested op counts to determine picture complexity for raster cache use nested op counts to determine picture complexity for raster cache Oct 21, 2021
@chinmaygarde
Copy link
Member

Taking into account nested pictures is the right thing to do. Obviously, the mechanism to determine the complexity of a single picture is rather naive. But with the picture complexity scoring work in the pipeline, that should get better too. I think we should land this now.

@flar flar added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Oct 28, 2021
@fluttergithubbot fluttergithubbot merged commit 529f08d into flutter:master Oct 28, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

affects: engine cla: yes perf: speed Performance issues related to (mostly rendering) speed waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Picture Cache complexity metrics should include nested SkPicture/DisplayList op counts

5 participants