diff options
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 5 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop_p.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 53 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop_p.h | 5 |
4 files changed, 18 insertions, 46 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 4986996d99..990c339630 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1376,6 +1376,11 @@ bool QQuickWindow::event(QEvent *e) if (d->mouseGrabberItem) d->mouseGrabberItem->ungrabMouse(); break; + case QEvent::UpdateRequest: { + if (d->windowManager) + d->windowManager->handleUpdateRequest(this); + break; + } default: break; } diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index e9b58c60ba..8d3214db60 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -64,6 +64,7 @@ public: virtual void update(QQuickWindow *window) = 0; virtual void maybeUpdate(QQuickWindow *window) = 0; + virtual void handleUpdateRequest(QQuickWindow *) { } virtual QAnimationDriver *animationDriver() const = 0; diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 29bee67f69..3e0230fe02 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -105,16 +105,6 @@ QT_BEGIN_NAMESPACE #define QSG_RT_PAD " (RT)" -static int get_env_int(const char *name, int defaultValue) -{ - QByteArray content = qgetenv(name); - - bool ok = false; - int value = content.toInt(&ok); - return ok ? value : defaultValue; -} - - static inline int qsgrl_animation_interval() { qreal refreshRate = QGuiApplication::primaryScreen()->refreshRate(); // To work around that some platforms wrongfully return 0 or something @@ -694,8 +684,6 @@ QSGThreadedRenderLoop::QSGThreadedRenderLoop() m_animation_driver = sg->createAnimationDriver(this); - m_exhaust_delay = get_env_int("QML_EXHAUST_DELAY", 5); - connect(m_animation_driver, SIGNAL(started()), this, SLOT(animationStarted())); connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped())); @@ -709,10 +697,7 @@ QSGRenderContext *QSGThreadedRenderLoop::createRenderContext(QSGContext *sg) con void QSGThreadedRenderLoop::maybePostPolishRequest(Window *w) { - if (w->timerId == 0) { - qCDebug(QSG_LOG_RENDERLOOP) << "- posting update"; - w->timerId = startTimer(m_exhaust_delay, Qt::PreciseTimer); - } + w->window->requestUpdate(); } QAnimationDriver *QSGThreadedRenderLoop::animationDriver() const @@ -862,7 +847,6 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window) win.window = window; win.actualWindowFormat = window->format(); win.thread = new QSGRenderThread(this, QQuickWindowPrivate::get(window)->context); - win.timerId = 0; win.updateDuringSync = false; win.forceRenderPass = true; // also covered by polishAndSync(inExpose=true), but doesn't hurt m_windows << win; @@ -952,6 +936,14 @@ void QSGThreadedRenderLoop::handleObscurity(Window *w) } +void QSGThreadedRenderLoop::handleUpdateRequest(QQuickWindow *window) +{ + qCDebug(QSG_LOG_RENDERLOOP) << "- polish and sync update request"; + foreach (const Window &w, m_windows) + if (w.window == window) + polishAndSync(const_cast<Window *>(&w)); +} + void QSGThreadedRenderLoop::maybeUpdate(QQuickWindow *window) { Window *w = windowFor(m_windows, window); @@ -1079,8 +1071,6 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) QQuickWindow *window = w->window; if (!w->thread || !w->thread->window) { qCDebug(QSG_LOG_RENDERLOOP) << "- not exposed, abort"; - killTimer(w->timerId); - w->timerId = 0; return; } @@ -1090,8 +1080,6 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) w = windowFor(m_windows, window); if (!w || !w->thread || !w->thread->window) { qCDebug(QSG_LOG_RENDERLOOP) << "- removed after event flushing, abort"; - killTimer(w->timerId); - w->timerId = 0; return; } @@ -1135,9 +1123,6 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) syncTime = timer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync); - killTimer(w->timerId); - w->timerId = 0; - if (m_animation_timer == 0 && m_animation_driver->isRunning()) { qCDebug(QSG_LOG_RENDERLOOP) << "- advancing animations"; m_animation_driver->advance(); @@ -1160,17 +1145,6 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose) Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync); } -QSGThreadedRenderLoop::Window *QSGThreadedRenderLoop::windowForTimer(int timerId) const -{ - for (int i=0; i<m_windows.size(); ++i) { - if (m_windows.at(i).timerId == timerId) { - return const_cast<Window *>(&m_windows.at(i)); - break; - } - } - return 0; -} - bool QSGThreadedRenderLoop::event(QEvent *e) { switch ((int) e->type()) { @@ -1181,15 +1155,8 @@ bool QSGThreadedRenderLoop::event(QEvent *e) qCDebug(QSG_LOG_RENDERLOOP) << "- ticking non-visual timer"; m_animation_driver->advance(); emit timeToIncubate(); - } else { - qCDebug(QSG_LOG_RENDERLOOP) << "- polish and sync timer"; - Window *w = windowForTimer(te->timerId()); - if (w) - polishAndSync(w); - else - killTimer(te->timerId()); + return true; } - return true; } default: diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h index 82f314a6af..b3db56e5f9 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h +++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h @@ -60,6 +60,8 @@ public: void update(QQuickWindow *window); void maybeUpdate(QQuickWindow *window); + void handleUpdateRequest(QQuickWindow *window); + QSGContext *sceneGraphContext() const; QSGRenderContext *createRenderContext(QSGContext *) const; @@ -80,7 +82,6 @@ private: QQuickWindow *window; QSGRenderThread *thread; QSurfaceFormat actualWindowFormat; - int timerId; uint updateDuringSync : 1; uint forceRenderPass : 1; }; @@ -89,7 +90,6 @@ private: void releaseResources(Window *window, bool inDestructor); bool checkAndResetForceUpdate(QQuickWindow *window); - Window *windowForTimer(int timerId) const; bool anyoneShowing() const; void initialize(); @@ -109,7 +109,6 @@ private: QList<Window> m_windows; int m_animation_timer; - int m_exhaust_delay; bool m_lockedForSync; }; |