Skip to content

Commit

Permalink
changed: use GLX_MESA_copy_sub_buffer if available for dirty regions …
Browse files Browse the repository at this point in the history
…rendering

This probably breaks vsync so we need to decide on how to handle that.
  • Loading branch information
elupus committed Jul 20, 2011
1 parent a964850 commit f680f5f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions xbmc/windowing/X11/WinSystemX11GL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "WinSystemX11GL.h"
#include "utils/log.h"
#include "utils/MathUtils.h"

CWinSystemX11GL::CWinSystemX11GL()
{
Expand All @@ -33,6 +34,7 @@ CWinSystemX11GL::CWinSystemX11GL()
m_glXSwapIntervalMESA = NULL;
m_glXGetSyncValuesOML = NULL;
m_glXSwapBuffersMscOML = NULL;
m_glXCopySubBufferMESA = NULL;

m_iVSyncErrors = 0;
}
Expand All @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/windowing/X11/WinSystemX11GL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit f680f5f

Please sign in to comment.