Permalink
Browse files

Merge pull request #11388 from Memphiz/vtb_choppy

[osx] - fix refclock after refreshrate change and re-add videoscreen.delayrefreshchange
  • Loading branch information...
2 parents 3851320 + 487d712 commit 83a4bad85d825cf864c6ce17dd7fbe00f06de3d3 @MartijnKaijser MartijnKaijser committed on GitHub Jan 11, 2017
Showing with 37 additions and 2 deletions.
  1. +3 −0 xbmc/windowing/osx/WinSystemOSX.h
  2. +28 −2 xbmc/windowing/osx/WinSystemOSX.mm
  3. +6 −0 xbmc/windowing/osx/WinSystemOSXGL.mm
@@ -79,6 +79,7 @@ class CWinSystemOSX : public CWinSystemBase, public ITimerCallback
void AnnounceOnLostDevice();
void AnnounceOnResetDevice();
+ void HandleOnResetDevice();
void StartLostDeviceTimer();
void StopLostDeviceTimer();
@@ -119,6 +120,8 @@ class CWinSystemOSX : public CWinSystemBase, public ITimerCallback
CCriticalSection m_resourceSection;
std::vector<IDispResource*> m_resources;
CTimer m_lostDeviceTimer;
+ bool m_delayDispReset;
+ XbmcThreads::EndTime m_dispResetTimer;
};
#endif
@@ -517,7 +517,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();
}
}
@@ -541,6 +541,7 @@ static void DisplayReconfigured(CGDirectDisplayID display,
m_lastDisplayNr = -1;
m_movedToOtherScreen = false;
m_refreshRate = 0.0;
+ m_delayDispReset = false;
}
CWinSystemOSX::~CWinSystemOSX()
@@ -562,7 +563,7 @@ static void DisplayReconfigured(CGDirectDisplayID display,
void CWinSystemOSX::OnTimeout()
{
- AnnounceOnResetDevice();
+ HandleOnResetDevice();
}
bool CWinSystemOSX::InitWindowSystem()
@@ -1742,8 +1743,33 @@ static void DisplayReconfigured(CGDirectDisplayID display,
(*i)->OnLostDisplay();
}
+void CWinSystemOSX::HandleOnResetDevice()
+{
+
+ int delay = CServiceBroker::GetSettings().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, &currentFps, currentScreenIdx);
+
+ g_graphicsContext.SetFPS(currentFps);
+
CSingleLock lock(m_resourceSection);
// tell any shared resources
CLog::Log(LOGDEBUG, "CWinSystemOSX::AnnounceOnResetDevice");
@@ -41,6 +41,12 @@
{
if (rendered)
FlushBuffer();
+
+ if (m_delayDispReset && m_dispResetTimer.IsTimePast())
+ {
+ m_delayDispReset = false;
+ AnnounceOnResetDevice();
+ }
}
void CWinSystemOSXGL::SetVSyncImpl(bool enable)

0 comments on commit 83a4bad

Please sign in to comment.