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 Sep 6, 2023

This PR refactors Rasterizer so that it's more suitable for multi-view.

Design doc: flutter.dev/go/multi-view-pipeline-and-rasterizer

With this change, Rasterizer::DrawToSurfaces has a structure that can handle drawing to multiple views, although the lack of some functionality still blocks it, mostly related to ExternalViewEmbedder and RasterCache.

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.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

No major concerns, mostly nits

FramePipeline::Consumer consumer = [&draw_result,
this](std::unique_ptr<FrameItem> item) {
draw_result = DoDraw(std::move(item->frame_timings_recorder),
std::move(item->layer_tree_tasks));
Copy link
Contributor

Choose a reason for hiding this comment

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

Something should probably clear out the tasks after this right?

Otherwise we have a list of tasks with nullptr...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tasks are moved all the way into DrawToSurfacesUnsafe, where some are discarded, some moved into resubmitted_tasks, and some stored in last_successful_tasks_. Since the vector is moved, there shouldn't be a list of nullptrs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I think I see now, this is the last spot they're used.

device_pixel_ratio);
}
}
// TODO(dkwingsmt): Pass in all raster caches
Copy link
Contributor

Choose a reason for hiding this comment

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

File a bug.

What's not clear to me is whether we'd actually want multiple raster caches or just one raster cache per layer tree. There are also ongoing explorations to see if we can just remove the raster cache entirely as we migrate to Impeller.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think its possible for the rasterizer to know if it is safe to share any of this information. i.e. if these are from different windows with a different GlContext, or the different windows with the same GlContext, et cetera. The backends are not designed to handle this.

@dkwingsmt
Copy link
Contributor Author

dkwingsmt commented Sep 26, 2023

@loic-sharma @dnfield I should have addressed all review comments.

Here are the non-trivial changes since the last review:

  • Several methods are renamed to reflect their multi-view nature, such as DrawLastLayerTree is renamed to DrawLastLayerTrees.
  • Rasterizer's view-specific data are grouped into a ViewRecord struct.
  • As per requested, the list of LayerTreeTask is now a vector of unique_ptrs.

Can you take another look?

@dkwingsmt dkwingsmt requested a review from dnfield September 28, 2023 17:25
@dkwingsmt dkwingsmt requested a review from dnfield September 29, 2023 20:26
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 29, 2023
@auto-submit auto-submit bot merged commit d203e34 into flutter:main Sep 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 29, 2023
@dkwingsmt dkwingsmt deleted the mv-raster-real branch September 29, 2023 23:05
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 29, 2023
flutter/engine@48973d7...d203e34

2023-09-29 [email protected] Multi-view Rasterizer  (flutter/engine#45512)
2023-09-29 [email protected] Roll Dart SDK from 955a3a964621 to 0931bb8a43c8 (1 revision) (flutter/engine#46423)
2023-09-29 [email protected] [Impeller] Redo simplify invert colors. (flutter/engine#46416)
2023-09-29 [email protected] Use `dart:_wasm` constructs to avoid dependence on `WebAssembly.Function` (flutter/engine#46388)
2023-09-29 [email protected] Roll Skia from 2d4045f55fd5 to a063eaeaf1e0 (6 revisions) (flutter/engine#46420)

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],[email protected],[email protected] 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…5776)

flutter/engine@48973d7...d203e34

2023-09-29 [email protected] Multi-view Rasterizer  (flutter/engine#45512)
2023-09-29 [email protected] Roll Dart SDK from 955a3a964621 to 0931bb8a43c8 (1 revision) (flutter/engine#46423)
2023-09-29 [email protected] [Impeller] Redo simplify invert colors. (flutter/engine#46416)
2023-09-29 [email protected] Use `dart:_wasm` constructs to avoid dependence on `WebAssembly.Function` (flutter/engine#46388)
2023-09-29 [email protected] Roll Skia from 2d4045f55fd5 to a063eaeaf1e0 (6 revisions) (flutter/engine#46420)

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],[email protected],[email protected] 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
This PR refactors `Rasterizer` so that it's more suitable for multi-view.

Design doc: [flutter.dev/go/multi-view-pipeline-and-rasterizer](http://flutter.dev/go/multi-view-pipeline-and-rasterizer)

With this change, `Rasterizer::DrawToSurfaces` has a structure that can handle drawing to multiple views, although the lack of some functionality still blocks it, mostly related to `ExternalViewEmbedder` and `RasterCache`. 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants