Has anyone tried to port nouveau(opensource nvidia driver)?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
cjxgm
Posts: 5
Joined: Sat Apr 30, 2011 12:15 am
Location: Quzhou, Zhejiang, China
Contact:

Has anyone tried to port nouveau(opensource nvidia driver)?

Post by cjxgm »

VESA/VBE is too difficult to use in pmode, and they look not so formal. So, I need to write a video driver for my nv18 card. I just need to switch to graphics mode with high resolution, and i don't need hardware acceleration now.
I tried to look into nouveau's source code, but after searching a lot, I still didn't find where is the code that switches modes. :oops:
Could someone who has read nouveau's code tell me where can I find it or paste the key codes here?

By the way, is there any vm that emulates nvidia's video card?

Apology for my bad English.
Where there is a hacker, there is art. Fork me!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by Combuster »

VBE is an industry standard, and the corresponding document is quite complete. On the other hand, you won't find a VM that does an nvidia card so you really have to be ready to do things on actual hardware. The closest thing you can get is the Trio64 with hardware acceleration found in VirtualPC.

And searching ftw
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
blackoil
Member
Member
Posts: 146
Joined: Mon Feb 12, 2007 4:45 am

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by blackoil »

i have interests. cooperate?
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by Love4Boobies »

The better arguments against VBE are non-BIOS firmware (e.g., EFI, UEFI, OFW, etc.), lack of acceleration (well, VBE/AF does that but very few cards actually supported it in their ROM), and maybe long mode (because it takes extra work).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
cjxgm
Posts: 5
Joined: Sat Apr 30, 2011 12:15 am
Location: Quzhou, Zhejiang, China
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by cjxgm »

First, I'm sorry I haven't reply till now. I was busy at school (you know, China's education system sucks) and now the summer holiday is coming so I have more time on the Internet. (In fact, I nearly forgot my post here...)

I know a lot of advantages of VBE, but it's really not so easy to use in non-real mode (whatever pmode or lmode).
I looked at the post Combuster provided, but it still uses VBE to switch modes.

And blackoil, I like to cooperate with you, and my OS's code base is here:
https://github.com/cjxgm/lanos
I'm not so good at documenting, and I used to believe a good line-break replaces comments, so there are few docs and comments. I'm sorry for that. And for the summer holiday doesn't start yet, I can now be online only at weekends.

Maybe an x86 emulator serves my need, but unless I understand the mechanism, I won't use it. (And I don't fully understand it yet.)
Where there is a hacker, there is art. Fork me!
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by Griwes »

Just set the mode at the bootup, while you're still in real mode via VBE, or while you are still using boot services via (U)EFI, and tell the user to reboot the system to change resolution, while you don't have driver for his specific graphics card (= most of time).
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
cjxgm
Posts: 5
Joined: Sat Apr 30, 2011 12:15 am
Location: Quzhou, Zhejiang, China
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by cjxgm »

Griwes wrote:Just set the mode at the bootup, while you're still in real mode via VBE, or while you are still using boot services via (U)EFI, and tell the user to reboot the system to change resolution, while you don't have driver for his specific graphics card (= most of time).
My kernel was loaded by GRUB1, so I can not set mode before entering pmode.
Where there is a hacker, there is art. Fork me!
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by Griwes »

http://forum.osdev.org/viewtopic.php?f=1&t=10488 - see Brendan's post. While this may be a little hacky, on my laptop GRUB sets video mode before showing its menu; I'm almost sure it's 1600x900 - highest resolution available on this particular laptop; thus, I think that GRUB is capable of using VBE modes, and with little searching in google, or asking on grub mailing list, you should find easy (or at least not hacky) way to use GRUB to set the mode.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by Combuster »

The thing with linux driver sets is that they have several components to them - Parts of the driver may be in the kernel, parts of the driver are loaded into X, and the biggest pile of junk you'll find somewhere around libgl.so. Porting is always an option, but the design may be quite not what you want.

I do know a Nouveau developer personally, and he was confident that the dependencies on the driver architecture were small. The question remains how that relates to others subjective opinion - my personal experience with X drivers demands replicating a large part of the server architecture, which is not generally what you want.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
zity
Member
Member
Posts: 99
Joined: Mon Jul 13, 2009 5:52 am
Location: Denmark

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by zity »

This might be a little off topic, but handling VBE in pmode or long mode can easily be done by porting x86emu. This is probabaly not an ideal solution but it's easy and so far it works well in my OS. You will get all the usual 4:3 modes, but widescreen modes are not available.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Has anyone tried to port nouveau(opensource nvidia drive

Post by JamesM »

cjxgm wrote:VESA/VBE is too difficult to use in pmode, and they look not so formal. So, I need to write a video driver for my nv18 card. I just need to switch to graphics mode with high resolution, and i don't need hardware acceleration now.
I tried to look into nouveau's source code, but after searching a lot, I still didn't find where is the code that switches modes. :oops:
Could someone who has read nouveau's code tell me where can I find it or paste the key codes here?

By the way, is there any vm that emulates nvidia's video card?

Apology for my bad English.
I've had a go, on Pedigree, here. It supported bitblitting and fillrects on the pre-GPGPU architectures.

Beware, there be dragons. And magic numbers. Lots of magic numbers.
Post Reply