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

Conversation

@eyebrowsoffire
Copy link
Contributor

Fixes flutter/flutter#140429

Some notes here:

  • Refactored the frame timing systems so that we can deal with asynchronous rendering.
  • Consolidated rendering of multiple pictures in skwasm into a single call, so that the rasterization can be properly measured.
  • Pulled the frame timings tests into the ui test suite so that they run on all renderers (including skwasm).

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Feb 16, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

I strongly recommend that we keep these files as similar as possible to their lib/ui/ counterparts to keep maintenance of the dart:ui API surface easy across platforms.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. We deviated before, which was difficult to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kind of makes me sad but okay.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

);
(await (renderer as SkwasmRenderer).surface.renderPictures(
<SkwasmPicture>[recorder.endRecording() as SkwasmPicture],
)).imageBitmaps.first;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm being paranoid, but using .single instead of .first may be able to catch bugs in the future.

)).imageBitmaps.first;
final DomOffscreenCanvas offscreenCanvas =
createDomOffscreenCanvas(bitmap.width.toDartInt, bitmap.height.toDartInt);
final DomCanvasRenderingContextBitmapRenderer context =
Copy link
Contributor

Choose a reason for hiding this comment

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

(github won't allow me to leave a comment on the line below, so putting it here)

The lines below that are zeroing out the contents of the canvas to reclaim resources should be identical to context.transferFromImageBitmap(null). Since context owns the ImageBitmap that's transferred into it, transferring null would free any previous ImageBitmap that it owned.

PS: It's also weird that we need a canvas to turn an ImageBitmap to a PNG, but I guess it's the web for ya.


extension RasterResultExtension on RasterResult {
external JSNumber get rasterStart;
external JSNumber get rasterEnd;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also use the Micros suffix here, for consistency with the Dart API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not actually micros, it's milliseconds as a double (what performance.now returns). I guess I should rename them to match that though, or at least put a comment in.

}

// Releasing picturePointers here and will recreate the unique_ptr on the
// other thread See skwasm_renderPicturesOnWorker
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should skwasm_renderPicturesOnWorker be surface_renderPicturesOnWorker?

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but I'm also leaning on Yegor's LGTM for the rendering bits that I'm not too familiar with :)

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 22, 2024
@auto-submit auto-submit bot merged commit 3ee6f25 into flutter:main Feb 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 22, 2024
…143972)

flutter/engine@06448ee...cb6115d

2024-02-22 [email protected] Avoid generated plugin registrant warnings for scenario_app (flutter/engine#50874)
2024-02-22 [email protected] Delete and create iOS simulator before running Scenario app test (flutter/engine#50835)
2024-02-22 [email protected] Roll Skia from b9c16065b76d to dd8cd405d145 (2 revisions) (flutter/engine#50872)
2024-02-22 [email protected] Remove 'bringup: true' from 'Mac mac_unopt' (flutter/engine#50865)
2024-02-22 [email protected] Pass the missing strut half leading flag over to skia paragraph builder (flutter/engine#50385)
2024-02-22 [email protected] Implement frame timing callbacks in Skwasm. (flutter/engine#50737)
2024-02-22 [email protected] [Impeller] Add stroke benchmarks that create UVs with no transform (flutter/engine#50847)
2024-02-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove WindowManager reflection in SingleViewPresentation.java (#49996)" (flutter/engine#50873)
2024-02-22 [email protected] Use RBE on more Windows builders (flutter/engine#50866)
2024-02-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] cache onscreen render targets. (#50751)" (flutter/engine#50871)

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
@goderbauer
Copy link
Member

@goderbauer goderbauer added the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
@eyebrowsoffire eyebrowsoffire added the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
auto-submit bot pushed a commit that referenced this pull request Feb 22, 2024
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
auto-submit bot added a commit that referenced this pull request Feb 22, 2024
Reverts #50737

Initiated by: goderbauer

Reason for reverting: Fails in device lab, see https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8755350727803344657/+/u/run_web_benchmarks_skwasm/stdout

Original PR Author: eyebrowsoffire

Reviewed By: {mdebbar, yjbanov}

This change reverts the following previous change:
Original Description:
Fixes flutter/flutter#140429

Some notes here:
* Refactored the frame timing systems so that we can deal with asynchronous rendering.
* Consolidated rendering of multiple pictures in skwasm into a single call, so that the rasterization can be properly measured.
* Pulled the frame timings tests into the `ui` test suite so that they run on all renderers (including skwasm).
goderbauer added a commit to flutter/flutter that referenced this pull request Feb 22, 2024
goderbauer added a commit to flutter/flutter that referenced this pull request Feb 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 23, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 23, 2024
…sions) (#143989)

Manual roll requested by [email protected]

flutter/engine@06448ee...0f3ad23

2024-02-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Implement frame timing callbacks in Skwasm. (#50737)" (flutter/engine#50895)
2024-02-22 [email protected] Roll Dart SDK from 0f0f7400c38a to e2f2d9b464e9 (4 revisions) (flutter/engine#50881)
2024-02-22 [email protected] Roll Skia from a285cd79614c to 58772db6bc46 (3 revisions) (flutter/engine#50884)
2024-02-22 [email protected] [Impeller] moved the kernel size assert to a more appropriate location. (flutter/engine#50880)
2024-02-22 [email protected] Build macOS engine as an xcframework (flutter/engine#50300)
2024-02-22 [email protected] Roll Skia from dd8cd405d145 to a285cd79614c (3 revisions) (flutter/engine#50878)
2024-02-22 [email protected] Avoid generated plugin registrant warnings for scenario_app (flutter/engine#50874)
2024-02-22 [email protected] Delete and create iOS simulator before running Scenario app test (flutter/engine#50835)
2024-02-22 [email protected] Roll Skia from b9c16065b76d to dd8cd405d145 (2 revisions) (flutter/engine#50872)
2024-02-22 [email protected] Remove 'bringup: true' from 'Mac mac_unopt' (flutter/engine#50865)
2024-02-22 [email protected] Pass the missing strut half leading flag over to skia paragraph builder (flutter/engine#50385)
2024-02-22 [email protected] Implement frame timing callbacks in Skwasm. (flutter/engine#50737)
2024-02-22 [email protected] [Impeller] Add stroke benchmarks that create UVs with no transform (flutter/engine#50847)
2024-02-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove WindowManager reflection in SingleViewPresentation.java (#49996)" (flutter/engine#50873)
2024-02-22 [email protected] Use RBE on more Windows builders (flutter/engine#50866)
2024-02-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] cache onscreen render targets. (#50751)" (flutter/engine#50871)

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],[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
eyebrowsoffire added a commit to eyebrowsoffire/engine that referenced this pull request Feb 26, 2024
Fixes flutter/flutter#140429

Some notes here:
* Refactored the frame timing systems so that we can deal with asynchronous rendering.
* Consolidated rendering of multiple pictures in skwasm into a single call, so that the rasterization can be properly measured.
* Pulled the frame timings tests into the `ui` test suite so that they run on all renderers (including skwasm).
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 platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SchedulerBinding.addTimingsCallback doesn't fire with SKWASM

4 participants