|
|
Subscribe / Log in / New account

LCA: Linux gaming at last

By Michael Kerrisk
February 6, 2013

At the beginning of his talk on Linux game development at linux.conf.au 2013, Eric Anholt noted that his original motivation for getting into graphics driver development was that he wanted to be able to play games on alternative operating systems. At that time, there were a few games available, but the graphics drivers were in such a poor state that he ended up working on drivers instead of playing games. Thus, he has now been working in Intel's graphics driver team for seven years; currently, he works mainly on Mesa's OpenGL graphics drivers.

Eric's talk took the form of a short review of some recent history in Linux game development followed by a description of his experiences in the Intel open source graphics driver team working with Valve Software to port the Steam game platform to Linux.

Recent history of game development on Linux

Eric started with a summary of significant changes that have taken place in the graphics stack over the last seven years. These changes include kernel mode setting and improvements to memory management so that multiple processes can reliably employ memory on the graphics card. On the OpenGL side, things have improved considerably. "Back when I started, we were about ten years behind". The then-current OpenGL version on Linux was 2.1, no modern games ran on Linux, and there was no OpenGLES on Linux. However, by now, Linux supports OpenGL 3.1 and has reached Khronos-certified OpenGLES 2.0 conformance, and Open GLES 3.0 certification seems to be quite close.

Development of open source games seems to have lagged. Eric suggested a number of reasons for this. One of these is that creating a game requires building a multi-talented team composed of artists, developers, and designers. It's difficult to put a team like that together. And then, even if one does manage to assemble such a team, it's hard to agree on a direction: when it comes to game design, the design space is so large that it can be difficult to agree on what you are creating. Finally, the move into open source game development means that you spend less time doing the thing you want to do: playing games.

Nevertheless, there have been a few open source games, such as etracer (Extreme Tux Racer), Neverball, Xonotic, Foobillard, and Wesnoth. In addition, there were closed source games such as Quake (later open sourced), Unreal Tournament 2004, Loki, Minecraft, and whatever users could force to run with Wine.

In May 2010, the Humble Indie Bundle appeared. The concept was a package of games made available DRM-free, with the user choosing the price that they would pay. "They've actually released some surprisingly good games for Linux." One of those games was Braid, and Eric noted that the developers who participated in Humble Bundle learned an important lesson from an earlier attempt to port that game to Linux.

The developer of Braid, Jonathan Blow, made a blog post asking for help on how to port Braid to Linux, asking questions such as "how do I deal with mouse grabs, so that mouse clicks only go to the game window?" and "how do I output sound?" The community did try to help: in all, the blog post got 251 responses, many of them containing directly conflicting advice. In response, the developer gave up: he couldn't justify spending the time to determine the correct way to do the port for what was a small target market.

The lesson that the Humble Bundle developers learned from the Braid experience was that game developers should not be burdened with the task of porting games. So instead, they employed Ryan C. Gordon, a developer who had already ported a number of games to Linux, to port all of their games. This approach has been surprisingly successful at quickly getting games to run on Linux.

Working with Valve on the Linux port of Steam

There have been petitions for Valve Software to port Steam to Linux for as long as Steam has been around, Eric said. The Intel graphics driver team started working with Valve Software in July 2012. During the porting project, the Intel team had access to the Steam source code and worked with Valve on both tuning Steam to work better with the Mesa graphics library and tuning Mesa to work better with Steam. The closed beta test for the port was started in November 2012, and the open beta started in December. The port included the Steam's Source engine and the game Left For Dead 2.

The cooperative work between the graphics developers and Valve proved to be quite productive, but in the process, the graphics developers learned about a number of things that Valve found really disappointing. The first of these disappointments concerned ARB_debug_output. This is an extension in the Windows development environment for OpenGL that provides a general event logging infrastructure between the graphics layer on one side and middleware and applications on the other side. This is an important debugging tool in the Windows environment, "where you don't really have the console so much". There is an implementation of ARB_debug_output in Mesa, but it is rudimentary, supporting only two event types.

Another major disappointment concerned bad debugging and performance-measurement tools. The Valve developers described the tools they used for debugging on Windows, and wanted to know what equivalents existed on Linux. In response, the graphics developers were excited to show Valve an API-tracing tool that they had developed. API tracing is a technique that is extremely useful for driver developers because it allows them to obtain a reproducible trace of the graphics operations requested by the application. This means driver developers can get the application out of the way while they replay the trace in order to debug problems in the driver or improve the driver's performance. However, this sort of low-level tool provides little assistance for analyzing performance at the application level.

By contrast, Windows has some good tools in this area that allow the application programmer to insert tracepoints to track application steps such "starting to draw the world", "starting to draw a figure", and "starting to draw a helmet". This enables the application developer to obtain a hierarchical view of performance and determine if (say) drawing helmets takes a long time. Linux has to do a lot to catch up in this area.

The Valve developers also complained that Mesa was simply too slow. Many of the code paths in Mesa are not well optimized, with enormous switch statements containing nested conditionals. One possible solution is to offload some of the graphics work onto a separate thread running on a different core. Some work has been done in this area, but, so far, performance is no better than for the existing single-threaded approach. More work is required.

Notwithstanding the disappointments, there were other aspects of working on Linux that the Valve developers loved. For example, they greatly appreciated the short development cycles that were made possible when using open source drivers. Although the support for ARB_debug_output was poor on Linux, the Valve developers were impressed when Eric was able to quickly implement some instrumentation of driver hotspots, so that the driver would log messages when the application asked it to carry out operations that were known to perform poorly. The Valve developers were also surprised that the logging could be controlled by environment variables, so that the same driver would be used in both quiet and "logging" mode.

A final pleasant surprise for the Valve developers was that drivers could be debugged using breakpoints. That possibility is unavailable with closed source Windows drivers. More generally, the Valve developers don't have much insight into the closed source drivers that they use on Windows (or, for that matter, closed source drivers on Linux). Thus, they have to resort to experimentation to form mental models about performance problems and how to get around them.

Concluding remarks

For gaming enthusiasts, the announcement by Valve—one of the largest producers of game software—that Steam would be ported to Linux was something of a watershed moment. The Linux gaming landscape is poised to grow much bigger, and even those of us who are not gamers can reflect that a much-improved games ecosystem will at the very least widen interest in Linux as a platform for desktop computer systems.

Index entries for this article
Conferencelinux.conf.au/2013


to post comments

LCA: Linux gaming at last

Posted Feb 7, 2013 5:10 UTC (Thu) by dirtyepic (guest, #30178) [Link] (1 responses)

Is there audio/video of this talk available anywhere?

LCA: Linux gaming at last

Posted Feb 7, 2013 7:36 UTC (Thu) by bo (guest, #56215) [Link]

LCA: Linux gaming at last

Posted Feb 7, 2013 10:10 UTC (Thu) by ortalo (guest, #4654) [Link] (6 responses)

Zero-AD (aka 0ad) is also a pretty interesting (and IMHO unique) example of a hackable and open source game running on Linux (http://play0ad.com/ or http://wildfiregames.com/0ad/ ).

BTW, it incorporates a performance measurement approach that offers the hierarchical view suggested in the article. But that was built-in by the original developpers (press F6 IIRC).

FWIW, they are looking after SpiderMonkey Javascript optimization gurus... Yes, the game logic itself is in Javascript: nice performance testcase isn't it?

LCA: Linux gaming at last

Posted Feb 11, 2013 21:58 UTC (Mon) by anholt (guest, #52292) [Link] (5 responses)

Yeah, I need to spend some time on 0ad. It's got a bug on our driver currently and I need to get a trace and start trimming that down to a testcase. I don't know how many are playing it currently, but it sure looks like the kind of game I'm interested in, at least :)

One of the things I forgot to mention that's really cool about working with Valve is that, thanks to it being an online service, they collect a lot of metrics. With approval for access, you can get at information like what distribution of chips is in use by valve users, or what share Linux is among their users overall. It's reminded me to give more love to the older chips than I had been, as painful as they are to work on. Things like debian's popcon package are close to this, except it doesn't get active usage information like they do (I've got neverball installed, but I sure don't play it), and each individual distro's popcon equivalent wouldn't be much information on its own.

LCA: Linux gaming at last

Posted Feb 13, 2013 8:54 UTC (Wed) by mgedmin (subscriber, #34497) [Link] (4 responses)

Popcon does track active usage information, from atime:
http://popcon.debian.org/FAQ

This won't work if you've got the filesystem mounted with noatime, but it will work if you use relatime.

LCA: Linux gaming at last

Posted Feb 13, 2013 19:54 UTC (Wed) by anholt (guest, #52292) [Link] (3 responses)

Very cool! Of course, it doesn't get the stuff outside of debian (steam, HIB), but here's what I managed to get out of it for "games people are using", most popular first:

2231 gnuchess 44230 1890 35622 6677 41 (Oliver Korff)
2810 aisleriot 15285 1187 10572 3525 1 (Josselin Mouette)
2857 yakuake 2305 1145 1047 113 0 (Ana Beatriz Guerrero Lopez)
3390 mahjongg 15024 755 10618 3466 185 (Josselin Mouette)
3424 kpat 7550 738 6137 669 6 (Debian Qt/kde Maintainers)
3604 gnome-sudoku 15110 658 10807 3644 1 (Josselin Mouette)
3628 chromium-bsu 1638 647 835 156 0 (Debian Games Team)
3669 gnomine 15078 633 10814 3629 2 (Josselin Mouette)
3771 glchess 14897 590 10799 3506 2 (Josselin Mouette)
3789 blinken 6667 581 5651 432 3 (Debian Qt/kde Maintainers)
3810 gnibbles 14731 574 10652 3503 2 (Josselin Mouette)
3825 lightsoff 14069 569 10014 3485 1 (Josselin Mouette)
3859 glines 14795 557 10723 3513 2 (Josselin Mouette)
3896 khangman 6644 548 5644 450 2 (Debian Qt/kde Maintainers)
3922 quadrapassel 14768 540 10696 3530 2 (Josselin Mouette)
3941 kanagram 6633 534 5648 448 3 (Debian Qt/kde Maintainers)
3955 gnect 14814 531 10752 3529 2 (Josselin Mouette)

If I try to filter for things I know of as being "GL games":

2857 yakuake 2305 1145 1047 113 0 (Ana Beatriz Guerrero Lopez)
3628 chromium-bsu 1638 647 835 156 0 (Debian Games Team)
3771 glchess 14897 590 10799 3506 2 (Josselin Mouette)
4574 supertuxkart 1847 377 1331 139 0 (Debian Games Team)
5285 openarena-data 1354 273 925 141 15 (Debian Games Team)
5466 extremetuxracer 2231 251 1859 120 1 (Debian Games Team)
5554 wesnoth-1.10-core 1200 246 831 122 1 (Debian Games Team)
7056 torcs 1142 142 934 66 0 (Rudy Godoy)
7157 nexuiz 842 137 647 56 2 (Debian Games Team)
7208 0ad 759 134 535 90 0 (Debian Games Team)
7446 warzone2100 859 125 685 47 2 (Debian Games Team)
29 sauerbraten 546 103 419 23 1 (Debian Games Team)
8830 bzflag-client 720 83 592 45 0 (Tim Riker)
9497 gl-117 500 71 396 32 1 (Cédric Delfosse)
9077 billard-gl 648 78 529 40 1 (Debian Games Team)
9562 foobillard 619 70 513 35 1 (Debian Games Team)
31 assaultcube 261 68 169 24 0 (Debian Games Team)
...

It's interesting to see the long tail of games being run. I'd be interested in some of the time-spent information you get out of steam, and whether this is just 68 people having run all these games for testing or if many people are playing different stuff, but it's at least more information than I thought we had. It'll help me balance priorities of bugs among these games.

None of this GL stuff is as popular as solitaire, though.

LCA: Linux gaming at last

Posted Feb 13, 2013 20:03 UTC (Wed) by andrel (guest, #5166) [Link]

There is also Ubuntu Popcon which seemingly has a larger pool of contributors.

LCA: Linux gaming at last

Posted Feb 14, 2013 11:15 UTC (Thu) by micka (subscriber, #38720) [Link] (1 responses)

In your list you have 'yakuake'... This is not a game but a terminal emulator ;)

LCA: Linux gaming at last

Posted Feb 14, 2013 16:22 UTC (Thu) by anholt (guest, #52292) [Link]

Oh, right. I remember hearing about that long ago and thinking... quake-style terminal emulator? Why is quake's terminal particularly interesting?

Economical remark LCA: Linux gaming at last

Posted Feb 7, 2013 10:19 UTC (Thu) by ortalo (guest, #4654) [Link]

Well, an improved games ecosystem may "widen interest in Linux" indeed, but I selfishly see another practical advantage: it would allow me to entirely remove that other operating system and save around 50-100 euros for its license, paid only to have access to conventional PC games.
And I may save a *lot* more in the forthcoming years if the kids agree...

Yep, that's real money so it can be put on the table. But kids are extremely strict on delivery in case you don't know... ;-)

LCA: Linux gaming at last

Posted Feb 7, 2013 16:31 UTC (Thu) by dashesy (guest, #74652) [Link]

Another major disappointment concerned bad debugging and performance-measurement tools.
I am wondering what performance measuring tools they use on Windows, and if paying is an option then why "Intel VTune" or "AMD Catalyst" could not fit the bill. It would be really educating if they can try different ones (including open source KernelShark). Since gaming is very demanding an overview on performance measuring techniques on Linux will be helpful for all of us.

LCA: Linux gaming at last

Posted Feb 9, 2013 2:20 UTC (Sat) by el_presidente (guest, #87621) [Link]

Meanwhile, X (1.13.1) still can't load the nvidia drivers automatically. Apparently the server wants to piss off the user by trying to load everything except the right driver.

Installing Steam for Linux

Posted Feb 9, 2013 2:42 UTC (Sat) by hamish (guest, #6282) [Link] (1 responses)

As the result of this talk, I got all excited about installing Steam and buying some of those cute games that my friends keep talking about. Only to discover that it basically only supports 32bit!

Yes, I know about multi-arch and chroot installs - I'm sure I could get it working, but that was not the source of my annoyance.

I had a look around and found a vague comment from last August where valve says "...will run on 64-bit Linux later", so perhaps all is not lost for those of us running 64bit systems (which I assume is almost everyone - certainly anyone with a recent gaming-capable computer should be running 64bit, otherwise they would probably be experiencing issues with physical memory address space)

Since this was not mentioned in the article (nor in the talk, so this is not an omission), this quick note might inform people - before they run off to install Steam...

Installing Steam for Linux

Posted Feb 12, 2013 12:55 UTC (Tue) by ssam (guest, #46587) [Link]

installed fine for me on amd64 fedora 18. i used these instructions https://russellbryantnet.wordpress.com/2012/12/07/install...

LCA: Linux gaming at last

Posted Feb 11, 2013 6:33 UTC (Mon) by Lumag (subscriber, #22579) [Link] (1 responses)

I was one of early adopters as Steam went to public beta. The thing that still depresses me is the lack of interest/activity from idSoftware. They had their major titles running on Linux long ago. But I can not install any Quake or Doom variant under Steam-for-Linux. Disgusting.

LCA: Linux gaming at last

Posted Feb 14, 2013 19:35 UTC (Thu) by obrakmann (subscriber, #38108) [Link]

I looks like that won't change: http://www.pcgamer.com/2013/02/06/john-carmack-claims-emu....
Really disappointing.

LCA: Linux gaming at last, thanks to Kickstarter

Posted Feb 14, 2013 9:25 UTC (Thu) by kragil (guest, #34373) [Link]

The Humble Bundle was a good first step, but what really made good games happen on Linux is that people started demanding Kickstarter funded games to have a Linux port.

Funding games via Kickstarter is all the rage now, that is really good for Linux gaming.

Sure Steam, Humble Bundle and middleware like Unity (the game engine) and Moai also helped a lot.

2013 will surely be the year of Linux gaming ;-)


Copyright © 2013, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds