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

Conversation

flar
Copy link
Contributor

@flar flar commented Jul 18, 2023

When a saveLayer is rendered with an ImageFilter that modifies the bounds of the rendered pixels, and some of the content of that saveLayer did not intersect the clip, but the filtered output of that content did intersect the clip, we might not accumulate the bounds of those rendering operations into the DisplayList bounds.

This bug was not encountered during practical testing, but showed up on some testing with the new NOP culling code.

For now, this bug only affects the accuracy of the reported bounds of the DisplayList, but that can affect raster caching and potentially the layer culling done in the LayerTree. It might also affect the accuracy of the RTree associated with the DisplayList, which would only show up in rare circumstances when the indicated operation was used in the presence of an embedded view.

@flar flar requested a review from ColdPaleLight July 18, 2023 21:14
@flar flar force-pushed the fix-filtered-saveLayer-clipped-content-bounds branch from 298f993 to 3b4b079 Compare July 19, 2023 07:25
Copy link
Member

@ColdPaleLight ColdPaleLight left a comment

Choose a reason for hiding this comment

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

LGTM

@flar
Copy link
Contributor Author

flar commented Jul 19, 2023

I'm at a loss for why there are crashes on every platform in CI testing, but they don't happen when I run the tests locally.

@jason-simmons
Copy link
Member

Some of the errors on CI are happening in a run that uses the address sanitizer.

Try reproducing it locally by building the host engine with the --asan/--lsan GN flags (see an example failing LUCI run at https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20Engine%20Drone/1101808/overview)

@jason-simmons
Copy link
Member

The error is happening because TestParameters is holding the sk_renderer_ and dl_renderer_ by reference. But in SaveLayerClippedContentStillFilters the renderer lambdas are temporaries that go out of scope after the TestParameters is constructed.

The renderer lambdas should be moved into variables within the test method's scope.

@flar
Copy link
Contributor Author

flar commented Jul 19, 2023

The error is happening because TestParameters is holding the sk_renderer_ and dl_renderer_ by reference. But in SaveLayerClippedContentStillFilters the renderer lambdas are temporaries that go out of scope after the TestParameters is constructed.

The renderer lambdas should be moved into variables within the test method's scope.

Good catch and bad design on my part in creating these test mechanisms. Thanks for investigating!

@flar flar force-pushed the fix-filtered-saveLayer-clipped-content-bounds branch from 3b4b079 to a91101c Compare July 19, 2023 17:57
@flar
Copy link
Contributor Author

flar commented Jul 19, 2023

The renderer lambdas should be moved into variables within the test method's scope.

A simpler solution was just to change the fields to non-references. The reference is fine during the constructor, but the long-term storage should not be by reference. If there is copying there as a result, that's fine as none of that code is performance-sensitive. Ignoring the fact that it is part of a test, that constructor is only executed a couple dozen times.

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 19, 2023
@auto-submit auto-submit bot merged commit d38eb4a into flutter:main Jul 19, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 19, 2023
…130939)

flutter/engine@6ea54ee...0af2852

2023-07-19 skia-flutter-autoroll@skia.org Roll Skia from 650c980daa72 to 30d458aea0b9 (1 revision) (flutter/engine#43825)
2023-07-19 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from Iqf3gYJ8Vkq8k8l3O... to 7kGBjmX-zBXcg1svE... (flutter/engine#43823)
2023-07-19 flar@google.com fix handling of clipped rendering inside a layer that applies a filter (flutter/engine#43787)
2023-07-19 skia-flutter-autoroll@skia.org Roll Skia from 8d19d04472e1 to 650c980daa72 (6 revisions) (flutter/engine#43821)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from Iqf3gYJ8Vkq8 to 7kGBjmX-zBXc

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 bdero@google.com,rmistry@google.com,zra@google.com 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
harryterkelsen pushed a commit to harryterkelsen/engine that referenced this pull request Jul 20, 2023
flutter#43787)

When a saveLayer is rendered with an ImageFilter that modifies the bounds of the rendered pixels, and some of the content of that saveLayer did not intersect the clip, but the filtered output of that content did intersect the clip, we might not accumulate the bounds of those rendering operations into the DisplayList bounds.

This bug was not encountered during practical testing, but showed up on some testing with the new NOP culling code.

For now, this bug only affects the accuracy of the reported bounds of the DisplayList, but that can affect raster caching and potentially the layer culling done in the LayerTree. It might also affect the accuracy of the RTree associated with the DisplayList, which would only show up in rare circumstances when the indicated operation was used in the presence of an embedded view.
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
…lutter#130939)

flutter/engine@6ea54ee...0af2852

2023-07-19 skia-flutter-autoroll@skia.org Roll Skia from 650c980daa72 to 30d458aea0b9 (1 revision) (flutter/engine#43825)
2023-07-19 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from Iqf3gYJ8Vkq8k8l3O... to 7kGBjmX-zBXcg1svE... (flutter/engine#43823)
2023-07-19 flar@google.com fix handling of clipped rendering inside a layer that applies a filter (flutter/engine#43787)
2023-07-19 skia-flutter-autoroll@skia.org Roll Skia from 8d19d04472e1 to 650c980daa72 (6 revisions) (flutter/engine#43821)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from Iqf3gYJ8Vkq8 to 7kGBjmX-zBXc

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 bdero@google.com,rmistry@google.com,zra@google.com 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
auto-submit bot pushed a commit that referenced this pull request Sep 26, 2023
Cherry pick
�r (#43787)

When a saveLayer is rendered with an ImageFilter that modifies the bounds of the rendered pixels, and some of the content of that saveLayer did not intersect the clip, but the filtered output of that content did intersect the clip, we might not accumulate the bounds of those rendering operations into the DisplayList bounds.

This bug was not encountered during practical testing, but showed up on some testing with the new NOP culling code.

For now, this bug only affects the accuracy of the reported bounds of the DisplayList, but that can affect raster caching and potentially the layer culling done in the LayerTree. It might also affect the accuracy of the RTree associated with the DisplayList, which would only show up in rare circumstances when the indicated operation was used in the presence of an embedded view.

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
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
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants