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

Generated code is not “wrong”. GPU drivers are performance critical so using generated code certainly helps to get the performance you need. But I can understand the reason on not wanting that many code lines in a repo. That said we have two major players in the field: AMD and nVidia, wenn we look at the free driver side. So this makes two potentially line-count heavy drivers to include. In my opinion that’s acceptable if you can support with this the large majority of GPUs out in the wield.

Generating code is not wrong, but storing the generated code in the Linux kernel instead of the sources and tools to generate it would have been better. I am not even sure if the way it is done complies with the GPL?

4 Likes

GPU drivers and GPL has always been a problem. To get GPU support you somehow had to give a hand to GPU vendors by closing an eye here and there. I’m not happy about that either but truth is today an OS is expected to have GPU HW support, meaning, shadersand/or opencl.

If open-source drivers are unavailable for a lightweight architecture such as Haiku, perhaps adapting the AmigaOS4 enhancer pack drivers for Warp3D Nova to work from Mesa would be mutually beneficial. They are owned by A-Eon Technologies but are low-level PPC code for AmigaOS 4.1FE2 and are closed-source. :thinking: Might not be worth it.

See: mesa: bump to 21.0.3 by kenmays · Pull Request #5792 · haikuports/haikuports · GitHub

Mesa 21.0 was tested on Haiku without any major issues.

There are devs working on a DRM-based Intel video driver port and testing the new Mesa LLVMpipe driver update…

5 Likes

You will have to wait for mesa 21 a bit because there actually were major issues in testing :)

If you want to test Mesa 21 you can add my repo - [http://haikuware.ru] and update packages: (http://haikuware.ru/package_list.php?repo=lote) (Haiku x86_64 only)
It very stable and usefull for me.

6 Likes

Your mileage can vary though. That last package I could test still did not work properly and caused apps like Blender to segfault. Not sure what causes the problems. Hopefully the final package magically starts working here.

There are also three versions of the blender in my repo, which work perfectly with the new version of mesa.

4 Likes

Well… three issues :slight_smile: I added a list to mesa: bump to 21.0.3 by kenmays · Pull Request #5792 · haikuports/haikuports · GitHub

1 Like

Good day @3dEyes,

Nice work with Stellarium (though crashes on quit, -and the window is not resizeable :cry: -, is quite usable), you had this kept for yourself, huh? :crazy_face: :crazy_face:

screenshot12

This is something I was waiting for! Thanks a lot. :+1: :+1: :+1:

Regards,
RR

7 Likes

Before I let the matter drop, how do Android-style binary blobs map into Mesa? Of course the AArch64 ARM chips are a tier-2 architecture after Intel x86 and AMD64, but Android doesn’t use the same graphics pipeline as Linux desktop does. No X-server nor Wayland might mean a more streamlined architecture if somebody could at least figure out how the binary blobs are supposed to map in.

I’ve got a Cubox i4Pro that could do with a more efficient OS than Linux since SolidRun and Motorola seem incapable of supplying non-Linux OS architectures for the iMX.6 SoC and every SoC has the same GPU core as any other model machine with the same SoC.

Correction: After some searching online I found that the Etnaviv driver for Mesa has already been upstreamed and is open-source. No need for binary blobs here!

Comment: Holy Monkeys! These things have appreciated in value! I got mine for $30 less several years ago.

I remember I got this (from him I think) and we ran it hardware accelerated on my nVidia driver, years and years ago… :wink:

3 Likes

Simplified:
OpenGL ES → SurfaceFlinger → Hardware driver → Hardware

Then, other pieces like: GrAlloc (graphic (virtual) memory allocation manager)…

1 Like

Thanks!

I hope this situation gets ironed out. I don’t expect miracles but the RasPi 4 has delivered on so many levels and other SoC machines have reverse-engineered drivers as I’ve discovered my Cubox has and my PineBookPro has. If discrete graphics cards play hard-to-get as far as drivers go, maybe ramping up the development of AArch64 might be an option.

1 Like

I’m just a Haiku user, however looks like AMD is trying to refactor Mesa interaction with the Linux Kernel:

https://lists.freedesktop.org/archives/dri-devel/2021-April/303671.html

The discussion is intense and touch: performance, security, why only Wayland approach (BSD, android excluded), VR headsets, browsers, why relay on Linux’s ABI api and so on.
Very complex and a good reference point when a new user makes a complaint about why Haiku lacks GPU acceleration.
Even with all the money and resources, Amd & Intel developers have a difficult task making their drivers faster on Mesa.

1 Like

Mesa 21.2.0

Progress…

Ref: https://dev.haiku-os.org/ticket/16847

haiku_glteapot-mesa21-8bit
haiku-glteapot-mesa21-16bit
haiku-glteapot-mesa21-32bit

11 Likes

It’s mesa package from my LOTE repo?

“mesa package from my LOTE repo”

I am using x86_64 hrev55306 -

If I load your repository the mesa package does not show up (others do), and if I download the hpkg it won’t install if I open the file in the installer (nothing happens when I click “install”. Are there any prerequesites that I may be missing?