QTimer events not handled when started from QSGRenderThread
-
Hi there, I use QQuickFramebufferObject to integrate my 3D render engine to QtQuick (taking into account the multi-threaded rendering architecture of QtQuick).
It works well on some aspects, when I want to update the window I ask for an update (repaint) and then the synchronize and render functions are called and I can do whatever I want to render my scene and display it inside my QtQuick GUI.But sometimes, I want to keep track of operations executed on the GPU and I would like to use GLsync fence system to do so. I place fences on the gpu command queue and I use a QTimer with a 0 interval to check their status and react to them being signaled as soon as possible.
It works well on my Mac because it uses a single-threaded render loop but it does not work on Linux where a multi-threaded render loop is used. It seems my QTimer events are not always taken into account, the render thread is waiting for something (a renderSync request ?) in order to wake and proceed with the events. But when there is no renderSync request, none of this events originated from this thread seems to be handled.
Is this behaviour intended or is it bug ? Is there a way to workaround it ? The only way I found was to do something like this from the main thread:
window->scheduleRenderJob(job, QQuickWindow::RenderStage::NoStage);
but the main thread should not be aware it has to do so only to make the fence polling works and it is not efficient.