Re: Qestions about VESA/VBE
Posted: Sun Dec 29, 2013 6:28 am
Hi,
In all cases, different video cards are allowed to do anything they like (e.g. 16bpp might be 5 bits for each with a spare bit for padding, or could be BGR instead of RGB, or 2-bits for blue and red with 12 bits for green, or anything else); and you should consult the bit positions and masks that VBE provides. This information should have been kept by the multi-boot boot loader (e.g. the "vbe_mode_info" pointer at offset 76 in the Multiboot information structure should point to the VBE mode info that contains the bit positions and masks that you need to use).
Note: Writing native video drivers sounds extremely hard; and to be honest it is extremely difficult if you want a full function native video driver. However; native video drivers that are only able to change video modes (and don't support fancy features like hardware mouse pointers, overlays, 2D/3D acceleration, shaders, GPGPU, etc) is probably a lot easier than most people realise.
Cheers,
Brendan
I've never seen RGBA for 24bpp - normally there's only RGB, with "8-bit blue byte, then 8-bit green byte, then 8-bit red byte". For 16bpp normally the lowest 5 bits are for blue, then middle 6 bits are green and the highest 5 bits are for red.MadZarx wrote:I dont understand the pixel formats in different bit depths. For example whats the format of placement of RGBA in a 24bpp or RGB in 16bpp?
In all cases, different video cards are allowed to do anything they like (e.g. 16bpp might be 5 bits for each with a spare bit for padding, or could be BGR instead of RGB, or 2-bits for blue and red with 12 bits for green, or anything else); and you should consult the bit positions and masks that VBE provides. This information should have been kept by the multi-boot boot loader (e.g. the "vbe_mode_info" pointer at offset 76 in the Multiboot information structure should point to the VBE mode info that contains the bit positions and masks that you need to use).
They use whatever the firmware provides to set an initial video mode during boot (e.g. VBE for BIOS or GOP/UGA for UEFI), and then start a native video driver for switching video modes after boot.MadZarx wrote:How windows loads 32bpp by deafult? Does windows pack drivers for all vga cards? Or how linux does it? When linux boots, its still in textmode then it changes the console resolution. Whats the trick behind these OSs that they support 32bpp and can change the resolution or bit depth at any time?
Note: Writing native video drivers sounds extremely hard; and to be honest it is extremely difficult if you want a full function native video driver. However; native video drivers that are only able to change video modes (and don't support fancy features like hardware mouse pointers, overlays, 2D/3D acceleration, shaders, GPGPU, etc) is probably a lot easier than most people realise.
Cheers,
Brendan