Comment 31 for bug 981199

Revision history for this message
Daniel Schürmann (daschuer) wrote : Re: Waveform 2.0 is jerking

I think the lowest Qt version we should support is Qt 4.6
From Qt 4.8 QPainter can be used from other than the GUI thread.
In Qt 4.6 you can paint from different thread than the GUI thread if you don't use QPainter but pure gl calls.
It is required to call this for thread save X11 calls:
#ifdef Q_WS_X11
    XInitThreads();
#endif
But anyhow. In my test I hit different bugs causing segfaults in the gl or driver library. So my preferred solution would be to do painting in the GUI thread and only do waiting in the vsync thread.

------
Apple: AGL_SWAP_INTERVAL
It sounds like this is implemented like glXSwapIntervalMESA.
What happens with Apple when you draw and swap with maximum speed?
Is the render rate fixed on 60 fps than?
If yes, when actually occurs the wait?
With glXSwapIntervalMESA it occours when you initialise the new Painter for the next frame.
Is this also the case in AGL?

I use this fact to sync Waveform to sound. See:

int GLWaveformWidget::render() {
    PerformanceTimer timer;
    int t1;
    //int t2, t3;
    timer.start();
    // QPainter makes QGLContext::currentContext() == context()
    // this may delayed until previous buffer swap finished
    QPainter painter(this);
    t1 = timer.restart();
    draw(&painter, NULL);
    //t2 = timer.restart();
    // glFinish();
    //t3 = timer.restart();
    //qDebug() << "GLVSyncTestWidget "<< t1 << t2 << t3;
    return t1/1000; // return timer for painter setup
}