OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 20, 2018 3:52 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: VESA graphic mode
PostPosted: Mon May 14, 2018 10:28 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 29
Good day! Please, how do I switch to vesa the card into graphics mode 1024x768 without bios? Klakap


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Mon May 14, 2018 11:39 am 
Offline

Joined: Sat Sep 24, 2016 12:06 am
Posts: 18
Hi, VESA - is a part of VBE, u can try to use int 10h in PM(may be w.o. switching v86), but w.o. BIOS u will write video driver for each video card.
Cheers,
Aleksandr


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Mon May 14, 2018 1:39 pm 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 29
I can't go from protected mode to real and back and therefore I would rather like to write a driver but I don't know where to get information. Therefore, I am asking if anyone knows how to write a driver for VESA cards.


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Mon May 14, 2018 2:08 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8351
Location: At his keyboard!
Hi,

Klakap wrote:
I can't go from protected mode to real and back and therefore I would rather like to write a driver but I don't know where to get information. Therefore, I am asking if anyone knows how to write a driver for VESA cards.


There are no "VESA cards"; there's just many video cards from many manufacturers that all use different (non-standard, proprietary) registers and memory mapped IO that happen to provide VESA's VBE interface as an "option ROM" that extends the BIOS.

If you don't/can't use VBE ("VESA BIOS Extensions') and don't/can't use UEFI's equivalent (GOP or UGA); then you have to write about 100 different video drivers (one for each different video card). In that case I'd probably be tempted to start with something ancient like "Cirrus Logic 5446" or "3dfx Voodoo Graphics" (both from about 20 years ago), partly because they're a lot simpler than anything modern, partly because you can obtain programming information for them (unlike NVidia cards, etc), and partly because they're emulated by various emulators.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Mon May 14, 2018 9:40 pm 
Offline
Member
Member

Joined: Mon Jul 25, 2016 6:54 pm
Posts: 103
Location: Adelaide, Australia
Brendan wrote:
If you don't/can't use VBE ("VESA BIOS Extensions') and don't/can't use UEFI's equivalent (GOP or UGA); then you have to write about 100 different video drivers (one for each different video card). In that case I'd probably be tempted to start with something ancient like "Cirrus Logic 5446" or "3dfx Voodoo Graphics" (both from about 20 years ago), partly because they're a lot simpler than anything modern, partly because you can obtain programming information for them (unlike NVidia cards, etc), and partly because they're emulated by various emulators.

Apologies for off topic, but what do you think of starting with something like Intel HD instead of Cirrus of 3dfx? It seems that the standards are quite open, and honestly, I don't think I could find a real Cirrus or Voodoo card in 2018 if my life depended on it!


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Mon May 14, 2018 11:09 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8351
Location: At his keyboard!
Hi,

StudlyCaps wrote:
Apologies for off topic, but what do you think of starting with something like Intel HD instead of Cirrus of 3dfx? It seems that the standards are quite open, and honestly, I don't think I could find a real Cirrus or Voodoo card in 2018 if my life depended on it!


The standards are relatively open; but without prior experience it's very hard to understand any of it, and trying to debug a video driver when there's no video (because the video driver needs debugging) adds an extra layer of difficulty on top of that. Writing a video driver for an emulator (where you can use a debugger) gets you the prior experience that makes it "less hard" to understand (parts of) Intel's documentation.

Mostly; I'd start with Cirrus Logic (it's supported by both Bochs and Qemu) and then maybe consider "VMware SVGA-II" (supported by both Qemu and VMware). After that I'd try to find a real computer that has Intel's integrated video plus something else, where something else is/can be configured as "primary display adapter". That way I'd be able to use a working "raw framebuffer setup by boot loader" video driver for the primary display adapter (to see debugging messages, etc) while writing a proper driver for Intel's integrated video.

For writing a video driver; I'd want to start by trying to figure out which (VGA, HDMI, DVI, ..) ports there are and which ones have a monitor plugged in; then getting information/EDID from the monitor/s; then basic video mode switching (including using EDID to get the timing right); then monitor power management (sending the display into standby, etc) and backlight control (if its a laptop); then hot-plug events (for when a monitor is plugged in or unplugged). Next I'd probably add support for "unused video RAM as swap space"; then try to get vertical sync and page flipping to work. At this point I'd stop and move on to the next video card.

After "initial support" is finished for all video cards (and after I've died from old age in several of my lives - I'm hoping that's how it works) I'd revisit each video card driver. For "round two"; I'd start by adding support for any fixed function hardware (hardware mouse cursor, hardware bitblits, 2D and 3D graphics accelerators in old video cards, movie/MPEG/H.265 decoders). Then (for newer video cards) I'd do GPGPU (not for graphics), followed by GPU (for graphics - shaders or whatever); and GPU power management.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Mon May 14, 2018 11:43 pm 
Offline
Member
Member

Joined: Mon Jul 25, 2016 6:54 pm
Posts: 103
Location: Adelaide, Australia
Thanks Brendan, makes a lot of sense.
I hadn't really considered the difficulty of debugging with no emulator, very tricky. Personally I'd really like to be able to support at least one actual GPU so I can have nice stuff like resolution options and multiple displays. Intel would seem to be the way to go on actual hardware, because some 70-80% of consumer grade systems from the last 10 years should support it. In practice though it would probably be lots of staring at a blank screen wondering which one of hundreds of register pokes went wrong!

If one was really dedicated to that task, maybe setting up serial for debugging. Then working, as you described, but only for a single chip. Maybe it would be possible in only one or two lifetimes!


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Tue May 15, 2018 1:45 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 467
Yes. Use serial ports for debugging. I wrote a driver for some Intel cards (see the Wiki) and did not find debugging to be very challenging - even if you can output to the screen, debugging via serial I/O is still superior (better scrolling).

You can start with Cirrus; that choice would not be too bad but OTOH you can only use that on emulators (unless you buy ancient graphics cards). You can also consider Bochs' BGA first, although its register interface has little in common with real interfaces. I jumped straight to Intel after implementing BGA but did a lot of reading in between.

Regardless of which route you choose, make sure to understand the VGA page on the Wiki - especially the section on the CRTC. While the register interfaces are somewhat different, the general terms are still in use. Reading Linux drivers also helps a lot, get used to that.


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Tue May 15, 2018 12:02 pm 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 29
I tried to write a driver for the VGA but nowhere I found how to switch VGA into graphics mode. Please what commands do I have to switch the VGA into graphics mode?


Top
 Profile  
 
 Post subject: Re: VESA graphic mode
PostPosted: Tue May 15, 2018 11:53 pm 
Offline
Member
Member

Joined: Mon Jul 25, 2016 6:54 pm
Posts: 103
Location: Adelaide, Australia
Klakap wrote:
I tried to write a driver for the VGA but nowhere I found how to switch VGA into graphics mode. Please what commands do I have to switch the VGA into graphics mode?


I havn't done my own VGA driver yet, but there is code here which shows how you can switch between the different text and graphics modes. If you reference that against the register information here you should be able to figure out how to fit it into your driver design.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 6 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