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

[flatland] Handle fence overflow in flatland_connection.cc #53366

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

filmil
Copy link
Contributor

@filmil filmil commented Jun 13, 2024

flatland_connection.cc used to allow an arbitrary number of acquire and release fences to be scheduled for each frame.

Sadly, Fuchsia has a limitation of (1) the number of total handles that can be sent per a FIDL call, but also (2) the Flatland protocol only supports sending up to 16 fences per each fence type.

Now, normally there should be very few scheduled fences per frame. But if frames get skipped, we could amass many fences which would then crash our attempts to send all of them to the Flatland Present endpoint.

This change introduces two fence multiplexer, which allow us to signal more than 16 fences per type, at a performance penalty. We expect to be able not to crash the FIDL subsystem using this approach, and may even be able to hobble along for a bit, until the fences issue is hopefully self-resolved.

That said, this issue seems to indicate there are frame scheduling problems elsewhere. But this is a fairly straightforward change to make without affecting the rest of the flatland code or integration, so we opt to do that first.

Issues: #150136

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.

@filmil filmil force-pushed the fix-flatland-scheduling branch 2 times, most recently from 066b1a3 to 5cac8fd Compare June 13, 2024 10:49
Copy link
Contributor

@uysalere uysalere left a comment

Choose a reason for hiding this comment

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

Thanks @filmil!

shell/platform/fuchsia/flutter/flatland_connection.cc Outdated Show resolved Hide resolved
shell/platform/fuchsia/flutter/flatland_connection.cc Outdated Show resolved Hide resolved
shell/platform/fuchsia/flutter/flatland_connection.cc Outdated Show resolved Hide resolved
@filmil filmil force-pushed the fix-flatland-scheduling branch 2 times, most recently from 4fee0e0 to ddbffb0 Compare June 13, 2024 17:02
@filmil
Copy link
Contributor Author

filmil commented Jun 13, 2024

@uysalere PTAL - I merged the code of EnqueueAcquireFence and EnqueueReleaseFence.

flatland_connection.cc used to allow an arbitrary number
of acquire and release fences to be scheduled for each frame.

Sadly, Fuchsia has a limitation of (1) the number of total handles
that can be sent per a FIDL call, but also (2) the Flatland protocol
only supports sending up to 16 fences per each fence type.

Now, normally there should be very few scheduled fences per frame. But
if frames get skipped, we could amass many fences which would then
crash our attempts to send all of them to the Flatland `Present`
endpoint.

This change introduces two fence multiplexer, which allow us to signal
more than 16 fences per type, at a performance penalty. We expect to
be able *not* to crash the FIDL subsystem using this approach, and may
even be able to hobble along for a bit, until the fences issue is
hopefully self-resolved.

That said, this issue seems to indicate there are frame scheduling
problems elsewhere. But this is a fairly straightforward change to make
without affecting the rest of the flatland code or integration, so we
opt to do that first.

Issue: #150136
@filmil
Copy link
Contributor Author

filmil commented Jun 17, 2024

@chinmaygarde Can you merge this for me? I am not a Flutter committer. Thanks!

@chinmaygarde chinmaygarde added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 17, 2024
@chinmaygarde
Copy link
Member

chinmaygarde commented Jun 17, 2024

Happy to endorse. Your call. go/flutter-onboarding.

@auto-submit auto-submit bot merged commit cabc195 into flutter:main Jun 17, 2024
31 checks passed
@filmil
Copy link
Contributor Author

filmil commented Jun 17, 2024

Happy to endorse. Your call. go/flutter-onboarding.

I don't think I'm at a point where flutter onboarding makes sense for me. Thanks for the pointer, however.

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 18, 2024
…150399)

flutter/engine@a4f266f...1c4e5e2

2024-06-17 flar@google.com [DisplayList] Create DrawDashedLine for paragraph code (flutter/engine#53411)
2024-06-17 chinmaygarde@google.com [Impeller] Update Android CPU profiling instructions. (flutter/engine#53437)
2024-06-17 jonahwilliams@google.com [Impeller] move draw vertices to dl unittests. (flutter/engine#53400)
2024-06-17 chinmaygarde@google.com [Impeller] Link CPU profiling docs from the main README. (flutter/engine#53435)
2024-06-17 skia-flutter-autoroll@skia.org Roll Dart SDK from 1ce6b4d54247 to 51bbba0da7d3 (1 revision) (flutter/engine#53432)
2024-06-17 jonahwilliams@google.com [Impeller] Move drawAtlas golden tests to display list. (flutter/engine#53398)
2024-06-17 fmil@google.com [flatland] Handle fence overflow in flatland_connection.cc (flutter/engine#53366)
2024-06-17 skia-flutter-autoroll@skia.org Roll Skia from 0dda1054f543 to 2b9bc16df969 (1 revision) (flutter/engine#53431)

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 chinmaygarde@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
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-fuchsia
Projects
None yet
3 participants