From 4baa3f7105004ce815b5b16b05d895814263e987 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 24 May 2012 16:05:17 +0200 Subject: [PATCH] Enable QML_FIXED_ANIMATION_STEP by default with buffer queueing. On Mac OS X and other systems with buffer queueing GL, we have very jerky animations as the pipeline does not block at regular intervals, causing the current-time based animations to come out very jerky despite us rendering at 60 FPS with a very good margin. To remedy this, we switch the default so that we by default advance with a fixed increment, making the uneven frames not a problem. This then comes at the cost of that animations will slow down if the application does not manage to render within 16 ms, but this is an acceptible compromise. Aka, now it will occationally look bad, as opposed to always bad which it currently does. Change-Id: I44a6c3e51f434e4235e49485182380ea531876d9 Reviewed-by: Michael Brasser --- src/quick/items/qquickwindowmanager.cpp | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index 392085a..2022d24 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -135,7 +135,6 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_ after shouldExit has been set to true. */ -DEFINE_BOOL_CONFIG_OPTION(qmlFixedAnimationStep, QML_FIXED_ANIMATION_STEP); DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP); DEFINE_BOOL_CONFIG_OPTION(qmlForceThreadedRenderer, QML_FORCE_THREADED_RENDERER); // Might trigger graphics driver threading bugs, use at own risk @@ -332,14 +331,22 @@ QQuickWindowManager *QQuickWindowManager::instance() theInstance = QSGContext::createWindowManager(); - bool fancy = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::BufferQueueingOpenGL) + bool bufferQueuing = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::BufferQueueingOpenGL); + bool fancy = bufferQueuing && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL); if (qmlNoThreadedRenderer()) fancy = false; else if (qmlForceThreadedRenderer()) fancy = true; - if (qmlFixedAnimationStep()) + // Enable fixed animation steps... + QByteArray fixed = qgetenv("QML_FIXED_ANIMATION_STEP"); + bool fixedAnimationSteps = bufferQueuing; + if (fixed == "no") + fixedAnimationSteps = false; + else if (fixed.length()) + fixedAnimationSteps = true; + if (fixedAnimationSteps) QUnifiedTimer::instance(true)->setConsistentTiming(true); if (!theInstance) { -- 1.7.2.5