The graphics acceleration can of worms

The userland side of things, yes. We have Mesa running and adding that part to the driver should not be too much of a problem.

In the kernel side, unfortunately, POSIX says nothing about what to do. And so the drivers heavily rely on Linux internals. And these internals keep changing at every Linux versions, and the drivers are very complex. If you look at things like this: The AMD Radeon Graphics Driver Makes Up Roughly 10.5% Of The Linux Kernel - Phoronix you get an idea how large it is.

For a while now the AMDGPU kernel graphics driver has been around 2+ million lines of code making it the largest in-tree kernel driver.

With all of Haiku git repository being currently less than 6 million lines of code, this gives you an idea of the scale of these drivers.

This is somewhat nuanced by this:

Though as reported previously, much of the AMDGPU driver code base is so large because of auto-generated header files for GPU registers, etc. In fact, 1.79 million lines as of Linux 5.9 for AMDGPU is simply header files that are predominantly auto-generated. It’s 366k lines of the 2.71 million lines of code that is actual C code.

However, I think we would still not be happy to increase Haiku sourcecode size by more than 33% for a single driver. And the other drivers in Linux are a lot smaller, fortunately, at a few hundred lines of code each. But the fact that Linux even allows 2 million lines of generated code to be included in their repository has me a bit worried about the overall quality of their code. Sure, they get things working, but is the price worth paying?

4 Likes