Add a Steam Frame build option; no chaperone commit at start; timer-based tick
- CMake option OVRAS_STEAM_FRAME. It is evaluated only in src/utils/platform_capabilities.h, which turns it into named capability constants and platform defaults. - Where the chaperone can't be committed (Steam Frame: it shifts the play area), MoveCenterTabController no longer commits the working copy at start-up or when applying reset data, and doesn't create the init autosave profile. Skips are logged once. - In "vsync disabled" mode the pump timer now runs directly at the custom tick rate instead of firing every 1 ms and counting. The Frame defaults to this mode at 11 ms (~90 Hz). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
266a2f9ce9
commit
423ea57db7
+22
-14
@@ -480,9 +480,7 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
|
||||
this,
|
||||
SLOT( OnTimeoutPumpEvents() ) );
|
||||
|
||||
// Every 1ms we check if the current frame has advanced (for vsync)
|
||||
m_pumpEventsTimer.setInterval( 1 );
|
||||
|
||||
applyTickInterval();
|
||||
m_pumpEventsTimer.start();
|
||||
|
||||
m_steamVRTabController.initStage2( this );
|
||||
@@ -966,6 +964,8 @@ void OverlayController::setVsyncDisabled( bool value, bool notify )
|
||||
{
|
||||
settings::setSetting( settings::BoolSetting::APPLICATION_vsyncDisabled,
|
||||
value );
|
||||
// The timer interval depends on the mode, see applyTickInterval().
|
||||
applyTickInterval();
|
||||
if ( notify )
|
||||
{
|
||||
emit vsyncDisabledChanged( value );
|
||||
@@ -1076,6 +1076,8 @@ void OverlayController::setCustomTickRateMs( int value, bool notify )
|
||||
settings::setSetting( settings::IntSetting::APPLICATION_customTickRateMs,
|
||||
verifiedTickRate );
|
||||
m_verifiedCustomTickRateMs = verifiedTickRate;
|
||||
// In "vsync disabled" mode the timer runs at this interval.
|
||||
applyTickInterval();
|
||||
|
||||
if ( notify )
|
||||
{
|
||||
@@ -1083,6 +1085,19 @@ void OverlayController::setCustomTickRateMs( int value, bool notify )
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the interval of m_pumpEventsTimer for the current tick mode:
|
||||
// - vsync: every 1 ms, OnTimeoutPumpEvents() checks whether the compositor
|
||||
// started a new frame.
|
||||
// - vsync disabled: the timer fires directly at the custom tick rate, so the
|
||||
// process wakes up once per tick instead of every 1 ms.
|
||||
// QTimer::setInterval() also restarts a running timer with the new interval.
|
||||
void OverlayController::applyTickInterval()
|
||||
{
|
||||
m_pumpEventsTimer.setTimerType( Qt::PreciseTimer );
|
||||
m_pumpEventsTimer.setInterval( vsyncDisabled() ? customTickRateMs() : 1 );
|
||||
}
|
||||
|
||||
// Called by m_pumpEventsTimer, see applyTickInterval().
|
||||
// vsync implementation:
|
||||
// this function triggers every 1ms
|
||||
// this function should remain lightweight and only check if it's time to
|
||||
@@ -1091,17 +1106,10 @@ void OverlayController::OnTimeoutPumpEvents()
|
||||
{
|
||||
if ( vsyncDisabled() )
|
||||
{
|
||||
// check if it's time for a custom tick rate tick
|
||||
if ( m_customTickRateCounter > customTickRateMs() )
|
||||
{
|
||||
mainEventLoop();
|
||||
m_customTickRateCounter = 0;
|
||||
updateRate.incrementCounter();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_customTickRateCounter++;
|
||||
}
|
||||
// The timer already runs at the custom tick rate: every call is a
|
||||
// tick.
|
||||
mainEventLoop();
|
||||
updateRate.incrementCounter();
|
||||
}
|
||||
|
||||
// vsync is enabled
|
||||
|
||||
Reference in New Issue
Block a user