-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix Opacity performance regression on Fuchsia #15573
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ void LayerTree::UpdateScene(SceneUpdateContext& context, | |
context, | ||
SkRRect::MakeRect( | ||
SkRect::MakeWH(frame_size_.width(), frame_size_.height())), | ||
SK_ColorTRANSPARENT); | ||
SK_ColorTRANSPARENT, SK_AlphaOPAQUE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this is covering Flutter's UI with an opaque rect. On other platforms Flutter UIs are expected to blend with other backgrounds transparently. Is it safe to assume that's never the case here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is safe to assume. I think we would like to have the same blending on Fuchsia, but unfortunately Scenic doesn't support that at the moment; you get a black square if you try |
||
if (root_layer_->needs_system_composite()) { | ||
root_layer_->UpdateScene(context); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
#include "flutter/fml/macros.h" | ||
#include "flutter/fml/time/time_delta.h" | ||
#include "third_party/skia/include/core/SkPicture.h" | ||
#include "third_party/skia/include/core/SkSize.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Extra import? |
||
|
||
namespace flutter { | ||
|
||
|
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.
Trying to make sure I understand this: So before FuchsiaSystemCompositedLayer would wrap this call. Now we're not constructing it any more, so we're calling it before every paint?
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.
Sure thing,
We landed this PR: #14024 in order to have OpacityLayer work on Fuchsia even with cross-process content. This way you could do say Opacity(opacity: 0.1, children: [chromium_child_view]) and the chromium that you embedded would be rendered at 0.1 group opacity.
In order to do so, OpacityLayer's need to be "popped out" as their own system composited layer. We also wanted to remove this same "popping out" from the PhysicalShapeLayer as it is wasteful in terms of resources.
needs_system_composite
flag indicates that one of the layers children or the layer itself is going to be popped out.Unfortunately, the PhysicalShapeLayer part of that change caused a large performance regression on Fuchsia. So, this patch reverts the original one and then re-applies it but without this commit: c4df6df
Definitely agreed on the tests, I'm thinking about that right now. Lack of tests is why the perf regression made it through in the first place. :)
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.
Also, to your previous question: ChildSceneLayer is a layer to embed cross-process content, so by definition
needs_system_composite
is true for it. I added that DCHECK as a sanity check while debugging