这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Apr 7, 2025

Fixes #166410

keep the potentially shutdown context alive until the last texture is reclaimed, to work around issues where pending UI tasks aren't flushed during platform view shutdown.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Apr 7, 2025
@jonahwilliams jonahwilliams marked this pull request as ready for review April 7, 2025 22:59
@jonahwilliams jonahwilliams changed the title [Impeller] keep context alive until last vk image is destroyed. [Impeller] keep device holder and allocator alive until last vk image is destroyed. Apr 8, 2025
@jonahwilliams jonahwilliams requested a review from matanlurey April 8, 2025 17:48
@chinmaygarde
Copy link
Member

While I can't think of anything that will go wrong as a result of this, I'd like to get the thoughts of @gaaclarke who introduced the DeviceHolder (flutter/engine@dab253347f2) to presumably handle cases like these. Per my understanding, the way he envisioned this would work was to first check if the holder had a live device. If it didn't, then you'd release the wrapper (and likely incur the small leak of the Vulkan object). In the case of the image, there is no chance of a leak of the image data itself because that is in the allocator which will be collected along with the device.

To put another way, instead of delaying collection of all live objects in the allocator till all textures are collected, just don't collect the texture if the allocator is dead.

But yeah, I'll take the lead from @gaaclarke on this.

@jason-simmons
Copy link
Member

The challenge is that the Vulkan memory allocator apparently expects that all allocations will be freed before the allocator itself is shut down.

If the texture and its allocation are still alive when the AllocatorVK is deleted, then the VMA will fail checks such as https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/+/refs/heads/master/include/vk_mem_alloc.h#12655

So it makes sense to adopt the strategy in this PR which will keep the allocator and Vulkan instance alive until all pending tasks have deleted their Vulkan objects.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 8, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 8, 2025

autosubmit label was removed for flutter/flutter/166725, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Apr 9, 2025
Merged via the queue into flutter:master with commit b013e41 Apr 9, 2025
175 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
… is destroyed. (flutter#166725)

Fixes flutter#166410

keep the potentially shutdown context alive until the last texture is
reclaimed, to work around issues where pending UI tasks aren't flushed
during platform view shutdown.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
dgh1818 pushed a commit to dgh1818/flutter_engine_ohos that referenced this pull request Oct 21, 2025
…最后一个 vk 图像被销毁之前保持设备持有者和分配器处于活动状态

Signed-off-by: lx123546879 <511859501@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[android] App crash on exit (back button press) when showing animated WEBP image

4 participants