mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Render the Steam home tab at 60 FPS (#3647)
Raise the shared Steam home idle animation cadence from 30 to 60 FPS without changing mixed-refresh displays or in-game frame limits.
This commit is contained in:
1 parent
18d735b4c4
commit
f75cb387eb
2 files changed
+40
-14
No files matched your search
@@ -82,17 +82,25 @@ import kotlinx.coroutines.withContext
|
||||
private const val WALL_MIN_GAMES = 4
|
||||
private const val WALL_DISTINCT = 40
|
||||
|
||||
private const val IDLE_FRAME_NS = 30_000_000L
|
||||
internal val IdleFrames = IdleFrameGate()
|
||||
|
||||
internal object IdleFrames {
|
||||
private var shown = 0L
|
||||
internal class IdleFrameGate {
|
||||
private var next = Long.MIN_VALUE
|
||||
private var shown = Long.MIN_VALUE
|
||||
|
||||
fun due(nanos: Long): Boolean {
|
||||
if (nanos == shown) return true
|
||||
if (nanos - shown < IDLE_FRAME_NS) return false
|
||||
// Allow sub-ms vsync jitter; carry the phase on panels whose refresh isn't a multiple of 60.
|
||||
if (nanos + VSYNC_TOLERANCE_NS < next) return false
|
||||
next = if (next == Long.MIN_VALUE || nanos - next >= FRAME_NS) nanos + FRAME_NS else next + FRAME_NS
|
||||
shown = nanos
|
||||
return true
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FRAME_NS = 1_000_000_000L / 60
|
||||
const val VSYNC_TOLERANCE_NS = 500_000L
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in new issue
Block a user