diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2017-01-11 20:50:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-11 20:50:37 +0100 |
commit | 413464bd0c77ecf68dec05c941363be1ab02f37f (patch) | |
tree | 54458aadc236469242e066093513e08646b0ae95 | |
parent | 77d3a003027cfcff8f34414b57a86a9083107d08 (diff) | |
parent | 6b0d017261fac0c6632a97e2ea97c6fc4b42445c (diff) |
Merge pull request #11389 from Memphiz/vtb_choppy_bp
[osx] - fix refclock after refreshrate change and re-add videoscreen.delayrefreshchange
-rw-r--r-- | xbmc/windowing/osx/WinSystemOSX.h | 3 | ||||
-rw-r--r-- | xbmc/windowing/osx/WinSystemOSX.mm | 30 | ||||
-rw-r--r-- | xbmc/windowing/osx/WinSystemOSXGL.mm | 6 |
3 files changed, 37 insertions, 2 deletions
diff --git a/xbmc/windowing/osx/WinSystemOSX.h b/xbmc/windowing/osx/WinSystemOSX.h index 1360fc833b..c46e27b41e 100644 --- a/xbmc/windowing/osx/WinSystemOSX.h +++ b/xbmc/windowing/osx/WinSystemOSX.h @@ -79,6 +79,7 @@ public: void AnnounceOnLostDevice(); void AnnounceOnResetDevice(); + void HandleOnResetDevice(); void StartLostDeviceTimer(); void StopLostDeviceTimer(); @@ -119,6 +120,8 @@ protected: CCriticalSection m_resourceSection; std::vector<IDispResource*> m_resources; CTimer m_lostDeviceTimer; + bool m_delayDispReset; + XbmcThreads::EndTime m_dispResetTimer; }; #endif diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm index d647e7967f..83e69e4020 100644 --- a/xbmc/windowing/osx/WinSystemOSX.mm +++ b/xbmc/windowing/osx/WinSystemOSX.mm @@ -516,7 +516,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, if (flags & kCGDisplaySetModeFlag || flags == 0) { winsys->StopLostDeviceTimer(); // no need to timeout - we've got the callback - winsys->AnnounceOnResetDevice(); + winsys->HandleOnResetDevice(); } } @@ -540,6 +540,7 @@ CWinSystemOSX::CWinSystemOSX() : CWinSystemBase(), m_lostDeviceTimer(this) m_lastDisplayNr = -1; m_movedToOtherScreen = false; m_refreshRate = 0.0; + m_delayDispReset = false; } CWinSystemOSX::~CWinSystemOSX() @@ -561,7 +562,7 @@ void CWinSystemOSX::StopLostDeviceTimer() void CWinSystemOSX::OnTimeout() { - AnnounceOnResetDevice(); + HandleOnResetDevice(); } bool CWinSystemOSX::InitWindowSystem() @@ -1741,8 +1742,33 @@ void CWinSystemOSX::AnnounceOnLostDevice() (*i)->OnLostDisplay(); } +void CWinSystemOSX::HandleOnResetDevice() +{ + + int delay = CSettings::GetInstance().GetInt("videoscreen.delayrefreshchange"); + if (delay > 0) + { + m_delayDispReset = true; + m_dispResetTimer.Set(delay * 100); + } + else + { + AnnounceOnResetDevice(); + } +} + void CWinSystemOSX::AnnounceOnResetDevice() { + double currentFps = m_refreshRate; + int w = 0; + int h = 0; + int currentScreenIdx = GetCurrentScreen(); + // ensure that graphics context knows about the current refreshrate before + // doing the callbacks + GetScreenResolution(&w, &h, ¤tFps, currentScreenIdx); + + g_graphicsContext.SetFPS(currentFps); + CSingleLock lock(m_resourceSection); // tell any shared resources CLog::Log(LOGDEBUG, "CWinSystemOSX::AnnounceOnResetDevice"); diff --git a/xbmc/windowing/osx/WinSystemOSXGL.mm b/xbmc/windowing/osx/WinSystemOSXGL.mm index 3e61409e9d..c7bfca3dfa 100644 --- a/xbmc/windowing/osx/WinSystemOSXGL.mm +++ b/xbmc/windowing/osx/WinSystemOSXGL.mm @@ -41,6 +41,12 @@ void CWinSystemOSXGL::PresentRenderImpl(bool rendered) { if (rendered) FlushBuffer(); + + if (m_delayDispReset && m_dispResetTimer.IsTimePast()) + { + m_delayDispReset = false; + AnnounceOnResetDevice(); + } } void CWinSystemOSXGL::SetVSyncImpl(bool enable) |