Skip to content

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

Merged
joshuatam merged 2 commits into
joshuatam:fix/gamescope-resolution-scanoutfrom
utkarshdalal:gamescope-active-panel-refresh
Oct 30, 2026
Merged

joshuatam merged 2 commits 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 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 shim the latch period was 8.33 ms. Measured on the Odin 3 (panel at 60 Hz, maximum 120): the shim logged panel grid period=8333us before this change and period=16666us after.

The change

  • One helper, detectRefreshRateHz: the display's current mode (Display.refreshRate), falling back to the default only when it cannot be read. It replaces detectMaxRefreshRateHz everywhere, so the FPS limiter's ceiling now follows the active rate too (times the same multiplier) instead of the panel's maximum.
  • The gamescope branch of session setup reports it ahead of nativeStart, and registers a DisplayManager.DisplayListener that reports it again on onDisplayChanged, so a mode switch mid-session reaches the daemon. The listener is unregistered at session exit, just before nativeStop.

Verification

  • :app:compileModernDebugKotlin passes on this base.
  • Odin 3 debug build: the daemon's grid period went from 8333 µs to 16666 µs with the panel at 60 Hz.

Stacked on utkarshdalal#2283 (base fix/gamescope-resolution-scanout); two commits.

@joshuatam
joshuatam merged commit ac59978 into joshuatam:fix/gamescope-resolution-scanout Oct 30, 2026
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