Skip to content

Report the panel's active refresh rate to the gndrm daemon - #22

Closed
utkarshdalal wants to merge 1 commit into
joshuatam:fix/gamescope-resolution-scanoutfrom
utkarshdalal:gamescope-active-panel-refresh
Closed

utkarshdalal wants to merge 1 commit into
joshuatam:fix/gamescope-resolution-scanoutfrom
utkarshdalal:gamescope-active-panel-refresh

Conversation

@utkarshdalal

Copy link
Copy Markdown
Collaborator

What this fixes

Under gamescope the daemon measures the panel's latch grid (vsync.rs) against the refresh rate the app reports through GameNativeDrm.nativeSetPanelRefreshHz. The app reported detectMaxRefreshRateHz, the fastest mode the panel supports, so on a panel a user holds at 60 Hz the daemon tracked a 120 Hz lattice and told the shims the latch period was 8.33 ms. The gamescope frame-rate limit is about to place its releases on that grid (GameNative/gamescope#21 A52, GameNative/gamenative-drm#33): with the wrong period it snaps to points that are not latch points, and commits land on the edge of the real window. Measured on the Odin 3 (panel at 60 Hz, maximum 120): the ICD logged panel grid period=8333us, and the capped session lost more frames at the latch than before.

The change

  • detectActiveRefreshRateHz: the display's current mode (Display.refreshRate), falling back to the maximum only when it cannot be read.
  • The gamescope branch of session setup reports the active rate ahead of nativeStart, and registers a DisplayManager.DisplayListener that reports it again on onDisplayChanged, so a mode switch mid-session (a user toggling 60/120, a game-mode profile) reaches the daemon. The listener is unregistered at session exit, just before nativeStop.
  • detectMaxRefreshRateHz stays for the limiter's ceiling and the emulated mode's rate elsewhere.

Verification

  • :app:compileModernDebugKotlin passes.
  • Device verification of the capped gamescope session with the three PRs together is pending an installed build.

Stacked on utkarshdalal#2283 (base branch fix/gamescope-resolution-scanout).

@utkarshdalal

Copy link
Copy Markdown
Collaborator Author

Moved to a standalone PR on utkarshdalal/GameNative master, since it does not depend on the scan-out-size work.

joshuatam pushed a commit that referenced this pull request Oct 31, 2026
…im gate census (utkarshdalal#2297)

* Gamescope payload 20261031.1 (test): FPS limiter on the vblank time grid

Payload 20261030.3 with bin/gamescope replaced by the CI build of
GameNative/gamescope PR #22 (A52, merge commit 8636e40 of b46a355);
everything else byte-identical.

Gamescope's non-VRR FPS limiter counted compositor wakeups on the 1200 Hz
session grid, and a wakeup more than one tick late skipped ticks that were
never counted, so a 60 cap read 54 on the Retroid Pocket 6 with the CPU and
GPU idle. The limiter now releases frames on a time grid (previous release
plus the target period): 60.0 fps at a 60 cap on the same device.

sha256 2b8998691633dc2de3256f9bc24fb937633e564105e19f32d5d62ec5e4fed148

* Gamescope payload 20261031.2: FPS limiter on the vblank time grid, shim gate census

Payload 20261030.3 with bin/gamescope from GameNative/gamescope ad78177
(A52, merged #22; byte-identical to the #22 CI build, same tree) and
lib/libadrenotools_gamescope.so from GameNative/gamenative-drm 52ed43f
(merged #35: VK_KHR_xcb_surface served, acquire-gate census); everything
else byte-identical.

sha256 fd3deaaee7560ef3ce53303a13eb77be31c4473cd26ea17771bd925d07d3347d

---------

Co-authored-by: Utkarsh Dalal <utkarsh.dalal@toptal.com>
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