Page 1 of 1

Implementing graphics drivers..

Posted: Sun May 30, 2021 4:35 pm
by newosdeveloper2021
I'm wondering about any nvidia documentation, I'm a great reverse engineer but it's obviously a waste of time. So I'm wondering if you need to develop your OS to a certain point, and then ask them to make a driver/give you documentation under certain conditions as i heard claims about that and people claiming to have the documentation

If not, do I just have to develop my OS enough and ask them?

Re: Implementing graphics drivers..

Posted: Sun May 30, 2021 4:38 pm
by mid
newosdeveloper2021 wrote:I'm wondering about any nvidia documentation, I'm a great reverse engineer but it's obviously a waste of time. So I'm wondering if you need to develop your OS to a certain point, and then ask them to make a driver/give you documentation under certain conditions as i heard claims about that and people claiming to have the documentation

If not, do I just have to develop my OS enough and ask them?
I would think you'd need a considerable market share and wealth for it to even be considered.

Must it be NVidia? Intel may have horrible GPU documentation (although the i815 docs seem alright), but at least they're freely accessible.

Re: Implementing graphics drivers..

Posted: Sun May 30, 2021 4:47 pm
by Ethin
NVIDIA is the last company who would give you documentation to their hardware. They're incredibly anal about it for some reason. The fact that Linux needed to make an open-source driver *before* NVIDIA gave us drivers for Linux, if memory serves, should tell you something. Even if you have a considerable market share they're unlikely to give you docs. The intel docs are horribly organized (especially given the fact that they organize registers alphabetically instead of by address like every other company out there) but those (and the AMD GPU docs) are where you should probably start. If you can't get the latest AMD GPU docs I think that they'll give you them if you email their open-source GPU driver development email.

Re: Implementing graphics drivers..

Posted: Sun May 30, 2021 9:50 pm
by Schol-R-LEA
You might consider looking at the source code and documentation for the Nouveau drivers, which are from an existing reverse-engineering project for Linux. They are far from what the closed-source Nvidia drivers are, but they would be the best - indeed, in some ways the only - source for documentation on the Nvidia hardware interface.

However, as others have already said, if there's any option of targeting either Intel or AMD instead of (or at least before) NVidia, that would be the better choice. Even if you would still want - or need - to implement Nvidia drivers at some point, getting the other two done first would at least give you the experience with GPU drivers so that you could focus more on the Nvidia-specific aspects once you have the more general aspects mastered.

Note that even for Linux, the Nvidia official drivers are closed source - they didn't provide anyone in the Linux community documentation, they just started handing out their own binary blob drivers when it became clear that they couldn't afford to ignore Linux outright (and many suspect that they only did that because they wanted to sell GPGPU hardware to supercomputer sites - providing drivers to ordinary Linux users was just a side result). The drivers are free, but the source code and hardware details are still kept under lock and key.

Re: Implementing graphics drivers..

Posted: Sun May 30, 2021 10:10 pm
by nullplan
Schol-R-LEA wrote:Note that even for Linux, the Nvidia official drivers are closed source - they didn't provide anyone in the Linux community documentation, they just started handing out their own binary blob drivers when it became clear that they couldn't afford to ignore Linux outright (and many suspect that they only did that because they wanted to sell GPGPU hardware to supercomputer sites - providing drivers to ordinary Linux users was just a side result). The drivers are free, but the source code and hardware details are still kept under lock and key.
Yep. The way the binary nVidia driver works is this: There is a source code part and a binary part. The source code part adapts to the kernel version. The driver creates a new device which is mapped into memory, and the binary blob then interacts with the card through the memory mapping. This makes it hard to trace what is going on, although in theory you could use IOMMU to find out.

Re: Implementing graphics drivers..

Posted: Mon May 31, 2021 1:01 pm
by pvc
As for NVIDIA, I was able to find this https://envytools.readthedocs.io/en/lat ... index.html piece of documentation some time ago. It's far from complete, but still, it should be better than nothing.

Re: Implementing graphics drivers..

Posted: Mon Jul 05, 2021 1:54 am
by eekee
Uh... FreeBSD has Nvidia drivers and Nvidia techs are quite eager to support it. If Linux has 1% of the desktop market, FreeBSD must have less than 1% of 1%. I'd say go for it; approach Nvidia about a driver, but be very polite and try not to take up too much of their support time because you're not exactly making them any money to pay for that support time. You probably will have to sign a non-disclosure agreement.
Ethin wrote:The fact that Linux needed to make an open-source driver *before* NVIDIA gave us drivers for Linux, if memory serves, should tell you something.
No, it shouldn't tell us something; things were different in that era. Basically all corporate attitudes to open source were different. It was even illegal to mod games. When Nvidia first released drivers for Linux, things were beginning to change. IBM had famously embraced Linux, much to everyones surprise. Nvidia weren't the first hardware vendors to accept Linux, but they were quite early. Relatively few other hardware vendors had. ATi may have released more documentation, but it was poor documentation. ATi drivers for Linux were much poorer-quality than Nvidia's for many years. Intel, of course, were not remotely competitive in graphics performance for over a decade.

Linus Torvalds complained about the closed-source nature of Nvidia drivers more than once, but this was because he and other Linux kernel devs didn't have the right to use debuggers on it. They couldn't see if the Nvidia driver was causing problems. I'm sure it's different for kernel devs who have signed the NDA to allow them to look into the driver. As a user using Nvidia drivers with stable Linux kernel versions, I only once had a problem which may or may not have been Nvidia's fault. I had more problems with Intel drivers at a time when Intel were enthusiastic contributors to Linux!