Skip to content

android: A33 blanks a missing override only once the desktop has painted again - #36

Merged
utkarshdalal merged 1 commit into
gamenativefrom
suggest/a33-binding-gap
Nov 10, 2026
Merged

utkarshdalal merged 1 commit into
gamenativefrom
suggest/a33-binding-gap

Conversation

@joshuatam

@joshuatam joshuatam commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Symptom

Nothing observed by itself — this is the other half of a drm change (GameNative/gamenative-drm#65). A33's exit arm treats a missing override surface as "the desktop is all that is left", which was true while the WSI shim sent override_window_content at surface creation and never sent wl_surface.destroy: the override could only disappear at teardown.

Once the shim binds at a swapchain's first commit and destroys the surface for real, the same absence happens mid-session — a device loss, or a rebuild on a new surface — and that arm blanks the panel for a gap that closes a frame or two later.

Cause

The arm decides by absence alone:

// The override is gone after having been bound: the desktop is all that is left
// (the game's own exit path, ahead of the reaper).
if ( override_surface == nullptr )
    return true;

"Gone after having been bound" was only ever the exit path when the binding was permanent. With a surface that can be destroyed and recreated, absence is a gap as often as it is an exit, and the two are not distinguished.

Change

A33 is corrected in place (the A28 precedent), not re-issued as a new patch. When the override first goes away its gap is stamped with the window's newest done commit id, and the blind is raised only once something has painted after that:

if ( override_surface == nullptr )
{
    if ( w->ulSessionOverrideGapCommitID == 0 )
        w->ulSessionOverrideGapCommitID = lastCommit ? lastCommit->commitID : 1;
    return lastCommit != nullptr && lastCommit->commitID > w->ulSessionOverrideGapCommitID;
}
w->ulSessionOverrideGapCommitID = 0;

Wine's desktop repaints when the game's window goes away — that is the exit case, and it still blanks (the reaper blank covers the rest). A guest recreating its surface binds and commits before the desktop repaints — that is the gap, and it no longer flashes. The clock is commit ids from the one counter the startup blind already uses, so there is no timeout to tune.

steamcompmgr_win_t gains ulSessionOverrideGapCommitID, and the one-shot log line gains gap_commit= so the panel evidence stays tieable to the predicate:

session-blank: blank=0 reaper=0 window=none    override_bound=0 saw_game_window=0 bound_commit=0 gap_commit=0 last_done_commit=0
session-blank: blank=1 reaper=0 window=present override_bound=1 saw_game_window=1 bound_commit=3 gap_commit=0 last_done_commit=3
session-blank: blank=0 reaper=0 window=present override_bound=1 saw_game_window=1 bound_commit=3 gap_commit=0 last_done_commit=4

No other patch is disabled: none of them is wrong on its own, and this one is only wrong about a premise the drm side removes.

Testing

Odin 3, Android 13, payload 20261110.1 — bin/gamescope 96cf8bf0 (the build of this patch) with the shim from gamenative-drm#65, wine explorer /desktop=shell,1280x720, Epic overlay enabled on both titles.

Yooka-Laylee — the startup arm, with the new field:

override: swapchain 0x…4450 binds surface 0x…e510 to XID 0x600004 at its first commit
session-blank: blank=1 … saw_game_window=1 bound_commit=3 gap_commit=0 last_done_commit=3   ← latch, nothing newer
session-blank: blank=0 … saw_game_window=1 bound_commit=3 gap_commit=0 last_done_commit=4   ← first newer commit, 334 ms later

Three transitions in the session, all at startup; fps 59.9–61.0 over 2 min 30 s.

FINAL FANTASY VII REMAKE INTERGRADE (vkd3d/D3D12) — the case this patch exists to keep quiet:

override: swapchain 0x…fa70 binds surface 0x…c250 to XID 0x600004 at its first commit
proxy swapchain destroyed: sc=0x…fa70 1280x720 presents=1 commits=1
override: swapchain 0x…ad50 binds surface 0x…c250 to XID 0x600004 at its first commit
session-blank: 3 transitions, all at startup, gap_commit=0 throughout

A swapchain destroyed and recreated mid-session did not unbind the window, so the gap arm never ran and no black frame appeared on the recreate. fps 30.0 with LIMIT -- (the title's own cap), gamescope Error/Warn: 0.

The series applies cleanly to a pristine 6c38178f (23 files, this patch included), and src/steamcompmgr.cpp compiles with the build's own flags (-fsyntax-only, NDK 27.3, -Wall -Wextra, no diagnostics).

Not tested

The gap arm itself — a guest that destroys its Vulkan surface while its window lives (DXVK/vkd3d device loss). Neither title did that in these runs, so gap_commit stayed 0 in both logs: reasoned through and consistent, but unexercised on hardware.

…ted again

A33's exit arm treats a missing override surface as "the desktop is all that is
left", which was true when the shim sent `override_window_content` at surface
creation and never sent `wl_surface.destroy`: the override could only disappear
at teardown.

drm ValveSoftware#64 binds at a swapchain's first commit and destroys the surface for real
when the guest does, so the same absence now happens mid-session — a device
loss, or a rebuild on a new surface — and the arm blanks the panel for a gap
that closes a frame or two later.

The arm now waits for evidence that nothing is coming back: when the override
first goes away it stamps the window's newest done commit id, and the blind is
raised only once something has painted after that. Wine's desktop repaints when
the game's window goes away, which is the exit case; a guest recreating its
surface binds and commits before the desktop repaints, which is not. The clock
is commit ids from the one counter the startup blind already uses, so there is
no timeout to tune. The one-shot log line carries the new id so the panel
evidence stays tieable to the predicate.

Verified: the series applies cleanly to a pristine 6c38178 (23 files, this
patch included), and `src/steamcompmgr.cpp` compiles with the build's own flags
(`-fsyntax-only`, NDK 27.3, `-Wall -Wextra`, no diagnostics). No device run:
the change is a predicate, and the case it changes needs a guest that destroys
its Vulkan surface mid-session — a DXVK device loss is the cheapest way to
provoke one.
@utkarshdalal
utkarshdalal merged commit 3d10d68 into gamenative Nov 10, 2026
1 check passed
@utkarshdalal
utkarshdalal deleted the suggest/a33-binding-gap branch November 10, 2026 16:24
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.

2 participants