Skip to content

Commit 0799560

Browse files
steamcompmgr: throttle overlay frame callbacks to output refresh under VRR
Under VRR, the main loop forces vblank=true every iteration so games can get commit wake-ups at their uncapped rate. Overlays fall through the FPS-limit throttle, so mangoapp receives a frame callback every main loop iteration and renders flat-out, spiking power usage. Throttle overlays on the latch path only, leaving the commit-done path alone so overlay commits are still marked done immediately and the next game-commit scanout picks up the freshest frame.
1 parent fe7f21c commit 0799560

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/steamcompmgr.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,6 +5789,24 @@ static bool steamcompmgr_should_vblank_window( bool bShouldLimitFPS, uint64_t vb
57895789

57905790
static bool steamcompmgr_should_vblank_window( steamcompmgr_win_t *w, uint64_t vblank_idx, uint64_t now )
57915791
{
5792+
// Overlays skip the FPS-limit throttle, so cap them to the output refresh under VRR.
5793+
if ( w && w->IsAnyOverlay() &&
5794+
GetBackend()->GetCurrentConnector() && GetBackend()->GetCurrentConnector()->IsVRRActive() )
5795+
{
5796+
uint64_t schedule = w->last_commit_first_latch_time + g_SteamCompMgrAppRefreshCycle;
5797+
5798+
static constexpr uint64_t k_ulVRRScheduleFudge = 200'000; // 0.2ms
5799+
if ( now + k_ulVRRScheduleFudge < schedule )
5800+
{
5801+
if ( !s_oLowestFPSLimitScheduleVRR )
5802+
s_oLowestFPSLimitScheduleVRR = schedule;
5803+
else
5804+
s_oLowestFPSLimitScheduleVRR = std::min( *s_oLowestFPSLimitScheduleVRR, schedule );
5805+
5806+
return false;
5807+
}
5808+
}
5809+
57925810
return steamcompmgr_should_vblank_window( steamcompmgr_window_should_limit_fps( w ), vblank_idx, w, now );
57935811
}
57945812

0 commit comments

Comments
 (0)