manage triple buffering

REVIEW: 110556
icc-effect-5.14.5
Thomas Lübking 2013-03-28 22:26:47 +01:00
parent b8439145bd
commit 6c998fc668
2 changed files with 17 additions and 8 deletions

View File

@ -258,6 +258,9 @@ bool EglOnXBackend::initBufferConfigs()
void EglOnXBackend::present() void EglOnXBackend::present()
{ {
if (lastDamage().isEmpty())
return;
const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
const bool fullRepaint = (lastDamage() == displayRegion); const bool fullRepaint = (lastDamage() == displayRegion);
@ -301,16 +304,18 @@ SceneOpenGL::TexturePrivate *EglOnXBackend::createBackendTexture(SceneOpenGL::Te
void EglOnXBackend::prepareRenderingFrame() void EglOnXBackend::prepareRenderingFrame()
{ {
if (!lastDamage().isEmpty()) present();
present();
eglWaitNative(EGL_CORE_NATIVE_ENGINE);
startRenderTimer(); startRenderTimer();
eglWaitNative(EGL_CORE_NATIVE_ENGINE);
} }
void EglOnXBackend::endRenderingFrame(const QRegion &damage) void EglOnXBackend::endRenderingFrame(const QRegion &damage)
{ {
setLastDamage(damage); setLastDamage(damage);
glFlush(); glFlush();
if (!blocksForRetrace()) {
present(); // this sets lastDamage emtpy and prevents execution from prepareRenderingFrame()
}
if (overlayWindow()->window()) // show the window only after the first pass, if (overlayWindow()->window()) // show the window only after the first pass,
overlayWindow()->show(); // since that pass may take long overlayWindow()->show(); // since that pass may take long

View File

@ -407,11 +407,13 @@ void GlxBackend::waitSync()
glXWaitVideoSync(1, 0, &sync); glXWaitVideoSync(1, 0, &sync);
#endif #endif
} }
startRenderTimer(); // yes, the framerate shall be constant anyway.
} }
void GlxBackend::present() void GlxBackend::present()
{ {
if (lastDamage().isEmpty())
return;
const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
const bool fullRepaint = (lastDamage() == displayRegion); const bool fullRepaint = (lastDamage() == displayRegion);
@ -422,7 +424,6 @@ void GlxBackend::present()
m_swapProfiler.begin(); m_swapProfiler.begin();
} }
glXSwapBuffers(display(), glxWindow); glXSwapBuffers(display(), glxWindow);
startRenderTimer();
if (gs_tripleBufferNeedsDetection) { if (gs_tripleBufferNeedsDetection) {
glXWaitGL(); glXWaitGL();
if (char result = m_swapProfiler.end()) { if (char result = m_swapProfiler.end()) {
@ -431,7 +432,7 @@ void GlxBackend::present()
} }
} }
} else { } else {
waitSync(); // calls startRenderTimer(); waitSync();
glXSwapBuffers(display(), glxWindow); glXSwapBuffers(display(), glxWindow);
} }
} else if (glXCopySubBuffer) { } else if (glXCopySubBuffer) {
@ -472,8 +473,8 @@ SceneOpenGL::TexturePrivate *GlxBackend::createBackendTexture(SceneOpenGL::Textu
void GlxBackend::prepareRenderingFrame() void GlxBackend::prepareRenderingFrame()
{ {
if (!lastDamage().isEmpty()) present();
present(); startRenderTimer();
glXWaitX(); glXWaitX();
} }
@ -481,6 +482,9 @@ void GlxBackend::endRenderingFrame(const QRegion &damage)
{ {
setLastDamage(damage); setLastDamage(damage);
glFlush(); glFlush();
if (!blocksForRetrace()) {
present(); // this sets lastDamage emtpy and prevents execution from prepareRenderingFrame()
}
if (overlayWindow()->window()) // show the window only after the first pass, if (overlayWindow()->window()) // show the window only after the first pass,
overlayWindow()->show(); // since that pass may take long overlayWindow()->show(); // since that pass may take long