Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

videorefclock: add advanced setting to control polling mode

  • Loading branch information...
commit cf989ab9ef98245ae32a0673df5a23b8617e19fd 1 parent ab4b60c
@FernetMenta authored
View
3  xbmc/settings/AdvancedSettings.cpp
@@ -106,6 +106,7 @@ void CAdvancedSettings::Initialize()
m_DXVANoDeintProcForProgressive = false;
m_videoFpsDetect = 1;
m_videoDefaultLatency = 0.0;
+ m_vblankPolling = false;
m_musicUseTimeSeeking = true;
m_musicTimeSeekForward = 10;
@@ -567,6 +568,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
//0 = disable fps detect, 1 = only detect on timestamps with uniform spacing, 2 detect on all timestamps
XMLUtils::GetInt(pElement, "fpsdetect", m_videoFpsDetect, 0, 2);
+ XMLUtils::GetBoolean(pElement,"vblankpolling", m_vblankPolling);
+
// Store global display latency settings
TiXmlElement* pVideoLatency = pElement->FirstChildElement("latency");
if (pVideoLatency)
View
1  xbmc/settings/AdvancedSettings.h
@@ -147,6 +147,7 @@ class CAdvancedSettings
bool m_DXVAForceProcessorRenderer;
bool m_DXVANoDeintProcForProgressive;
int m_videoFpsDetect;
+ bool m_vblankPolling;
CStdString m_videoDefaultPlayer;
CStdString m_videoDefaultDVDPlayer;
View
13 xbmc/video/VideoReferenceClock.cpp
@@ -31,6 +31,7 @@
#include <sstream>
#include <X11/extensions/Xrandr.h>
#include "windowing/WindowingFactory.h"
+ #include "settings/AdvancedSettings.h"
#define NVSETTINGSCMD "nvidia-settings -nt -q RefreshRate3"
#elif defined(__APPLE__) && !defined(__arm__)
#include <QuartzCore/CVDisplayLink.h>
@@ -161,8 +162,6 @@ void CVideoReferenceClock::Process()
m_RefreshChanged = 0;
m_Started.Set();
- SetPriority(1);
-
if (SetupSuccess)
{
m_UseVblank = true; //tell other threads we're using vblank as clock
@@ -283,10 +282,10 @@ bool CVideoReferenceClock::SetupGLX()
m_bIsATI = true;
m_bPolling = true;
}
- else if (Vendor.compare(0, 6, "nvidia") == 0)
+ if (g_advancedSettings.m_vblankPolling)
{
- CLog::Log(LOGDEBUG, "CVideoReferenceClock: GL_VENDOR: %s, use polling", Vendor.c_str());
m_bPolling = true;
+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: use polling");
}
m_vInfo = glXChooseVisual(m_Dpy, DefaultScreen(m_Dpy), singleBufferAttributes);
@@ -380,6 +379,9 @@ bool CVideoReferenceClock::SetupGLX()
UpdateRefreshrate(true); //forced refreshrate update
m_MissedVblanks = 0;
+ if (m_bPolling)
+ SetPriority(1);
+
return true;
}
@@ -1286,6 +1288,9 @@ int64_t CVideoReferenceClock::Wait(int64_t Target)
if (m_UseVblank) //when true the vblank is used as clock source
{
+ if (Target < m_CurrTime)
+ Target = m_CurrTime + 0.5/m_RefreshRate;
+
while (m_CurrTime < Target)
{
//calculate how long to sleep before we should have gotten a signal that a vblank happened
Please sign in to comment.
Something went wrong with that request. Please try again.