xbmc: add patch to fix glxSwapBuffers limit

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-08-13 22:48:13 +02:00
parent 49dccd607e
commit 0a0dd8cba8

View File

@ -0,0 +1,53 @@
From f46d7a99bc2f3bc70f274422ec8d16257e2a97aa Mon Sep 17 00:00:00 2001
From: FernetMenta <fernetmenta@online.de>
Date: Sat, 13 Aug 2011 16:07:08 +0200
Subject: [PATCH] ati: limit glxSwapBuffers going to far ahead
---
xbmc/WinSystemX11GL.cpp | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/xbmc/WinSystemX11GL.cpp b/xbmc/WinSystemX11GL.cpp
index 94f369e..870999e 100644
--- a/xbmc/WinSystemX11GL.cpp
+++ b/xbmc/WinSystemX11GL.cpp
@@ -43,7 +43,27 @@ CWinSystemX11GL::~CWinSystemX11GL()
bool CWinSystemX11GL::PresentRenderImpl(const CDirtyRegionList& dirty)
{
- if(m_iVSyncMode == 3)
+ if(m_iVSyncMode == 2)
+ {
+ static unsigned int last = 0;
+ unsigned int now;
+ if(m_glXGetVideoSyncSGI(&now) != 0)
+ CLog::Log(LOGERROR, "%s - glXGetVideoSyncSGI - Failed to get current retrace count", __FUNCTION__);
+
+ if (now == last)
+ {
+ if (m_glXWaitVideoSyncSGI(2, (last + 1) % 2, &now) != 0)
+ CLog::Log(LOGERROR, "%s - glXWaitVideoSyncSGI - Returned error", __FUNCTION__);
+ if(m_glXGetVideoSyncSGI(&now) != 0)
+ CLog::Log(LOGERROR, "%s - glXGetVideoSyncSGI - Failed to get current retrace count", __FUNCTION__);
+ last = now + 1;
+ }
+ else
+ last = now;
+
+ glXSwapBuffers(m_dpy, m_glWindow);
+ }
+ else if(m_iVSyncMode == 3)
{
glFinish();
unsigned int before = 0, after = 0;
@@ -236,7 +256,6 @@ bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, R
else
m_glXSwapIntervalMESA = NULL;
-
return true;
}
--
1.7.5.4