Initial support for DRM async page flip v2 - #1948
Conversation
34c75fb to
5d6e9d7
Compare
|
Works as expected on my integrated AMD Radeon cards 👌 |
|
Works as expected in Niri with very minor changes to it on AMD :) Thank you for the good work |
|
Using #1946 + #1949 on NVIDIA Turing (with the Worth noting that DRM debugger reports the following message: |
|
I've been waiting for this for so long... 🥹 |
5d6e9d7 to
80c793c
Compare
Co-Authored-By: Christian Meissl <meissl.christian@gmail.com>
80c793c to
f8a8f0f
Compare
Hm, |
|
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! |
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.
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.
|
Any expectations when this will get merged? So excited for this! |
Description
This is based on #1335, but takes a slightly different route.
Instead of calculating the
PresentationModeinsideDrmCompositor::render_frameit expects to receivethe desired mode.
This should allow the following things:
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
this should increase the chance that we can fulfill the async request
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=1shouldenable 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