Skip to content

Allow tearing with an overlay up (again) - #2284

Draft
matte-schwartz wants to merge 3 commits into
ValveSoftware:masterfrom
matte-schwartz:matts/tearing-ignore-overlay
Draft

Allow tearing with an overlay up (again)#2284
matte-schwartz wants to merge 3 commits into
ValveSoftware:masterfrom
matte-schwartz:matts/tearing-ignore-overlay

Conversation

@matte-schwartz

Copy link
Copy Markdown
Collaborator

Pending further on-device testing.

gamescope set DRM_MODE_PAGE_FLIP_ASYNC before liftoff built the request, and
liftoff passes the flags straight through to its own test commits. An async
flip may only change FB_ID, so every frame that reassigns planes emits CRTC_ID
and color changes that the kernel rejects. liftoff then reports that it needs
composition, and we cache that layout as impossible and never retry it, even on
later synchronous frames.

Let liftoff search with synchronous flags instead, and probe the finished
request with a test-only async commit. We tear only when the kernel accepts the
request as a pure flip, and commit synchronously for that frame otherwise.
liftoff has no notion of async-capable allocations, so a layout that is only
valid synchronously now scans out without tearing rather than falling back to
composition.
The convar zeroed nIgnoredOverlayRepaints at the top of every loop iteration,
before any of the flip paths could read it, so it also disabled the escalation
that stops an overlay repaint from starving behind a game that has stopped
submitting frames while tearing. Honour the convar where the adaptive sync path
reads the counter instead. The adaptive sync path already guards its own
increment the same way, so its behaviour is unchanged, and the counter now
survives for the other flip paths.
Tearing was disabled whenever an overlay was up, because the async flag made
liftoff fail to find a plane allocation and fall back to composition, which
stuttered. The DRM backend now probes async flips after liftoff has built the
request, so an overlay no longer costs us the allocation and we can keep
tearing while one is visible. An overlay repaint that the game does not follow
with a frame of its own still forces a synchronous flip through
nIgnoredOverlayRepaints, so overlay updates cannot be starved. Set
tearing_ignore_overlay to 0 to get the old behaviour back.
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.

1 participant