iris: Add a new experimental Gallium driver for Intel Gen8+ GPUs
I believe it's finally time to merge my out-of-tree Iris driver into master. While it's not finished, we're up to nearly 800 patches, and so maintaining it out-of-tree is becoming a bit unruly...and it's in solid enough shape that it could benefit from being in-tree.
For now, Iris will build and install alongside i965 - with i965 remaining the default driver. Iris is still considered experimental.
More details below...
What is Iris?
The new "Iris" driver prototype is essentially our Mesa i965 driver reimagined and rebuilt from the ground up. Our main goal was to make the driver as efficient as possible, aiming for very low CPU overhead. We also decided to drop support for legacy hardware and outdated kernel drivers, freeing us up to design for the future without worrying about impacting the past. This let us ask, "if we were doing it all again...what would we want it to look like?"
While designing the new driver, we drew a lot of inspiration from our newer Vulkan driver, as well as a few other Gallium drivers.
Key Changes
-
All new state upload code is dramatically more efficient.
In CPU overhead microbenchmarks, Iris can issue on average 3 times as many draw calls per second as our i965 driver.
-
Supports only Broadwell and newer (Gen8+); drops support for the older Gen4-7.5 GPUs, as well as Braswell/Cherrytrail.
-
Updated memory management takes full advantage of modern PPGTT support, allocating VMA in userspace for greater control, and allowing us to pre-bake state containing addresses.
-
Requires a modern Linux kernel (v4.16+, could be v4.5 if needed).
-
Leverages Mesa's "Gallium" driver framework, allowing us to share more code and development effort with the rest of the community.
While many pieces are new, much of the driver remains the same. We continue using these components of our existing stack:
- The Mesa OpenGL API front-end
- The Mesa shader compiler (GLSL, SPIR-V, NIR, i965 Gen-assembly backend)
- The Intel Surface Layout (ISL) library
- The Intel Blit-on-Render-Pipe (BLORP) library
- The i965 auxiliary surface resolve tracker
- The i965 buffer manager (extended, but largely reused)
Q&A
Q: How do I build and use Iris?
Iris only supports the Meson and Android build systems (sorry, no Autotools or SCons support). To build Iris, use -Dgallium-drivers=iris when running Meson. -Ddri-drivers=i965 will also build i965.
i965 remains the default driver (assuming it's built). You can try out Iris on a per-application basis by setting an environment variable:
$ export MESA_LOADER_DRIVER_OVERRIDE=iris
Please note that Iris requires a modern kernel, such as 4.19+.
Q: Should I use Iris yet?
Iris is not considered stable or ready for production use - it's still very experimental. However, it is largely feature complete (a few less commonly-used features are missing), and is passing roughly 99% of the Piglit test suite and OpenGL CTS. We have not done extensive testing or benchmarking of games and applications yet.
If you're feeling adventurous, feel free to try it out and report issues at https://bugs.freedesktop.org/ under product Mesa and the Drivers/Gallium/Iris component. Or ask us on IRC (irc.freenode.net channel #intel-3d).
Q: Are there any known issues?
-
Currently, Glamor rendering, and shaders using gl_VertexID, may not work correctly. This will be fixed shortly after merging.
-
GPU reset support is poor - if it hangs, it will likely hang repeatedly until the kernel bans it. Chris Wilson and I are working on a solution for this.
-
There is a known kernel memory leak in some 4.18 kernels, which Iris can provoke. The fix has already been backported, but a few distros didn't pick it up before moving on to 4.19+. Please use the latest available kernel.
-
Performance is expected to be slower than i965 for the moment, in many cases, but this will improve in the days to come. There are still a number of stall avoidance paths which have not been hooked up yet, which can lead to the GPU idling. Fast clears support is missing, and end-to-end color compression is not working yet.
We expect it to be faster in the long run, and it already is in some particular cases. For one customer, Iris is 18% faster than i965. Your mileage may vary until the driver matures a bit more.
Q: What's with the commit history?
The commit history in this merge request is largely the actual non-idealized history for bringing up the driver, rather than the tidy patch series we're used to seeing. I decided that preserving the history mostly as-is might be of interest to other people who are considering bringing up a new driver, to see how I did it. Also, after a year of work, I wanted to be able to fairly attribute people's work, and squashing it would not have done that justice.
During development, I rebased the driver on master periodically. At the end, I went back and ensured that the driver would at least compile at each step, so that people can bisect across it without as many issues. I also squashed some obvious fixup commits. But it's largely still the original history.
Q: Who developed Iris?
According to git shortlog, the following people contributed patches to Iris which made it into the original MR:
- Kenneth Graunke (732)
- Jordan Justen (14)
- Dave Airlie (13)
- Chris Wilson (12)
- Rafael Antognolli (8)
- Jason Ekstrand (7)
- Caio Marcelo de Oliveira Filho (3)
- Andre Heider (2)
- Rhys Kidd (1)
- Sagar Ghuge (1)
- Tapani Pälli (1)
- Timur Kristóf (1)
This understates the work, however, as we've reused a lot of code from our existing drivers and infrastructure, so my thanks to the whole Intel Mesa team, and the entire Mesa community. Particular thanks to Dave Airlie, Ilia Mirkin, Marek Olšák, and Eric Anholt, and others for answering a lot of questions about Gallium.
In any list of acknowledgments, I am sure to have missed people; sorry for the omission, and thank you nonetheless!