aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgthreadedrenderloop.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use qDebug for all debug under src/quick/scenegraph.Gunnar Sletta2014-01-071-1/+2
| | | | | | | Mixing printf and qDebug can make the output come out of sync. Change-Id: Ia71e71b09cb3bf651010eb2eb652db7899b07f0d Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-121-18/+35
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlcompiler.cpp Change-Id: I802731139d47c5b733dd805f7bf432d67d7331e1
| * Set the format for the fallback offscreen surfacev5.2.0Laszlo Agocs2013-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | Ie76dbe5fd4ab935db3da34f3ff63d217a3ba5013 fails to set the format for the QOffscreenSurface, resulting in BAD_MATCH failures when trying to make it current. Task-number: QTBUG-35410 Change-Id: I1d420556fad4df96a1893cb3513e398eeb6e71aa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Don't leave the GL context current after cleanup.Gunnar Sletta2013-12-041-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When shutting down, we left the gl context current on the window even when it was hidden. On mac this was a problem as it would optimize away our makeCurrent when the surface was made visible again, leading to nothing being rendered. So we call doneCurrent regardless during invalidateGL(). We also check and verify that makeCurrent in invalidateGL() actually succeeds. This lead to another problem which is that closing the app using [x] will call QWindow::destroy() on all windows, removing their platform windows and causing makeCurrent to fail. To still gracefully clean up resources, we introduced the concept of an offscreen fallback surface which is temporarirly used during the cleanup when needed. The problem is still present on QWindow+QOpenGLContext level, and I've opened QTBUG-35363 to fix this. Task-number: QTBUG-35234 Change-Id: Ie76dbe5fd4ab935db3da34f3ff63d217a3ba5013 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Don't crash when QCoreApplication is currently being deleted.Sérgio Martins2013-12-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In debug mode fixes a crash. The next Q_ASSERT dereferrenced QCoreApplication::instance(). In release mode fixes hundreds of messages about timers: "QObject::startTimer: Timers can only be used with threads started with QThread" A case where this is reproducible is having a QQuickItem that's child of qApp, or in some child hierarchy of qApp. Change-Id: I3b506aefdb537b74dc0d6c755b6874d31be159a1 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | Mark item as dirty when nodes are cleanedMichael Brasser2013-12-101-0/+2
| | | | | | | | | | | | | | | | Otherwise they may not be recreated in the correct configuration. Change-Id: Ib103b1874d7f104680eae7b6f43f722b5fa93bf2 Done-with: Aaron Kennedy <aaron.kennedy@jollamobile.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-031-16/+0
|\| | | | | | | Change-Id: I894ad7b4888744833f487b481950c087fa960a5c
| * Revert 99480d5420c0beea6771be582c039b550a4461f5Gunnar Sletta2013-11-271-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The Mac OS X platform plugin has been fixed so that this hack is no longer needed. Not to mention that it breaks on XCB. We keep the warning about bad exposes from the plugin in debug mode. These are still useful for tracking down future bugs. Task-number: QTBUG-35143 Change-Id: I5125f7ae2b7fd77c55e9a29b10aa5434598a9ea9 Reviewed-by: Ulf Hermann <ulf.hermann@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* | Fix typo in debug defineGunnar Sletta2013-12-031-1/+1
|/ | | | | Change-Id: I4d024aeb4618228cad3000ddfda32e5c8aba5742 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Stop render thread regardless when the window is being destroyedGunnar Sletta2013-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | When a window is shown and quickly hidden again we can get to a state, on a asynchronous windowing system API, where the isExposed=true event has been pushed to the event queue but not yet processed at the time the user calls hide(). As hide() immediately sets isVisible() to false, we end up with isExposed=true and isVisible=false which prevent the WM_Obscure event to be sent to render loop which means the render thread thought the window was still on screen when we reched the shutdown in WM_TryRelease. Changed WM_TryRelease handling to disregard window state when the window is being deleted. This forces SG and GL cleanup and stops the thread. Task-number: QTBUG-35055 Change-Id: Ibac5aa27354d6450f30a61450214cb785ab855bf Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Do not crash when resizing invisible (non-tracked) windows.Gunnar Sletta2013-11-251-3/+4
| | | | | Change-Id: I776c21a0f675d2dbe831325cef2c1c2a103e03e5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Be even more tolerant towards broken platform behavior.Gunnar Sletta2013-11-221-0/+21
| | | | | | | | | | When the platform (Mac in particular) sends us exposes for windows which are not renderable, we store it for later and fake expose events when we get resized. Task-number: QTCREATORBUG-10814 Change-Id: I909bb5a920550589322afd97ae1834884754cf81 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Safeguard the threaded renderloop against incorrectly exposed windows.Gunnar Sletta2013-11-221-6/+9
| | | | | | | | | | | | On Mac we had a situation where we got expose events for windows which were either 0x24 in size or completely off the screen. These would result in makeCurrent failing and lead to crashes later on in the scene graph. Safeguard against invalid dimensions during initialization and abort after a call to makeCurrent if any of them fail. Task-number: QTCREATORBUG-10814 Change-Id: I9063ea4d078eea3914666e4c155d141a1502e2ff Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Fix lockup in creator.Gunnar Sletta2013-11-151-2/+9
| | | | | | | | | | | | | | | My previous fix to force expose when the render thread is inactive was not enough. We now lock down access to 'QSGRenderThread::window' so that it will always be set when the thread is in the "exposed" state and 0 when the thread is in the "obscured" state. This introduces another sync point in handleObscurity to protect the writing of window in the render thread. Task-number: QTCREATORBUG-10793 Change-Id: I1e1153189b3a3562705892b42625f88ef6329188 Reviewed-by: Ulf Hermann <ulf.hermann@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Avoid deadlock in Qt CreatorGunnar Sletta2013-11-141-1/+15
| | | | | | Task-number: QTCREATORBUG-10699 Change-Id: Ia88df5ec4ea74fda6a0449aa739a9c6976fedb02 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Improve internal debug statements.Gunnar Sletta2013-11-141-92/+79
| | | | | | | | Now that we have one thread per window it is useful to know which thread and window prints out the messages. Change-Id: I699eae180575fd3355551ebe0bfe6fd6ac8837c9 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Animate when only one out of several windows is exposed.Gunnar Sletta2013-11-111-3/+9
| | | | | | Change-Id: I7f76ed722f91076ee308a47c699984d371a220f0 Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Refactored Animator internalsGunnar Sletta2013-11-061-6/+7
| | | | | | | | | | | | Change the design from posting events for starting and stopping to use the scene graph's existing 'sync' point. This gives much higher predictability and makes both ownership and cleanup cleaner and also reduces intermediate states while events are waiting to be delivered. Task-number: QTBUG-34137 Change-Id: I069ac22acbddaa47925b8172ba98ac340fe9bf8d Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Added private API for enabling sharing between the QQuickwindow instances.Gunnar Sletta2013-11-011-0/+2
| | | | | | | | This API is primarily a hook which is needed by the Qt WebEngine to set up sharing with the scene graph's OpenGL contexts. Change-Id: I5bb03abd9ab99f502db8e413fe838a8b30365b8d Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
* Use one render loop per QQuickWindowGunnar Sletta2013-10-301-211/+262
| | | | | | | | | | | | | | | | | | | See the task for the full reasoning behind this patch. The threaded renderloop has been refactored to have one window per thread. This is mostly a simplification of the current code path where for loops over multiple windows are turned into if (window). The QSGContext has been split into two classes, QSGRenderContext for which there is one per OpenGLContext. The rest of the patch is name changes and a couple of cleanups in the hopes of simplifying this change. Task-number: QTBUG-33993 Change-Id: I31c81f9694d7da7474a72333169be38de62613c4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Don't leave a window current when removing itGiulio Camuffo2013-10-141-2/+6
| | | | | | | | The window may be deleted before any other window is make current, and that would lead to memory corruption with Mesa's EGL. Change-Id: I414b972fd517f60c28d194fa059bf7871e422872 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix license headers of QtQuick sources.Gunnar Sletta2013-09-301-1/+1
| | | | | Change-Id: I3750c47640bf21c3567c5fa1c4667e3e2552942e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Allow animators to work properly with multiple windowsGunnar Sletta2013-09-261-0/+15
| | | | | Change-Id: I5ba663ba0fa089ea786cf43cb4dfa40cbc955342 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Animators - Render thread animation systemGunnar Sletta2013-09-211-2/+5
| | | | | | | | | | | | This introduces 6 new QML types for animating state in the scene graph when the UI thread is blocked. The QObject property being animated is updated after the animation completes. It works also with the "windows" and "basic" render loops, but offer litte benefit then compared to in the "threaded" case. Change-Id: Ic19e47c898c0b8bd53e457db922b3c9c457c8147 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove variables that aren't being used right nowThiago Macieira2013-09-071-2/+2
| | | | | | | | | | | | | Found by ICC. src/quick/items/qquicktextcontrol.cpp(78): error #2415: variable "fullWidthSelection" of static storage duration was declared but never referenced src/quick/items/qquicktextinput.cpp(2696): error #2415: variable "textCursorWidth" of static storage duration was declared but never referenced src/quick/items/qquicktextinput.cpp(2697): error #2415: variable "fullWidthSelection" of static storage duration was declared but never referenced src/quick/scenegraph/qsgthreadedrenderloop.cpp(164): error #2415: variable "WM_LockAndSync" of static storage duration was declared but never referenced src/quick/scenegraph/qsgthreadedrenderloop.cpp(181): error #2415: variable "WM_UpdateLater" of static storage duration was declared but never referenced Change-Id: I60b5cce79d7be5f909b690f97ffa93ea00d3c044 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* New scenegraph renderer and atlas textures.Gunnar Sletta2013-09-021-2/+2
| | | | | | | | | | | | | The renderer tries to batch primitives together where possible, isolate non-changing subparts of the scene from changing subparts and retain vertexdata on the GPU as much as possible. Atlas textures are crucial in enabling batching. The renderer and atlas texture are described in detail in the doc page "Qt Quick Scene Graph Renderer". Change-Id: Ia476c7f0f42e1fc57a2cef528e93ee88cf8f7055 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-08-121-1/+4
|\ | | | | | | Change-Id: Ibb584a2d7975996cd26514b82d1da2d447fcbebf
| * Stop the update timer when no windows are visibleGunnar Sletta2013-08-071-1/+4
| | | | | | | | | | Change-Id: Ib9758a99891829d9bec81996687373d08ecfa055 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* | Merge "Merge branch 'stable' into dev" into refs/staging/devSergio Ahumada2013-08-061-2/+2
|\|
| * Fix crash when changing non-cached source of image during animationMichael Brasser2013-08-011-2/+2
| | | | | | | | | | | | | | | | | | Ensure deferred deletions are handled while syncing, otherwise texture might be deleted after sync but before deferred deletion is processed. Task-number: QTBUG-32513 Change-Id: Id276f536a5722a36baae815b7b550b574eeeb483 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-32/+66
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
| * Set incubation controller when a Window{} is loaded via QQmlApplicationEngineAlan Alpert2013-06-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was the one convenience that was lost when transitioning templates from QQuickView + Item{} to QQmlApplicationEngine + Window{}. As the default window incubation controller was tied to the first window's frameSwapped, we could easily run into a situation where a secondary window required incubation while the first window was idle. This would then starve the incubation controller. Instead make it so that the renderloop emits "timeToIncubate" once it is done with a renderpass over all windows, so the incubator gets to run once and exactly once per vsync when animating. The incubator logic was also flawed in that it could post a lot of events to itself as a result of incubatingObjectCountChanged and thus starve system events while processing incubation requests. Now we start a timer and don't start it again until we have completed an incubation pass. Task-number: QTBUG-31203 Change-Id: Iea9e2c81efb46bb7875c70ccda0cdc4b3b3e58e7 Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
| * QmlProfiler: fix SceneGraph profilingChristiaan Janssen2013-05-271-1/+1
| | | | | | | | | | Change-Id: I54c960f0b0da061816223a51795c83a9f9dd3f66 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
| * QmlProfiler: SceneGraph profilingChristiaan Janssen2013-05-061-25/+52
| | | | | | | | | | Change-Id: Ide71b330b13fc3816ed191bd9af84e0fce0d9587 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
| * Clear the pendingUpdate flag every frame.Gunnar Sletta2013-04-231-2/+3
| | | | | | | | | | | | Change-Id: Icd9bf8ec63e46341f5a43dbb85fe6a3a885f6afb Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
| * Don't use bitfields, reading/wrting them is not atomicGunnar Sletta2013-04-171-3/+3
| | | | | | | | | | | | | | Task-number: QTBUG-30663 Change-Id: I952bb4cd9c254f085304ceeddced14b66e0f12b6 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* | Cleanup lots of V8 dependencies in QJS* classesLars Knoll2013-04-181-0/+1
|/ | | | | | | | | | | Implement a good part of QJSValue using V4. Keep the QV8Engine for now (as it is used everywhere), but add an ExecutionEngine pointer to it so other parts can more easily be ported to V4. Remove a lot of other stuff that's not required anymore. Change-Id: Ibe2c9ab10f0ee977e0e3d05a42f526206d7b22b5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove resize hook from QSGRenderLoop, exposureChanged is enough.Gunnar Sletta2013-04-041-41/+2
| | | | | | | | | After much back and forth, I think we have settled on the right approach in QtGui, which is that resizeEvent is pretty much useless as the action happens on the following exposeEvent(). Change-Id: I5e87bda89853907d041f56acf9a2895e540c41f0 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Our debug env vars are a mess. Standardize on QSG_RENDER_TIMINGGunnar Sletta2013-04-041-20/+20
| | | | | Change-Id: I4e88b479a8a9a5126312a05800e8170511b1f7ac Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Polish usage of a QElapsedTime instance in QSGThreadedRenderLoopJędrzej Nowacki2013-03-131-1/+3
| | | | | | | | The patch should make valgrind happy, by not using an uninitialized memory. Change-Id: Iec7f16c56f250dd121a37f03da4cfc5d9e5c0742 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fixed incorrect vsync delta time in QSGThreadedRenderLoop.Yoann Lopes2013-03-121-1/+1
| | | | | Change-Id: I32bb720e9c9aa0278959dd64e5e1c449bdace7d1 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Create the sg render thread's opengl context on the GUI threadGunnar Sletta2013-03-121-34/+12
| | | | | Change-Id: I710d80ebb4e5a12fda1f58f54089b0e72268dfcf Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Make sure exposeEvents trigger a render passGunnar Sletta2013-02-211-0/+2
| | | | | | | | We needs this on non-compositing window managers to trigger repaints on partial updates. Change-Id: Ied5f3e854173c5e00ad7e1222aeb66eb9c96158c Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Improved animations in the new render loopGunnar Sletta2013-02-191-97/+85
| | | | | | | | | | | | | | | | | | | | To advance animations in line with vsync, we used a dedicated event from the rendering thread which we fired immediately after sync. This is a bit elaborate as we know in Gui when sync is complete and we can just animate there and then. This means we can remove all animation logic from the rendering thread, making it simpler. I also updated the syncAndRender pass so that it does not render anything if the scene graph reported no changes during the sync pass. This will prevent non-visual animations and property updates from triggering render passes which will save quite a few cycles. Change-Id: I62bb5484f0673f99abe726fca5a9b424f6b0a317 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Make sure deleteLater gets run at the "correct" time.Gunnar Sletta2013-02-071-16/+116
| | | | | | | | | | | | | | | | | | | We have a number of places where we delete scene graph objects with deleteLater() and change the scene graph. The timing of when the deleteLater happens is very important as we need to complete the updates to the scene graph first. In this particular case, a QQuickShaderEffectSource was released, and an update was scheduled but because animations were running we were already beginning to render a new frame before the update was handled, causing a crash. The only safe place to run deferred deletes is after we have performed a proper sync with the item scene. Task-number: QTBUG-29485 Change-Id: I6e93d4e6276fe82d3f4c818781b188e03c46e510 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Added to QML_RENDERER_TIMING logic to capture most render bottlenecks.Gunnar Sletta2013-01-301-12/+11
| | | | | | | | | The typical bottlenecks during rendering are usually compiling shader programs, uploading textures and preparing glyphs, so add profiling data around them. Change-Id: I9c330a0f6b769836d303a035b2c0dce832842aec Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Complete rewrite of threaded render loop.Gunnar Sletta2013-01-181-0/+1044
This change starts using the superior implementation of the scene graph render loop which has been worked on in the scenegraph-playground project for a while. It uses a far more straightforward locking/sync paradigm compared to the existing one and is less deadlock and error prone. It also enables the scene graph thread to run on its own when the GUI thread is blocked, enabling threaded animations. This changes also introduces a naming change inside Qt Quick from "Window Manager" -> "Render Loop" as that fits better to what the code does. Change-Id: I1c2170ee04fcbef79660bd7dae6cace647cdb276 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>