GNOME 3.16 and NVIDIA binary driver ‘BadMatch’ crash with totem, gnome-maps, cheese and others

Update 03.07.15:
The crash issue has been fixed in clutter >= 1.22.4 and clutter-gtk >= 1.6.2.

I’ve planned to update my openSUSE Linux desktop running GNOME 3.14 to the recently released GNOME 3.16. Fortunately Dominique Leuenberger (DimStar) and his team already packaged GNOME 3.16 for the openSUSE Factory distribution when it was released so it was easy to start on openSUSE 13.2 support.

I’ve tested a repository with GNOME 3.16 targeting the current openSUSE 13.2 release and helped fixing it. It works well as far as the general desktop functionality concerns and I am running it now, although there are still two blocking issues before allowing users to update safely.

As the title suggests, there is one major issue if you are using the NVIDIA binary drivers.

After updating to GNOME 3.16, gdm doesn’t start anymore and even if you downgrade to gdm 3.14 to make it start again, some of the “daily-use” apps that you love crash upon start with something like this:

(totem:16213): Gdk-ERROR **: The program 'totem' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
 (Details: serial 658 error_code 8 request_code 155 (GLX) minor_code 31)
 (Note to programmers: normally, X errors are reported asynchronously;
 that is, you will receive the error a while after causing it.
 To debug your program, run it with the GDK_SYNCHRONIZE environment
 variable to change this behavior. You can then get a meaningful
 backtrace from your debugger if you break on the gdk_x_error() function.)

This issue is not distribution related and after some investigation/bisecting I’ve located the issue to be within cogl/clutter‘s GDK/backend code. Talking with Emanuelle Bassi (clutter maintainer/creator/gfx-framework-guru), who was very helpful, lead to a bug report and a few initial patches.

The root of the issue became clear, too. NVIDIA’s glx implementation is very strict and not as lazy as Mesa and others about picking it’s glx fbconfigs and visuals.

New GL functionality had been added to GDK with GTK+ 3.16 in order to improve support for widgets like GtkGLArea and Wayland. Asides, the GDK backend in 3.16 is now the default backend on Linux, instead of the X11 one.

It turns out that cogl/clutter’s code fails to select a visual matching the GDK backend’s visual (or any at all), leading to the BadMatch error for the glXCreateWindow() call due to NVIDIA’s implementation rejecting the visual and leading to crashing applications that many users who updated to GNOME 3.16 currently start to run into.

Thus all applications using cogl/clutter with GTK+ 3.16 on NVIDIA binary drivers are affected. This includes totem, gnome-maps, cheese and more.

There is a fix in the works that will require updating cogl/clutter and perhaps GTK+ but it looks like both need some sort of refactoring in the visual selection code to properly work with NVIDIA’s implementation. As a temporary workaround you can run the affected apps without crashes by reverting to use the x11 backend like this:

$ CLUTTER_BACKEND=x11 totem &

The open-source graphics drivers are apparently not affected by this issue.

I’ll provide an update once the crashes are fixed and GNOME 3.16 can be considered stable for all users of openSUSE 13.2.