Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jason-simmons
Copy link
Member

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

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.

LGTM, any idea how we could test this?

// When the command pool is destroyed, all of its command buffers are freed.
// Handles allocated from that pool are now invalid and must be discarded.
for (vk::UniqueCommandBuffer& buffer : buffers_to_collect_) {
buffer.release();
Copy link
Member

Choose a reason for hiding this comment

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

But the handle to the buffer will still be leaked right? Unless this is a reset.

Copy link
Member Author

Choose a reason for hiding this comment

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

Earlier this function calls graphics_pool_.reset(), which destroys the Vulkan command pool and frees all of the pool's buffers.

After that the buffer handle is invalid, and the Vulkan validation layers will warn about a call to vkFreeCommandBuffers using the handle.

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 3, 2023
@auto-submit auto-submit bot merged commit 8bee0dc into flutter:main Aug 3, 2023
@zanderso
Copy link
Member

zanderso commented Aug 3, 2023

@jason-simmons @chinmaygarde I see that @gaaclarke had a question about testing on this PR that went unanswered, so I'll go ahead and echo that. IIRC we there's a test harness for Vulkan we can use for stuff like this, right?

@jason-simmons
Copy link
Member Author

@gaaclarke had created a framework for mocking a ContextVK (https://github.com/flutter/engine/blob/main/impeller/renderer/backend/vulkan/test/mock_vulkan.h). But I don't know if we have any harness that can invoke Vulkan APIs and check for validation layer violations.

@chinmaygarde
Copy link
Member

My bad. We were going through this in triage and missed the call. I am not sure how to test this though TBH. We'd need to mock out Vulkan entrypoints.

@gaaclarke
Copy link
Member

I think mock_vulkan.h should be usable. Every single call to vulkan can be captured, so you could check the calls to vkFreeCommandBuffers. It would require a bit of plumbing but hopefully if more people used it, it will get easier to use. Unfortunately I think I did the plumbing at some point, but then dropped the PR so I never landed it.

Another option would be to hook into DebugReportVK and actually grab the validation layers violation. We are using validation layers to run impeller_unittests if I remember correctly. That hasn't been plumbed up, but once someone does it it will be easier for the next person.

@gaaclarke
Copy link
Member

We'd need to mock out Vulkan entrypoints.

That's what mock_vulkan.h does.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 3, 2023
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Aug 4, 2023
…131902)

flutter/engine@0c1de9b...4c62dd8

2023-08-03 [email protected] [Impeller] Run clangd tidy, opting out in 2 cases. (flutter/engine#44351)
2023-08-03 [email protected] Reland "[web] Update text editing test skips" (flutter/engine#37655)
2023-08-03 [email protected] [Impeller] Discard invalid command buffer handles after destroying a command pool (flutter/engine#44194)
2023-08-03 [email protected] Roll Skia from bae32428c1c7 to 3b3c1a617544 (1 revision) (flutter/engine#44345)

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
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
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 e: impeller

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

[Impeller] "Invalid VkCommandPool Object" in impeller::CommandPoolVK::~CommandPoolVK()

4 participants