Application freezes in glXWaitVideoSyncSGI

Hi,

I am reporting a probable bug inside glXWaitVideoSyncSGI() that belongs to GLX_SGI_video_sync extension on Linux.

Symptoms: Application freezes. Usually immediately, sometimes after some number of rendered frames, sometimes window resize is needed to trigger it. Sometimes whole X gets frozen.

gdb backtrace of the frozen application:
#0 0x00007f170f1ee3b0 in __poll_nocancel () at …/sysdeps/unix/syscall-template.S:81
#1 0x00007f170fd9090d in ?? () from /usr/lib/nvidia-313-updates/libGL.so.1
#2 0x00007f170baa6e93 in ?? () from /usr/lib/nvidia-313-updates/libnvidia-glcore.so.313.30
#3 0x00007f170fd5e874 in glXWaitVideoSyncSGI () from /usr/lib/nvidia-313-updates/libGL.so.1
#4 0x00007f1711237e82 in QGLContext::swapBuffers (this=) at qgl_x11.cpp:976
#5 0x0000000000404f4a in GLWidget::mouseMoveEvent(QMouseEvent*) ()
#6 0x00007f17106f9abb in QWidget::event (this=this@entry=0x1bc8cb0, event=event@entry=0x7fff2da97bc0) at kernel/qwidget.cpp:8360
#7 0x00007f17111c2c68 in QGLWidget::event (this=0x1bc8cb0, e=0x7fff2da97bc0) at qgl.cpp:4407
#8 0x00007f17106ac8ec in QApplicationPrivate::notify_helper (this=this@entry=0x1b39200, receiver=receiver@entry=0x1bc8cb0, e=e@entry=0x7fff2da97bc0)
at kernel/qapplication.cpp:4567

Steps to reproduce:
I used Qt’s HelloGL example. Hm, I do not see a way to attach it to post. So, it is available in Qt sourses in the folder examples\opengl\hellogl . I used Qt version 4.8.4 .

Then, I changed the constructor of GLWidget to use v-sync:

QGLFormat getMyFormat()
{
QGLFormat f(QGL::SampleBuffers);
f.setSwapInterval(1); // this triggers the problem
return f;
}

//! [0]
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(getMyFormat(), parent)
{
[…]

After running of the application, the application freezes inside glXWaitVideoSyncSGI() in a second. Sometimes, it runs correctly and the problem appears after the window resize. Exactly the same problem appears in our production applications.

Further investigation showed that the problem disappears if I uncheck “Sync to VBlank” in NVIDIA X Server Settings. If I check it once again, the problem appears again, usually with immediate application freezes (after the computer restart, the freezes are sometimes not so quick).

I am using Kubuntu 13.04 64bit with window composition turned on, Qt version 4.8.4, with Quadro K1000M and 313.30 Nvidia drivers. However, the problem is around for a while and is probably not related to Qt version, particular driver version, neither to Quadro/GeForce differences - at least according to my impressions with the problem. I tried to switch composition off and it still freezes. The only workaround is unchecking of “Sync to VBlank” checkbox in NVIDIA X Server Settings.

Let me know if you would need more input from me. Thanks for the support.
John
nvidia-bug-report.log.gz (52 KB)

Qt Hello GL example - bug reproducer.zip (38 KB)

pcjohn, Thanks for reporting this issue. Please provide nvidia bug report. Please share download link for Qt version 4.8.4 and the HelloGL example path. In which file you made below changed ?

Then, I changed the constructor of GLWidget to use v-sync:

QGLFormat getMyFormat()
{
QGLFormat f(QGL::SampleBuffers);
f.setSwapInterval(1); // this triggers the problem
return f;
}

//! [0]
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(getMyFormat(), parent)
{
[…]

Is there any compilation and executing steps ? May be you can attach repro program/apps to this thread .

Thanks Sandip,

I attached nvidia-bug-report to my original post (I have found attach button there, but I do not see any in this post. Maybe a suggestion to website improvement.).

I attached HelloGL example to my original post, including the binary (compiled on Kubuntu 13.04 with Qt 4.8.4).

Link to download Qt 4.8.4:
http://download.qt-project.org/archive/qt/4.8/4.8.4/qt-everywhere-opensource-src-4.8.4.zip

Steps to reproduce: Detailed instructions in my previous post. But simply: Providing that Qt 4.8.4 is installed on the Linux distribution, run NVIDIA X Server Settings and make sure that “Sync to VBlank” is checked. Then, run submitted example by ./hellogl . After a little of manipulation, application gets frozen. More rarely, whole X get frozen. If I attach gdb to the frozen process, the application is locked inside NVIDIA driver (glXWaitVideoSyncSGI).

John
nvidia-bug-report.log.gz (52 KB)

I attached HelloGL example to my original post, including the binary (compiled on Kubuntu 13.04 with Qt 4.8.4).

pcjohn, I didn’t find anything attached to original post?

Please provide requested information. Filed Bug 1394220 to track this issue.

Attaching and uploading files does not work for me on this website using Firefox on Linux.

To workaround the issue, I uploaded the files here:

http://www.fit.vutbr.cz/~peciva/nvidia-bug-report.log.gz
http://www.fit.vutbr.cz/~peciva/Qt%20Hello%20GL%20example%20-%20bug%20reproducer.zip

Is there a link to follow Bug 1394220 that you filled?

Thanks,
John

pcjohn, We are able to reproduce the issue with 313.30 and 313.46, But this issue no longer repro with 331_00 drivers. Could you please check with 331.13 and 331.17 ?

Sandip, I tested 331.17 and 325.15 and I can confirm that the issue dissapeared. Sorry for not testing latest drivers first. The reasons are simple: (1) the problem was around for about 2 years, (2) laptop backlight control does not work for me on Kubuntu 13.04 after installing the latest drivers (confirming for 331.17 and 325.15). I saw the backlight problem so many times in the past that I am usually staying with the working driver as long as possible.

Thanks for resolving the issue. I will wait on official driver release that will not have backlight problem and use code workarounds until then.