aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Frühberger <Peter.Fruehberger@gmail.com>2015-05-18 19:58:49 +0200
committerPeter Frühberger <Peter.Fruehberger@gmail.com>2015-05-18 19:58:49 +0200
commitc8640e9717ea9ea3604ae560e568efed102f2103 (patch)
tree33087342a782fcc823afa111970c1173466efbe3
parentbb5f0ca0ff2cbf1f3a24aed6e79900484fe2d947 (diff)
parentd0531679ed0a472d5218c99a3d0b2a5ac4107814 (diff)
Merge pull request #7149 from FernetMenta/refclock
videorefclock: fix wrong speed when in windowed mode
-rw-r--r--xbmc/guilib/GraphicContext.cpp12
-rw-r--r--xbmc/guilib/GraphicContext.h6
-rw-r--r--xbmc/video/videosync/VideoSyncDRM.cpp6
-rw-r--r--xbmc/video/videosync/VideoSyncDRM.h1
-rw-r--r--xbmc/windowing/X11/WinSystemX11.cpp4
-rw-r--r--xbmc/windowing/X11/XRandR.cpp10
-rw-r--r--xbmc/windowing/X11/XRandR.h2
7 files changed, 38 insertions, 3 deletions
diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp
index 58406f7c9d..78da1230a6 100644
--- a/xbmc/guilib/GraphicContext.cpp
+++ b/xbmc/guilib/GraphicContext.cpp
@@ -52,6 +52,7 @@ CGraphicContext::CGraphicContext(void) :
m_bFullScreenVideo(false),
m_bCalibrating(false),
m_Resolution(RES_INVALID),
+ m_fFPSOverride(0.0),
/*m_windowResolution,*/
/*,m_cameras, */
/*m_origins, */
@@ -466,6 +467,7 @@ void CGraphicContext::SetVideoResolutionInternal(RESOLUTION res, bool forceUpdat
m_iScreenId = info_mod.iScreen;
m_scissors.SetRect(0, 0, (float)m_iScreenWidth, (float)m_iScreenHeight);
m_Resolution = res;
+ m_fFPSOverride = 0 ;
if (g_advancedSettings.m_fullScreen)
{
@@ -739,6 +741,12 @@ const RESOLUTION_INFO CGraphicContext::GetResInfo(RESOLUTION res) const
info.Overscan.left /= 2;
info.Overscan.right = (info.Overscan.right - info.iBlanking) / 2;
}
+
+ if (res == m_Resolution && m_fFPSOverride != 0)
+ {
+ info.fRefreshRate = m_fFPSOverride;
+ }
+
return info;
}
@@ -1064,3 +1072,7 @@ void CGraphicContext::GetAllowedResolutions(vector<RESOLUTION> &res)
}
}
+void CGraphicContext::SetFPS(float fps)
+{
+ m_fFPSOverride = fps;
+}
diff --git a/xbmc/guilib/GraphicContext.h b/xbmc/guilib/GraphicContext.h
index 5c1501af77..a8fd03ede5 100644
--- a/xbmc/guilib/GraphicContext.h
+++ b/xbmc/guilib/GraphicContext.h
@@ -238,6 +238,11 @@ public:
CRect generateAABB(const CRect &rect) const;
+ /*! \brief sets refresh rate, overrides the one stored with modes
+ * \param fps refresh rate
+ */
+ void SetFPS(float fps);
+
protected:
std::stack<CRect> m_viewStack;
@@ -250,6 +255,7 @@ protected:
bool m_bFullScreenVideo;
bool m_bCalibrating;
RESOLUTION m_Resolution;
+ float m_fFPSOverride;
private:
class UITransform
diff --git a/xbmc/video/videosync/VideoSyncDRM.cpp b/xbmc/video/videosync/VideoSyncDRM.cpp
index b30fb433d0..a661f443df 100644
--- a/xbmc/video/videosync/VideoSyncDRM.cpp
+++ b/xbmc/video/videosync/VideoSyncDRM.cpp
@@ -176,4 +176,10 @@ float CVideoSyncDRM::GetFps()
return m_fps;
}
+void CVideoSyncDRM::RefreshChanged()
+{
+ if (m_fps != g_graphicsContext.GetFPS())
+ m_abort = true;
+}
+
#endif
diff --git a/xbmc/video/videosync/VideoSyncDRM.h b/xbmc/video/videosync/VideoSyncDRM.h
index 35f3e2110e..b214b37410 100644
--- a/xbmc/video/videosync/VideoSyncDRM.h
+++ b/xbmc/video/videosync/VideoSyncDRM.h
@@ -32,6 +32,7 @@ public:
virtual void Cleanup();
virtual float GetFps();
virtual void OnResetDevice();
+ virtual void RefreshChanged();
private:
static void EventHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data);
int m_fd;
diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp
index 05f36eec55..c3a8ec7486 100644
--- a/xbmc/windowing/X11/WinSystemX11.cpp
+++ b/xbmc/windowing/X11/WinSystemX11.cpp
@@ -1468,12 +1468,14 @@ void CWinSystemX11::UpdateCrtc()
{
XWindowAttributes winattr;
int posx, posy;
+ float fps;
Window child;
XGetWindowAttributes(m_dpy, m_mainWindow, &winattr);
XTranslateCoordinates(m_dpy, m_mainWindow, RootWindow(m_dpy, m_nScreen), winattr.x, winattr.y,
&posx, &posy, &child);
- m_crtc = g_xrandr.GetCrtc(posx+winattr.width/2, posy+winattr.height/2);
+ m_crtc = g_xrandr.GetCrtc(posx+winattr.width/2, posy+winattr.height/2, fps);
+ g_graphicsContext.SetFPS(fps);
}
#endif
diff --git a/xbmc/windowing/X11/XRandR.cpp b/xbmc/windowing/X11/XRandR.cpp
index 458b852335..165fad1e8c 100644
--- a/xbmc/windowing/X11/XRandR.cpp
+++ b/xbmc/windowing/X11/XRandR.cpp
@@ -480,7 +480,7 @@ XOutput* CXRandR::GetOutput(const std::string& outputName)
return result;
}
-int CXRandR::GetCrtc(int x, int y)
+int CXRandR::GetCrtc(int x, int y, float &hz)
{
int crtc = 0;
for (unsigned int i = 0; i < m_outputs.size(); ++i)
@@ -492,6 +492,14 @@ int CXRandR::GetCrtc(int x, int y)
(m_outputs[i].y <= y && (m_outputs[i].y+m_outputs[i].h) > y))
{
crtc = m_outputs[i].crtc;
+ for (auto mode: m_outputs[i].modes)
+ {
+ if (mode.isCurrent)
+ {
+ hz = mode.hz;
+ break;
+ }
+ }
break;
}
}
diff --git a/xbmc/windowing/X11/XRandR.h b/xbmc/windowing/X11/XRandR.h
index 94deb29510..88f2a81418 100644
--- a/xbmc/windowing/X11/XRandR.h
+++ b/xbmc/windowing/X11/XRandR.h
@@ -108,7 +108,7 @@ public:
bool IsOutputConnected(const std::string& name);
bool TurnOffOutput(const std::string& name);
bool TurnOnOutput(const std::string& name);
- int GetCrtc(int x, int y);
+ int GetCrtc(int x, int y, float &hz);
//bool Has1080i();
//bool Has1080p();
//bool Has720p();