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

Conversation

@jonahwilliams
Copy link
Contributor

This fixes the flickering and rendering errors when running on Android seen in flutter/flutter#148412 .

The problem is the barriers proceding mip generation do not account for the input text having been the output of a render pass. Unfortunately no validation errors on this, and no Idea how to test it.

@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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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.

We do have tests that get close to this in blit_pass_unittests.cc. None of them hit this code at all. Can you add a test that executes BlitPassVK::OnGenerateMipmapCommand to make sure it doesn't crash or create validation errors? That's better than nothing.

@jonahwilliams
Copy link
Contributor Author

I can definitely add a test case that hits this path. That said, I did not observe any validation errors locally unfortunately

@gaaclarke
Copy link
Member

I can definitely add a test case that hits this path. That said, I did not observe any validation errors locally unfortunately

Yea, the test won't help us know that we've fixed the issue, but it will help us know that we didn't introduce a new one. I was hoping maybe the process of writing a non-perfect test might make the path to a better test more clear.

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

The sync validation only catches errors due such as write-after-write which can be trivially checked to be incorrect. This one is an issue with insufficient synchronization and harder to detect. For instance, we could have had a compute stage writing to this texture before before blitting from it. Or perhaps we had another form of synchronization like a semaphore.

Like you idea on tracking layouts at the queue level, perhaps we can track write and reads at the per-resource per-queue level too and automatically insert barriers?

LGTM modulo Aarons comments.

@jonahwilliams
Copy link
Contributor Author

Longer term, yeah - automatic barrier determination is a must - especially for something like flutter GPU. That said, its a big lift to do so efficiently

@jonahwilliams
Copy link
Contributor Author

I checked and all of the backdrop blurs in aiks_blur_unttests will hit this case. The bug happens when a render pass texture has mips generated

@gaaclarke
Copy link
Member

I checked and all of the backdrop blurs in aiks_blur_unttests will hit this case. The bug happens when a render pass texture has mips generated

Could we potentially set up the barriers to be in the bad state before doing an aiks_blur_unttests test to reproduce the problem?

@jonahwilliams
Copy link
Contributor Author

The barriers are currently in a bad state

@gaaclarke
Copy link
Member

The barriers are currently in a bad state

Could we get that bug to show up in the golden output then by drawing at a particular mip level? Or is it non deterministic so we couldn't know for sure we grabbed bad output?

@jonahwilliams
Copy link
Contributor Author

Unfortunately its a synchronization issue/race, so I don't think we can guarantee it shows up

@gaaclarke
Copy link
Member

Unfortunately its a synchronization issue/race, so I don't think we can guarantee it shows up

Ahh yea, we'd probably have to make a test that just pounds on drawing and check that the output is the same each frame, so not really a golden test. Otherwise, a test that just tests the flags on a mocked up vulkan isn't so helpful. We don't really have anything that does that yet that I know of. Do you think we could reproduce the problem like that and would it be worth investing in? This bug is so subtle I could easily see this getting broken again at some point and not noticing it until much later, but investing in a potentially flaky test isn't an obvious slam dunk either.

@jonahwilliams
Copy link
Contributor Author

if all of our blurs start flickering, I think we just have to hope that we notice. I do not even know if its possible to reproduce in swiftshader. Its possible that the implicit synchronization from running everything on the CPU causes it to "just work".

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.

test exception: The new logic is invariant so a test that mocks out vulkan isn't that informative. The code is executed as part of the blur tests, so it has some coverage to make sure it isn't completely wrong. The error manifests because of a synchronization problem that isn't caught by the validation layers. We are uncertain if pounding on drawing could even reproduce the problem with our swiftshader test harness.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2024
@auto-submit auto-submit bot merged commit 06934ef into flutter:main May 29, 2024
@jonahwilliams jonahwilliams deleted the blur_rrect branch May 29, 2024 20:58
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 30, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 30, 2024
…149290)

flutter/engine@8d5d14a...4adf453

2024-05-29 [email protected] Roll Skia from aecf76e8eb9a to f23183f041fe (1 revision) (flutter/engine#53102)
2024-05-29 [email protected] Update CONTRIBUTING.md links (flutter/engine#53043)
2024-05-29 [email protected] Roll Skia from 32746679f7be to aecf76e8eb9a (1 revision) (flutter/engine#53100)
2024-05-29 [email protected] Roll Skia from b18b7d6af6e8 to 32746679f7be (2 revisions) (flutter/engine#53097)
2024-05-29 [email protected] [Impeller] revert changes to IO thread upload scheduling. (flutter/engine#53096)
2024-05-29 [email protected] [Impeller] fix barriers prior to mip generation. (flutter/engine#53082)
2024-05-29 [email protected] Roll Skia from e11a5c5b402e to b18b7d6af6e8 (2 revisions) (flutter/engine#53095)
2024-05-29 [email protected] Switch to FilterQuality.medium for images (flutter/engine#52984)
2024-05-29 [email protected] Roll Skia from a4f58c9dabc3 to e11a5c5b402e (1 revision) (flutter/engine#53092)
2024-05-29 [email protected] Roll Skia from ca77972f659e to a4f58c9dabc3 (2 revisions) (flutter/engine#53091)
2024-05-29 [email protected] [Impeller] relax conditions for SkRRect.isSimple conversion to impeller::RRect. (flutter/engine#53083)
2024-05-29 [email protected] Roll Skia from d1a6967c48a5 to ca77972f659e (1 revision) (flutter/engine#53090)

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
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request May 31, 2024
…lutter#149290)

flutter/engine@8d5d14a...4adf453

2024-05-29 [email protected] Roll Skia from aecf76e8eb9a to f23183f041fe (1 revision) (flutter/engine#53102)
2024-05-29 [email protected] Update CONTRIBUTING.md links (flutter/engine#53043)
2024-05-29 [email protected] Roll Skia from 32746679f7be to aecf76e8eb9a (1 revision) (flutter/engine#53100)
2024-05-29 [email protected] Roll Skia from b18b7d6af6e8 to 32746679f7be (2 revisions) (flutter/engine#53097)
2024-05-29 [email protected] [Impeller] revert changes to IO thread upload scheduling. (flutter/engine#53096)
2024-05-29 [email protected] [Impeller] fix barriers prior to mip generation. (flutter/engine#53082)
2024-05-29 [email protected] Roll Skia from e11a5c5b402e to b18b7d6af6e8 (2 revisions) (flutter/engine#53095)
2024-05-29 [email protected] Switch to FilterQuality.medium for images (flutter/engine#52984)
2024-05-29 [email protected] Roll Skia from a4f58c9dabc3 to e11a5c5b402e (1 revision) (flutter/engine#53092)
2024-05-29 [email protected] Roll Skia from ca77972f659e to a4f58c9dabc3 (2 revisions) (flutter/engine#53091)
2024-05-29 [email protected] [Impeller] relax conditions for SkRRect.isSimple conversion to impeller::RRect. (flutter/engine#53083)
2024-05-29 [email protected] Roll Skia from d1a6967c48a5 to ca77972f659e (1 revision) (flutter/engine#53090)

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.

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.

3 participants