Page 1 of 2

Video generation books

Posted: Thu Feb 04, 2021 8:51 am
by lukassevc
Hello!

I would like to add video generation capability to my OS. The problem is that I'm confused wih all the standarts and ways, that's why I would like to ask for some complete book/document/... ( web site and projects as well, even though I don't prefer them ) which explains everything from the basic 320x200 16 color EGA/VGA modes, through the VGA hardware registers up to the VESA GOP and how to create a universal video driver ( if something like that is possible ). I'm not looking for some fancy 3D acceleration stuff, just for thing as simple as drawing a pixel to the screen and some basic sprites. Also, I would be very happy if it could generate 1920x1080 full HD video, is it possible by using the VGA hardware registers?

Thanks a lot!

Re: Video generation books

Posted: Thu Feb 04, 2021 9:33 am
by austanss
What architecture are you building this OS on?

Re: Video generation books

Posted: Thu Feb 04, 2021 9:48 am
by nullplan
lukassevc wrote:The problem is that I'm confused wih all the standarts and ways,
There once was a graphics card known as the VGA. It was very good for its time (1987) but has outlived its usefulness. Then there used to be VESA, which came in different versions, but the most recent ones simply tell you to query for the available graphics modes, and then set the mode you want, and then leave it at that. Now there is GOP, which is essentially the same thing with a different interface (function pointers instead of interrupts). But the idea is the same: Query modes, set mode, use framebuffer. Be happy. The only alternative to using these things is to write a graphics driver for your (brand of) graphics card. Good like finding documentation. Intel releases theirs. nVidia doesn't. Don't know for AMD. Don't know any other player in the current market.
lukassevc wrote: Also, I would be very happy if it could generate 1920x1080 full HD video, is it possible by using the VGA hardware registers?
No. The VGA is fundamentally incapable of anything like that. To my knowledge, you could conceivably get 640x480 going, but only at eyestraining refresh rates. For anything else, the pixel clock is too slow. Besides, the quality of VGA emulation has been slipping somewhat in recent graphics adapters, probably because few need it. Your best bet is, now as always, to go with VESA or GOP and forget the VGA ever existed. Set graphics mode via firmware, get framebuffer characteristics from firmware, and work with that.

Re: Video generation books

Posted: Thu Feb 04, 2021 10:02 am
by eekee
nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!

Re: Video generation books

Posted: Thu Feb 04, 2021 10:44 am
by nullplan
eekee wrote:nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!
A certain Torvalds quote comes to mind. Dear god, we just had a system that basically works for every card and every PC, and now they want to break it. WHY?

Re: Video generation books

Posted: Thu Feb 04, 2021 11:19 am
by lukassevc
nullplan wrote:
lukassevc wrote:The problem is that I'm confused wih all the standarts and ways,
There once was a graphics card known as the VGA. It was very good for its time (1987) but has outlived its usefulness. Then there used to be VESA, which came in different versions, but the most recent ones simply tell you to query for the available graphics modes, and then set the mode you want, and then leave it at that. Now there is GOP, which is essentially the same thing with a different interface (function pointers instead of interrupts). But the idea is the same: Query modes, set mode, use framebuffer. Be happy. The only alternative to using these things is to write a graphics driver for your (brand of) graphics card. Good like finding documentation. Intel releases theirs. nVidia doesn't. Don't know for AMD. Don't know any other player in the current market.
lukassevc wrote: Also, I would be very happy if it could generate 1920x1080 full HD video, is it possible by using the VGA hardware registers?
No. The VGA is fundamentally incapable of anything like that. To my knowledge, you could conceivably get 640x480 going, but only at eyestraining refresh rates. For anything else, the pixel clock is too slow. Besides, the quality of VGA emulation has been slipping somewhat in recent graphics adapters, probably because few need it. Your best bet is, now as always, to go with VESA or GOP and forget the VGA ever existed. Set graphics mode via firmware, get framebuffer characteristics from firmware, and work with that.
The only problem is that I have my normal computer with UEFI and GOP, but my much much older computer from 2008 dosn't have it, so there remains a question, how am I supposed to deal with this kind of a problem? I think I should somehow detect the GOP, and that's the reason why I wanted a book about it. Also, it has some FUJITSU GPU and I don't really know anything about it.

Re: Video generation books

Posted: Thu Feb 04, 2021 11:21 am
by lukassevc
eekee wrote:nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!
May I ask where I can find this doc? I tried to search for it multiple times but nothing usable. Thanks!

Re: Video generation books

Posted: Thu Feb 04, 2021 12:00 pm
by Klakap
The only problem is that I have my normal computer with UEFI and GOP, but my much much older computer from 2008 dosn't have it, so there remains a question, how am I supposed to deal with this kind of a problem? I think I should somehow detect the GOP, and that's the reason why I wanted a book about it. Also, it has some FUJITSU GPU and I don't really know anything about it.
For older computers without UEFI is VESA standard. It working on BIOS interrupt 0x10. On wiki we have page VESA_Video_Modes. You can scan all graphic modes whose are aviable and choose biggest.

//edit: VESA spec is very useful, you can get it fromhttp://www.petesqbsite.com/sections/tut ... s/vbe3.pdf

Re: Video generation books

Posted: Thu Feb 04, 2021 12:25 pm
by xeyes
nullplan wrote:
eekee wrote:nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!
A certain Torvalds quote comes to mind. Dear god, we just had a system that basically works for every card and every PC, and now they want to break it. WHY?
Because they want us consumers to buy other vendor's video cards :wink:

NVDA is content as long as it can sell AI accelerators, yup, those that don't have video output ports or capabilities at all, to the big corporations. Much better margin, growth, and 'exciting story of growth' over there than a 'dying' market like the PC.

Re: Video generation books

Posted: Thu Feb 04, 2021 1:00 pm
by austanss
eekee wrote:nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!
So this explains why my OS looks like wack on my PC...

Re: Video generation books

Posted: Thu Feb 04, 2021 8:39 pm
by eekee
nullplan wrote:
eekee wrote:nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!
A certain Torvalds quote comes to mind. Dear god, we just had a system that basically works for every card and every PC, and now they want to break it. WHY?
I had a guess I thought was a good one, but now I come to write it out, I realise it looks like total paranoia. It goes like this: Idiot buys nVidia card & installs mainstream OS. Idiot doesn't install graphics driver & doesn't realise its using a framebuffer driver. Idiot gets all over the net shouting "nVidia slowed down my PC!" If this was a real problem, why don't ATi remove native resolutions too?
xeyes wrote:Because they want us consumers to buy other vendor's video cards :wink:
Hahaha!
xeyes wrote:NVDA is content as long as it can sell AI accelerators, yup, those that don't have video output ports or capabilities at all, to the big corporations. Much better margin, growth, and 'exciting story of growth' over there than a 'dying' market like the PC.
Interesting... and somewhat annoyingly, very likely true. There is one up-side to this: those things aren't just AI accelerators, they make good accelerators for physics engines too.

Re: Video generation books

Posted: Sat Feb 06, 2021 10:31 am
by lukassevc
Klakap wrote:
The only problem is that I have my normal computer with UEFI and GOP, but my much much older computer from 2008 dosn't have it, so there remains a question, how am I supposed to deal with this kind of a problem? I think I should somehow detect the GOP, and that's the reason why I wanted a book about it. Also, it has some FUJITSU GPU and I don't really know anything about it.
For older computers without UEFI is VESA standard. It working on BIOS interrupt 0x10. On wiki we have page VESA_Video_Modes. You can scan all graphic modes whose are aviable and choose biggest.

//edit: VESA spec is very useful, you can get it fromhttp://www.petesqbsite.com/sections/tut ... s/vbe3.pdf
Thank you very much! There's just one problem, I can't use this in protected mode since it uses real mode interrupts, any way around this except for switching back and forth?

Re: Video generation books

Posted: Sat Feb 06, 2021 11:28 am
by Gigasoft
The other option, which might be easier, is to use Virtual 8086 mode.

Re: Video generation books

Posted: Sat Feb 06, 2021 1:47 pm
by Schol-R-LEA
eekee wrote:nVidia releases some documentation; just enough to set display modes. This is likely to be essential as nVidia also hate VESA and GOP to a near-fanatic extent, going so far as to remove the screen's native pixel size from the supported modes!
AMD is slightly better in this regard, providing enough documentation to write a basic driver and even directly supporting the FOSS drivers for Linux. They do still hold back some important info, but far less than nVidia do.

Re: Video generation books

Posted: Sat Feb 06, 2021 3:10 pm
by Octocontrabass
lukassevc wrote:There's just one problem, I can't use this in protected mode since it uses real mode interrupts, any way around this except for switching back and forth?
Make your bootloader do all of the work before it switches to protected mode.