merge buffer_age render into general render code

avoiding the blocking swapinterval detection causes
issues in the timing strategy and prevents protection
against CPU overload on the nvidia blob

BUG: 329821
FIXED-IN: 4.11.6
REVIEW: 115306
This commit is contained in:
Thomas Lübking 2014-01-24 22:29:30 +01:00
parent 882d55f1b5
commit 79c3fa55f2
2 changed files with 16 additions and 20 deletions

View file

@ -279,15 +279,8 @@ void EglOnXBackend::present()
if (lastDamage().isEmpty())
return;
if (supportsBufferAge()) {
eglSwapBuffers(dpy, surface);
eglQuerySurface(dpy, surface, EGL_BUFFER_AGE_EXT, &m_bufferAge);
setLastDamage(QRegion());
return;
}
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
const bool fullRepaint = (lastDamage() == displayRegion);
const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion);
if (fullRepaint || !surfaceHasSubPost) {
if (gs_tripleBufferNeedsDetection) {
@ -315,6 +308,9 @@ void EglOnXBackend::present()
setBlocksForRetrace(result == 'd');
}
}
if (supportsBufferAge()) {
eglQuerySurface(dpy, surface, EGL_BUFFER_AGE_EXT, &m_bufferAge);
}
} else {
// a part of the screen changed, and we can use eglPostSubBufferNV to copy the updated area
foreach (const QRect & r, lastDamage().rects()) {
@ -323,8 +319,10 @@ void EglOnXBackend::present()
}
setLastDamage(QRegion());
eglWaitGL();
xcb_flush(connection());
if (!supportsBufferAge()) {
eglWaitGL();
xcb_flush(connection());
}
}
void EglOnXBackend::screenGeometryChanged(const QSize &size)

View file

@ -438,15 +438,8 @@ void GlxBackend::present()
if (lastDamage().isEmpty())
return;
if (supportsBufferAge()) {
glXSwapBuffers(display(), glxWindow);
glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge);
setLastDamage(QRegion());
return;
}
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
const bool fullRepaint = (lastDamage() == displayRegion);
const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion);
if (fullRepaint) {
if (haveSwapInterval) {
@ -478,6 +471,9 @@ void GlxBackend::present()
waitSync();
glXSwapBuffers(display(), glxWindow);
}
if (supportsBufferAge()) {
glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge);
}
} else if (glXCopySubBuffer) {
foreach (const QRect & r, lastDamage().rects()) {
// convert to OpenGL coordinates
@ -490,9 +486,11 @@ void GlxBackend::present()
glDrawBuffer(GL_BACK);
}
glXWaitGL();
setLastDamage(QRegion());
XFlush(display());
if (!supportsBufferAge()) {
glXWaitGL();
XFlush(display());
}
}
void GlxBackend::screenGeometryChanged(const QSize &size)