Skip to content

fix(framebuffer): Draw DRM frames before flipping (6.8) - #25131

Merged
agneszitte merged 1 commit into
unoplatform:servicing/6.8from
ramezgerges:dev/rara/68-drm-draw-then-flip
Oct 13, 2026
Merged

agneszitte merged 1 commit into
unoplatform:servicing/6.8from
ramezgerges:dev/rara/68-drm-draw-then-flip

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: #24505 (backport of #25060)

PR Type:

🐞 Bugfix

What changed? 🚀

Backport of #25060 to 6.8.

On the Linux framebuffer host with KMS/DRM, DRMRenderer drew ahead of the next request. The page-flip handler pre-drew a frame, and InvalidateRender only swapped and flipped that buffer, so each flip showed a frame drawn before the content it was answering existed. A request that arrived while a flip was in flight could also be lost: the handler cleared the pending flag before checking it.

Fix, the same as #25060:

  • InvalidateRender draws, then flips (DrawAndFlip).
  • The two flags become a single _flipState (idle / in flight / in flight with a request pending), changed only by compare-and-swap. A request made during a flip is always served when that flip lands.
  • The flip handler no longer draws ahead; it serves the pending request or returns to idle.

Differences from #25060: master's flip handler had already moved into OnPageFlipCore with a try/catch, which came from a 7.0-only commit. 6.8 keeps its static OnPageFlip handler, with the new state logic applied in place. InvalidateRender and DrawAndFlip are identical to master.

Validation:

  • Runtime: the issue's sample in the same QEMU VM as fix(framebuffer): Draw DRM frames before flipping #25060 (virtio-gpu), built against Uno.WinUI 6.8.0-dev.212. 16 screenshots were taken 1.7 s apart, each next to the guest clock, on a fresh boot per run.
    • DRM was confirmed in use for each run: the process held /dev/dri/card0 and had no /dev/fb0 mapping. The sample sets UseKMSDRM(gbmSurfaceColorFormat: XR24), because virtio-gpu rejects the default ARGB8888, as noted in fix(framebuffer): Draw DRM frames before flipping #25060. Without that, the host silently falls back to the software renderer, and the bug can't show.
    • Before (packaged framebuffer runtime): every screenshot showed the previous 5-second tick. For example, at 18:26:52.2 the screen showed :46 although the :51 tick had fired.
    • After (this PR's framebuffer DLL swapped in, nothing else changed): every screenshot showed the current tick.
  • Compile: Uno.UI.Runtime.Skia.Linux.FrameBuffer builds on servicing/6.8.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable): not testable in the runtime tests (DRM only); validated in the VM as above.
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features): not applicable.
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code

Fixes unoplatform#24505.

The page-flip handler drew ahead of the next request, so each flip
presented a buffer drawn before the content it answered existed, and a
request arriving mid-flip was cleared before it was checked. Content
updates without follow-up invalidations stayed one frame behind.

Draw at the request, then flip, and track flip state in one word so a
request made during a flip is always served when it lands.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 819266d)
@unodevops

Copy link
Copy Markdown
Contributor

@mergify

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

@agneszitte
agneszitte merged commit 55edf6f into unoplatform:servicing/6.8 Oct 13, 2026
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants