How to enable indirect GLX contexts (+iglx) in Ubuntu 14.04 LTS with nvidia gfx-cards

32,146

Solution 1

I had a similar issue when running some GL applications via 'ssh -X' and solved it by adding "+iglx" to xserver-command in /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf.

[SeatDefaults]
# Dump core
xserver-command=X -core +iglx

After which you either reboot or Ctrl-Alt-F1, login, and 'sudo service lightdm restart'.

I hope this helps!

Solution 2

An alternative (and display-manager-independent) way to add the options is to add the following section to /etc/X11/xorg.conf:

Section "ServerFlags"
    Option "IndirectGLX" "on"
EndSection

Solution 3

I was having the same issue running a custom OpenGL program over ssh -X. The above solution worked with a slight modification

Section "ServerFlags"  
    Option "AllowIndirectGLX" "on"  
    Option "IndirectGLX" "on"  
EndSection  

This worked with ubuntu 16.04 server running kubuntu-desktop with NVIDIA GTX 1070 GPU and NVIDIA binary driver installed through apt.

Share:
32,146

Related videos on Youtube

cmks
Author by

cmks

Updated on September 18, 2022

Comments

  • cmks
    cmks over 1 year

    I am running a linux-host for Qt-software-development at a central place.

    With my windows box I use Xming as a local X-server and putty to connect to that linux-host. With this configuration I can use all X (xclock, xterm) and GLX (qtcreator, gxlinfo, glxgears...) programs at the linux-host.

    My main workstation is a ubuntu 14.04 LTS with a nvidia gfx card. When I connect to the linux-host with my ubuntu-system using "ssh -p port# -YC my.dev.host.com" I also can use all X programs (xclock, xterm) programs but I can not use GLX programs (qtcreator, gxlinfo, glxgears...).

    As far I learned this is because the X-server dont support indirect GLX contexts by default for version younger 1.16.

    So my questions ist: How can I enable indirect GLX contexts (X-server and nvidida driver) in my ubuntu 14.04 LTS installation to get things working as expected from a X-server.

    Thank you for any help!

    cmks

    Here is the output of glxgears, maybe that helps:

    [email protected]:~# LIBGL_DEBUG=verbose glxgears 
    libGL: screen 0 does not appear to be DRI2 capable
    libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
    libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
    libGL: Can't open configuration file /root/.drirc: No such file or directory.
    libGL: Can't open configuration file /root/.drirc: No such file or directory.
    libGL error: No matching fbConfigs or visuals found
    libGL error: failed to load driver: swrast
    X Error of failed request:  BadValue (integer parameter out of range for operation)
      Major opcode of failed request:  154 (GLX)
      Minor opcode of failed request:  3 (X_GLXCreateContext)
      Value in failed request:  0x0
      Serial number of failed request:  35
      Current serial number in output stream:  37
    
  • cmks
    cmks about 8 years
    glxdemo, glxheads and glxinfo are working now. glxgears starts but shows only the first frame. I guess it is related to "Running synchronized to the vertical refresh." There are still the messages libGL error: No matching fbConfigs or visuals found and libGL error: failed to load driver: swrast
  • cmks
    cmks about 8 years
    The libGL errors are caused by the try to use DRI. Setting LIBGL_ALWAYS_INDIRECT=1 prohibits using of DRI in then there are no error messages. But glxgears still only shows one frame
  • David Foerster
    David Foerster almost 7 years
    Welcome to Ask Ubuntu! I recommend to edit this answer to expand it with specific details about where to add this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
  • ArcaneDominion
    ArcaneDominion over 6 years
    My xorg.conf keeps getting overwritten everytime I restart lightdm.
  • Ben Middleton
    Ben Middleton over 6 years
    Seems like the right setting is Option "IndirectGLX" "on". According to this, enableIndirectGLX must evaluate to TRUE so the BadValue error is not returned. The default is: FALSE = -iglx (on command line). So on of either set: +iglx command line option, OR IndirectGLX "on" or equivalent "truthy" value
  • Ben Middleton
    Ben Middleton over 6 years
    Nvidia docs for the binary drivers say there is another option AllowIndirectGLXProtocol for the same thing. However, their docs are somewhat confusing, because they mention the BadValue error will be returned with their setting name as AllowIndirectGLXProtocol = "true". This is completely opposite of what they say later "The NVIDIA GLX implementation will prohibit creation of indirect GLX contexts if AllowIndirectGLXProtocol option is set to False." So it's confusing, and maybe docs are wrong?
  • Steve Dee
    Steve Dee almost 6 years
    Could your glxgears crash be: bugs.freedesktop.org/show_bug.cgi?id=99555 ? Looks like IGLX is broken in Xorg for about a year :(
  • gerardw
    gerardw almost 6 years
    @ArcaneDominion Put commands in a file in /usr/share/X11/xorg.conf.d (at least on xubuntu 16.04)
  • benathon
    benathon about 3 years
    Can you clarify if you edited the client (the computer which run ssh -X) or the server (the computer with the ssh server)?