-
Notifications
You must be signed in to change notification settings - Fork 6k
Turn on RasterCache based on view hierarchy #13360
Conversation
flow/layers/layer_tree.cc
Outdated
| root_layer_->Preroll(&preroll_context, root_surface_transformation); | ||
| // The needs painting flag may be set after the preroll. So check it after. | ||
| if (root_layer_->needs_painting()) { | ||
| paint_context.has_platform_view = preroll_context.has_platform_view; |
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.
Is this necessary? None of the other variables from preroll_context are copied over here. I wasn't sure if this root_layer_ was guaranteed to be a single node with no children at this point or not.
Previously the cache was disabled on whether or not PlatformViews were globally enabled. Instead track their existence in the view hierarchy and only disable RasterCache if a PlatformView is actually present.
|
IIUC the current code splits the tree into 2 parts (before and after hitting the first platform view) and raster cache is disabled for the later part? I'm thinking we should probably set engine/flow/layers/container_layer.cc Line 30 in 87b00d3
|
Good catch, I tested this out with a demo app and a sibling of a PlatformView was also having its RasterCache disabled. This should be fixed now. I didn't set it to |
Thanks. Not sure it matters as a platform view layer has no children flow layers. |
flow/layers/layer.h
Outdated
| TextureRegistry& texture_registry; | ||
| const RasterCache* raster_cache; | ||
| const bool checkerboard_offscreen_layers; | ||
| bool has_platform_view; |
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.
Not sure why this new field is necessary. If the raster cache needs to be disabled, the raster_cache pointer can just not be supplied in the paint context. There is nothing more to do.
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.
It's not necessary, removed.
flow/layers/container_layer.cc
Outdated
| void ContainerLayer::PrerollChildren(PrerollContext* context, | ||
| const SkMatrix& child_matrix, | ||
| SkRect* child_paint_bounds) { | ||
| const bool had_platform_view = context->has_platform_view; |
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.
nit: I'd keep the simpler version of this where we assume platform view has no children (it is a leaf layer)
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. I did put in a debug assert just to try and catch in case this assumption ever changes in the future.
We should probably add a test for the case we're using raster cache after a platform view |
- Test for platform view layer as a sibling of layers that need to be cached to make sure the context is being reset between children. - Minor code cleanup.
Done. I converted the previous test case instead of adding an entirely separate one. I think testing that the platform view layer isn't cached but sibling layers are also covers the case of checking that platform views aren't cached in general. |
amirh
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.
LGTM
(assuming that Chinmay approves the changes to shell and embedder_engine)
| layer->Paint(paintContext); | ||
| } | ||
| }); | ||
| entry.image = Rasterize( |
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.
I guess the formatting of this file is going to depend on the last editor? 😝
@chinmaygarde
[not blocking this PR]
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 actual change here is that paintContext.rasterCache is getting set to context->has_platform_view ? nullptr : context->raster_cache instead of just context->raster_cache. That statement is so long that clang-format decided to move this whole block further to the left to make room for it. I'm not sure why it was moved further to the right to start with, but it should be consistent between editors and CI.
chinmaygarde
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.
Some nits but looks good overall. Thanks!
|
|
||
| setup.Wait(); | ||
| const flutter::Shell& shell = | ||
| reinterpret_cast<flutter::EmbedderEngine*>(engine.get())->shell(); |
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 reinterpret cast depends on an implementation detail in embedder.cc. Please add a method to any file other than embedder.h that basically does just this cast. The implmentation of the method itself can be in embedder.cc though.
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.
Moved to embedder_assertions.h with the other utility conversion methods.
This caused EmbedderTest.VerifyB143464703 to fail after merging into
master.
```
../../flutter/shell/platform/embedder/tests/embedder_unittests.cc:3111: Failure
Value of: ImageMatchesFixture("verifyb143464703.png", renderered_scene)
Actual: false
Expected: true
[ FAILED ] EmbedderTest.VerifyB143464703 (2507 ms)
```
This reverts commit 3ad3bc7.
[email protected]:flutter/engine.git/compare/5051bef17bdc...e609577 git log 5051bef..e609577 --no-merges --oneline 2019-10-30 [email protected] Revert "Turn on RasterCache based on view hierarchy (#13360)" (flutter/engine#13442) 2019-10-30 [email protected] Turn on RasterCache based on view hierarchy (flutter/engine#13360) 2019-10-30 [email protected] Roll src/third_party/dart d3a5b82355..f30b494035 (9 commits) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
This is a duplicate of #13360 with the test switched to use the software backend instead of the GL backend. After some debugging and testing on another GL embedder I think the issue with the test is some bug having to do with the GL implementation in the test harness specifically. Fixes flutter/flutter#38903
[email protected]:flutter/engine.git/compare/5051bef17bdc...e609577 git log 5051bef..e609577 --no-merges --oneline 2019-10-30 [email protected] Revert "Turn on RasterCache based on view hierarchy (flutter#13360)" (flutter/engine#13442) 2019-10-30 [email protected] Turn on RasterCache based on view hierarchy (flutter/engine#13360) 2019-10-30 [email protected] Roll src/third_party/dart d3a5b82355..f30b494035 (9 commits) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Previously the cache was disabled on whether or not PlatformViews were
globally enabled. Instead track their existence in the view hierarchy
and only disable RasterCache if a PlatformView is actually present.
Fixes flutter/flutter#38903