Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[engine] changes to DlVertices::Builder and Stopwatch visualizer. #57031

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

jonahwilliams
Copy link
Member

Collection of changes to DlVertices::Builder and the stopwatch visualizer.

At a high level:

  • improve performance of the stopwatch visualizer by pre-allocating storage (and sharing it across both visualizers), lookup up font once, and cache the debug frame rate used. Updates to use Dl types instead of SkTypes.

  • Change DlVerticesBuilder to allow storing the bounds and use that in the visualizer, since we already know them. Make FML_CHECKS into dchecks, as the dart:ui vertices will already bounds check correctly - so these should only be necessary for debugging engine changes.

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

Mostly looks good, but is there really caching going on?

auto const right = rect.GetRight();
auto const bottom = rect.GetBottom();

auto const vertices = std::array<DlPoint, 6>{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why make an array only to immediately turn around and copy the values into the vectors one by one? This could just be 6 lines of "vector_[index_++] = next point".

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah good point, let me swap that out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -134,16 +137,22 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const {
SkScalar width = paint_bounds().width() - (padding * 2);
SkScalar height = paint_bounds().height() / 2;
auto mutator = context.state_stack.save();
// Cached storage for vertex output.
std::vector<DlPoint> vertices_storage;
std::vector<DlColor> color_storage;
Copy link
Contributor

Choose a reason for hiding this comment

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

Weren't these supposed to be cached somewhere? It looks like they are recreated on every frame?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or is this just re-use between the 2 graphs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just between the two graphs. originally I was much more ambitious but it turns out that we rebuild the layer each frame so there isn't a good place to put the storage.

@jonahwilliams jonahwilliams requested a review from flar December 11, 2024 20:03
Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

LGTM

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 11, 2024
@auto-submit auto-submit bot merged commit 24d4f27 into flutter:main Dec 11, 2024
31 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 11, 2024
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Dec 11, 2024
…160126)

flutter/engine@ba7ad87...b8034f1

2024-12-11 [email protected] Roll Dart SDK from
be9c98daf9df to aa03dca5beb2 (1 revision) (flutter/engine#57136)
2024-12-11 [email protected] Make Felt unzip Chrome
into a temporary directory next to the final location of the files
(flutter/engine#57109)
2024-12-11 [email protected] [engine] changes to
DlVertices::Builder and Stopwatch visualizer. (flutter/engine#57031)

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants