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

Reduce number of surfaces required when presenting platform views #43301

Merged
merged 5 commits into from
Nov 27, 2023

Conversation

knopp
Copy link
Member

@knopp knopp commented Jun 28, 2023

Fixes flutter/flutter#129710
Fixes flutter/flutter#138936

Implements https://flutter.dev/go/optimized-platform-view-layers

Example

This scene would normally require 5 surfaces, but with the PR it comes down to 2 (when drawing over platform views) and 1 when all drawing is outside of platform views).

optimized-platform-view-layers.mov

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@chinmaygarde
Copy link
Member

cc @cbracken @knopp Are we going to make progress on this?

@knopp
Copy link
Member Author

knopp commented Aug 31, 2023

#42960 just got merged today. I'll rebase this tomorrow, retest and remove the wip.

@knopp knopp force-pushed the platform_views_optimized_layers branch from 0677c2c to 1f2d059 Compare September 1, 2023 16:38
@knopp knopp changed the title WIP: Reduce number of surfaces when presenting platform views Reduce number of surfaces when presenting platform views Sep 1, 2023
@knopp knopp force-pushed the platform_views_optimized_layers branch from 7facd2e to 63a45e2 Compare September 2, 2023 15:45
@knopp
Copy link
Member Author

knopp commented Sep 3, 2023

I'm not sure why verifyb143464703_soft_noxform fails. I tried running it locally but I get all golden failures, even through images seemingly look same. Maybe a slight difference in antialiasing?

@chinmaygarde
Copy link
Member

The failure should point to both the expectation and the actual image. Can you paste both of them here. If its AA, we should be able to reason about it.

@knopp knopp changed the title Reduce number of surfaces when presenting platform views Reduce number of surfaces required when presenting platform views Nov 24, 2023
@knopp knopp force-pushed the platform_views_optimized_layers branch from f4de691 to f77dc51 Compare November 25, 2023 15:32
for (auto i = params->mutatorsStack().Begin();
i != params->mutatorsStack().End(); ++i) {
const auto& m = *i;
if (m->GetType() == MutatorType::kTransform) {
Copy link
Member

Choose a reason for hiding this comment

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

Use a switch statement here; it's wordier, but helps with listing.

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

lgtm with mostly nits.

@knopp knopp force-pushed the platform_views_optimized_layers branch from d58f1be to 26b0c66 Compare November 27, 2023 11:06
@knopp knopp merged commit 9b610ec into flutter:main Nov 27, 2023
27 checks passed
@knopp knopp deleted the platform_views_optimized_layers branch November 27, 2023 13:07
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 27, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 27, 2023
…139063)

flutter/engine@6f499ec...9b610ec

2023-11-27 matej.knopp@gmail.com Reduce number of surfaces required when presenting platform views (flutter/engine#43301)

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 jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
harryterkelsen pushed a commit to harryterkelsen/engine that referenced this pull request Nov 27, 2023
…utter#43301)

Fixes flutter/flutter#129710
Fixes flutter/flutter#138936

Implements https://flutter.dev/go/optimized-platform-view-layers

## Example

This scene would normally require 5 surfaces, but with the PR it comes
down to 2 (when drawing over platform views) and 1 when all drawing is
outside of platform views).


https://github.com/flutter/flutter/assets/96958/091da832-bfbc-44a2-8da5-d55d84024c96

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## 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] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
@renanyoy
Copy link

renanyoy commented Dec 6, 2023

this PR remove the ability to use Opacity(..) around an AppKitView() also it seems that each time a new platform view is created the UI blink during one or 2 frames.

@knopp
Copy link
Member Author

knopp commented Dec 6, 2023

this PR remove the ability to use Opacity(..) around an AppKitView() also it seems that each time a new platform view is created the UI blink during one or 2 frames.

I can't reproduce that even with your example. This is AppKitView wrapped with 0.1 opacity:

Screenshot 2023-12-06 at 09 47 00

That said, once opacity is enabled, I can definitely reproduce the flicker. I have reopened flutter/flutter#138936.

caseycrogers pushed a commit to caseycrogers/flutter that referenced this pull request Dec 29, 2023
…lutter#139063)

flutter/engine@6f499ec...9b610ec

2023-11-27 matej.knopp@gmail.com Reduce number of surfaces required when presenting platform views (flutter/engine#43301)

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 jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants