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

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

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!


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

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.