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

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Mar 27, 2024

With this PR, backing stores are labeled with view IDs. When the engine requests the embedder to create a backing store, the engine will promise that it will only be used for a specific view.

This follows the design doc http://flutter.dev/go/backing-stores-for-multi-view-partial-repaint, so that backing stores can be used as a front surface that retains its content last frame.

The engine will create a render target cache for each view to cache backing stores separately.

Alternative design

The separate render target cache for each view is not needed to implement the design doc, since all usages described in the design doc avoids the engine cache. Instead, we can make the engine still only manage one render target cache for all views, and backing stores in it are interchangeable across views. We might describe the behavior in this way:

  • In general, the view ID is just provided to the creating callback as information. (This is how it is seen when the engine cache is avoided.)
  • If the engine cache is used, then the created backing store might not be immediately collected, and might be reused for different views.

But it's really hard to explain the mechanism and the result is really confusing (as can be seen from my attempt). Why is there a view ID but it's not used, and if you enable the engine cache it's not even followed?

That's why I chose the current approach. Feel free to suggest otherwise for this.

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 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.

@dkwingsmt dkwingsmt marked this pull request as ready for review April 3, 2024 23:11
@dkwingsmt dkwingsmt requested a review from loic-sharma April 3, 2024 23:11
const std::shared_ptr<impeller::AiksContext>& aiks_context,
std::unique_ptr<SurfaceFrame> frame) {
// Get the view's cache, or create one if the view doesn't have a cache yet.
EmbedderRenderTargetCache& render_target_cache =
Copy link
Member

@loic-sharma loic-sharma Apr 4, 2024

Choose a reason for hiding this comment

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

Could you add a comment on EmbedderRenderTargetCache's class declaration that it is view-specific?

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

This LGTM but please also get a review from engine folks too :)

@loic-sharma
Copy link
Member

/cc @knopp

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 4, 2024
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.

@auto-submit auto-submit bot merged commit dcc99d6 into flutter:main Apr 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 4, 2024
flutter/engine@e3104af...dcc99d6

2024-04-04 dkwingsmt@users.noreply.github.com Multiview backing store (flutter/engine#51722)
2024-04-04 skia-flutter-autoroll@skia.org Roll Skia from f9dfb0308594 to 8ad03dfe4e2e (2 revisions) (flutter/engine#51915)
2024-04-04 43091780+utzcoz@users.noreply.github.com Bump Robolectric to 4.12.1 (flutter/engine#51800)
2024-04-04 johnoneil@users.noreply.github.com #145421 Fix glyph padding in STB atlas impl. (flutter/engine#51585)

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 matanl@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
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
…6308)

flutter/engine@e3104af...dcc99d6

2024-04-04 dkwingsmt@users.noreply.github.com Multiview backing store (flutter/engine#51722)
2024-04-04 skia-flutter-autoroll@skia.org Roll Skia from f9dfb0308594 to 8ad03dfe4e2e (2 revisions) (flutter/engine#51915)
2024-04-04 43091780+utzcoz@users.noreply.github.com Bump Robolectric to 4.12.1 (flutter/engine#51800)
2024-04-04 johnoneil@users.noreply.github.com flutter#145421 Fix glyph padding in STB atlas impl. (flutter/engine#51585)

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 matanl@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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-android platform-fuchsia platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants