Skip to content

[web] Enable hybrid Skwasm presentation on selected desktop configurations - #195106

Draft
MarlonJD wants to merge 20 commits into
flutter:masterfrom
MarlonJD:skwasm-hybrid-defaults
Draft

MarlonJD wants to merge 20 commits into
flutter:masterfrom
MarlonJD:skwasm-hybrid-defaults

Conversation

@MarlonJD

Copy link
Copy Markdown
Contributor

Related: #187660. Part 5 of 5, split from #188628. Depends on #195105; this draft includes the prerequisite commits. The default-policy change is f4a67610a217. It stays draft until the opt-in implementation lands.

Enables hybrid presentation by default on desktop Safari/Firefox and desktop Chrome ST. Chrome MT, mobile, and Wimp remain opt-in. Explicit skwasmUseHybridRasterizer settings override the default, and lack of transferred-canvas support keeps bitmap rendering.

Measurements against master 18aa6807735a, with the timing recorder from #188628, use 72 runs (36 bitmap/hybrid pairs) and 7,200 measured samples on an M2 Pro Mac mini. These measure engine presentation duration, not displayed FPS. Chrome MT improved in this campaign, but stays opt-in because the earlier candidate/browser version regressed on text. This revision has not been requalified on physical mobile devices.

Full benchmark table

Medians of three per-run averages; microseconds, lower is better. Chrome 155, Safari 27, Firefox 148 on macOS 27. Each run confirmed its intended presentation path and reported no application errors.

Browser Threads Benchmark Bitmap µs Hybrid µs Change
Chrome MT Cards 1356.8 1130.8 -16.7%
Chrome MT Text 2271.8 1946.9 -14.3%
Chrome ST Cards 1036.6 756.8 -27.0%
Chrome ST Text 2302.9 1934.0 -16.0%
Firefox MT Cards 10336.9 1099.0 -89.4%
Firefox MT Text 10039.6 1360.0 -86.5%
Firefox ST Cards 9718.7 918.4 -90.6%
Firefox ST Text 9644.0 1527.9 -84.2%
Safari MT Cards 3108.0 702.6 -77.4%
Safari MT Text 2156.7 1031.7 -52.2%
Safari ST Cards 1464.3 556.4 -62.0%
Safari ST Text 1685.3 792.0 -53.0%

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team labels Oct 22, 2026
yexuan910812 pushed a commit to yexuan910812/flutter that referenced this pull request Oct 30, 2026
…188628)

Related: flutter#187660. Part 1 of 5 from the original hybrid-rasterizer
change. This PR is now limited to the independent benchmark
instrumentation.

Adds `presentation_duration` around preparation and frame submission,
including asynchronous raster work, and records it in the web benchmark
harness. The timer stops before reporting, and benchmark listeners are
cleaned up even when startup fails. The existing profile JSON schema is
unchanged.

Verified locally: two engine timing tests cover enabled/disabled
profiling and delayed preparation/rasterization; a browser regression
test covers listener cleanup after synchronous startup failures. Static
analysis and formatting pass. This change is independent of the hybrid
rasterizer.

The remaining pieces are separate drafts:

- flutter#195103: native callback IDs and optional bitmap capture.
- flutter#195104: platform-view DOM commit after rasterization.
- flutter#195105: opt-in hybrid presentation, depending on the two changes
above.
- flutter#195106: desktop default policy and benchmark results, depending on
the opt-in implementation.

The duplicate semaphore and codec changes were dropped on rebase because
master already includes flutter#194139 and flutter#193187.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant in-code documentation (doc comments with
`///`).
- [ ] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Zero marks an unset context-loss callback. Skip it when the shared uint32_t callback sequence wraps so context-loss notifications remain registered.
Keep canvases alive until pending rasterization finishes and clean up partially prepared frames. Handle platform-view removal during rasterization and keep staged presentation hooks with the hybrid rasterizer.
Merge current master while preserving disposed-frame cancellation and timing guards. Pass each queued render size through the rasterizer and update the platform-view regression helper for the required size argument.
Integrate upstream render sizes and deferred platform-view publication. Verify placeholder pixels independently of animation callbacks, clear stale readback pixels, and release GPU resources in their owning contexts.

Dispatch context-loss notifications without dereferencing a disposed surface. Add regression coverage for unavailable placeholders, delayed animation callbacks, context disposal, and explicit DPR in platform-view coordinate tests.
Integrate the updated opt-in implementation while retaining the desktop defaults for WebKit, Firefox, and single-threaded Chromium. Multi-threaded Chromium, mobile platforms, and Wimp continue to require explicit opt-in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant