VirtualGL: Difference between revisions

From Leo's Notes
This page was last edited on 30 December 2021, at 01:12.
m Added categories and navbox
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


==Installation==
==Installation==
Download the RPM packages from VirtualGL's repository (on SourceForge) and install it. You may then use the included helper script at <code>/opt/VirtualGL/bin/vglserver_config</code> to set up your system. The script writes to various places., including <code>/etc/security/console.perms</code>, <code>/etc/modprobe.d/virtualgl.conf</code>, <code>/etc/X11/xorg.conf.d/99-virtualgl-dri</code>.


#Download the .rpm packages from VirtualGL's repository (on SourceForge) and install it.
Applications using VirtualGL are executed using the <code>vglrun</code> script which injects a library that redirects OpenGL calls so they render on a local target display (the <code>VGL_DISPLAY</code>). Because each Xorg server uses a Xauth cookie for authentication, <code>vglrun</code> will also try to read this Xauth cookie from <code>/etc/opt/VirtualGL/vgl_xauth_key</code>. For VirtualGL to work, we also need to write the Xauth cookie at this location for the screen the user is trying to render to.
#Run the configuration helper script at <code>/opt/VirtualGL/bin/vglserver_config</code>. You will be asked some questions:
 
#*If using VNC with TurboVNC or TigerVNC, do not disable XTEST extension
The <code>vgl_xauth_key</code> file can be created using the <code>/usr/bin/vglgenkey</code> script or manually using <code>xauth</code>. If using a login manager like LightDM or GDM, you will need to have the login manager run the <code>vglgenkey</code> script on startup. For systems with multiple GPUs, you will need to start a Xorg server on each GPU and have the <code>vgl_xauth_key</code> contain every cookie or somehow setup the user's xauth cookie list prior to running <code>vglrun</code>.
#*You may restrict certain users access to the <code>vglusers</code> group when prompted.
 
#*The script writes to various places., including <code>/etc/security/console.perms</code>, <code>/etc/modprobe.d/virtualgl.conf</code>, <code>/etc/X11/xorg.conf.d/99-virtualgl-dri</code>
<br />
#I had issues with GDM working with VirtualGL. Install LightDM and configure the seats to generate a key. {{Highlight
 
=== Using the login manager's X11 server ===
 
==== LightDM ====
Install LightDM and configure the seats to generate a key. {{Highlight
| code = [Seat:seat0]
| code = [Seat:seat0]
display-setup-script=/usr/bin/vglgenkey
display-setup-script=/usr/bin/vglgenkey
| lang = text
| lang = text
}}
}}
#After restarting your login manager, verify that <code>/etc/opt/VirtualGL/</code> has a key file.


If you need to tweak <code>xorg.conf</code>, you may generate one using Nvidia's <code>nvidia-xconfig</code> utility. You may wish to specify the device the screen is to use by looking up the PCI bus ID and passing it as an argument. Eg:
=== Starting X11 Manually ===
{{highlight|lang=terminal|code=
This method gives you full control over which Xorg server starts on which GPU.
 
Create a <code>xorg.conf</code> file. You may generate one using Nvidia's <code>nvidia-xconfig</code> utility, but this tool doesn't support multiple GPUs. It's a good starting point however, because you just need to duplicate the Screen/Device sections for each of the additional GPUs you want to use with VirtualGL.{{highlight|lang=terminal|code=
# nvidia-xconfig --use-display-device=none --busid="PCI:6:0:0"
# nvidia-xconfig --use-display-device=none --busid="PCI:6:0:0"
}}
}}


 
Create an xauth cookie for each X11 server and then start each X11 server. Merge all cookies into the <code>vgl_xauth_key</code> file so vglrun works.
==Usage==
==Usage==
The idea with VirtualGL is that the program you wish to have GPU acceleration renders locally (ie. the remote host that's running the login manager) and VirtualGL then copies the framebuffer back to you. As a result, anything you do run with VirtualGL can appear on the local display which could be a security risk for workstations (such as in a lab setting).
The idea with VirtualGL is that the program you wish to have GPU acceleration renders locally (ie. the remote host that's running the login manager) and VirtualGL then copies the framebuffer back to you. As a result, anything you do run with VirtualGL can appear on the local display which could be a security risk for workstations (such as in a lab setting).
Line 33: Line 39:
*<code>VGL_LOGO</code> will print 'VGL' on the window to show that it's rendering with VirtualGL.
*<code>VGL_LOGO</code> will print 'VGL' on the window to show that it's rendering with VirtualGL.


<br />
 
{{Navbox Linux}}
[[Category:Linux]]
[[Category:LinuxUtilities]]

Latest revision as of 01:12, 30 December 2021


Installation

Download the RPM packages from VirtualGL's repository (on SourceForge) and install it. You may then use the included helper script at /opt/VirtualGL/bin/vglserver_config to set up your system. The script writes to various places., including /etc/security/console.perms, /etc/modprobe.d/virtualgl.conf, /etc/X11/xorg.conf.d/99-virtualgl-dri.

Applications using VirtualGL are executed using the vglrun script which injects a library that redirects OpenGL calls so they render on a local target display (the VGL_DISPLAY). Because each Xorg server uses a Xauth cookie for authentication, vglrun will also try to read this Xauth cookie from /etc/opt/VirtualGL/vgl_xauth_key. For VirtualGL to work, we also need to write the Xauth cookie at this location for the screen the user is trying to render to.

The vgl_xauth_key file can be created using the /usr/bin/vglgenkey script or manually using xauth. If using a login manager like LightDM or GDM, you will need to have the login manager run the vglgenkey script on startup. For systems with multiple GPUs, you will need to start a Xorg server on each GPU and have the vgl_xauth_key contain every cookie or somehow setup the user's xauth cookie list prior to running vglrun.


Using the login manager's X11 server

LightDM

Install LightDM and configure the seats to generate a key.

[Seat:seat0]
display-setup-script=/usr/bin/vglgenkey

Starting X11 Manually

This method gives you full control over which Xorg server starts on which GPU.

Create a xorg.conf file. You may generate one using Nvidia's nvidia-xconfig utility, but this tool doesn't support multiple GPUs. It's a good starting point however, because you just need to duplicate the Screen/Device sections for each of the additional GPUs you want to use with VirtualGL.

# nvidia-xconfig --use-display-device=none --busid="PCI:6:0:0"

Create an xauth cookie for each X11 server and then start each X11 server. Merge all cookies into the vgl_xauth_key file so vglrun works.

Usage

The idea with VirtualGL is that the program you wish to have GPU acceleration renders locally (ie. the remote host that's running the login manager) and VirtualGL then copies the framebuffer back to you. As a result, anything you do run with VirtualGL can appear on the local display which could be a security risk for workstations (such as in a lab setting).

To run a specific application with VirtualGL, use the vglrun command. To help debug issues, use the +v flag to enable verbose logging.

A few environment variables you should be aware of:

  • VGL_DISPLAY should point to the local display with the login manager. (eg. :0)
  • DISPLAY or the -display option should be set to the target display (eg. :1.0, or whatever your display is in a VNC session)
  • VGL_VERBOSE enables debugging
  • VGL_LOGO will print 'VGL' on the window to show that it's rendering with VirtualGL.