This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread #55398
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
jonahwilliams
approved these changes
Sep 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
gaaclarke
approved these changes
Sep 24, 2024
gaaclarke
reviewed
Sep 24, 2024
There was a problem hiding this 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.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Sep 25, 2024
…clerVK after decoding an image on the IO thread (flutter/engine#55398)
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 [email protected] Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417) 2024-09-25 [email protected] [Flutter GPU] Add CullMode. (flutter/engine#55409) 2024-09-25 [email protected] Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412) 2024-09-24 [email protected] [Impeller] fix Impeller on windows. (flutter/engine#55323) 2024-09-24 [email protected] [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168) 2024-09-24 [email protected] Move each dart GN rule to a standalone file. (flutter/engine#55404) 2024-09-24 [email protected] Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406) 2024-09-24 [email protected] [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028) 2024-09-24 [email protected] Disallow time traveling frame times (flutter/engine#55310) 2024-09-24 [email protected] [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398) 2024-09-24 [email protected] Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405) 2024-09-24 [email protected] [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272) 2024-09-24 [email protected] Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399) 2024-09-24 [email protected] [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 [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://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 [email protected] Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417) 2024-09-25 [email protected] [Flutter GPU] Add CullMode. (flutter/engine#55409) 2024-09-25 [email protected] Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412) 2024-09-24 [email protected] [Impeller] fix Impeller on windows. (flutter/engine#55323) 2024-09-24 [email protected] [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168) 2024-09-24 [email protected] Move each dart GN rule to a standalone file. (flutter/engine#55404) 2024-09-24 [email protected] Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406) 2024-09-24 [email protected] [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028) 2024-09-24 [email protected] Disallow time traveling frame times (flutter/engine#55310) 2024-09-24 [email protected] [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398) 2024-09-24 [email protected] Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405) 2024-09-24 [email protected] [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272) 2024-09-24 [email protected] Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399) 2024-09-24 [email protected] [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 [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://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 [email protected] Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417) 2024-09-25 [email protected] [Flutter GPU] Add CullMode. (flutter/engine#55409) 2024-09-25 [email protected] Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412) 2024-09-24 [email protected] [Impeller] fix Impeller on windows. (flutter/engine#55323) 2024-09-24 [email protected] [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168) 2024-09-24 [email protected] Move each dart GN rule to a standalone file. (flutter/engine#55404) 2024-09-24 [email protected] Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406) 2024-09-24 [email protected] [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028) 2024-09-24 [email protected] Disallow time traveling frame times (flutter/engine#55310) 2024-09-24 [email protected] [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398) 2024-09-24 [email protected] Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405) 2024-09-24 [email protected] [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272) 2024-09-24 [email protected] Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399) 2024-09-24 [email protected] [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 [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://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 [email protected] Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417) 2024-09-25 [email protected] [Flutter GPU] Add CullMode. (flutter/engine#55409) 2024-09-25 [email protected] Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412) 2024-09-24 [email protected] [Impeller] fix Impeller on windows. (flutter/engine#55323) 2024-09-24 [email protected] [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168) 2024-09-24 [email protected] Move each dart GN rule to a standalone file. (flutter/engine#55404) 2024-09-24 [email protected] Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406) 2024-09-24 [email protected] [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028) 2024-09-24 [email protected] Disallow time traveling frame times (flutter/engine#55310) 2024-09-24 [email protected] [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398) 2024-09-24 [email protected] Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405) 2024-09-24 [email protected] [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272) 2024-09-24 [email protected] Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399) 2024-09-24 [email protected] [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 [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://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 [email protected] Roll Dart SDK from 7af8c4882e07 to eda9ae15367e (2 revisions) (flutter/engine#55417) 2024-09-25 [email protected] [Flutter GPU] Add CullMode. (flutter/engine#55409) 2024-09-25 [email protected] Roll Skia from 2e92f0b443f4 to 3541cdf2fae6 (1 revision) (flutter/engine#55412) 2024-09-24 [email protected] [Impeller] fix Impeller on windows. (flutter/engine#55323) 2024-09-24 [email protected] [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168) 2024-09-24 [email protected] Move each dart GN rule to a standalone file. (flutter/engine#55404) 2024-09-24 [email protected] Roll Skia from 118914b760cb to 2e92f0b443f4 (1 revision) (flutter/engine#55406) 2024-09-24 [email protected] [Impeller] Pack impeller:Path into 2 vecs instead of 3. (flutter/engine#55028) 2024-09-24 [email protected] Disallow time traveling frame times (flutter/engine#55310) 2024-09-24 [email protected] [Impeller] Delete command pools held by the CommandPoolRecyclerVK after decoding an image on the IO thread (flutter/engine#55398) 2024-09-24 [email protected] Roll Skia from cf28f9dd411d to 118914b760cb (1 revision) (flutter/engine#55405) 2024-09-24 [email protected] [Flutter GPU] Add pipeline stencil config. (flutter/engine#55272) 2024-09-24 [email protected] Roll Skia from 6e5ff9253147 to cf28f9dd411d (1 revision) (flutter/engine#55399) 2024-09-24 [email protected] [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 [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://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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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