X
18247

OpenGL Direct Hardware Rendering on Linux

[ Please note:  Although this Help Article was written a number of years ago, and specific graphics hardware, drivers, operating systems, and X server references may be out of date, the basic concepts discussed in this article regarding OpenGL direct hardware rendering on Linux remain relevant. Direct hardware rendering should not be confused with IDL "Direct Graphics", which does not utilize OpenGL rendering. ]

Starting with version 6.0, IDL is capable of utilizing OpenGL direct hardware rendering on Linux systems that are equipped with the appropriate hardware and software. Direct Rendering Infrastructure (DRI) or Direct hardware rendering enables IDL to communicate directly with the graphics hardware instead of sending graphics data through the X server, resulting in performance that can be tens of times faster than going through the X server. If the hardware and software have been configured correctly, no additional action is required to allow IDL to use this faster rendering path for Object Graphics.

IDL and X / OpenGL Architecture



Similar architectures exist on other Unix platforms, but the internal details may vary due to the proprietary nature of these systems.

Discussion:

Determining if your system already has the required support

Some of the more recent Linux distributions may already be configured to support direct OpenGL hardware acceleration for some of the more popular video cards. Here is a quick way to determine if this is the case:

  • Start your X server
  • Run the command 'glxinfo'
  • Look for the "OpenGL renderer string"
  • if you see something like:

    OpenGL vendor string: VA Linux Systems, Inc
    OpenGL renderer string: Mesa GLX Indirect
    OpenGL version string: 1.2 Mesa 3.4.2


    then your system is using indirect rendering. You will need to configure your system for direct hardware rendering as described below.

  • If you see (for example):

    OpenGL vendor string: NVIDIA Corporation
    OpenGL renderer string: GeForce 256/AGP/SSE
    OpenGL version string: 1.4.0 NVIDIA 43.63


    then your system is probably configured correctly for direct OpenGL rendering.

As another "fun" test, run the command 'glxgears', which is often present in /usr/X11R6/bin, assuming an X installation based on XFree86. After a few seconds, the program will print a frame rate in your terminal window. If direct rendering is working, you should see frame rates higher than 200 or so. A video card such as an ATI Radeon 9700 Pro running on a 2.8 GHz Pentium 4 will run this demo in excess of 4000 frames per second. If the frame rate is down around 200 or less, then your system is probably not configured correctly for direct rendering or your graphics card and driver software are not working correctly.

There may be other games and programs that use OpenGL in your Linux distribution, such as 'tuxracer' and 'chromium' that can serve as additional test cases.

One encouraging trend is that more and more components of many Linux desktops are using OpenGL for some of their graphical interfaces and applets. This should increase the number of systems that are configured to use direct OpenGL without additional configuration at installation time.

Before calling Exelis VIS
It is important to verify that your configuration is correct as described above before expecting to see improved performance in IDL. Basically, if glxgears runs and runs fast, then IDL should as well.

Installing hardware accelerated drivers
Because of the large number combinations of hardware, drivers, X servers, and Linux distributions, Exelis VIS cannot publish up to date installation instructions for all situations. It is even difficult to discuss minimum requirements for versions of the required software. The best approach is to contact the vendor of your video card/chipset and obtain the latest Linux drivers, usually by visiting their website. If Object Graphics rendering performance is important to you, you may wish to verify with the vendor that they support direct hardware rendering in your environment before purchasing. The Linux distribution, version of XFree86, Linux kernel version, etc are all be important factors.

Our experiences [at the time this article was written] exposed no problems installing drivers on earlier versions of RedHat systems with both ATI and nVidia video hardware.

After downloading the driver software, follow the installation instructions correctly. In some cases, you may need your kernel sources so that the driver kernel module can be rebuilt. At the time this article was written, RSI [now Exelis VIS] found the installation instructions for ATI and nVidia drivers to be fairly complete and straightforward.

Troubleshooting
Exelis VIS cannot control driver quality, so you may have trouble with some drivers that might be buggy. Besides obtaining a driver update from the vendor, there are several things you can do to make IDL usable again in the presence of a buggy driver:

  • Read the documentation that came along with your driver software carefully. There may be a number of diagnostic tools or environment variables that you can set to provide some relief.
  • When using an X server based on XFree86, modifying the XFree86 configuration file may solve any problems. Consult the XFree86 documentation for details. Also, the XFree86 server startup log, usually found in /var/log, can provide many clues about the problem.
  • Set the LIBGL_ALWAYS_INDIRECT environment variable. This causes OpenGL to ignore IDL's request to use direct rendering and would then avoid any bugs that may exist in the direct path.
  • Configure your IDL session to use software rendering when required or code your IDL application to use software rendering. These details are covered in IDL documentation.
  • As a last resort, remove/rename the gl_driver shared library from your IDL installation (in the binary directory). This will keep IDL from attempting to use direct or indirect hardware rendering. IDL will instead perform all rendering itself and send the results to the X server with "2D" commands.
  • One expert IDL programmer reported in March 2004 on the IDL Newsgroup this promising workaround on a host running Fedora Linux:
    "If you're a user of a recent Linux (like Fedora), and you've experienced IDL crashes that post the following fatal error:

      Floating exception

    when attempting to use any of IDL's OpenGL 3D stuff (like the Demo->Itools, for example), you might try the following:

      setenv MESA_NO_ASM 1

    This disables some specific ASM code in the Mesa library which was causing these types of crashes for me. I use an ATI Radeon 7500 plus XFree86 4.3.0's Radeon drivers. With this environment variable set, IDL's 3D hardware rendering seems stable, and definitely executes much faster than the alternative software rendering option."

Review on 12/31/2013 MM, 2/5/2015 JU