Linux gaming platform = Linux kernel + middleware. Game engines could be programmed to take advantage of all the hardware features, but they are not because they have to work through the software layers and APIs that stand between themselves and the hardware.

After reading User:ScotXW/Linux as platform, it is time to ask the question: Is the Linux kernel-based family of operating systems suited as platform for computer gaming?

This is user-space article towards writing a better Linux as a gaming platform-article.


Abstract

Developing video games for Linux

  1. Linux API
  2. windowing system: Wayland + XWayland
  3. abstraction APIs for the desktop:
  4. abstraction APIs for video game development:
  5. abstraction APIs for professional audio production:

Distributing video games for Linux

  1. compile against Linux ABI
  2. package
    1. package RPM or DEB and distribute over package management system using your own software repository (monetize how?)
    2. package for and distribute over Steam
    3. Ubuntu Software Center
    4. other?
      1. Google Play has been only available for their Android not for [[[SteamOS]], Debian, etc.

Playing video games on Linux

  1. use PMS to install free and open-source video games available in the software repositories of your Linux distribution
  2. use Steam to purchase and install games distributed by Valve
  3. ...

What it offers

People have been playing free as well as commercial games on Linux since at least 1994: e.g. Doom. Yet, very few games have been ported to Linux. Why? DirectX is only available for Windows and also because Linux distribution have not cared about a long-time stable ABI. So for a very long time, 'Linux as a gaming platform has been neglected. A proof for this is this rather long list: List of game engine recreations; these talented people either can't afford to purchase Windows license, or they insist of playing those games on Linux. So Ryan C. Gordon is not the only one who has experience in game programming on Linux, though he may have extensive experience in porting games from Windows to Linux. ;-) "Do not use nasm; you can use readelf to show all libraries you link to."

Game developing for PC operating systems

Not everything is executed on the CPU... some data is sent to the GPU, along with GPU instructions to be executed on the GPU. The results are stored in a framebuffer, the display controller sends it to the screen.
Rendering calculations are outsourced over OpenGL to the GPU to be done in real-time. DRM/GEM/TTM regulate access and do book-keeping. It all seems superfluous when only a fullscreen 3D game is running, but hardware access is a fundamental kernel task.

What serious game developers want instead

Not the performance (fps) but a low-enough latency is paramount for a good gaming experience. When a button-trigger takes more then 30 ms to result something on then screen, most gamers start complaining. Some Sample-and-hold screens, especially television sets, can add significant latency.

All serious game developers want OS developers to take a different approach towards rendering APIs & device drivers and have been talking to the graphics hardware vendors for years to get this: a platform, that does not stand in the way and gives a game developer full access to the hardware if he wishes.

Especially Mantle offers a real benefit, and the laggard at AMD keeps it close for too long, waits to add Mantle to their Linux drivers too long, and benefit Microsoft Windows.

Video game consoles

Video game consoles have been designed conforming to the needs and wants of game developers. They additionally enforce some hard-to-break copy-protection. However, PC games do not exist, because it is easier to circumvent the copy protection but because some people do buy PC games. Curiously with the newest Wii U homebrew is hard to achieve, while simply circumventing the copy protection to pirate games is simple!!![3] The hardware is usually subsidized. Yet the PC as a gaming platform still exists. And while sales of desktop computers are said to drop, and many developers/publishers denounced exclusive titles, there are PC games. Why?

PC gaming on AMD Steam Machines

"Considering that Intel is perfecting it's 14nm production with second generation products already out of the gates while AMD is still stuck with 28nm sais a lot about the current competition situation.

After showing off with the XBox One and the PlayStation 4 but failing to bring Mantle to both..., why hasn't AMD brought out an APU with a TDP of 300 Watt combining:

Why hasn't AMD

Instead we have lousy bottom-to-middleclass APU's with barely "good enough for Sims" GPU's that don't spark anyones interest."

The good

The bad

Some sample-and-hold screens, especially TVs, can add significant latency.

The ugly

The hardware

Hardware CPU GPU Memory
Product Price Microarchitecture Cores Frq (GHz) Microarchitecture Config core1 Compute Units2 Frq (MHz) Type Amount Bus width (bit) Bandwidth (GB/s) Zero-copy
PlayStation 4 € 400,– customized Jaguar 2x4 1.6 GCN 1.1 1152:?:32 18 800 GDDR5-5500 8 GiB 256 176[4] Yes
XBox One € 500,– customized Jaguar 2x4 1.75 GCN 1.1 768:?:16 12 853 DDR3-2133 +
ESRAM-3412
8 GiB +
32 MiB
256
1024
68.3
204
No
Wii U € 240,– Espresso 3 1.24 Latte 320:16:4 550 DDR3-1600 +
eDRAM
2 GiB +
32 MiB
64
1024
10.3
70
?
Radeon R7 260 ("Bonaire") € 100,– GCN 1.1 768:48:16 18 1000 GDDR5 1 GiB 128 96 Yes
Radeon R7 265 "(Curaçao PRO)" € 120,– GCN 1.1 1024:64:32 20 900 GDDR5 2 GiB 256 179.2 Yes
Radeon R9 270 "(Curaçao PRO)" € 140,– GCN 1.1 1280:80:32 20 900 GDDR5 2 GiB 256 179.2 Yes
Radeon R9 290X ("Hawaii XT") € 330,– GCN 1.1 2816:176:64 44 1000 GDDR5 4 GiB 512 320 Yes
GeForce GTX Titan Black € 855,– Kepler 2880:240:48 15 SMX 890 GDDR5 6 GiB 384 336.4 No
A10-7850K (Kaveri, FM2+, 95W) € 150,– Steamroller 43 3.7 GCN 1.1 512:32:8 8, R7 720 DDR3-2133 128 35.32 Yes
Core i7 4770R (BGA1364) $ 392,– Haswell 4 3.2 Iris Pro Graphics 5200 160:8:4 40 EUs 1300 DDR3-1600
128MiB eDRAM
128 25.6
50
No
Athlon 5350 (Kabini, AM1, 25W) € 50,– Jaguar 4 2.05 GCN 1.0 128:8:4 2, R3 600 DDR3-1600 64 12.8[5] No
A6 6310 (Beema, 15W) ? Puma 4 2.0 GCN 1.1 128:8:4 2, R4 800 DDR3L-1866 64 15 No
Tegra K1 $ 192,– Cortex-A15 4 2.4 Kepler 192:8:4 1 SMX 950 DDR3L 2 GiB 64 17 No
Tegra M1 Cortex/Denver ? Maxwell 128:8:4? 1 SMM ? No[6][7][8][9]
Atom Z3580 ? Silvermont 4 2.13 PowerVR 6 (Rogue) G6430 ? 4 533 LPDDR3-1066 64 8.5 No

Various benchmarks

Memory hierarch of PlayStation 4

Why HSA is a big deal

Classical desktop computer architecture with a distinct graphics card over PCI Express. Bandwidths are shown, latencys are missing. Zero-copy between GPU and CPU not possible. High-priced with huge power consumption and highest performance. Significant performance lost to "layers of crap".
HSA-enable CPU and GPU allow pointer sharing over PCIe.
Partitioned main memory: a part of the system memory is allocated to the GPU exclusively, tero-copy not possible. Worst performance thinkable.
HSA-enabled unified main memory. We can do zero-copy by passing pointer.[10]. PS4 has this, XBox One does not! Definitely the future for mobile and low-power, but as the PS4 demonstrates, also the future on the desktop.

Memory bandwidth can be a huge limit to scaling processor graphics performance, especially since the GPU has to share its limited bandwidth to main memory with a handful of CPU cores. Intel's workaround with Haswell multi-chip modules was to pair the CPU/GPU with 128MiB of eDRAM yielding unimpressive 50GB/s additionally to the available 25GB/s from the main memory handled as victim cache to the L3 cache!

For me, because of zero-copy. Memory throughput is the bottleneck on low-power, low-price hardware![5] Gaming PCs have distinct graphics cards, with their distinct graphics memory. In other devices – mobile devices, Intel desktop APUs do, AMD's desktop APUs do, Nvidia's Tegra, the game consoles – the CPU and the GPU share the physical memory and access it through the same memory controller. Question is, whether this memory is partitioned or unified. Albeit from using highly clocked GDDR5 memory over 256-bit or wider channels like the PlayStation 4, zero-copy is obviously something we need to save precious bandwidth and also significant amounts of electrical current. With zero-copy, instead of copying large data blocks, we pass (copy) pointers referring to their location and we are done.

Heterogeneous System Architecture introduced pointer-sharing between CPU and GPU, i.e. zero-copy. Neither Intel nor Nvidia are not part of the HSA Foundation, and I am not aware that their products (Atom SoCs, Tegra K1) facilitate zero-copy through some own technology. Anyway, the software probably need to make active use of this possibility, so it needs to rewritten. The rendering APIs (Direct3D, OpenGL, Mantle) may need augmentations as well. The PS 4 uses GNM, GNMX and PlayStation Shader Language. Obviously Direct3D and OpenGL have gotten more and more alternatives.

Of course, given that the GeForce GTX Titan Black has 336.4 GB/s, while the Kaveri has 35.32 GB/s, zero-copy could offer only a small an advantage. How big is effort-to-performance ratio of HSA-facilitated zero-copy with a Kaveri-based computer? How big with the PlayStation 4?

Has anybody statistics on how many copy's between main memory and graphics memory could be saved? PCIe 3 does not seem to be the bottleneck, the system memory is. Why not do it like the PS 4?

The PlayStation 4 hardware, not the Sony walled garden, is IMHO really in the sweet-spot of price to computing power to power consumption. BUT maybe 2 years from now, maybe sooner, €400,– hardware with much more computing power will be available without the walled garden. Whether it runs Windows only, which is in the process of becoming a walled garden, or is capable of running Linux will be interesting for the hardware vendor.

Valve is pricing the PC gaming market as awesome, because it lacks a walled garden (Microsoft is rapidly changing that for the benefit of Linux), but also because people update their hardware more often then every 6 years. Some PC gamers also invest more into their hardware.

And while the Oculus Rift could be much more immersive then a 4K resolution display, all, the Rift, 4K resolution-display, and the Rift's successors need much more computational power than we can buy today! This is good news for at least Nvidia and AMD. Maybe Intel and Vivante as well. The Oculus Rift additionally needs a low-latency software stack, so no "cloud-computation-crap". A 4K resolution-display might not offer more fun then a 1080p display, but a 4K resolution Occulus Rift is probably far superior to a 1080p Occulus Rift! I do not see Kaveri-like computers generating the necessary power with 95Watt TDP and 35.32 GB/s for CPU and GPU. Kaveri-like computers are low-price systems, that simply generate more computing power due to removing the memory throughput-bottleneck partly or completely then similar priced systems without zero-copy. The PS4 costs € 400,– total, with casing and power-supply. So I am curious about hardware like the PS4, without the walled-garden stuff in one, two, three years from now. The GeForce GTX Titan Black costs € 850,–, way over what I am willing to pay for a mere graphics card. Kaveri-stuff, is all about price-to-power ratio ("bang for the buck") and power consumption-to-power ratio ("bang for the watt"). I'd rather invest less into IC, which could be replaced every two years, and more for the peripherals.

Adoption

Valve Corporation

Valve Corporation wants to establish Linux as gaming platform. They ported Steam to the Linux platform. Valve's motivation:

Rendering APIs

Moved to User:ScotXW/Rendering APIs

Multi-monitor

Yes, multi-monitor setup is supported on Linux at least by AMD Eyefinity & AMD Catalyst, Xinerama and RandR on both X11 and Wayland. Games e.g. Serious Sam 3: BFE.

Existing open-source engine and free content video games

User:ScotXW/Free and open-source software#Free and open-source game engines with free content

Tools to create game content:

Adoption of Linux as gaming platform by game engines

Main article: Linux as gaming platform § Adoption by game engines

Here is a table of games engine in current and future video games: (see more here: Template:Video game engines)

Note: Platform refers to the software, not to the hardware! The only hardware-parameter relevant are computing power and available peripherals (the Human–machine interfaces).

Hence it is tempting to mention PlayStation Vita, Pandora or Nvidia Shield. See maybe Template:Handheld game consoles. Especially Linux-powered devices, besides Homebrew and TiVo-like, are interesting, because they care for the development of the Linux platform, making the available computing power, the only barrier. That means, that a game engine that some solid performant Linux support, will run on any platform, such as the Pandora or its successors.

Game engine Interfaces Supported "platforms" Programming Licensing
Icon Name Rendering paths Audio, Input, etc. Linux Windows Mac OS X Sony Microsoft Nintendo Other Build Programming
language
Programming
language
bindings
Scripting FOSS License
Vulkan OpenGL Direct3D SDL/SFML/etc. DirectX PS3 PS4 XBox 360 XBox One Wii Wii U
Frostbite Frostbite WIP Yes ? Yes Yes Yes Yes ? ? ? ? ? ? ? C? C++? ? No proprietary
id Tech 6 Yes ? ? Yes WIP Yes Yes Yes Yes Yes Yes ? ? ? C++, AMPL, Clipper ? ? No proprietary
CryENGINE CryEngine WIP Yes Yes ? Yes Yes Yes Yes ? ? ? ? ? ? ? C++? ? ? No proprietary
Unigine Unigine WIP Yes Yes ? Yes Yes Yes Yes ? ? ? ? ? ? ? C++? ? ? No proprietary
Unreal Engine Unreal Engine WIP Yes Yes ? Yes Yes Yes Yes ? ? ? ? ? ? ? C++? ? ? No proprietary
Unity Unity WIP Yes Yes ? Yes Yes Yes Yes ? ? ? ? ? ? ? C++? ? ? No proprietary
4A Engine WIP Yes Yes ? Yes Yes Yes Yes ? ? ? ? ? ? ? C++? ? ? No proprietary
dhewm3 WIP Yes ? SDL, OpenAL ? Yes Yes Yes Yes ? Yes ? ? ? ? CMake C++? ? ? Yes free and open-source
DarkPlaces engine an Id Tech 1-fork, adopted by Nexuiz and Xonotic
dhewm3 an id Tech 4-fork (Doom 3 engine)
iodoom3 another id Tech 4-fork
ioquake3 an id Tech 3-fork (Quake III engine)
OpenMW an open-source engine re-implementation of The Elder Scrolls III: Morrowind (Gamebryo) https://openmw.org/en/
RBDoom3BFG a community port of id Software's Doom 3 BFG Edition game to Linux.
Spearmint a further visually advanced version of IOquake3
Daemon a combination of the ioquake3 and ETXreaL open-source game engines with many advanced modifications, used by Unvanquished
Watermint a fork of the Spearmint engine that seeks to ship a realistic open-source game.

Future

John D. Carmack repeatably talked about (finaly) adopting ray-tracing over rasterizing in video games to do the rendering.

Technical POV

This article refers to doing the rendering-computation fast enough, so that the series of rendered images induce the illusion of movement in the human brain of the user. This illusion allows for the interaction with the software doing the calculations taking into account user input. The unit used for measuring the frame rate in a series of images is frames per second (fps). Different techniques for rendering exist, e.g. ray-tracing and rasterizing.

Technical Questions

Comparing

Why is the GeForce GTX 780 Ti (GK110-425-B1) a) slower then the GeForce GTX 680 (GK104-400-A2), and why is the b) discrepancy bigger? This kind of behavior proves how hard it must be to write graphics device drivers.

Then again the same behavior with AMD:

References

  1. ^ "Android Nears 80% Market Share In Global Smartphone Shipments".
  2. ^ a b "HID for 3.15". 2014-04-02.
  3. ^ http://fail0verflow.com/media/30c3-slides/#/
  4. ^ "Interview with PS4 system architect". 2013-04-01.
  5. ^ a b c "DDR3-800 to DDR3-1600 scaling performance AMD's Athlon 5350".
  6. ^ "No unified virtual memory in Maxwell".
  7. ^ http://www.anandtech.com/show/7515/nvidia-announces-cuda-6-unified-memory-for-cuda
  8. ^ http://www.gamersnexus.net/guides/1383-nvidia-unified-virtual-memory-roadmap-tegra-future
  9. ^ http://wccftech.com/nvidia-previewing-20nm-maxwell-architecture-unified-memory-architecture-gtc-2014-demo-upcoming-geforce-driver/
  10. ^ "Kaveri microarchitecture". SemiAccurate. 2014-01-15.