VGA Hardware: Difference between revisions

m
no edit summary
[unchecked revision][unchecked revision]
mNo edit summary
mNo edit summary
 
(5 intermediate revisions by 5 users not shown)
Line 1:
The VGA is a complex piece of hardware. Even though it's old, many modern graphics cards are compatible with it, including NVidia and ATI cards. This can make writing a VGA driver rather attractive. The amount of compatibility varies however, so never assume a card is compatible without proper hardware detection.
Apart from real machines, several emulators and virtual machines provide VGA emulation: [[Bochs]], [[QEMU]] and [[Microsoft Virtual PC]] to name a few.
{{Video warning}}
 
TheEven though VGA is a complex piece of hardware. Even though it's old, many modern graphics cards are compatible with it, including NVidia and ATI cards. This can make writing a VGA driver rather attractive. The amount of compatibility varies however, so never assume a card is compatible without proper hardware detection.
Apart from real machines, several emulators and virtual machines provide VGA emulation: [[Bochs]], [[QEMU]] and [[Microsoft Virtual PC]] to name a few. After 2011 video card manufacturers begun to drop VGA compatibility in favour of [[GOP]] under [[UEFI]] (VirtualBox UEFI and TianoCore both supports that).
 
== Overview ==
Line 136:
|}
 
The Plane Write Enable register is used to choose the plane to be written, then the memory can be written by written by accessing the corresponding address in memory.
 
=== Memory Layout in 256-color graphics modes ===
Line 647:
==== Timing Model ====
 
The horizontal timing registers are based on a unit called 'character' (As they match one character in text mode). Each character equals 8 ('''9/8 Dot Mode''' is set) or 9 ('''9/8 Dot Mode''' is clear) pixels. Each scanline contains '''Horizontal Total''' + 5 characters, zero based. '''Horizontal Display End''' tells us the last character that is calculated from memory (i.e. the horizontal resolution in characters minus one). '''Horizontal Blanking Start''' and '''Horizontal Retrace Start''' give us the the last character before either period is started. '''Horizontal Blanking End''' and '''Horizontal Retrace End''' need more explanation, as they only contain part of a number. When blanking or horizontal retrace is enabled the significant bits are checked against the character counter, and if these bits match the respective period will be ended. The quick solution is to calculate the appropriate values, compute the last character clock at which each period should be active, then AND it with 0x3F (Blank) or 0x1F (Retrace) to get the register's value. Note that the periods must be between 1 and 63(Blank)/31(Retrace) character clocks. To be safe, there must be at least one character of overscan on each side of the screen to avoid additional artefacts.
 
The vertical timing is similar, apart from the fact that these registers operate on scan lines (pixels) instead of characters. The '''Vertical Retrace End''' and '''Vertical Blank End''' registers work also similar, although they are different sizes. The Retrace End is 4 bits wide (AND with 0xF, period is 1-15 scanlines), The Blank End size is at least 7 bits (some say its 8, some say its 7), so the value is computed by ANDing with 0xFF, with the period ranging from 1-127 scanlines. As with horizontal timing, at least one scan line of overscan must be present to avoid possible artefacts.
Line 973:
 
* http://tinyvga.com/vga-timing — VGA Signal Timing
* http://www.osdever.net/FreeVGA/vga/vga.htm — includes some things not explained here
 
[[Category:VGA]]
[[Category:Video]]
[[Category:Hardware]]