You are not logged in.

#1 2011-10-23 02:17:22

coffee_addict
Member
From: Canada
Registered: 2011-06-14
Posts: 12

Qt with OpenGL: _intel_batchbuffer_flush() causing application exit

Hi,

I'm developing an application using Qt with OpenGL, I've used Qt with OpenGL before and haven't had any issues. However, this time around I have multiple QGLWidgets that each share the same OpenGL context, so I'm thinking this is part of the problem.

The issue is that after a call to one of the QGLWidget's paintGL() functions, the application exits from _intel_batchbuffer_flush(), no crash, exit() is being called. What's strange is that it doesn't always exit, sometimes everything works fine (1/10). I have an Intel gfx card (everything is running from my Arch machine of course), below is a (partial) stack trace:

#0  0xb6d6fa80 in exit () from /lib/libc.so.6
#1  0xb6306ad7 in _intel_batchbuffer_flush ()
   from /usr/lib/xorg/modules/dri/i915_dri.so
#2  0xb631ced0 in intel_flush () from /usr/lib/xorg/modules/dri/i915_dri.so
#3  0xb631cf12 in ?? () from /usr/lib/xorg/modules/dri/i915_dri.so
#4  0xb60e0680 in _mesa_flush () from /usr/lib/libdricore.so
#5  0xb60e0d89 in _mesa_Flush () from /usr/lib/libdricore.so
#6  0xb7011849 in glXSwapBuffers () from /usr/lib/libGL.so.1
#7  0xb7e7fee4 in QGLContext::swapBuffers() const ()
      from /usr/lib/libQtOpenGL.so.4
#8  0xb7e09ef8 in QGLWidget::swapBuffers() () from /usr/lib/libQtOpenGL.so.4
#9  0xb7e0a6c0 in QGLWidget::glDraw() () from /usr/lib/libQtOpenGL.so.4
#10 0xb7e09f9c in QGLWidget::paintEvent(QPaintEvent*) ()
	     from /usr/lib/libQtOpenGL.so.4
#11 0xb74e38ae in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#12 0xb7e0fa22 in QGLWidget::event(QEvent*) () from /usr/lib/libQtOpenGL.so.4
#13 0xb7489a24 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
		    from /usr/lib/libQtGui.so.4
#14 0xb748ee78 in QApplication::notify(QObject*, QEvent*) ()
			   from /usr/lib/libQtGui.so.4
#15 0xb721fb2e in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
			      from /usr/lib/libQtCore.so.4
...

I have nothing fancy going on in my OpenGL code, the drawing code draws some textured quads in an orthographic view... when exit() is not called, everything works as expected.

Any ideas?

Last edited by coffee_addict (2011-10-26 15:41:37)

Offline

#2 2011-10-23 16:03:17

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Qt with OpenGL: _intel_batchbuffer_flush() causing application exit

From looking at the _intel_batchbuffer_flush() code, it doesn't seem like exit() can be reached.  There is a path that calls exit(), but it looks something like this:

int ret = 0;
/* ... (no mention of `ret') */
if (ret != 0) {
  exit(1);
}

Try running your program under valgrind.

Offline

#3 2011-10-23 17:41:08

coffee_addict
Member
From: Canada
Registered: 2011-06-14
Posts: 12

Re: Qt with OpenGL: _intel_batchbuffer_flush() causing application exit

I have run the progam via Valgrind, I receive two errors; however, both occur whether the program exits or not.

==17510== Syscall param writev(vector[...]) points to uninitialised byte(s)
==17510==    at 0x522CF2E: writev (in /lib/libc-2.14.so)
==17510==    by 0x40004: ???
==17510==  Address 0x58d37bf is 223 bytes inside a block of size 16,384 alloc'd
==17510==    at 0x4026416: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==17510==    by 0x53B46B1: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==17510==    by 0x43DB392: ??? (in /usr/lib/libQtGui.so.4.7.4)
==17510==    by 0x435E5BB: QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) (in /usr/lib/libQtGui.so.4.7.4)
==17510==    by 0x57A8027: ???
==17510== 
==17510== Invalid read of size 4
==17510==    at 0x6581B12: _mesa_make_extension_string (in /usr/lib/libdricore.so)
==17510==    by 0x655C7BF: _mesa_make_current (in /usr/lib/libdricore.so)
==17510==    by 0x64E01BB: intelMakeCurrent (in /usr/lib/xorg/modules/dri/i915_dri.so)
==17510==    by 0x64B99DE: ??? (in /usr/lib/xorg/modules/dri/i915_dri.so)
==17510==    by 0x4FF9CFC: ??? (in /usr/lib/libGL.so.1.2)
==17510==    by 0x4FD2081: glXMakeContextCurrent (in /usr/lib/libGL.so.1.2)
==17510==    by 0x4FD2202: glXMakeCurrent (in /usr/lib/libGL.so.1.2)
==17510==    by 0x41CFD81: QGLContext::makeCurrent() (in /usr/lib/libQtOpenGL.so.4.7.4)
==17510==    by 0x4159EB7: QGLWidget::makeCurrent() (in /usr/lib/libQtOpenGL.so.4.7.4)
==17510==    by 0x808D8F3: AppLauncher::run() (AppLauncher.cpp:56)
==17510==    by 0x808F079: AppLauncher::qt_metacall(QMetaObject::Call, int, void**) (moc_AppLauncher.cpp:72)
==17510==    by 0x4E15EEC: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (in /usr/lib/libQtCore.so.4.7.4)
==17510==  Address 0x612f748 is 0 bytes inside a block of size 1 alloc'd
==17510==    at 0x4026416: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==17510==    by 0x6581CDE: _mesa_make_extension_string (in /usr/lib/libdricore.so)
==17510==    by 0x655C7BF: _mesa_make_current (in /usr/lib/libdricore.so)
==17510==    by 0x64E01BB: intelMakeCurrent (in /usr/lib/xorg/modules/dri/i915_dri.so)
==17510==    by 0x64B99DE: ??? (in /usr/lib/xorg/modules/dri/i915_dri.so)
==17510==    by 0x4FF9CFC: ??? (in /usr/lib/libGL.so.1.2)
==17510==    by 0x4FD2081: glXMakeContextCurrent (in /usr/lib/libGL.so.1.2)
==17510==    by 0x4FD2202: glXMakeCurrent (in /usr/lib/libGL.so.1.2)
==17510==    by 0x41CFD81: QGLContext::makeCurrent() (in /usr/lib/libQtOpenGL.so.4.7.4)
==17510==    by 0x4159EB7: QGLWidget::makeCurrent() (in /usr/lib/libQtOpenGL.so.4.7.4)
==17510==    by 0x808D8F3: AppLauncher::run() (AppLauncher.cpp:56)
==17510==    by 0x808F079: AppLauncher::qt_metacall(QMetaObject::Call, int, void**) (moc_AppLauncher.cpp:72)
==17510== 
==17510== 
==17510== HEAP SUMMARY:
==17510==     in use at exit: 73,489,681 bytes in 12,812 blocks
==17510==   total heap usage: 122,413 allocs, 109,601 frees, 295,287,118 bytes allocated

Last edited by coffee_addict (2011-10-26 15:45:17)

Offline

#4 2011-10-26 15:49:17

coffee_addict
Member
From: Canada
Registered: 2011-06-14
Posts: 12

Re: Qt with OpenGL: _intel_batchbuffer_flush() causing application exit

I attempted to step through _intel_batchbuffer_flush(), but it was quite difficult to follow without debugging symbols hmm
I'm going to link against the debug binaries and then step through, hopefully I can figure out what's going on then.

Offline

Board footer

Powered by FluxBB