[Development] Avoiding segfaults with QML and video cards which do not support OpenGL 2.0

Kevin Kofler kevin.kofler at chello.at
Fri Jan 15 23:27:50 CET 2016


Hi Lisandro,

Lisandro Damián Nicanor Pérez Meyer wrote:
> Hi! With my Debian packager hat on, we are receiving bugs like [bug] in
> which applications using QML with video cards that do not support OpenGL
> 2.0 (yes, there are people using 15+ years old video cards out there)
> makes stuff crash.
> 
> It is totally fine that QML requires at least OpenGL 2.0, but it would be
> really nice if apps could be made to not crash.
> 
> It will also not surprise me if there is already a way to avoid this and
> what we package maintainers need to do is fill proper bugs to apps not
> using it.

you just need to install this script:
http://pkgs.fedoraproject.org/cgit/rpms/qt5-qtbase.git/plain/10-qt5-check-opengl2.sh
to:
/etc/X11/xinit/xinitrc.d/10-qt5-check-opengl2.sh
and depend on glx-utils, which provides the glxinfo command the script uses.

I got the prerequisite environment variable (QT_XCB_FORCE_SOFTWARE_OPENGL)
support added to Qt 5.3:
https://codereview.qt-project.org/#/c/76992/
It has been in there ever since. (I also mentioned the needed script, but
there was no interest in shipping this with Qt, unfortunately.) This is
checked once at X11 startup because it is fairly expensive to check the
available OpenGL version: You have to spawn an external process and ask Mesa
for information there. If you initialize your own process with hardware
OpenGL, it is too late to request LIBGL_ALWAYS_SOFTWARE.

We have been shipping this solution in Fedora for around 2 years now.

What I have not checked is how this interacts with Wayland. The
glxconvenience code inside Qt where my QT_XCB_FORCE_SOFTWARE_OPENGL variable
is actually implemented may or may not be used there. And xinitrc.d may or
may not be run there. Don't ask me.

        Kevin Kofler




More information about the Development mailing list