Some app can't start with "Couldn't find matching GLX visual"

I wan’t to play some game that depend on opengl. I however have the problem “Couldn’t find matching GLX visual” that appear when I do that. One app that do this is the game azimuth, that I packaged some time ago (I now have a different computer).

When I start it, it say: Fatal error in az_set_fullscreen: SDL_SetVideoMode failed: Couldn’t find matching GLX visual
The same game, on the exact same revision work well on ubuntu, that I used before I installed nixos. On ubuntu, it display some debug information about the GPU:
Using GL implementation:
Vendor: X.Org
Renderer: AMD RAVEN2 (DRM 3.33.0, 5.3.0-42-generic, LLVM 9)
Version: 4.5 (Compatibility Profile) Mesa 19.2.8

Some game that use openGL work well, however, like half life with wine.
Interesingly enought, nexuiz have two executable. nexuiz-sdl work, and nexuiz-glx doesn’t work, logging: Initializing Video Mode: fullscreen 1366x768x32x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Desired video mode fail, trying fallbacks…
Initializing Video Mode: fullscreen 1366x768x32x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Initializing Video Mode: fullscreen 1366x768x32x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Initializing Video Mode: fullscreen 1366x768x32x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Initializing Video Mode: fullscreen 640x768x32x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Initializing Video Mode: fullscreen 640x480x32x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Initializing Video Mode: fullscreen 640x480x16x60hz
Loading OpenGL driver libGL.so.1
Unable to open symbol list for libGL.so.1
Unable to load GL driver “libGL.so.1”
Quake Error: Video modes failed

I have found were the error happen in azimuth, and it is arround here:


  // Enable antialiasing:
  SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
  SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);

  // Init the display:
  int x = 0, y = 0;
  if (display_initialized) {
    SDL_GetMouseState(&x, &y);
  }
  if (!SDL_SetVideoMode(AZ_SCREEN_WIDTH, AZ_SCREEN_HEIGHT, VIDEO_DEPTH,
                        VIDEO_FLAGS | (fullscreen ? SDL_FULLSCREEN : 0))) {
    AZ_FATAL("SDL_SetVideoMode failed: %s\n", SDL_GetError());
  }

However, commenting the two SDL_GL_SetAttribute make the game work (with some graphical issue).

Can you help me solve this issue ?

Also: dolphin-emu work well with vulkan but not with openGL, citra work well.

Additionaly, when starting Xonotic (it seem it default to xonotic-sdl, xonotic-glx doesn’t work, with the same error that nexuiz, xonotic being a fork of nexuiz), it display something interesing, seeming to indicate is that the driver have a bad version (or something similar):

GL_VENDOR: X.Org
GL_RENDERER: AMD RAVEN2 (DRM 3.36.0, 5.5.13, LLVM 9.0.1)
GL_VERSION: 4.5 (Compatibility Profile) Mesa 19.3.3
vid.support.arb_multisample 1
vid.support.gl20shaders 1
NOTE: requested 1x AA, got 0x AA

(rest of the log skipped)

It seem someone have the same error than I have with nexuiz with xonotic (was able to reproduce with xonotic-glx):

So I found the solution. This is a bug in mesa, so I was able to track the source of the error to an update of mesa, then to the commit of mesa that caused the error. Just used an old version of mesa (related issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2908).

The temporary solution is to set the variable AMD_DEBUG to nodmacopyimage .