Posted On July 13, 2022
For the past 4 years and half I have being working in i915, the Linux kernel-space driver for Intel GPUs, but soon I will be moving to Mesa (the 3D user-space driver for almost all GPUs supported by Linux) so thought that is the best time to share a bit about it.
As any hardware device driver, it provides an abstraction API to access the hardware.
Linux has two APIs that moderns GPUs (Intel, AMD, Nvidia…) implements:
- DRM for rendering and memory management
- KMS for display mode set
DRM is an API to allow user-space middle-ware to allocate GPU buffers, then it can write to this buffers with GPU specific instructions to draw in another memory buffer then with KMS API you can take the rendered buffer and show up in the monitor.
There is really more than that, but that is the main purpose of those APIs.
Mesa my new project is the user-space middle-ware that uses the DRM API to implement graphics APIs(OpenGL, Vulkan…) that are going to be used by graphics toolkits(EFL, GTK, Qt…) to render pretty and fast Linux desktop environments, the same graphics APIs are also used by game engines to render your favorite games.
In i915 I was mostly involved in the bring up of new GPUs were we start to add driver support to new GPUs even before the simulator is ready and carry it through simulation, power-on, code stabilization and up-streaming to drm-tip branch, from there it will land in Linus Torvalds master branch in a couple of Linux kernel releases and then in your favorite Linux distribution hopefully before the new Intel processor with integrated GPU or discrete GPU(say hello to Alchemist) is on the shelf.
One of the coolest features that I developed is called Panel Self-Refresh(PSR), this feature allows the GPU to be put in low-power states when the screen is not updated that often.
When such idle state is detected, the GPU prepares the panel to refresh the image by itself and after that the connection between the GPU and notebook panel is turned off and GPU(most of the times the whole SOC) is put in low-power states.
So the notebook panel needs to continue to refresh itself from its internal memory until the GPU is awaken to render and update the panel with a new frame.
Think about how often your screen needed to be updated for you to read this post, not much right?!
This feature alone allows notebooks to save in average 2~4 watts/hour depending on the content, if you multiply that by millions of Intel CPUs with integrated GPU out there running Linux, I already did my part in saving the planet kkkkk.
That is all that I had to share in this quick post, maybe I will write something more in depth about the areas that I have expertise in i915 to help new i915 contributors.