Hi, Just wanted to give a follow-up on this topic;
You are affected if you are drawing on Canvas (and don't want to repaint it completely when returning to application) Symptom is that canvas gets cleared when going away from application (minimizing it to cover) The simplest way to not allow releasing, add two middle lines in your main() as suggested in original email; view->setSource(SailfishApp::pathTo("qml/ankkuri.qml")); view->setPersistentOpenGLContext(true); view->setPersistentSceneGraph(true); view->show(); -kimmo -----Original Message----- From: devel-boun...@lists.sailfishos.org [mailto:devel-boun...@lists.sailfishos.org] On Behalf Of Gunnar Sletta Sent: Tuesday, May 06, 2014 12:55 PM To: devel@lists.sailfishos.org Subject: [SailfishDevel] Upcoming behavioural change with how graphics resources are handled. Hi, If you are not using OpenGL directly or the Qt Quick scene graph's C++ API, please ignore this mail. Qt Quick and the scene graphs supports releasing its graphics resources when the application is not rendering. This is not a feature we have been taking advantage of so far, but as you can guess, it can be quite beneficial on a multitasking system to release unused graphics memory. Once we move our stack to Qt 5.2, we will change the defaults of http://qt-project.org/doc/qt-5/qquickwindow.html#setPersistentSceneGraph and http://qt-project.org/doc/qt-5/qquickwindow.html#setPersistentOpenGLContext to be "false" meaning that when an application is not on screen, its graphics memory and OpenGL context will be deleted. - Applications using Qt Quick, Sailfish Silica Components combined with non-graphical C++ APIs are not affected. - Applications using only QML-level API, including ShaderEffect or CustomParticle, are not affected. - Applications using QWindow and QOpenGLContext and not Qt Quick are also not affected. - Covers are unaffected. Only applications using Qt Quick, QSG-classes and/or QOpenGLContext and/or raw OpenGL calls ARE affected. If this applies to you, there are two ways to deal with graphics stuff being released: 1. Don't allow releasing. This is a valid scenario in many cases. Shaders have been compiled, resources loaded, etc and rebuilding this is difficult, take too long to be feasible or some times not possible at all. If so, add the following two lines to your main.cpp AFTER you told it to load the QML file and BEFORE you show it. QQuickWindow::setPersistentSceneGraph(true); QQuickWindow::setPersistentOpenGL(true); This will revert to the current behaviour where graphics resources are retained, even when the application is backgrounded. 2. React and handle it. Use the QQuickWindow::sceneGraphInvalidated() and QOpenGLContext::aboutToBeDestroyed() signals to clean up your graphics resources and let your application handle not being shown on screen. --- I can't tell you when the change over happens, but we're aiming for some time later this year :) I'm giving you an early heads up so you can update your applications now if you are affected. Reacting to http://qt-project.org/doc/qt-5/qquickwindow.html#sceneGraphInvalidated or http://qt-project.org/doc/qt-5/qopenglcontext.html#aboutToBeDestroyed is something something you can already do. Same if you want to avoid the issue all together and setPersistent(SceneGraph|OpenGL)(true) right away. These APIs have been there since Qt 5.0. --- If you have further questions, please feel free to ask. cheers, Gunnar (sletta on IRC) _______________________________________________ SailfishOS.org Devel mailing list _______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org