4 ms·
This is not correct. Right now, the GPU Driver for Asahi Linux is not written in Rust/C++ yet (because that's a lot of work). Instead, the prototype driver is w
by gjsman-1000 4y ago
This is not correct. Right now, the GPU Driver for Asahi Linux is not written in Rust/C++ yet (because that's a lot of work). Instead, the prototype driver is written in Python, and when it is done, then it will be rewritten in Rust/C++ once it works correctly. It runs on a host system, receives OpenGL calls (like the demo application shown at the bottom), and then creates a pile of GPU instructions that are then sent over USB to run on the real GPU in the m1n1 preboot environment. So, in practice, the GPU is being reverse-engineered, is doing the rendering, it's just that the OpenGL -> GPU layer is being handled outside Linux in a simpler language for development speed. This prototype GPU driver has 94% openGLES test suite compliance at this point.
> It will probably take many years to reverse engineer.
The last 6% is probably decently hard, but it will probably not be terribly hard to finish - and not long for this team thereafter to change the Python code into an actual Linux driver considering the sheer number of drivers they've already written. Once you have openGLES, you have a HW-accelerated desktop, at least through most desktop environments. Video acceleration is another story they haven't started on, but its generally easy by comparison. Might take another year or two for full OpenGL or Vulkan though.
- cultofmetatron 4y agoI'm a bit mind blown that you can write a driver in python. I thought it would be too high level to do the job at all, nevrmind slowly
- aseipp 4y ago"Drivers" for things in the kernel space in this case, are mostly just a glorified shim that allow you to submit command buffers to a device through memory-mapped I/O. The actual meat of the "driver" in these case is in Mesa, a userspace component, which is what actually forms and creates the command buffers to send. You can write a driver to interact with hardware in any language assuming you don't have insane timing requirements. It's mostly a matter of engineering deciding where the pieces should go, though. (For example, everything else aside, a major advantage of this kind of design is that all the real complexity exists in userspace.)
- pxc 4y agoPython is a popular choice for FUSE filesystem drivers, I think. It's also how this perfectly usable driver for the DualShock 4 is written: https://github.com/chrippa/ds4drv https://github.com/chrippa/ds4drv
- IntelMiner 4y agoWhy Rust/C++? The Linux kernel is written in C, Linus has historically made his dislike of C++ clear as well Rust would be reasonable but its inclusion in the kernel at this point is "that's a good idea!" rather than "that's a thing being done right now in kernel.org kernels"
- remexre 4y agoThis is the userspace part of the driver, not the kernelspace part; the existing open-source graphics drivers already are (for the most part) in C++, because extern "C" is less of a pain than writing a compiler in pure C
- dezgeg 4y agoThe majority of a GPU driver doesn't live in the kernel, but in userspace (part of the Mesa library).