Repository navigation
fix(composition): Guarantee a frame for every render request, without a stall recovery - #25941
ramezgerges merged 15 commits into
Conversation
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 242943 found UI Test snapshots differences: Details
|
9748755 to
fde5b68
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 243339 found UI Test snapshots differences: Details
|
|
@Mergifyio backport release/stable/7.0 |
✅ Backports have been createdDetails
|
fde5b68 to
192c1c8
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
Xiaoy312
left a comment
There was a problem hiding this comment.
Thanks, the core reasoning holds: the assert came from the recovery re-arming _shouldEnqueueRenderOnNextNativePlatformFrameRequested while a render was still queued, and the per-host fixes (DRM CAS, WASM _pendingInvalidate, Win32 initial signal, X11 pacer ordering and queued-event check) each look correct on their own.
One blocker, though: the new register-time ask reaches the Headless host before its renderer exists (inline on XamlRootMap.cs). No test in the repo exercises the Headless runtime, so CI won't catch it.
Inline also: a DRM page-flip loop that can't exit on an idle state, and a question about dropping the stall warning along with the re-arm.
CI on 243693: the red jobs aren't from this PR. Android shards 0/4 are the master baseline; Given_InputPane.When_Focus_Moves_While_Occluded_... and When_Touch_Selection_Does_Not_Lock_ScrollViewer_* also fail on master (14 each since 10-20); NativeAOT is NU1903 on ILCompiler; the Linux job died in Install Linux dependencies (mirror timeout). That last one means the X11 changes have no runtime evidence yet, neither local nor CI. Worth a rerun before merge.
|
The build 243693 found UI Test snapshots differences: Details
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
2f50941 to
dabbb80
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
Xiaoy312
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. All five points from the first round are addressed: Headless registers last (and since the content island is only attached after the constructor, publishing the size before Register doesn't reach the display-information lookup), the DRM flip handler can't spin, the stall warning is back as log-only, DRM now draws only on the page-flip thread, and the swap path goes through AskHostForFrame().
Approving. Two follow-ups inline: the restored warning measures the wrong interval and will fire in normal use, and a question on the resize re-request.
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 244129 found UI Test snapshots differences: Details
|
3118f0c to
c416663
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 244379 found UI Test snapshots differences: Details
|
c416663 to
6fe4f36
Compare
A request made before the window's host registered, or latched for a renderer that was then replaced, was never answered. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The flip handler returned to idle with an unconditional write, discarding a request made in between, and a failed frame dropped one too. poll is also retried on EINTR. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ered A frame that could not be scheduled, or was skipped while the GPU caught up, left the request consumed or the latch stuck. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The pacer now exists before the host registers, and events that another thread read into Xlib's queue are handled without waiting for the next socket event. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The window can be asked for frames before graphics negotiation creates the thread, and those requests had nothing to signal. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The display pass consumes needsDisplay, so skipping the frame without re-arming lost the request. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every host now answers a request with a frame, so re-asking after 2 s only re-requested renders still queued, which tripped NativeDispatcher's one-render-per-target assert (fixes unoplatform#25303). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Win32 and X11 Vulkan drop the first frame after a resize, and UIKit Metal one with no drawable; each now asks its platform for another frame. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A request no longer draws inline: it wakes the page-flip thread through an eventfd when idle, so InvalidateRender never throws into its caller. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An idle window gets no frames, so measuring from the last one reported a request that was milliseconds old as outstanding for seconds. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The frame dropped after a resize draws the old recording; the re-record it triggers already asks for the next frame, and re-asking early could present that old recording into the resized swapchain. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 244915 found UI Test snapshots differences: Details
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
GitHub Issue: closes #25303
PR Type:
🐞 Bugfix
What changed? 🚀
A Debug build on Skia Android (Vulkan) could abort at a slow cold start, on
Debug.Assert(details.renderAction is null)inNativeDispatcher.EnqueueRender(#25303).Cause.
CompositionTarget.IsRenderRequestStalledre-asked the host for a frame after 2 s without one, and re-armed the frame handshake. At a cold start the host had simply not produced a frame for a few seconds while the UI thread was busy, so the render queued by the previous frame was still pending. The next frame then queued a second render for the same target, which is what the assert rejects.The recovery dates from the Apple/Android lanes hanging on animations (
79d8c7820f). It turned out a host was not losing frames:CompositionTargetitself never asked for one after an ahead-of-time paint, whicheff8d1cb41fixed. The recovery stayed as a safety net.This PR removes it. Instead, every host now guarantees the contract it was covering: once
InvalidateRender()is called for a live window, the host eventually callsOnNativePlatformFrameRequested. With no recovery re-arming the handshake, "one queued render per target" is a real invariant again and the assert stays.I audited every host against that contract (Android, iOS/tvOS, macOS, Win32, X11, WebAssembly, Linux framebuffer DRM and software, Headless). The gaps it found are fixed in separate commits:
fix(composition)XamlRootMap.Registernow asks the new host for it (CompositionTarget.OnHostAttached). After a renderer swap, the request merged into one latched for the old renderer; the host is now asked directly. It goes through the sameAskHostForFrame(); #25901 takes this version when it rebases.fix(framebuffer)pollis retried onEINTRinstead of throwing on the page-flip thread. A flip completion that finds no flip in flight now throws (logged by the handler) instead of spinning.fix(framebuffer)InvalidateRender, so any caller (a property setter, layout,Register) could receive a rendering exception. Only the page-flip thread draws now: a request made while idle wakes it through aneventfdit polls alongside the card.fix(wasm)_pendingInvalidatewas cleared before the readiness checks and left set if the JS interop threw, either consuming a request without a frame or blocking all later ones. It is now cleared only when the frame is delivered.fix(x11)poll.fix(win32)_renderThread?.SignalNewFrame()while the thread was null. One frame is now signalled when the thread starts.fix(macos)fix(headless)fix(rendering)refactor(composition)IsRenderRequestStalled's re-ask and handshake re-arm.feat(composition)Apart from the UIKit dropped present above, the audit found no gap on Android or iOS/tvOS that this PR must close.
CurrentActivity, the finished activity, and that activity'sOnDestroycloses the window anyway. So this PR does not depend on fix(android): Hand the window back from a stacked activity #25901.Not in this PR (follow-up found by the same audit): an exception in a frame ends the render loop on X11, UIKit Metal and the Android GL canvas. That is a bug to fix on its own; the stall warning makes it visible.
Validation
Uno.UI,Uno.UI.Runtime.Win32,.X11,.MacOS,.Linux.FrameBufferand.WebAssembly.Browserbuild with analyzers on, with no warnings in the changed files.Given_CompositionTarget,Given_AnimatedVisualPlayer,Given_Storyboard,Given_DoubleAnimation,Given_RenderTargetBitmapandGiven_Window.Given_Windowtheme tests that fail the same way on master on this dark-themed machine.Given_CompositionTarget,Given_AnimatedVisualPlayerandGiven_Storyboard: 46 pass, 0 fail.Uno.UI,.Win32,.X11,.Linux.FrameBuffer); the UIKit change is left to CI.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code