Question - Why Are Graphics Drivers in The Kernel and in Mesa - R - Linux - Gaming
Question - Why Are Graphics Drivers in The Kernel and in Mesa - R - Linux - Gaming
: r/linux_gaming
Why do (some) Graphics-drivers have to be in the Kernel, wouldn't it be better to have everything in Mesa? Or in any other
single place, that could be updated frequently?
The problem: Some of the fixes and improvements in the open-source-drivers (AMD, Intel) take a very long time to reach
the end user (See the discussion about Kernel 5.8). There is rapid progress right now in linux gaming, but it takes a long
time to manifest, and performance-fixes in gaming must be applied in a timely manner. So, it seems beneficial to have
drivers in a place that could be updated frequently. This means: Faster updates, Ubuntu/Debian users wouldn't have to
wait for ages to get improvements. The drivers would be in one place.
30 40 Share
Add a Comment
K900_ • 4y ago
The kernel handles communicating with the hardware, Mesa provides implementations of standard graphics APIs on
top of that. You can't move the talking to the hardware part out of the kernel, because userspace can't actually talk to
hardware directly, and you don't want to move OpenGL and stuff into the kernel because it's massively complex and
has no business running at a high privilege level.
50 Reply Share
I think they were actually thinking about the reverse: move most graphic driver infrastructure in userland where it
could be updated more quickly, à la Windows, independently of the entire kernel and what it entails (you may like
your distro stable kernel but still want only the amdgpu driver up to date - which is possible but may be frowned
upon as not "as franken-kernel" with little doc and support).
It's not a guarantee of things being "better" overall, but just a different model, with some benefits and drawbacks.
4 Reply Share
taintsauce • 4y ago
My understanding of the kernel architecture is pretty basic, but I'm curious what the roadblocks would be to
breaking those DRM modules out and shipping them as a separate package that can be compiled with DKMS or
the like. The proprietary AMD and Nvidia drivers both do this already, but they obviously aren't as deeply
ingrained with the rest of the kernel development-wise.
1 Reply Share
K900_ • 4y ago
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 1/7
4/7/24, 4:09 PM Question: Why are graphics drivers in the Kernel and in Mesa? : r/linux_gaming
You can generally already do that. In fact, that's exactly what the AMD proprietary driver does - it ships a
Skip to main content
newer version of the AMDGPU kernel driver. Log In
1 Reply Share
geearf • 4y ago
None it's already done, but it's harder to match any possible API since it can keep breaking at any point so it
makes it a little harder on the user.
1 Reply Share
Because Linux has a monolithic kernel design, which gives it extra flexibility and efficiency which is a major reason
it's the preferred OS for both $15 raspberry pis and also every top supercomputer in the world.
The problem: Some of the fixes and improvements in the open-source-drivers (AMD, Intel) take a very long
time to reach the end user (See the discussion about Kernel 5.8).
The solution: use a rolling distro, and learn to accept the compromises in stability that come with that philosophy.
You're not really missing anything here, you're just using distros that are fundamentally made for servers on your
desktop, and you have different priorities than server operators.
18 Reply Share
AlienOverlordXenu • 4y ago
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 2/7
4/7/24, 4:09 PM Question: Why are graphics drivers in the Kernel and in Mesa? : r/linux_gaming
Skip to So,
mainit seems
contentbeneficial to have drivers in a place that could be updated frequently. This means: Faster
Log In
updates, Ubuntu/Debian users wouldn't have to wait for ages to get improvements. The drivers would be in
one place.
What am I missing here?
Few things first. The situation is the same on Windows as well, it's just that there drivers come in one package and
nobody cares which particular component of the driver runs in kernel space and which in user space.
Why are graphics drivers laid out like this? Well, to directly access hardware you need privileged mode of execution,
meaning it has to run within kernel space (this is called protection ring 0 on x86 family of CPUs). But, kernel is not
really the nicest environment out there, bugs in ring 0 code have potential to hang the entire system and there are lot
of limitations on what you can do there. So the divide is simple: only the necessary parts of the driver execute in
kernel space, other parts (the ones that user applications interface with) run from user space. User space parts of the
driver tend to be more complex anyway because they lay the foundation of graphics APIs and shader compiler, and
they are in direct communication with their kernel space counterpart, sending GPU commands back and forth.
So now that you understand why the divide, let's talk why drivers are so tied to kernel version on Linux. You see,
every kernel has its own set of interfaces (basically predefined set of functions, an internal API), those interfaces are
used by any software that wants to execute in kernel space. Now, the difference between Linux and Windows in this
regard is that on Linux, kernel interfaces aren't stable. What that means? It means that, internally, linux devs are
constantly adjusting interfaces, and there is no guarantee that interfaces from kernel 2.6.1 will stay the same as in
2.6.2 which breaks compatibility. So you have to have a different set of drivers for pretty much every kernel version.
On Windows, Microsoft basically releases one kernel per Windows release, and from there on there are only bug
fixes and no compatibility breaking changes which means that any version of any windows XP driver will work on any
version of windows XP, sometimes this binary compatibility would even span through several versions of Windows,
which is kinda unheard of on Linux.
Nvidia maintains their binary blob, and they actually go out of their way to support each and every version of Linux
kernel in their driver. AMD went a different route and their kernel components live in kernel tree meaning that
whenever kernel interfaces change modules get updated automatically.
Understand that there are advantages and disadvantages to both Windows and Linux way of doing things, it's a
compromise.
7 Reply Share
tkonicz OP • 4y ago
1 Reply Share
DarkeoX • 4y ago
1 Reply Share
EddyBot • 4y ago
The solution is pretty simple: If you are a gamer who wants the latest optimizations on this AMD hardware, then use
a rolling release distro
There are plenty to choose from which are perfectly fine to play games on
Debian/Ubuntu are certainly not the only choice
15 Reply Share
destarolat • 4y ago
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 3/7
4/7/24, 4:09 PM Question: Why are graphics drivers in the Kernel and in Mesa? : r/linux_gaming
Or you can simply add a ppa to install the latest kernel and Mesa.
Skip to main content
Log In
In Ubuntu you even have a GUI that let's you switch kernels easily.
I think the problem here is more of lack of knowledge. People are willing to install the latest driver with a GUI in
windows, but not install the latest kernel with a GUI in Linux? IMO the problem is lack of knowledge of how Linux
work, than installing the kernel/Mesa.
4 Reply Share
EddyBot • 4y ago
I would rather run a rolling release where the maintainer actually tests that stuff works on latest
kernel/graphics stack, it doesn't even need to get complicated
Running PPAs from some random people who aren't distro maintainer to get the latest software on a distro
where they claim stability/reliability through old software is kinda dumb, isn't it?
5 Reply Share
1 more reply
Shap6 • 4y ago
This always confuses me so much. This is Linux. We can change it to fit whatever our needs are and are not
locked down in any way. But we can’t update the drivers that ship with our distro? People act like you have to
reinstall your whole OS for it.
1 Reply Share
pdp10 • 4y ago
For post-Polaris AMD graphics hardware yes, for everything else not really.
Right now, post-Polaris AMD graphics users are probably best served by a rolling-release distro, and Nvidia users
are probably best served by a stable-release distro. I'd like to see AMD get to the point where their drivers are usually
mainlined many months before hardware ships, like Intel typically manages, but I can live with the current situation
because it's literally the best we've ever had it for graphics on Linux.
2 Reply Share
geearf • 4y ago
What makes the GPU so different from the rest of the hardware that you think it should be updated separately? CPU
fixes and others come in the same place, at the same pace.
I think the drivers on amd's website support dkms so you should be able to get some of those fixes with your older
kernel if that is to your liking, but I doubt they support enough kernels to always be able to without worrying (which is
the nice part of having them upstream).
Your other, less official, option is to use less stable kernels, either the RCs of the kernel.org or drm-next or even
agd5f's tree of which I forgot the name right now.
3 Reply Share
EnglishFromEURLEX • 4y ago
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 4/7
4/7/24, 4:09 PM Question: Why are graphics drivers in the Kernel and in Mesa? : r/linux_gaming
If the Linux kernel had a stable API for kernel modules, we could have graphics drivers, as well as other drivers, in
many different places. But for a number of reasons it doesn't, drivers are expected to be in the kernel. So we just
can't have everything in Mesa.
That being said, the Direct Rendering Infrastructure exists precisely to offload as much as possible to Mesa and the
userspace in general.
1 Reply Share
rocketstopya • 4y ago
Nvidia drivers are somehow packaging these two into 1 driver package, but open-source needs both components.
1 Reply Share
[deleted] • 4y ago
Nvidia isn't doing anything different. They have a kernel module and a userspace opengl implementation. They
just provide an installer.
7 Reply Share
PolygonKiwii • 4y ago
AMD's installer can also install the amdgpu module with dkms. It's just not recommended for gamers to use
that since it's a lot cleaner to just update the whole kernel (and as a gamer there's no point in only updating
the GPU drivers instead of all the drivers).
1 Reply Share
If you use:
openSUSE Tumbleweed
Manjaro
Arch
Fedora
Ubuntu is pretty common but IMHO is overrated, the list of distros that i said, is better
1 Reply Share
Cytomax • 4y ago
I would agree to list you gave is better for gaming on modern hardware
1 Reply Share
Koylio • 4y ago
It's code quality vs. developement speed. Without quality control, that kernel and user space separation is big piece
of, you'd lose the stability. You just can't save the cake and eat it too.
1 Reply Share
[deleted] • 4y ago
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 5/7
4/7/24, 4:09 PM Question: Why are graphics drivers in the Kernel and in Mesa? : r/linux_gaming
It increases stability by moving the driver to userspace. You just lose performance.
1 Reply Share
Koylio • 4y ago
If by user space you mean out of tree kernel driver, history proves otherwise. When AMD tried to upstream
the amdgpu kernel part, it was rejected for poor code quality. Multiple times. Many users were upset because
of this, because they wanted everything now. In the end AMD improved their driver to meet the high
standards getting the driver in kernel requires, and because of this, we now have a driver that even devs
outside of AMD can improve.
https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-DC-DRM-No
If by moving the driver to user space you mean removing the kernel part, I don't think it would work. Mostly
the parts that need to be there are in kernel.
https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html
2 Reply Share
[deleted] • 4y ago
I mean actual userspace aka you force the only means of communicating with the driver is another shitty
IPC instead of normal buffer sharing like monolithic design.
1 Reply Share
1 more reply
[deleted] • 4y ago
Why do (some) Graphics-drivers have to be in the Kernel, wouldn't it be better to have everything in Mesa? Or
in any other single place, that could be updated frequently?
Do you want an utterly crappy driver by design? Microkernel guys spent millions to billions of development dollars
into this idea and the performance is pretty crappy.
1 Reply Share
geearf • 4y ago
Isn't the macOS kernel proving that this should work? (well it is not a pure microkernel, maybe drivers are not
outside)
2 Reply Share
[deleted] • 4y ago
You basically describe a monolithic kernel. MacOS claims they are hybrid kernel for marketing purposes.
Their graphic drivers do freeze and have issues.
1 Reply Share
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 6/7
4/7/24, 4:09 PM Question: Why are graphics drivers in the Kernel and in Mesa? : r/linux_gaming
Log In
More posts you may like
Related Gaming
TOP POSTS
https://www.reddit.com/r/linux_gaming/comments/g8a4bd/question_why_are_graphics_drivers_in_the_kernel/ 7/7