Skip to content

app_server: stop dropping damage when a page flip is refused - #222

Open
schotek wants to merge 1 commit into
VitruvianOS:masterfrom
schotek:fix/AtomicFlip
Open

app_server: stop dropping damage when a page flip is refused#222
schotek wants to merge 1 commit into
VitruvianOS:masterfrom
schotek:fix/AtomicFlip

Conversation

@schotek

@schotek schotek commented Aug 10, 2026

Copy link
Copy Markdown

Fixes #219.

Three defects in the DRM flip path made parts of the UI flicker on integrated Intel graphics (verified on a Surface Book 2 and a Dell XPS 17). QEMU is unaffected — its virtual scanout accepts flips at any time, real hardware paced by vsync refuses them routinely.

  • a refused flip (EBUSY while the CRTC is busy) threw the accumulated damage away
  • damage arriving while a flip was in flight never triggered a follow-up flip
  • the completion handler cleared fPageFlipPending before swapping the buffer pointers

Reproduced on 843b7eab today, fixed on both machines with this change, no regression under QEMU.

On two laptops with integrated Intel graphics (Surface Book 2, Dell XPS
17) parts of the UI - and seemingly random rectangles of the screen -
flickered between old and new content. QEMU is unaffected: its virtual
scanout accepts page flips at any time, while real hardware paced by
vsync routinely refuses them. Verified fixed on both machines.

Three cooperating defects in the DRM flip path:

* A refused drmModePageFlip/_AtomicFlip (EBUSY while the CRTC is busy
  is routine) threw the accumulated damage away. The pixels had already
  been blitted into one buffer but never reached the other, so that
  region kept alternating between stale and fresh content on every
  subsequent flip. The damage is now kept and the flip retried on the
  next event-loop pass.

* Damage that arrived while a flip was in flight was copied into the
  buffer that had just left the screen, and nothing scheduled a
  follow-up flip - the update stayed invisible until unrelated damage
  came along. fNeedsFlip makes the completion handler ask for it.

* The completion handler cleared fPageFlipPending before swapping the
  buffer pointers. In that window CopyBackToFront() took the "no flip
  in flight" path and blitted into the buffer the CRTC had just started
  scanning out. Swap first, clear the flag after.
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.

UI elements flicker on integrated Intel GPUs — damage is dropped when a page flip is refused (fix ready)

1 participant