summaryrefslogtreecommitdiffstats
path: root/src/core/aspects/qaspectmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Expose number of jobs is last updateMike Krus2019-12-171-1/+2
| | | | | | | Useful for tracking amount of work done Change-Id: I1d6e0394c35fffc4b33991373e4d16e4651987c7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Implement getting list of aspects from system information classMike Krus2019-12-131-2/+3
| | | | | Change-Id: I999dfbb5c139ff8af2b1de9255f76ac132ae2dc0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make tracing a runtime optionMike Krus2019-12-131-50/+41
| | | | | | | | | | | - Moved most of the code QSystemInformationService (private class for now) - Tracing can be enabled by setting QT3D_TRACE_ENABLED or calling QSystemInformationService::setTraceEnabled(bool) - Introduced QTaskLogger class to easy logging (RAII) Change-Id: I2a3e08e4371fcee3e9ef3cf575725f13f57d1a94 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make NodeRelationshipChange struct privateMike Krus2019-12-061-2/+2
| | | | | | | Was private in 5.14, should remain so in 5.15 Change-Id: I74231d349e60f498d8ffb4ff39cc1e95fa3f0567 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Revert "Fix post FF API changes"Mike Krus2019-12-031-2/+2
| | | | | | | 84766ed9098f10efc53e4e43a75eef38fce7fbf6 Change-Id: I12341ec1b7bc68a7586c6671aa7b8f21caed17e0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix frame advance serviceMike Krus2019-10-281-1/+5
| | | | | | | | | | | | | | on macOS, blocking the main thread waiting for current frame to finish can lead to events flooding the event queue. In particular, moving the mouse over the window causes the QBasicTimer used by the uniform timer that drives (qtquick) animations to no longer fire. Use tryAcquire to get the resources, waiting a short while to avoid busy main thread. Task-number: QTBUG-79379 Change-Id: I930aa8ad7d5a15600d7ac7af93e6e72321457089 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix post FF API changesMike Krus2019-10-221-2/+2
| | | | | Change-Id: I347f6df41c0a4f2295831e78248669b4a2d6b5ef Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix Coverity warningsMike Krus2019-10-211-0/+1
| | | | | Change-Id: I00c875b48d838170fddf0b92f0ac5592828c6f0f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove use of node/components added/removed messagesMike Krus2019-10-041-0/+7
| | | | | | | | | | | | | Introduce mechanism to notify backend nodes of changes in relationship between nodes. If a component is added or removed from an entity, or if a node is added or removed from a property of another node, then just rely on the node being marked as dirty when syncing takes place. For nodes that do not support syncing, messages are delivered as before but allocated on the stack rather than the heap. Change-Id: I06affac77e42a9998d9c7f44e231c7724c52b320 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add accessor to retrieve frontend node from an idMike Krus2019-10-021-0/+19
| | | | | | | Useful later to sync backend changes back to the frontend. Change-Id: I874d140fc97462b8e186b66c882647db26d5678e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Process pending nodes needing _q_postConstructorInit at start of frameJim Albamont2019-09-181-0/+9
| | | | | | | | | | | | | | NodePostConstructorInit::processNodes and QAspectManager::processFrame are both triggered by the event loop which means the frame can happen before the processNodes call. We want to ensure processNodes is called first so those pending nodes can be created during the processFrame call otherwise they will get deferred until the next frame. Created a test to show this and removed the now unnecessary double calls to processEvents in several other tests. Change-Id: I7a3f7b34be2858b4acdb9275804b458f9366ec67 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use direct access to remove backend nodesPaul Lemire2019-09-161-9/+80
| | | | | | | | | - Stop using messages - Remove QSceneObserverInterface - Ensure backend node creation/destruction is done at the right time Change-Id: I470825af344ab65bf05e93fc149b61d1b9eefc96 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use sync method when initializing new backend nodesMike Krus2019-08-291-2/+9
| | | | | | | | | | | If the node type supports syncing, use that rather than the creation message. The message is still needed since that is passed to the instantiation functor (none of qt3d's classes appear to use anything but the node id, but can't be sure no other classes do, and can't add other virtual method without breaking BC). Change-Id: Id99f448070b8722a7809b968798772c9eb3c8397 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Do direct notification of backend nodeswip/refactorMike Krus2019-08-281-0/+6
| | | | | | | | | | | | | | | | | Since aspect manager is now on main thread, we can directly update backend nodes safely. Track nodes which have changed properties and notify the backend nodes as part of the frame loop. This avoid allocating and delivering many change messages. To follow: - implement on all nodes - look at backend to frontend syncing - figure out what to do with non property messages (components added/removed, commands, ...) Change-Id: Ia0c442b0528e728c4324d168200bae021bc29266 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QAspectEngine: add run loop driving modesPaul Lemire2019-08-071-4/+13
| | | | | | | | Can be either Automatic (Qt3D is in charge or driving it) or manual where the user has to call QAspectManager::processFrame() manually. Change-Id: I3e41d24aea0ddc5cce61328d9731b23f91b54215 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove the Aspect ThreadPaul Lemire2019-08-071-133/+132
| | | | | | | | | | | | | | | | | | This now makes the Qt3D simulation loop run in the Main Thread. In theory having the Aspect Thread allowed Qt3D to continue rendering even if the main thread got locked. In practice however this leads to a large amount of complexities in the Qt3D implementations and provides little value as in most cases blocking the main thread would block animations driven by frontend nodes. Removing the Aspect Thread will allow to remove the backend tree copies each aspect had to make which will allow to reduce memory. In addition, getting direct access to frontend nodes, will now be possible without introducing races which should allow to make more optimizations and reduce latencies on some operations. Change-Id: I80e4cd6427de06ddedfa1bb50d40710b91867b24 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Avoid busy loop in QAspectManager while simulation loop is not startedMauro Persano2018-07-041-35/+36
| | | | | | | | | | | | | After QAspectThread starts, it gets in a busy loop until QAspectManager::enterSimulationLoop is called. Make the aspect thread's main loop block on QEventLoop::processEvents until it's told to start the simulation loop. Task-number: QTBUG-67823 Change-Id: I3daac20b65227787c42907d53c11609e1a87ea85 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Doc: Fix documentation warnings related to Clang QDoc parserTopi Reinio2018-04-201-1/+5
| | | | | | | | | | | | | | | | | | | | | Since Qt 5.11, QDoc uses Clang to parse C++ documentation. Clang requires a module header, as well as proper include paths, to build a precompiled header and process the sources. To do this, add a custom module header that pulls in all Qt 3D modules - this way, we can continue using a single documentation project to covers all of Qt 3D. Fix all documentation warnings are caused by missing namespaces, QML module/type names and typos, as well as a number of linking problems and other minor issues. After this change, the remaining documentation issues consist of 'No documentation for ...' warnings. Task-number: QTBUG-67790 Change-Id: I38b91163c475a00cc1893e793240470c5409eb57 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
* Doc: Fix documentation warnings for Qt 3D CoreTopi Reinio2018-02-161-0/+2
| | | | | | | | | | | | This change fixes multiple QDoc warnings for Qt 3D Core that are related to how Clang parses the source code and the \fn QDoc commands. We still have a number of 'No documentation for ...' warnings left - those are not addressed in this change. Change-Id: Ia6394f453d7bd959bc4d4cc9347ac0039b80f661 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Properly use QT_CONFIG for Qt3D profiling optionsPaul Lemire2017-08-031-2/+2
| | | | | | Change-Id: Id3bb7bb657f3d48c6c4cd3d5e86c43ad64dca791 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fixes includes to comply with coding conventions for Src/CoreRobert Brock2017-03-311-16/+16
| | | | | | | | Reordering the header includes to comply with Qt coding conventions Task-number: QTBUG-56185 Change-Id: I3943678c183c4ef46d403e0fff878c3cad964dfa Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix race in QAspectManager when shutting downPaul Lemire2017-01-101-1/+18
| | | | | | | | | | Happened when trying to shutdown immediately after creation by not giving a chance to properly complete initialization. Added a semaphore to force initialization to be completed prior to doing anything else. Task-number: QTBUG-56573 Change-Id: Ia1ecbf0bb8e156e6dc0e8667ee031baf31e0ecc6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QAspectManager: add stat trace for arbiter sync timePaul Lemire2016-12-151-0/+14
| | | | | Change-Id: Ie2abab5d1116b57a0296ac52cc8a311e31ce2ef7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Allow the QtQuick + Scene3D case to shutdown cleanlySean Harmer2016-05-201-1/+7
| | | | | | | | | | | | | | | | | | | | | | | ...by having the Scene3D item exit the simulation loop before asking the renderer to shutdown. This is necessary because if we let the simulation loop keep running then the render aspect keeps creating and executing jobs as we pull the rug out form under it by shutting down the renderer. This exhibited quite regularly as a crash caused by a race in the Shader::cleanup() function which tried to access the GraphicsContext that was destroyed by the renderer shutdown. This approach sequences things very similarly to the pure Qt 3D shutdown method. The main difference is that we explicitly stop the simulation loop whereas in the pure Qt 3D case, that is done for us by the QAspectEngine::setRootEntity(null) call. This is still done in the QAspectEngine dtor but by that time, the simulation loop is already stopped. The exit simulation logic has been adapted to handle this case. Task-number: QTBUG-51035 Task-number: QTBUG-42353 Change-Id: I08d16e301eab421fa6eb99e558f38e832534c151 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Allow the backend chance to process any final changes during shutdownSean Harmer2016-05-201-0/+11
| | | | | | | | | | | | | | | | | | | | | The QAspectEngine now flushes any pending changes batched up before telling the aspect manager to exit the simulation loop. Furthermore, the call to QAspectManager::exitSimulationLoop() now waits until the aspect thread has completely finished the simulation loop and has called onEngineShutdown() on each of the aspects. This is important to ensure that the main thread doesn't call QAspectEngine::shutdown() too early as this deletes the change queue which contains the final changes sent from the main thread during shutdown. For some reason the backend is unable to find which QBackendNodeMapper corresponds to each destruction change. Will investigate that next. Task-number: QTBUG-42353 Change-Id: Iec4d6a57a163effefd5b60249bf97c76ed187413 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Unregister aspects when shutting downSean Harmer2016-05-181-0/+20
| | | | | | | | | | | | | This allows the aspect manager to call QAbstractAspect::onUnregistered() in a symmetric way to onRegistered() before we exit the aspect manager's main loop. In particular, this allows the render aspect a chance to cleanly shutdown the renderer submission thread. Task-number: QTBUG-51035 Change-Id: I38a2f3d4fa016f451e53f0ceac02c387911aa6c4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix deadlock when quitting aspect managerJanne Koskinen2016-05-181-0/+4
| | | | | | | | Stop waiting for next frame advance if we are about to shut down. Change-Id: I334c5afa69eb262d6e4e7139acc826fbd7aa9263 Task-number: QTBUG-50044 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Qt3DCore: eradicate remaining Q_FOREACH loopMarc Mutz2016-05-141-1/+1
| | | | | Change-Id: I96364eb258f8f2f73456ddec4e9e65511b50c18e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Q_NULLPTR -> nullptrSean Harmer2016-05-011-2/+2
| | | | | | Task-number: QTBUG-52736 Change-Id: I58f9cbcdf018e7b672d33dd865067485412b79fe Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QVectorize QAspectManagerRobert Brock2016-04-191-1/+1
| | | | | | | Replaced QList with QVector Change-Id: I9295a4bec2dc7d9ab6893154519dcd0425d86c6e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Hook up some machinery ready for testing the no cloning approachSean Harmer2016-03-221-2/+2
| | | | | | Task-number: QTBUG-51835 Change-Id: I4520bf38acc9b8a990d3f3bce3d96f2014c5637b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Set objectName for aspects to help with debug outputSean Harmer2016-03-201-2/+6
| | | | | Change-Id: If1380c413cf04db3d8b95262aa1d81b0776032a9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add QAbstractAspectPrivate::onEngineAboutToShutdown() virtualSean Harmer2016-03-201-0/+12
| | | | | | | | | | Gives internal aspects a chance to unqueue any queued work that could potentially deadlock during trying to exit the inner loop in QAspectManager::exec(). Task-number: QTBUG-51421 Change-Id: I8f9892db2d8648c39092720f1a787c4db412d30d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove QAbstractAspect::onCleanup()Sean Harmer2016-03-171-6/+4
| | | | | | | | | | | This was actually called both when unsetting a root entity and during final shutdown. Remove it and move work it was doing to the overrides of onUnregistered() for now. Will need another look when we finish this refactoring to also include backend node destruction. Task-number: QTBUG-51421 Change-Id: I2f96ede4006fea3a4766d15cf6e162452dd58321 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Remove QAbstractAspect::onRootEntityChangedSean Harmer2016-03-171-1/+1
| | | | | | | | No longer needed, as we can do all needed in onEngineStartup(). Task-number: QTBUG-51421 Change-Id: I64487b9f118aaad073e4e060bc5fd36f3a6dd16a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Start improving the startup/shutdown code pathsSean Harmer2016-03-171-25/+44
| | | | | | | | | | * Add some docs * Comment out stuff we don't need right now * Make startup/shutdown work with a simple test case and simple aspect Task-number: QTBUG-51421 Change-Id: I749770e8103771b39645d1fcf7a5c277755c06e6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename onStartup/onShutdownSean Harmer2016-03-161-2/+2
| | | | | | | | | | onEngineStartup/onEngineShutdown is more descriptive of when these functions get called in the overall flow of operation. Task-number: QTBUG-51421 Change-Id: I09dd7dfa2e3ce961a67de7fd150bf027226849ae Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Rename QAbstractAspect::onInitialized() to onRegistered()Sean Harmer2016-03-161-2/+3
| | | | | | | | | This is the first step in reworking the startup/shutdown code to simplify it and provide a more symmetric API. Task-number: QTBUG-51421 Change-Id: Ib06be1e7adb3f3d52b31d5e0a1ec598f39543f9a Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QAspectManager: eradicate Q_FOREACH loopsMarc Mutz2016-03-011-6/+5
| | | | | | | | | | | ... by replacing them with C++11 range-for loops. Saves 1.1KiB (0.5%) in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I9f197dc25ef1b3f20d3dc4734da1167a0192022b Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add some optional timing loggingSean Harmer2016-02-191-0/+10
| | | | | Change-Id: Ie80a346dcd8fa4e53d528ea4de25d2bd42043cd8 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Unify license header usageAntti Kokko2016-01-261-11/+14
| | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I8eac0cd6bbc276a56df487249cc459c0d4fab165 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* QAspectEngine/QAbstractAspects: get rid of setDataPaul Lemire2016-01-221-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Getting rid of set data and the refactoring on setting the surface implies that: - Given the FrameGraph configuration, there may be several RenderViews each having a different RenderSurfaceSelector/Window - This means that the Renderer/QRenderAspect can't know about the surface before reading the scene - This means that the Renderer may be dealing with more than 1 window - This means that initialization, render and shutdown procedures will have to be updated accordingly Therefore the Renderer was refactored to: - Be initialized without knowing about a surface - For each RenderView, check the surface and if different from the previous one: * Make the context current with it * Create the appropriate glHelpers (as Surfaces may have != formats) TO DO: - Fix picking - Fix windows exposition - Fix shutdown / detection of all windows beging closed Change-Id: I49d070b05f46be4b26cfb57e494feba145d1da9c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix race on QAspectManager shutdownMauro Persano2016-01-081-0/+4
| | | | | | | | | | | | | | When QAspectManager::quit() is called, the exec() loop finishes. Then QAspectThread calls shutdown() and deletes the QAspectManager instance. However, in certain cases, the QAspectManager object can be deleted before QAspectThread::quit() has a chance to finish running, causing a crash when it tries to acquire the m_waitForEndOfExec semaphore. Make exec() wait for quit() to prevent this. Change-Id: I579e3e6b5684984ec32497852d94cc050cccbef5 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Make QSceneObserverInterface privateKevin Ottens2015-12-171-2/+2
| | | | | Change-Id: I98454ea6ed5bd5bbfed550317fedbf8ee47a1f8f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Move QAbstractAspect::registerAspect() to the pimplKevin Ottens2015-12-171-1/+1
| | | | | Change-Id: Iabc9afe59052e69725a82fb6bdb42f0dfae7fc91 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Turn all services private for nowKevin Ottens2015-12-121-2/+2
| | | | | Change-Id: I9da605c77c5489b9bef4f07079e05f8babb9559f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QScheduler::update renamed to something giving more insightPaul Lemire2015-11-241-1/+1
| | | | | Change-Id: I46fb61368e1637c5e06d3b1bd8de38982aa99c7b Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Fix data race with dirty flags set from property change eventsSean Harmer2015-11-231-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that dirty flags (typically on buffers and textures) are set as the very first thing we do in a frame by processing changes sent from the frontend to the backend before scheduling any jobs. Without this change, the dirty flag was sometimes being set whilst the renderer submission thread was busy processing the RenderViews and RenderCommands. This could result in the submission thread seeing the dirty flag on a buffer and performing a glBufferData() call before the jobs to populate the new data had been executed and then clearing the dirty flag. Depending upon the exact timings, updates appeared to lag a change behind or just get missed entirely. Later, when we have aspects that perform changes that need to be sent to the frontend, it might be a good idea to add a set of flags to the QChangeArbiter->syncChanges() call that allows to process events: * From frontend to backend only (at start of frame) * From backend to frontend only (at end of frame or other well defined times) * From backend to backend (to allow aspects to sync with each other) Task-Id: QTBUG-49602 Task-Id: QTBUG-49599 Change-Id: I5b2d4d6d81b119c8ec921ba4f8b90e3703c251da Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move Qt3DCore into Qt3DCore namespaceSean Harmer2015-10-131-3/+3
| | | | | | | Update other aspects, tests and examples accordingly. Change-Id: Ib1bcf0bdf4f5aec4422dc0c80bfc32b27fb1a317 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add onStartup() and onShutdown() virtuals to QAbstractAspectSean Harmer2015-08-061-1/+18
| | | | | | | | | | | | | Gives aspects a chance to do work just prior to and just after the main loop in QAspectManager. Specifically the shutdown functionality is required for the upcoming logic aspect to ensure a clean shutdown. Added the onStartup() method for symmetry. Change-Id: If5f32d62629543cdceb2e6e3ff6383747acb7c99 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>