OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 11:18 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Is it possible to use existing GPU drivers?
PostPosted: Sun May 10, 2020 3:40 am 
Offline

Joined: Sun May 10, 2020 3:34 am
Posts: 2
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!


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Fri May 15, 2020 2:51 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
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.


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Fri May 15, 2020 4:36 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
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


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Sat May 16, 2020 2:19 pm 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 815
Location: Hyperspace
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.

_________________
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


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Sun May 17, 2020 5:12 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
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].


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Tue May 19, 2020 7:54 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 815
Location: Hyperspace
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 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.

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


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Mon Jun 01, 2020 2:30 am 
Offline

Joined: Sun May 10, 2020 3:34 am
Posts: 2
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.


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?


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Mon Jun 01, 2020 7:47 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
SevcLuka wrote:
Can I ask where can I find the documentation?

What do you need documentation for?

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.


Top
 Profile  
 
 Post subject: Re: Is it possible to use existing GPU drivers?
PostPosted: Thu Jun 04, 2020 5:51 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 815
Location: Hyperspace
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.

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.

_________________
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: belliash, DotBot [Bot], Google [Bot], Majestic-12 [Bot], nullplan, rdos and 117 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group