Skip to content
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

Remove unnecessary saveLayer #5420

Merged
merged 1 commit into from May 30, 2018
Merged

Remove unnecessary saveLayer #5420

merged 1 commit into from May 30, 2018

Conversation

liyuqian
Copy link
Contributor

saveLayer is slow so we should avoid it as much as possible. If
there are artifacts without saveLayer, then we should report that
to Skia for the fix instead of slowing the performance with
saveLayer.

This PQ makes average rasterizer time drop from 25ms to 18ms in
flutter_gallery transitions perf test on a Nexus 5X.

This partially fixes flutter/flutter#13736 .
We probably still need some work in the opacity layer to squize
all the performance improvements.

saveLayer is slow so we should avoid it as much as possible. If
there are artifacts without saveLayer, then we should report that
to Skia for the fix instead of slowing the performance with
saveLayer.

This PQ makes average rasterizer time drop from 25ms to 18ms in
flutter_gallery transitions perf test on a Nexus 5X.
@liyuqian
Copy link
Contributor Author

CC @tvolkert @Hixie @xster

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Typo in commit message.

@liyuqian liyuqian changed the title Remov unnecessary saveLayer Remove unnecessary saveLayer May 30, 2018
@liyuqian liyuqian merged commit d174c4f into flutter:master May 30, 2018
@xster
Copy link
Member

xster commented May 30, 2018

Awesome! Looking forward to the benchmark of the next roll.

@@ -48,7 +48,7 @@ void ClipPathLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ClipPathLayer::Paint");
FXL_DCHECK(needs_painting());

Layer::AutoSaveLayer save(context, paint_bounds(), nullptr);
SkAutoCanvasRestore save(&context.canvas, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work. It will cause artifacts.
See this article for a discussion of why: https://master-docs-flutter-io.firebaseapp.com/flutter/dart-ui/Canvas/saveLayer.html

@Hixie
Copy link
Contributor

Hixie commented May 31, 2018

There will definitely be artifacts. For example, if a clip region contains a red rectangle with a white rectangle on top of it, then at the edge of the clip region, this will result in red-tinted pixels, but they should be white.

@Hixie
Copy link
Contributor

Hixie commented May 31, 2018

Interestingly, I just tried this on the beta channel and I get the red outlines already, so while I don't think this PR is correct, it seems something else had already broken this before.

@Hixie
Copy link
Contributor

Hixie commented May 31, 2018

Filed flutter/flutter#18057 to track this. I marked in "regression" because I'm sure this used to work.

najeira pushed a commit to najeira/flutter-engine that referenced this pull request Jun 5, 2018
saveLayer is slow so we should avoid it as much as possible. If
there are artifacts without saveLayer, then we should report that
to Skia for the fix instead of slowing the performance with
saveLayer.

This PQ makes average rasterizer time drop from 25ms to 18ms in
flutter_gallery transitions perf test on a Nexus 5X.

This partially fixes flutter/flutter#13736 .
We probably still need some work in the opacity layer to squize
all the performance improvements.
liyuqian added a commit to liyuqian/flutter that referenced this pull request Jun 20, 2018
This is a follow up on flutter/engine#5420
and flutter#18057

As you can see from the diff, we also mistakenly saveLayer before
the clip at some places previously.
liyuqian added a commit to flutter/flutter that referenced this pull request Jun 21, 2018
This is a follow up on flutter/engine#5420
and #18057

As you can see from the diff, we also mistakenly saveLayer before
the clip at some places previously.
najeira pushed a commit to najeira/flutter-engine that referenced this pull request Jul 19, 2018
saveLayer is slow so we should avoid it as much as possible. If
there are artifacts without saveLayer, then we should report that
to Skia for the fix instead of slowing the performance with
saveLayer.

This PQ makes average rasterizer time drop from 25ms to 18ms in
flutter_gallery transitions perf test on a Nexus 5X.

This partially fixes flutter/flutter#13736 .
We probably still need some work in the opacity layer to squize
all the performance improvements.
@liyuqian liyuqian deleted the nosavelayer branch September 12, 2018 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants