Repository navigation
gamescope: the present mode follows the container, the cap on the display's vsync grid (payload 20261103.1) - #2327
Conversation
…play's vsync grid, payload 20261103.1 libgamenative_drm.so is rebuilt (08d6276c) from gamenative-drm shim-present-mode-from-container (#46) at a4a7bb0: the daemon's vsync note carries the flip events' stamp lead, which the shim needs before it gates a cap on the display's real vblank grid. Daemon sources are unchanged since 46ccc70. Payload 20261103.1 is 20261102.4 with only lib/libadrenotools_gamescope.so replaced (fa50add9), the shim from the same head: on the gamescope route it declares the container's present mode; a non-FIFO mode under a cap at the display's rate is declared FIFO with the vblank-grid gate kept, and a cap below the display's rate stays mailbox, enforced by the gate on the real vblank grid instead of gamescope's divisor limiter. gamescope and Xwayland are unchanged.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Payload 20261103.2 is 20261102.4 with only lib/libadrenotools_gamescope.so replaced (a77a7b77), the shim from GameNative/gamenative-drm#46 at 1b708d5: with no cap, a guest's FIFO request now wins over the container's default mode. gamescope and Xwayland are unchanged; libgamenative_drm.so is unchanged (the daemon sources have not changed since 46ccc70).
Payload 20261103.3 is 20261102.4 with only lib/libadrenotools_gamescope.so replaced (cfe96ac2, build string 202611030510c9b7c31), the shim from GameNative/gamenative-drm#46 at c9b7c31: the same present-mode rule as 1b708d5, with the shim's logging gated for shipping. The present-mode line prints once when frames start and again when the declared mode, source, cap or gate changes; its 10 s repeat with the counters needs GNDRM_LOG_VKSHIM=1. The mailbox-at-display-rate test switch is gone. gamescope, Xwayland and libgamenative_drm.so are unchanged.
Dependency update: GameNative/gamenative-drm#46 merged at c9b7c31 before the cap-rate regression fix reached its branch; that fix is GameNative/gamenative-drm#47 (commit 1cc98e1, the same change as 2567925). Payload 20261103.4 already carries it. GameNative/gamenative-drm#47 is merged (master bf2757b), so this PR is ready: payload 20261103.4 is the master shim, the daemon in jniLibs is the master daemon.
Description
Depends on GameNative/gamenative-drm#46 (under review by @joshuatam); do not merge before it.
This ships GameNative/gamenative-drm#46 (branch
shim-present-mode-from-container, head 2567925). The daemon from that branch goes injniLibs, and the shim from the same head ships as gamescope payload20261103.4(app commit 40dd841). App master runs payload 20261102.4.What changes in this PR
GamescopePayload.VERSION=20261103.4.jniLibs/arm64-v8a/libgamenative_drm.so=08d6276c268ed9ff169a0cc76f059bf7e30dec2288f13617bfa64c6f4ff407f6. In the APK, after stripping, it is70510ed2…7802.stamp_lead_ns), which the shim's vblank-grid gate needs.Nothing else in the app changes.
What changes for users
Today every default container (cap 60,
MESA_VK_WSI_PRESENT_MODE=mailbox) runs FIFO under gamescope's divisor limiter. A game below the cap therefore drops onto divisors of the refresh rate, which is worst on 90/120 Hz panels, and the container's present mode is ignored on this route. With this PR:source=guest): vsynced at the panel rate, as on mastersource=env)source=cap-rate gate=off). Same as today.source=cap-compat). That is why the daemon ships in this PR.Build (NDK 27.3, rustc 1.98.1 via rustup,
SOURCE_DATE_EPOCH= commit time, rustflags fromtools/build-android.sh)cargo test -p adrenotools_gamescope --libinrust:1-bookworm(aarch64): 88 passed.cargo clippy --target aarch64-linux-android -p adrenotools_gamescope -p gndrm-android -p gndrm-daemon --all-targets -- -D warningsis clean.vk_icd*entry points.2026110307122567925(sha2566355ee9e…9035).GNDRM_LOG_VKSHIM=1enables the periodic line.Payload 20261103.4
gamescope-gamenative-20261103.4.tzst, 14307540 B, sha2565126c4ee8f042a69e287a3bde16e3be5a79de0cc052aaeadff5554b6a09fe7b9.lib/libadrenotools_gamescope.so6355ee9ecdd1d8d8d6e6128d5e06c68536c085bebeaaaa28e70af517b2af90352026110307122567925bin/gamescope(unchanged)65d024fcee6af1b1f81b2281cc5223ee07615daa05aa8d9ecebe865526f8df69bin/Xwayland(unchanged)4dded8566661423ee3c91490523d96240c85906bd00e0774adc912df9dd38698Measured (Retroid Pocket 6, cap 60, from GameNative/gamenative-drm#46's verification)
late=0. Equal to master's FIFO.requested=immediate), ce1f919 (FIFO at the panel's rate + gate), 59.97 Hzdeclared=fifo source=cap-rate gate=vsync. SurfaceFlinger 60 s: 59.199 fps, 46 doubles (1.3 %). Master's FIFO: 59.22 fps, 46 doubles. Shim commits = daemon publishes,late=0.declared=fifo requested=fifo source=cap-rate cap=60 gate=vsync. SurfaceFlinger 60 s: 59.978 fps, 3598 single intervals, 0 doubles;slot_waits=0.requested=fifo), 1b708d5 + 46ccc70 daemon, shipped gamescope, 60 Hzdeclared=fifo requested=fifo source=guest route=gamescope cap=0 gate=off. SurfaceFlinger 60 s: 59.973 fps, 3598 single intervals, 0 doubles. Commits +600 per 10 s, equal to the daemon's 600/600 publishes,late=0.presentedtracks commits (9942/9943);slot_waits=0.MESA_VK_WSI_PRESENT_MODE=fifo, cap 60, VSync on, 1b708d5, 60 Hzdeclared=fifo requested=fifo source=env cap=60 gate=off. SurfaceFlinger 59.980 fps, 3598 single intervals, 0 doubles. Commits equal publishes, 600/600.declared=mailbox requested=fifo source=env cap=60 gate=vsync. SurfaceFlinger 32.624 fps (per-second median 33, p5 32). Intervals in 120 Hz periods: 2 = 1.1 %, 3 = 33.5 %, 4 = 61.7 %, 5 = 3.5 %, 6 = 0.2 % (C1: 3 = 25.1 %, 4 = 70.6 %; C2 FIFO: 2 = 8.6 %, 3 = 7.4 %, 4 = 75.3 %, 5 = 7.3 %). Shim commits 319-331 per 10 s, equal to the daemon's 319-332 publishes per ~1200 vsyncs.commit_lat_us~30-31.5 ms;slot_waits=0. See the N3 observation below.Gamescope payload 20261103.2 ready), with the stamp and shim sha (a77a7b77…) as expected;ICD loaded [shim 202611030337 1b708d5]. The file tree before and after differed only in the stamp and the shim. Censusdeclared=fifo requested=fifo source=cap-rate cap=60 gate=vsync. SurfaceFlinger 59.966 fps, 3596 single intervals, 1 double. Commits equal publishes.B1-C2 were capped and ran on earlier heads. N1-N4 ran on 1b708d5, the shim in payload 20261103.2 (N4 from the payload itself), with the 46ccc70 daemon. The 20261103.4 shim (2567925) drops the gate from the cap-rate cell; the B7, S1 and N4 rows above were measured with it on.
Observation for review (N3). On the below-rate mailbox path at 120 Hz, the daemon logged
late=77-175per ~1200 vsyncs:Open question for @joshuatam in GameNative/gamenative-drm#46: should the gate's release point on a 120 Hz grid carry a larger lead?
Not verified on the final build
declared=mailbox source=env gate=off). N1 covers the no-cap row for a game asking for FIFO.How JT can test
./gradlew :app:assembleModernDebug(app/build/outputs/apk/modern/debug/).Gamescope payload 20261103.4 ready;gn-vkshim: ICD loaded [shim 202611030712 2567925];gn-vkshim: present mode: declared=… requested=… source=… route=gamescope cap=… gate=… lsfg=…prints once when frames start, and again only when the declared mode, source, cap or gate changes (for example, a limiter change in the QuickMenu);acquires= commits= … gate_holds= gate_late= skipped= slot_waits= commit_lat_us= spacing=[…], every 10 s), setGNDRM_LOG_VKSHIM=1in the container's environment;MESA_VK_WSI_PRESENT_MODElogsInvalid MESA_VK_WSI_PRESENT_MODE value!once.declared=fifo … source=cap-rate … gate=off, about 60 fps,gndrm-daemon: vsync: check … late=0; still about 60 after a live 120 to 60 Hz switchdeclared=fifo … source=guest … gate=off, a vsynced 60declared=mailbox … source=env … gate=vsync; a game running below 60 is not quantized to 30 (frame intervals mix 2, 3 and 4 vsyncs instead of locking to 4)MESA_VK_WSI_PRESENT_MODE=fifowith a capdeclared=fifo … source=env … gate=off, the same as masterA
source=cap-compatline means the old daemon is loaded, i.e. the APK is not from this branch.Recording
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by CodeRabbit