Skip to content

Initial support for DRM async page flip v2 - #1948

Open
cmeissl wants to merge 3 commits into
masterfrom
feature/async_pageflip
Open

Initial support for DRM async page flip v2#1948
cmeissl wants to merge 3 commits into
masterfrom
feature/async_pageflip

Conversation

@cmeissl

@cmeissl cmeissl commented Feb 28, 2026

Copy link
Copy Markdown
Collaborator

Description

This is based on #1335, but takes a slightly different route.
Instead of calculating the PresentationMode inside DrmCompositor::render_frame it expects to receive
the desired mode.

This should allow the following things:

  • more stable async page flip handling
    the implicit handling might not have enough information about user-preference and calculating it
    per frame could result in flip-flip between sync and async page flip which should be avoided imo
  • implicit disable overlay planes (potentially allowing them in a future PR)
    this should increase the chance that we can fulfill the async request
  • keep the decision a compositor policy

Note: This won't work as is on some intel hardware, because not all formats support async page flips.
I will try to come up with a solution, but that can wait for another day.

There is also a new environment variable in anvil to test this, running with ANVIL_FORCE_TEARING=1 should
enable it.

@PolyMeilex I opened a separate PR because I did not like to overwrite your wonderful work, but I kept you
as the main author. I hope you don't mind.

Checklist

@cmeissl
cmeissl force-pushed the feature/async_pageflip branch 4 times, most recently from 34c75fb to 5d6e9d7 Compare February 28, 2026 21:43
@cmeissl cmeissl mentioned this pull request Mar 1, 2026
1 task
@PolyMeilex

Copy link
Copy Markdown
Member

Works as expected on my integrated AMD Radeon cards 👌

@EmanuelKroell

Copy link
Copy Markdown

Works as expected in Niri with very minor changes to it on AMD :) Thank you for the good work

@urayde

urayde commented Apr 5, 2026

Copy link
Copy Markdown

Using #1946 + #1949 on NVIDIA Turing (with the nvidia-open proprietary driver) works fine, both on niri and anvil.

Worth noting that DRM debugger reports the following message:
[drm:drm_atomic_check_prop_changes] [PROP:18:IN_FENCE_FD] No prop can be changed during async flip
Couldn't reproduce it on other compositors such as Sway or Hyprland.

@shibahaczix

Copy link
Copy Markdown

I've been waiting for this for so long... 🥹

@cmeissl
cmeissl force-pushed the feature/async_pageflip branch from 5d6e9d7 to 80c793c Compare April 9, 2026 18:49
Co-Authored-By: Christian Meissl <meissl.christian@gmail.com>
@cmeissl
cmeissl force-pushed the feature/async_pageflip branch from 80c793c to f8a8f0f Compare April 9, 2026 18:55
@cmeissl
cmeissl marked this pull request as ready for review April 9, 2026 18:56
@cmeissl

cmeissl commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator Author

IN_FENCE_FD

Hm, IN_FENCE_FD was excluded from the things that are allowed to change, yeah. But as far as I know this limitation has been removed.

@OneGraund

Copy link
Copy Markdown

tested in niri with rtx 4060 mobile (proprietary 610.43.02) via nvidia-drm. kernel 6.18 (arch). async flips engage as needed. Thank you!

cushycush added a commit to cushycush/smithay that referenced this pull request Jul 13, 2026
Adds a sticky PresentationMode { Vsync, Async } to DrmCompositor (and
a DrmOutput passthrough), consulted at flip time. An async flip is the
ordinary atomic request plus PAGE_FLIP_ASYNC (PageFlipFlags::ASYNC on
the legacy backend), gated on DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP /
DRM_CAP_ASYNC_PAGE_FLIP queried once per surface.

The request is otherwise unchanged: IN_FENCE_FD and FB_DAMAGE_CLIPS are
kept (recent kernels exempt both from the async-flip property check, and
keeping the fence means the kernel still waits for the buffer to be
ready, so a tearing flip never scans out an unfinished buffer). A commit
the kernel refuses on the async path is retried synchronously with the
same request inside the surface page_flip; the actual per-frame outcome
is recorded on the pending frame and exposed via pending_presentation_mode
so the caller can classify the completed flip by what really happened.

Carried on top of 298ebc9 for Drift DRIFT-984 until upstream async-flip
support (PR Smithay#1948) lands.
cushycush added a commit to cushycush/smithay that referenced this pull request Jul 13, 2026
Adds a sticky PresentationMode { Vsync, Async } to DrmCompositor (and
a DrmOutput passthrough), consulted at flip time. An async flip is the
ordinary atomic request plus PAGE_FLIP_ASYNC (PageFlipFlags::ASYNC on
the legacy backend), gated on DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP /
DRM_CAP_ASYNC_PAGE_FLIP queried once per surface.

The request is otherwise unchanged: IN_FENCE_FD and FB_DAMAGE_CLIPS are
kept (recent kernels exempt both from the async-flip property check, and
keeping the fence means the kernel still waits for the buffer to be
ready, so a tearing flip never scans out an unfinished buffer). A commit
the kernel refuses on the async path is retried synchronously with the
same request inside the surface page_flip; the actual per-frame outcome
is recorded on the pending frame and exposed via pending_presentation_mode
so the caller can classify the completed flip by what really happened.

Carried on top of 298ebc9 for Drift DRIFT-984 until upstream async-flip
support (PR Smithay#1948) lands.
@0x42697262

Copy link
Copy Markdown

Any expectations when this will get merged? So excited for this!

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.

7 participants