On 06 May 2014, at 12:19, David Greaves <david.grea...@jolla.com> wrote:

> On 06/05/14 10:55, Gunnar Sletta wrote:
> 
>> to be "false" meaning that when an application is not on screen, its graphics
>> memory and OpenGL context will be deleted.
> 
> What does on screen mean? Since....
> 
>> affected. - Covers are unaffected.
> 
> .... my cover shows the GL context - so I'm not sure quite how this will work 
> :)

Being on screen means the app is visible. When it is not visible, it should be 
prepared to handle the case where its graphics resources go away or request 
that they don't go away using the setPersistent.. API.

When I said Covers are unaffected, I should have said. Covers on applications 
with explicit cover windows are not affected. 

Applications which does not implement a cover will get their application main 
window as a cover window. In this case, the memory will be released when 
neither the cover nor the application is visible. For instance, when the device 
goes to the lock screen.

This does however bring forth another potential issue with Qt 5.2 (which is 
unrelated to Sailfish OS, but still might affect some users). In Qt 5.2, each 
QQuickWindow will have its own OpenGL context and these are not sharing. 

> 
>> 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.
>> 
>> 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.
> 
> One concern is that putting these in the wrong place will of course not be a
> problem until the switch and then at that point the app will break.
> 
> Hopefully we'll have the public update-RC programme in place by then so app
> developers can do QA :)

*nod*

> 
>> 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 assume this is not testable for Harbour apps until 5.2 is actually released?

It is not testable for Harbour apps, but you can test the impact using stock Qt 
on for instance Linux or Mac and setting the parameters to false and then 
calling hide() on the window, for instance. 

> 
>> ---
>> 
>> 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.
> 
> ah - thanks. I wasn't sure when individual methods appeared :)
> 
> David
> _______________________________________________
> SailfishOS.org Devel mailing list

_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to