Why install drivers if they came with the linux kernel

driversgpugraphics cardlinux

This morning, I wanted to show a friend of mine just how easy it has become to play video games on linux thanks to lutris. However during the installation of lutris, it asked me to download drivers for my graphics card. Now I have been told that most drivers for the GPU are already baked into the linux kernel(I have an AMD GPU)… so why does it ask me to install drivers for my graphics card if they already come baked into the linux kernel?

My second question is why was the installment of these drivers as simple as running a pacman -S command in the terminal? I mean since drivers are so low level and are loaded on OS startup, I would at least expect to have to download them from my manufacturers website and install them manually. Or at the very least have to restart my computer.

Best Answer

Now I have been told that most drivers for the GPU are already baked into the linux kernel(I have an AMD GPU)... so why does it ask me to install drivers for my graphics card if they already come baked into the linux kernel?

Not all things called "drivers" are actually kernel drivers.

Some of them are just user-space libraries which work on top of what the kernel provides. For example, the entirety of OpenGL and Vulkan is implemented as libraries (libGL, etc), and on Linux those usually come from the Mesa project. The kernel driver knows how to talk to your AMDGPU, but Mesa knows what to say – the "drivers" provided by Mesa compile OpenGL shaders to GPU-specific instructions before uploading those through the kernel driver into the GPU.

So if you're installing something like vulkan-radeon, that's a driver – just not a kernel driver. You could say it's the "upper layer" of a driver, while the part that's in the kernel is the "lower layer".

Additionally, while there's only one type of kernel driver per system, the libraries (such as Mesa's) are loaded into each individual program and therefore have both 64-bit and 32-bit versions. You already have the 64-bit Mesa package, but if you want to run a 32-bit game through Wine then you need to also install the "lib32" package of the same libraries.

On Windows, all these pieces are directly provided by AMD, so they all come in the same installation bundle – if you install the "AMD drivers" you get both the kernel drivers and the OpenGL/DirectX libraries (of both 64-bit and 32-bit variants).


Also, as you observed, most, but not all, GPU drivers come with the kernel. NVIDIA is the biggest exception; they don't contribute any GPU support to the kernel, and their GPUs are much harder to write unofficial drivers for, too. (Unlike e.g. 'radeon' for old ATI, which was unofficial but still quite good.) The result is that kernel has relatively basic, unofficial drivers for NVIDIA cards, but you won't get much performance from them at all – you have to install their closed-source drivers for that.

I mean since drivers are so low level and are loaded on OS startup, I would at least expect to have to download them from my manufacturers website and install them manually.

Those things actually have nothing to do with each other. Low-level components can be distributed the same way as high-level ones; in the end, they're just files. In fact on Windows you actually get most drivers through Windows Update. It's only the ones that aren't in Windows Update that you need to download from the manufacturer's website.

(Kernel drivers can be loaded dynamically; indeed most are. The kernel driver for USB sticks is loaded the first time you connect a USB stick, not on boot. You do need to reboot Linux in order to replace one kernel GPU driver with another, usually, though on Windows even that is no longer necessary.)

Related Question