Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

The change to fix PowerVR barriers regressed Mali (see #165538)

We need to tighten the barriers to remove the transfer barrier to get back mali performance. however, this requires us to drop the usage of the blit for onscreen restore. not a huge loss imo.

At any rate, all of these changes should be visible in benchmarks.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

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.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Mar 20, 2025

fml::Status TextureSourceVK::SetLayout(const BarrierVK& barrier) const {
const auto old_layout = SetLayoutWithoutEncoding(barrier.new_layout);
if (barrier.new_layout == old_layout) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't correct because we can transition across the same layout with different stage masks - dropping the barrier makes it incorrect.

private:
SharedHandleVK<vk::Framebuffer> framebuffer_;
SharedHandleVK<vk::RenderPass> render_pass_;
mutable RWMutex layout_mutex_;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This mutex is incorrect. The layout depends on code submitted to the queue, not the order of encoded operations. so layout_ is only a best guess and isn't correct if there is shared texture usage across more than one thread.

We don't do that today so there aren't any drawbacks to the bug.

Copy link
Member

Choose a reason for hiding this comment

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

We don't do what today? We don't use the textures across more than one thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. And if we did, this mutex would still be wrong because it records layout at recording time whereas the layout only actually changes at submit time.

}
if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER) {
image_usage_flags |= vk::ImageUsageFlagBits::eColorAttachment;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was wrong, AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY isn't used by vulkan.

? ahb_size.MipCount()
: 1u;
if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY) {
if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

typo should be framebuffer

@jonahwilliams jonahwilliams requested a review from gaaclarke March 20, 2025 17:57
deps[0].srcAccessMask = vk::AccessFlagBits::eShaderRead |
vk::AccessFlagBits::eTransferRead |
vk::AccessFlagBits::eColorAttachmentWrite;
if (is_swapchain_) {
Copy link
Member

Choose a reason for hiding this comment

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

A comment wouldn't hurt here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried :)

private:
SharedHandleVK<vk::Framebuffer> framebuffer_;
SharedHandleVK<vk::RenderPass> render_pass_;
mutable RWMutex layout_mutex_;
Copy link
Member

Choose a reason for hiding this comment

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

We don't do what today? We don't use the textures across more than one thread?

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.

This stuff is hard to review. LGTM as long as there is automated tests that are executing this, preferably with validation layers turned on.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 21, 2025
@jonahwilliams jonahwilliams added this pull request to the merge queue Mar 25, 2025
Merged via the queue into flutter:master with commit 33cf3b6 Mar 25, 2025
172 checks passed
@jonahwilliams jonahwilliams deleted the tighten_up_barriers branch March 25, 2025 15:44
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 25, 2025
@jonahwilliams
Copy link
Contributor Author

reason for revert: render pass compatibility issue.

@jonahwilliams jonahwilliams added the revert Autorevert PR (with "Reason for revert:" comment) label Mar 25, 2025
auto-submit bot pushed a commit that referenced this pull request Mar 25, 2025
…it, tighten up graphics on level 3. (#165584)"

This reverts commit 33cf3b6.
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Mar 25, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 25, 2025
…lit, tighten up graphics on level 3. (#165584)" (#165898)

<!-- start_original_pr_link -->
Reverts: #165584
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: render pass compatibility issue.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jonahwilliams
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {gaaclarke}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
The change to fix PowerVR barriers regressed Mali (see
#165538)

We need to tighten the barriers to remove the transfer barrier to get
back mali performance. however, this requires us to drop the usage of
the blit for onscreen restore. not a huge loss imo.

At any rate, all of these changes should be visible in benchmarks.
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 29, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 29, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
zhangyuang pushed a commit to zhangyuang/flutter-fork that referenced this pull request Jun 9, 2025
…ten up graphics on level 3. (flutter#165584)

The change to fix PowerVR barriers regressed Mali (see
flutter#165538)

We need to tighten the barriers to remove the transfer barrier to get
back mali performance. however, this requires us to drop the usage of
the blit for onscreen restore. not a huge loss imo.

At any rate, all of these changes should be visible in benchmarks.
zhangyuang pushed a commit to zhangyuang/flutter-fork that referenced this pull request Jun 9, 2025
…lit, tighten up graphics on level 3. (flutter#165584)" (flutter#165898)

<!-- start_original_pr_link -->
Reverts: flutter#165584
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: render pass compatibility issue.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jonahwilliams
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {gaaclarke}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
The change to fix PowerVR barriers regressed Mali (see
flutter#165538)

We need to tighten the barriers to remove the transfer barrier to get
back mali performance. however, this requires us to drop the usage of
the blit for onscreen restore. not a huge loss imo.

At any rate, all of these changes should be visible in benchmarks.
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <[email protected]>
zhangyuang pushed a commit to zhangyuang/flutter-fork that referenced this pull request Jun 9, 2025
relands flutter#165584

We can't have separate barriers for onscreen because it makes the render
pass incompatible.
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
…ten up graphics on level 3. (flutter#165584)

The change to fix PowerVR barriers regressed Mali (see
flutter#165538)

We need to tighten the barriers to remove the transfer barrier to get
back mali performance. however, this requires us to drop the usage of
the blit for onscreen restore. not a huge loss imo.

At any rate, all of these changes should be visible in benchmarks.
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
…lit, tighten up graphics on level 3. (flutter#165584)" (flutter#165898)

<!-- start_original_pr_link -->
Reverts: flutter#165584
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: render pass compatibility issue.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jonahwilliams
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {gaaclarke}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
The change to fix PowerVR barriers regressed Mali (see
flutter#165538)

We need to tighten the barriers to remove the transfer barrier to get
back mali performance. however, this requires us to drop the usage of
the blit for onscreen restore. not a huge loss imo.

At any rate, all of these changes should be visible in benchmarks.
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <[email protected]>
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
relands flutter#165584

We can't have separate barriers for onscreen because it makes the render
pass incompatible.
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.

2 participants