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

[Impeller] add herustic for ignoring coverage limit w/ image filters. #55030

Merged

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Sep 7, 2024

Switching to save_layer_utils regressed perf/memory usage on several devicelab benchmarks, see https://flutter-flutter-perf.skia.org/e/?queries=device_type%3DPixel_7_Pro%26sub_result%3D90th_percentile_gpu_memory_mb%26sub_result%3Daverage_gpu_memory_mb%26test%3Dnew_gallery_impeller_old_zoom__transition_perf&selected=commit%3D42418%26name%3D%252Carch%253Dintel%252Cbranch%253Dmaster%252Cconfig%253Ddefault%252Cdevice_type%253DPixel_7_Pro%252Cdevice_version%253Dnone%252Chost_type%253Dlinux%252Csub_result%253D90th_percentile_gpu_memory_mb%252Ctest%253Dnew_gallery_impeller_old_zoom__transition_perf%252C

The reason is that the source_coverage_limit intersection is highly unstable from frame to frame if there is an animated blur and/or image filter.

This change mostly matches the old entity pass behavior. . In cases where the difference between the intersected coverage result is small (< 20% in both dimensions), we just use the transformed content coverage.

The old behavior would always use the transformed content coverage even if it was substantially large than the coverage limit. This posed problems if folks drew content larger than the max texture size. This herustic attempts to prevent that by allowing the source coverage limit to kick in once the difference is larger than 20% in either direction

@jonahwilliams jonahwilliams requested a review from flar September 9, 2024 16:39
@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 9, 2024
@auto-submit auto-submit bot merged commit 813ad2d into flutter:main Sep 9, 2024
30 checks passed
@jonahwilliams jonahwilliams deleted the fix_herustic_save_layer_size branch September 9, 2024 18:41
return coverage.TransformBounds(effect_transform)
.Intersection(source_coverage_limit.value());
// Trimming the content coverage by the coverage limit can reduce memory
// coverage. limit can reduce memory bandwith. But in cases where there are
Copy link
Contributor

Choose a reason for hiding this comment

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

double phrase.

// to non-optimal allocation patterns as differently sized textures cannot
// be reused. Hence the following herustic: If the coverage is within a
// semi-arbitrary percentage of the intersected coverage, then just use the
// transformed coverage. In other cases, use the intersection.
Copy link
Contributor

Choose a reason for hiding this comment

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

What about going further and using surfaces that are rounded up to a tile size or some other quantization size? Would we be able to reuse the surfaces?

Some thought would need to be taken with kClamp/repeat/mirror tile modes, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

OOh, that is a good idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can the clamp/repeat modes restrict themselves to a coordinate sample not on the edge?

Copy link
Member Author

Choose a reason for hiding this comment

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

We control the input UVs for all of our image filters, so should be able to easily (tm) restrict the input range.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 9, 2024
…154844)

flutter/engine@1b2656a...813ad2d

2024-09-09 [email protected] [Impeller] add herustic for ignoring coverage limit w/ image filters. (flutter/engine#55030)
2024-09-09 [email protected] Roll Skia from f7e4ddabb754 to 8103f53635fd (1 revision) (flutter/engine#55043)

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
jesswrd pushed a commit to jesswrd/engine that referenced this pull request Sep 11, 2024
…flutter#55030)

Switching to save_layer_utils regressed perf/memory usage on several devicelab benchmarks, see https://flutter-flutter-perf.skia.org/e/?queries=device_type%3DPixel_7_Pro%26sub_result%3D90th_percentile_gpu_memory_mb%26sub_result%3Daverage_gpu_memory_mb%26test%3Dnew_gallery_impeller_old_zoom__transition_perf&selected=commit%3D42418%26name%3D%252Carch%253Dintel%252Cbranch%253Dmaster%252Cconfig%253Ddefault%252Cdevice_type%253DPixel_7_Pro%252Cdevice_version%253Dnone%252Chost_type%253Dlinux%252Csub_result%253D90th_percentile_gpu_memory_mb%252Ctest%253Dnew_gallery_impeller_old_zoom__transition_perf%252C

The reason is that the source_coverage_limit [intersection](https://github.com/flutter/engine/blob/main/impeller/entity/save_layer_utils.cc#L67-L68) is highly unstable from frame to frame if there is an animated blur and/or image filter.

This change mostly matches the old entity pass behavior. . In cases where the difference between the intersected coverage result is small (< 20% in both dimensions), we just use the transformed content coverage.

The old behavior would _always_ use the transformed content coverage even if it was substantially large than the coverage limit. This posed problems if folks drew content larger than the max texture size. This herustic attempts to prevent that by allowing the source coverage limit to kick in once the difference is larger than 20% in either direction
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.

4 participants