Increasing opengl game performance

From LQWiki
Jump to navigation Jump to search

By tuning just about any hardware, you can usually get much better performance. 3D cards are no exception. This page will tell you about ways to boost performance without resorting to brute force over clocking methods. These options have not been tested using ATI or Nvidia drivers, only the open source drivers that ship with Xorg, so this page may not work with new hardware thats unsupported by the open source drivers.

Getting good 3D performance can be effected by a number of factors besides the graphics card itself, such as, the mainboard itself, memory, CPU, what version of Mesa you have, the drivers for the card, the drivers for your mainboard, harddrive speed. All these things can effect the condition and playability of 3D games under Linux.

Hardware

Hardware effects the total performance of a system, refer to Performance for more information, as this page focuses on more 3D specific tweaking.

X Configuration

This is a great place to start when it comes to getting the most out of that video card. First, make sure that your system boots into a text-based login, so that you have to manually type startx to start the X server. This will make it so that if you mess up your video settings beyond repair, you can still log in and switch them back to known good settings. Now, as root, open up your X configuration, for most users, this should be /etc/X11/xorg.conf. Locate the device section, for by ATI Radeon 9200SE it looks like this:

Section "Device"
    Identifier  "video"
    Driver      "radeon"
    Option      "AGPMode"         "4"
    Option      "ColorTiling"     "on"
#    Option      "AccelMethod"     "XAA"
    Option      "EnablePageFlip"  "on"
#    Option      "RenderAccel"     "on"
#    Option      "AGPFastWrite"    "yes"
EndSection

Only the Option statements matter, these are configuration options your video card might take. Notice how some of them are commented out. This is because they didn't work for me. Be careful here, some settings might cause the X server to not load, or work crappy, so test them well, and remember to boot into text mode, just in case these do mess up your X server.

The most important option is EnablePageFlip. Using glxgears as a crude method of benchmarking, it took performance from about 600FPS to 1030FPS. Its the best option for a quick speed increase.

AGPMode determines what AGP speed to use, X by default uses 1 as its a safe setting.

ColorTiling Not sure what it does, but it gives a small speed increase.

AccelMethod Valid options are XAA or EXA. XAA is the older, default rendering architecture, tested well and all. EXA is the new rendering architecture and might be buggy. EXA should give better performance, especially in the future when its more developed. Test them both and see what you prefer. Note: EXA disables some options, such as EnablePageFlip. Using glxgears to test this is not recommended, as EXA performs different under various conditions, and will produce lower FPS's in glxgears anyway.

AGPFastWrite Requires complaint hardware. See if it works for you, it didn't for me.

Also, make sure that X uses a 24-bit color depth or higher. Performance can suffer in some games if you use less. This is easy, locate the section Screen, make sure it has the line DefaultDepth 24.

DRI

DRI is how 3D gets done under Linux, and it has configuration options that we can play with. Install the driconf utility, it will give you a easy GUI to configure DRI. When playing with the options, you don't need to restart X. The best options to toy with are under the performance tab, don't fiddle with the others unless you know what your doing, or have good reason. To reset the options to their defaults, just delete the file ~/.drirc and restart driconf. Configuring this is essentially trial and error, see what works, what doesn't. Just a heads up tho, Synchronization with vertical refresh will kill the FPS of glxgears, it limits the FPS to the refresh of your screen, so again, use more tests then a simple glxgears, i recommend using your favorite 3D game that pushes your cards limits.

See also