-
Notifications
You must be signed in to change notification settings - Fork 6k
Implement frame timing callbacks in Skwasm. #50737
Implement frame timing callbacks in Skwasm. #50737
Conversation
lib/web_ui/lib/frame_timings.dart
Outdated
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ); | ||
| (await (renderer as SkwasmRenderer).surface.renderPictures( | ||
| <SkwasmPicture>[recorder.endRecording() as SkwasmPicture], | ||
| )).imageBitmaps.first; |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
lib/web_ui/skwasm/surface.cpp
Outdated
| } | ||
|
|
||
| // Releasing picturePointers here and will recreate the unique_ptr on the | ||
| // other thread See skwasm_renderPicturesOnWorker |
There was a problem hiding this comment.
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?
There was a problem hiding this 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 :)
…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
|
Reason for revert: Fails in device lab, see https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8755350727803344657/+/u/run_web_benchmarks_skwasm/stdout |
This reverts commit 3ee6f25.
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).
…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
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).

Fixes flutter/flutter#140429
Some notes here:
uitest suite so that they run on all renderers (including skwasm).