Permalink
Browse files

changed: use GLX_MESA_copy_sub_buffer if available for dirty regions …

…rendering

This probably breaks vsync so we need to decide on how to handle that.
  • Loading branch information...
1 parent a964850 commit f680f5f4c3ae1921adf284b7ba5dd4bde5ab6e2b @elupus committed Jul 20, 2011
Showing with 21 additions and 1 deletion.
  1. +20 −0 xbmc/windowing/X11/WinSystemX11GL.cpp
  2. +1 −1 xbmc/windowing/X11/WinSystemX11GL.h
@@ -24,6 +24,7 @@
#include "WinSystemX11GL.h"
#include "utils/log.h"
+#include "utils/MathUtils.h"
CWinSystemX11GL::CWinSystemX11GL()
{
@@ -33,6 +34,7 @@ CWinSystemX11GL::CWinSystemX11GL()
m_glXSwapIntervalMESA = NULL;
m_glXGetSyncValuesOML = NULL;
m_glXSwapBuffersMscOML = NULL;
+ m_glXCopySubBufferMESA = NULL;
m_iVSyncErrors = 0;
}
@@ -43,6 +45,20 @@ CWinSystemX11GL::~CWinSystemX11GL()
bool CWinSystemX11GL::PresentRenderImpl(const CDirtyRegionList& dirty)
{
+ if(m_glXCopySubBufferMESA && dirty.size() > 0)
+ {
+ for (unsigned int i = 0; i < dirty.size(); i++)
+ {
+ GLint x1 = MathUtils::round_int(dirty[i].x1);
+ GLint y1 = MathUtils::round_int(dirty[i].y1);
+ GLint x2 = MathUtils::round_int(dirty[i].x2);
+ GLint y2 = MathUtils::round_int(dirty[i].y2);
+
+ m_glXCopySubBufferMESA(m_dpy, m_glWindow, x1, m_height - y2, x2-x1, y2-y1);
+ }
+ return;
+ }
+
if(m_iVSyncMode == 3)
{
glFinish();
@@ -236,6 +252,10 @@ bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, R
else
m_glXSwapIntervalMESA = NULL;
+ if (IsExtSupported("GLX_MESA_copy_sub_buffer"))
+ m_glXCopySubBufferMESA = (void(*)(Display *, GLXDrawable, int, int, int, int))glXGetProcAddress((const GLubyte*)"glXCopySubBufferMESA");
+ else
+ m_glXCopySubBufferMESA = NULL;
return true;
}
@@ -51,7 +51,7 @@ class CWinSystemX11GL : public CWinSystemX11, public CRenderSystemGL
Bool (*m_glXGetSyncValuesOML)(Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);
int64_t (*m_glXSwapBuffersMscOML)(Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor,int64_t remainder);
-
+ void (*m_glXCopySubBufferMESA )(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height );
int m_iVSyncErrors;
};

0 comments on commit f680f5f

Please sign in to comment.