GALLIUM_HUD: FRAPS-like FPS overlay for Linux

I have long been looking for a simple way to display the current FPS in games (without direct support in the game), similar to what FRAPS or other tools do in Windows. For Linux, I haven’t had too much luck. There are not many tools for this and usually there are some problems with them – either they are not packaged and complication is difficult, or they don’t work reliably, or they can’t display FPS overlay in the game, just log to a file. But this weekend, I have finally been lucky.

I have stumbled upon an older article from Phoronix: Gallium3D Gets A Heads-Up Display For Information. Gallium3D is a graphics acceleration framework that is currently used by radeon and nouveau drivers. By simply setting an environment variable, you can get a live on-screen overlay displaying lots of useful information:

gallium-fraps

This is pretty amazing and it does exactly what I was looking for. The usage is really simple – to see the available options, just run:

$ GALLIUM_HUD="help" glxgears
Syntax: GALLIUM_HUD=name1[+name2][...][:value1][,nameI...][;nameJ...]

  Names are identifiers of data sources which will be drawn as graphs
  in panes. Multiple graphs can be drawn in the same pane.
  There can be multiple panes placed in rows and columns.

  '+' separates names which will share a pane.
  ':[value]' specifies the initial maximum value of the Y axis
             for the given pane.
  ',' creates a new pane below the last one.
  ';' creates a new pane at the top of the next column.

  Example: GALLIUM_HUD="cpu,fps;primitives-generated"

  Available names:
    fps
    cpu
    cpu0
    cpu1
    cpu2
    cpu3
    samples-passed

In Fedora 20, only basic options like fps and cpu are available. In Fedora Rawhide with newer graphics stack, there are many more options. But I’m fully content with just the basic ones. Now I can run games like this:

$ GALLIUM_HUD="fps,cpu+cpu0+cpu1+cpu2+cpu3:100" mygame

And I have pretty two graphs of FPS and CPU usage. You can run steam the same way, and then see the overlay on each game started from it. And, as a bonus, you can even run totem or vlc (with GL output) like this and see actual FPS of your video rendering 🙂

I’m really excited about this. This is how I imagine a modern operating system to look like – useful features directly integrated into its core and very easily accessible (hell, it can’t get even easier than setting an environment variable!). Thanks Marek Olšák and AMD for implementing this. You really made my day.

The only drawback is that because it’s implemented in Gallium3D, it works only on Gallium3D-enabled drivers, which means opensource AMD and Nvidia drivers. No binary drivers and no Intel drivers can benefit from this. Marek explained that it had been very simple to implement this inside Gallium3D, but it would be very tricky to implement this on a level that would affect all the drivers. So there you have it, the opensource drivers now have a killer feature that proprietary drivers don’t 🙂 Just the Intel situation is unfortunate, maybe they’ll reconsider this some time in the future.

Enjoy.

Flattr this

3 thoughts on “GALLIUM_HUD: FRAPS-like FPS overlay for Linux

    1. This is a tool for powerusers. If you don’t know to operate a terminal and run processes (e.g. find a game binary you want to run), you don’t have sufficient knowledge to use this. I recommend to find some newbie tutorial on how to start using the command line. Then it will get clearer.

Leave a Reply (Markdown syntax supported)