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

[Impeller] migrate blur to calculating coefficients on the cpu #49512

Merged
merged 16 commits into from
Jan 4, 2024

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Jan 3, 2024

issue: flutter/flutter#131580

This factors out the gaussian blur fragment shader to be a more generic kernel fragment shader. We can't use this for the old gaussian blur because it's kernel is unbounded in one dimension. I implemented this by passing in the coefficients into the UBO so it can't support that.

Profile after change:

    "average_vsync_transitions_missed": 2.0,
    "90th_percentile_vsync_transitions_missed": 2.0,
    "99th_percentile_vsync_transitions_missed": 2.0,
    "average_vsync_frame_lag": 0.0,
    "90th_percentile_vsync_frame_lag": 0.0,
    "99th_percentile_vsync_frame_lag": 0.0,
    "average_layer_cache_count": 0.0,
    "90th_percentile_layer_cache_count": 0.0,
    "99th_percentile_layer_cache_count": 0.0,
    "average_frame_request_pending_latency": 16636.624373956594,
    "90th_percentile_frame_request_pending_latency": 16718.0,
    "99th_percentile_frame_request_pending_latency": 16761.0,
    "worst_layer_cache_count": 0.0,
    "average_layer_cache_memory": 0.0,
    "90th_percentile_layer_cache_memory": 0.0,
    "99th_percentile_layer_cache_memory": 0.0,
    "worst_layer_cache_memory": 0.0,
    "average_picture_cache_count": 0.0,
    "90th_percentile_picture_cache_count": 0.0,
    "99th_percentile_picture_cache_count": 0.0,
    "worst_picture_cache_count": 0.0,
    "average_picture_cache_memory": 0.0,
    "90th_percentile_picture_cache_memory": 0.0,
    "99th_percentile_picture_cache_memory": 0.0,
    "worst_picture_cache_memory": 0.0,
    "total_ui_gc_time": 1.65,
    "30hz_frame_percentage": 0.0,
    "60hz_frame_percentage": 100.0,
    "80hz_frame_percentage": 0.0,
    "90hz_frame_percentage": 0.0,
    "120hz_frame_percentage": 0.0,
    "illegal_refresh_rate_frame_count": 0,
    "average_gpu_frame_time": 21.875,
    "90th_percentile_gpu_frame_time": 31.25,
    "99th_percentile_gpu_frame_time": 31.25,
    "worst_gpu_frame_time": 31.25,
    "average_cpu_usage": 162.86326532653064,
    "90th_percentile_cpu_usage": 167.3,
    "99th_percentile_cpu_usage": 168.500003,
    "average_gpu_usage": 93.26530612244898,
    "90th_percentile_gpu_usage": 94.0,
    "99th_percentile_gpu_usage": 95.0,
    "average_memory_usage": 113.56696428571429,
    "90th_percentile_memory_usage": 145.484375,
    "99th_percentile_memory_usage": 152.75

This is a 13% (21.25 / 25 ) drop in average_gpu_frame_time from the last profile in #49299.

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.

@flutter-dashboard

This comment was marked as outdated.

@gaaclarke gaaclarke marked this pull request as draft January 3, 2024 23:52
@gaaclarke gaaclarke marked this pull request as ready for review January 4, 2024 21:32
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

Uber-nit: kernel as a name is sort of ambiguous. If we're able to get rid of the old gaussian, can we reclaim that name later?

@gaaclarke
Copy link
Member Author

Uber-nit: kernel as a name is sort of ambiguous. If we're able to get rid of the old gaussian, can we reclaim that name later?

Here's the thinking behind it. The fragment shader, by virtue of removing all the blur math, was left with just applying a Kernel. It's exactly the name for what it does. There are a few effects that can be implemented with just a Kernel and given Impeller's ethos of having a limited static set of shaders, it made more sense, to me, to make it available for everyone instead of naming it something specific.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 4, 2024
@auto-submit auto-submit bot merged commit f60d9a9 into flutter:main Jan 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 4, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 5, 2024
…140993)

flutter/engine@0bbb4d6...f60d9a9

2024-01-04 [email protected] [Impeller] migrate blur to calculating coefficients on the cpu (flutter/engine#49512)

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] 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
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants