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

[Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread #55398

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

jason-simmons
Copy link
Member

In the Vulkan backend, the CommandPoolRecyclerVK stores command pools that can be reused while rendering a frame. For each frame, SurfaceContextVK::AcquireNextSurface calls CommandPoolRecyclerVK::Dispose to clear the cached pools.

However, the CommandPoolRecyclerVK's cache of pools is placed in thread-local storage. So command pools used on the IO thread will not be cleaned up if frame rendering calls Dispose on the raster thread.

This PR adds a Context API that the IO thread can call after using a command pool in order to ensure that cached resources are disposed.

Fixes flutter/flutter#155519

…er decoding an image on the IO thread

In the Vulkan backend, the CommandPoolRecyclerVK stores command pools
that can be reused while rendering a frame.  For each frame, SurfaceContextVK::AcquireNextSurface
calls CommandPoolRecyclerVK::Dispose to clear the cached pools.

However, the CommandPoolRecyclerVK's cache of pools is placed in
thread-local storage.  So command pools used on the IO thread will not
be cleaned up if frame rendering calls Dispose on the raster thread.

This PR adds a Context API that the IO thread can call after using a
command pool in order to ensure that cached resources are disposed.

Fixes flutter/flutter#155519
Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

It would be nice if we had an integration test that made sure things get cleaned up after image decoding. I'm not sure how difficult that would be to pull off though.

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2024
@auto-submit auto-submit bot merged commit a2cd9f4 into flutter:main Sep 24, 2024
32 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 25, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 25, 2024
…155648)

flutter/engine@559f2ff...746ce61

2024-09-25 skia-flutter-autoroll@skia.org Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417)
2024-09-25 bdero@google.com [Flutter GPU] Add CullMode. (flutter/engine#55409)
2024-09-25 skia-flutter-autoroll@skia.org Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412)
2024-09-24 jonahwilliams@google.com [Impeller] fix Impeller on windows. (flutter/engine#55323)
2024-09-24 jonahwilliams@google.com [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
2024-09-24 matanlurey@users.noreply.github.com Move each dart GN rule to a standalone file. (flutter/engine#55404)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406)
2024-09-24 jonahwilliams@google.com [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028)
2024-09-24 codefu@google.com Disallow time traveling frame times (flutter/engine#55310)
2024-09-24 jason-simmons@users.noreply.github.com [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405)
2024-09-24 bdero@google.com [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399)
2024-09-24 jonahwilliams@google.com [Impeller] delete expensive trace event. (flutter/engine#55400)

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 bdero@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
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 26, 2024
…lutter#155648)

flutter/engine@559f2ff...746ce61

2024-09-25 skia-flutter-autoroll@skia.org Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417)
2024-09-25 bdero@google.com [Flutter GPU] Add CullMode. (flutter/engine#55409)
2024-09-25 skia-flutter-autoroll@skia.org Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412)
2024-09-24 jonahwilliams@google.com [Impeller] fix Impeller on windows. (flutter/engine#55323)
2024-09-24 jonahwilliams@google.com [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
2024-09-24 matanlurey@users.noreply.github.com Move each dart GN rule to a standalone file. (flutter/engine#55404)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406)
2024-09-24 jonahwilliams@google.com [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028)
2024-09-24 codefu@google.com Disallow time traveling frame times (flutter/engine#55310)
2024-09-24 jason-simmons@users.noreply.github.com [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405)
2024-09-24 bdero@google.com [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399)
2024-09-24 jonahwilliams@google.com [Impeller] delete expensive trace event. (flutter/engine#55400)

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 bdero@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
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 26, 2024
…lutter#155648)

flutter/engine@559f2ff...746ce61

2024-09-25 skia-flutter-autoroll@skia.org Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417)
2024-09-25 bdero@google.com [Flutter GPU] Add CullMode. (flutter/engine#55409)
2024-09-25 skia-flutter-autoroll@skia.org Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412)
2024-09-24 jonahwilliams@google.com [Impeller] fix Impeller on windows. (flutter/engine#55323)
2024-09-24 jonahwilliams@google.com [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
2024-09-24 matanlurey@users.noreply.github.com Move each dart GN rule to a standalone file. (flutter/engine#55404)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406)
2024-09-24 jonahwilliams@google.com [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028)
2024-09-24 codefu@google.com Disallow time traveling frame times (flutter/engine#55310)
2024-09-24 jason-simmons@users.noreply.github.com [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405)
2024-09-24 bdero@google.com [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399)
2024-09-24 jonahwilliams@google.com [Impeller] delete expensive trace event. (flutter/engine#55400)

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 bdero@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
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 27, 2024
…lutter#155648)

flutter/engine@559f2ff...746ce61

2024-09-25 skia-flutter-autoroll@skia.org Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417)
2024-09-25 bdero@google.com [Flutter GPU] Add CullMode. (flutter/engine#55409)
2024-09-25 skia-flutter-autoroll@skia.org Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412)
2024-09-24 jonahwilliams@google.com [Impeller] fix Impeller on windows. (flutter/engine#55323)
2024-09-24 jonahwilliams@google.com [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
2024-09-24 matanlurey@users.noreply.github.com Move each dart GN rule to a standalone file. (flutter/engine#55404)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406)
2024-09-24 jonahwilliams@google.com [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028)
2024-09-24 codefu@google.com Disallow time traveling frame times (flutter/engine#55310)
2024-09-24 jason-simmons@users.noreply.github.com [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405)
2024-09-24 bdero@google.com [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399)
2024-09-24 jonahwilliams@google.com [Impeller] delete expensive trace event. (flutter/engine#55400)

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 bdero@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
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 27, 2024
…lutter#155648)

flutter/engine@559f2ff...746ce61

2024-09-25 skia-flutter-autoroll@skia.org Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417)
2024-09-25 bdero@google.com [Flutter GPU] Add CullMode. (flutter/engine#55409)
2024-09-25 skia-flutter-autoroll@skia.org Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412)
2024-09-24 jonahwilliams@google.com [Impeller] fix Impeller on windows. (flutter/engine#55323)
2024-09-24 jonahwilliams@google.com [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
2024-09-24 matanlurey@users.noreply.github.com Move each dart GN rule to a standalone file. (flutter/engine#55404)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406)
2024-09-24 jonahwilliams@google.com [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028)
2024-09-24 codefu@google.com Disallow time traveling frame times (flutter/engine#55310)
2024-09-24 jason-simmons@users.noreply.github.com [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405)
2024-09-24 bdero@google.com [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272)
2024-09-24 skia-flutter-autoroll@skia.org Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399)
2024-09-24 jonahwilliams@google.com [Impeller] delete expensive trace event. (flutter/engine#55400)

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 bdero@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 e: impeller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

decodeImageFromPixels memory leak on Android when Impeller is enabled
3 participants