OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 7:16 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Nvidia QUADRO 2000 Driver
PostPosted: Tue Oct 18, 2022 1:02 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
I Want to write a simple display adapter for my gpu, maybe add some 3d support to gain some knowledge.

Should I use the nouveau project as a reference ? My only problem is that these linux sources are very complicated. And it is so hard to understand the code.

To make sure it is supported, I tried the ChromeOS Flex on my PC (Not installed) and it immediately sets the screen resolution.


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Tue Oct 18, 2022 1:34 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1604
devc1 wrote:
I Want to write a simple display adapter for my gpu
OK, get a framebuffer going, maybe some 2D acceleration with a hardware mouse cursor, that should be feasible to reverse engineer from the VESA code.
devc1 wrote:
maybe add some 3d support to gain some knowledge.
Well, that is going to be quite the leap from what I outlined above.
devc1 wrote:
Should I use the nouveau project as a reference ?
Anything that helps you. But nouveau is itself the result of a reverse engineering effort. If I was you, I would dump and disassemble the VBIOS. VESA code must exist to query supported video modes and set them, so that ought to tell you how to do it on your card. Just trace out the interrupt 10h handler for the various well-known functions. Alternatively you could try looking for documentation for your card, but I don't know how successful that will be. Nvidia is famously tight-lipped about these things.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Tue Oct 18, 2022 3:13 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
nullplan wrote:
Nvidia is famously tight-lipped about these things.

Not as much as they used to be! Unfortunately, the currently available documentation doesn't cover Fermi GPUs like the Quadro 2000 very well, so some reverse-engineering will likely be involved. (But it does cover some parts, like the bytecode interpreter in the VBE ROM, so definitely look at that before you start disassembling it.)


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Tue Oct 18, 2022 5:11 pm 
Offline
Member
Member

Joined: Sat Nov 21, 2009 5:11 pm
Posts: 852
The ROM might not be that helpful, especially if you want acceleration. Better to disassemble the Windows drivers, starting with the video miniport driver and then moving on to the GDI and DirectDraw drivers.


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Tue Oct 18, 2022 11:52 pm 
Offline
Member
Member

Joined: Sat Jul 02, 2016 7:02 am
Posts: 210
One can try an old AMD GPU built on GCN 1.0+ uArch. Some of those old GPUs can be bought for cheap prices (depending upon your region).

The Linux drivers (radeon or amdgpu) can help setup the device (POSTing the bios, loading the uCode, filling the registers, setting up the GART, setting up the location and layout of framebuffers, configuring the clocks and the display pipeline, etc.)

Mesa contains OpenGL and Vulkan drivers for (supported) GPUs; that will help set up the command streams to draw 3D, etc. One can recompile Mesa and DRM with debug symbols, point the triangle or game or whichever OpenGL/Vulkan application to those recompiled libraries, and live-debug using gdb, to see how the command streams are set up.

Mesa also has built-in debug variables that can help in dumping the intermediate representations and the final hw-level assembly of the shaders, all without recompiling Mesa.

The GPU ISA is public, so one can even write one's own assembler to assemble the shader code.

One can also go a bit further back in time and run with TeraScale GPUs. Their ISAs aren't very straightforward, as they were VLIW5- or VLIW4- based ISAs.

Such a GPU can be inserted into the host system, and can be made to pass through to a VM, so that you can test your driver with relative ease. You also do not need to buy a separate monitor - a cheap HDMI-to-USB video capture device, along with software like OBS Studio will do.

AMD releases its GPU drivers under the MIT license, so there is some amount of wiggle room for someone learning to write such drivers.

The advantages listed above may also apply to Intel GPUs, since they too provide extensive documentation, plus their kernel-mode and user-mode GPU drivers are open-source.

If you are not restricted to x86-based OS, you can also try to learn programming the RPi VideoCore IV GPU, or one of the Arm Mali GPUs. Linux and Mesa can help even in these cases. Moreover, these GPUs are simpler to program than the desktop GPUs.

IMHO, understanding AMD's kernel driver is much easier than understanding Nouveau. Nouveau is very generously sprinkled with magic numbers which initially put me off and had me looking elsewhere, though I believe that, once armed with the experience of programming a GPU, nouveau too shouldn't pose too much of a challenge.

Another aspect of NVIDIA GPUs that disappoint me is the lack of documentation on their ISA - they instead ask for the shader code to be presented in their PTX byte code format (which I believe is indeed open), and then rely on their closed-source driver for the translation from PTX to hw-level binary. Nouveau/Mesa may or may not have reached a point where they have the actual hw-level ISA reversed for us to use, for a particular NVIDIA GPU.


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sat Oct 22, 2022 10:50 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
Dunno about the AMD GPU documentation (I can't seem to find it, just ISA documentation), but the Intel ones are ridiculously convoluted in terms of "where do I find what?". For me, at least, its non-intuitive where to get started and then where to go from there.


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 2:11 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
But if my gpu isn't included in the nouveau project, how does ChromeOS sets the resolution immediatly at startup ?


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 6:10 am 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1604
devc1 wrote:
But if my gpu isn't included in the nouveau project, how does ChromeOS sets the resolution immediatly at startup ?
VESA? Or maybe ChromeOS comes with a better driver.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 6:38 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
First chrome os is booting into UEFI.
Second, GOP in my PC (because my os also boots in uefi) does not include a high resolution such as 1920x1080.

And graphics seem to be accelerated with less cpu usage.

I've gone through some documentation from the nouveau project and they state that they have some documentations about nvidia fermi gpus like mine (quadro 2000).

But the documentation does not include anything about the architecture, it is just like an introduction


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 6:42 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
Sorry but I feel that most topics that I open have no answers or need some guy like Linus torvalds to call some company to give us the answer : (


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 8:36 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
devc1 wrote:
But if my gpu isn't included in the nouveau project,

It is included. Fermi is the NVC0 column.

devc1 wrote:
But the documentation does not include anything about the architecture, it is just like an introduction

For a lot of things, the nouveau source code is the only documentation.


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 9:16 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
Where is the driver entry point ? Is it "nouveau_drm_init" ?


Top
 Profile  
 
 Post subject: Re: Nvidia QUADRO 2000 Driver
PostPosted: Sun Oct 23, 2022 3:53 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
I guess you could call it that.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], SemrushBot [Bot] and 98 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