Is it possible to use existing GPU drivers?
Is it possible to use existing GPU drivers?
I would like to add full HD resolution to mz Operating System, but I don't want to use UEFI. Is it possible to use existing GPU drivers from NVidia and Intel to make it possible? IS there some documentation for them, in terms of usage, functions, ...? Or is there some complete tutorial how to achieve this? Thanks for response!
-
- Member
- Posts: 5575
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Is it possible to use existing GPU drivers?
It's not possible to use existing drivers. You will have to either use firmware (BIOS VBE, UEFI GOP) to set the resolution, or write your own driver using the available documentation.
Why don't you want to use UEFI? Modern PCs don't support BIOS, only UEFI.
Why don't you want to use UEFI? Modern PCs don't support BIOS, only UEFI.
Re: Is it possible to use existing GPU drivers?
Well, in theory you could use. All you need to do is to implement the same ABI/API as Linux, and you'll able to use the binary drivers provided for Linux. But in practice this is extremely hard, and requires to inherit Linux structures into your kernel, therefore I agree with @Octocontrabass, in practice it's not possible.
BTW, Intel has a good documentation and an Open Source driver under Linux, so you can implement or port a device driver for it in your OS. As for Nvidia, the documentation is not available, only a binary kernel driver blob. However there's a reverse engineered Open Source driver, nouveau, which you can study and/or port. Not an easy task, but doable.
Cheers,
bzt
BTW, Intel has a good documentation and an Open Source driver under Linux, so you can implement or port a device driver for it in your OS. As for Nvidia, the documentation is not available, only a binary kernel driver blob. However there's a reverse engineered Open Source driver, nouveau, which you can study and/or port. Not an easy task, but doable.
Cheers,
bzt
Re: Is it possible to use existing GPU drivers?
nVidia do release some information which, if I remember right, is enough to set modes. (I'm assuming nvidia hasn't stopped dong this since they started a few years ago.) The information will have been incorporated into Linux's noveau driver, so that's a valid place to look as bzt suggested.
You could probably port the full nvidia drivers if you sign a non-disclosure agreement (NDA) with nvidia. You'd have to distribute your ported driver in binary form, but you could see the source yourself - or enough of it to interface with. They'd expect you to have professional-level understanding, but that's not really as high as it sounds.
nvidia have been enthusiastic about helping port their drivers to FreeBSD, but I can't remember if that was a full port or if it involved FreeBSD's Linux compatibility layer.
Regarding the suggestion of UEFI, it's not the panacea it should be. Some graphics chipsets set the wrong resolution under VBE and UEFI to try to force you to use their drivers. Some nVidia cards do this; not sure about ATI. Some even set it to 800x600 which is below the minimum specified in the UEFI standard, as far as I know.
You could probably port the full nvidia drivers if you sign a non-disclosure agreement (NDA) with nvidia. You'd have to distribute your ported driver in binary form, but you could see the source yourself - or enough of it to interface with. They'd expect you to have professional-level understanding, but that's not really as high as it sounds.
nvidia have been enthusiastic about helping port their drivers to FreeBSD, but I can't remember if that was a full port or if it involved FreeBSD's Linux compatibility layer.
Regarding the suggestion of UEFI, it's not the panacea it should be. Some graphics chipsets set the wrong resolution under VBE and UEFI to try to force you to use their drivers. Some nVidia cards do this; not sure about ATI. Some even set it to 800x600 which is below the minimum specified in the UEFI standard, as far as I know.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Re: Is it possible to use existing GPU drivers?
Due to the nature of the NVIDIA drivers, they might actually be the most reusable ones. If you supported an appropriate /dev/nvidiactl and /dev/nvidia0, it might be possible to run the userspace binary blob unchanged (provided that you also have the other components of the Linux graphics stack, like X11). The NVIDIA device nodes are open source (e.g., the FreeBSD code is quite readable) and mostly expose ACPI power management and PCI BAR access.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Re: Is it possible to use existing GPU drivers?
I was thinking this, but didn't say it because it's been more than 10 years since I looked into it. At the time, the license didn't actually allow me to look into it as literally as I did, but I can confirm there's a source-code wrapper around the blob.Korona wrote:Due to the nature of the NVIDIA drivers, they might actually be the most reusable ones. If you supported an appropriate /dev/nvidiactl and /dev/nvidia0, it might be possible to run the userspace binary blob unchanged (provided that you also have the other components of the Linux graphics stack, like X11). The NVIDIA device nodes are open source (e.g., the FreeBSD code is quite readable) and mostly expose ACPI power management and PCI BAR access.
I'm not even sure you'd actually need X11, just something providing the functionality of GLX: coordinating the OpenGL-drawn regions with the window system.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Re: Is it possible to use existing GPU drivers?
I would like to use it test it on my one of my old computers, that's why. Can I ask where can I find the documentation?Octocontrabass wrote:It's not possible to use existing drivers. You will have to either use firmware (BIOS VBE, UEFI GOP) to set the resolution, or write your own driver using the available documentation.
Why don't you want to use UEFI? Modern PCs don't support BIOS, only UEFI.
-
- Member
- Posts: 5575
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Is it possible to use existing GPU drivers?
What do you need documentation for?SevcLuka wrote:Can I ask where can I find the documentation?
If you're using GRUB, use a framebuffer tag in your multiboot2 header and GRUB will use the firmware to set up the framebuffer for you.
If you're writing your own bootloader (or doing something silly like calling the BIOS after you've switched to protected mode), you'll want to refer to the VBE core specification, version 3. It may also be helpful to refer to older versions, so here's version 2 as well. There are some related documents listed on the last page; use your favorite search engine if you feel like reading those as well.
Re: Is it possible to use existing GPU drivers?
This will work if you build your kernel with Grub's headers, but if you don't, then you should be aware of a bug in Grub: It makes one of the framebuffer fields 32 bits wide when the spec says 16 bits.Octocontrabass wrote:SevcLuka wrote:If you're using GRUB, use a framebuffer tag in your multiboot2 header and GRUB will use the firmware to set up the framebuffer for you.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie