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

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Sep 5, 2023

fixes flutter/flutter#133933

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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke force-pushed the threadsafe-skia-vkqueuesubmit branch 3 times, most recently from ecc6882 to 0d16c56 Compare September 7, 2023 03:33
@gaaclarke gaaclarke marked this pull request as ready for review September 8, 2023 19:02
}

#if SHELL_ENABLE_VULKAN
TEST_F(EmbedderTest,
Copy link
Member Author

Choose a reason for hiding this comment

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

@bdero please advice how you want these tests to be. They are just straight copies of the software rendering now. It was the easiest way I could find to test this.

Copy link
Member

@bdero bdero Sep 8, 2023

Choose a reason for hiding this comment

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

Oh interesting -- does this test reproduce the problem and fail without your change? And if not, is the existing EmbedderTestMultiBackend.CanRenderGradientWithCompositorOnNonRootLayer sufficient for covering the code in this PR?

If the test doesn't repro the problem, I would just remove it. Otherwise, tossing it into embedder_gl_unittests and writing it using EmbedderTestMultiBackend to cover both GL and Vulkan seems like a good approach for the moment.

Later on we should add software context support to the multi-backend class, but that's perhaps a job for another day.

Basically, anything that's Vulkan-specific gets changed to a switchboard method:

  • auto& context = GetEmbedderContext(EmbedderTestContextType::kVulkanContext) becomes auto& context = GetEmbedderContext(GetParam());
  • builder.SetRenderTargetType(EmbedderTestBackingStoreProducer::RenderTargetType::kVulkanImage); becomes builder.SetRenderTargetType(GetRenderTargetFromBackend(GetParam(), false));
  • etc

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is a race condition which I can't force to happen. So this doesn't assert that the race condition is gone, but it does exercise the code to make sure that it functions. It's possible that the failure would happen in this test infrequently without the change.

Running embedder_unittests this is the only way I could get this code to be hit. The BUILD.gn file only compiles embedder_gl_unittests.cc if test_enable_gl == true which isn't possible to enable on macos. Let me see if I can detangle some of this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I pulled the new tests into a embedder_vk_unittests.cc to mirror the ones in embedder_gl_unittest.cc and embedder_metal_unittests.cc. It has a comment in there that says some of the tests are in embedder_gl_unittests.cc and I added an issue to clean them up more later (noted in comment).

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

LGTM

}

#if SHELL_ENABLE_VULKAN
TEST_F(EmbedderTest,
Copy link
Member

@bdero bdero Sep 8, 2023

Choose a reason for hiding this comment

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

Oh interesting -- does this test reproduce the problem and fail without your change? And if not, is the existing EmbedderTestMultiBackend.CanRenderGradientWithCompositorOnNonRootLayer sufficient for covering the code in this PR?

If the test doesn't repro the problem, I would just remove it. Otherwise, tossing it into embedder_gl_unittests and writing it using EmbedderTestMultiBackend to cover both GL and Vulkan seems like a good approach for the moment.

Later on we should add software context support to the multi-backend class, but that's perhaps a job for another day.

Basically, anything that's Vulkan-specific gets changed to a switchboard method:

  • auto& context = GetEmbedderContext(EmbedderTestContextType::kVulkanContext) becomes auto& context = GetEmbedderContext(GetParam());
  • builder.SetRenderTargetType(EmbedderTestBackingStoreProducer::RenderTargetType::kVulkanImage); becomes builder.SetRenderTargetType(GetRenderTargetFromBackend(GetParam(), false));
  • etc

@gaaclarke gaaclarke force-pushed the threadsafe-skia-vkqueuesubmit branch from c145143 to 4ef4e5a Compare September 8, 2023 23:18
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 8, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 8, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 8, 2023

auto label is removed for flutter/engine/45459, due to - The status or check suite triage has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke
Copy link
Member Author

I'll try to rebase this to see if that flushes out the failure.

@gaaclarke gaaclarke force-pushed the threadsafe-skia-vkqueuesubmit branch from 4ef4e5a to 67f1bd8 Compare September 9, 2023 00:04
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 9, 2023
@auto-submit auto-submit bot merged commit 1f2da3d into flutter:main Sep 9, 2023
@gaaclarke
Copy link
Member Author

I'm going to revert this. It works fine in tests, but it's not going to work for real usage of the embedder since the user has free access to the vkQueue and thus has no way to ensure that the vkQueue isn't used concurrently.

gaaclarke added a commit that referenced this pull request Sep 11, 2023
auto-submit bot pushed a commit that referenced this pull request Sep 11, 2023
Reverts #45459

I'm going to revert this. It works fine in tests, but it's not going to work for real usage of the embedder since the user has free access to the vkQueue and thus has no way to ensure that the vkQueue isn't used concurrently.

See: flutter/flutter#133933 (comment)
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter engine may invoke vkQueueSubmit from the io thread

2 participants