toaruos/kernel/include/vesa.h
Kevin Lange c0f45e0b7f VESA mode switching support.
BIOS execution is provided through the `v8086` module, which provides
software emulation of an 8086 processor. It is not currently working
with some BIOSes and may (read: probably will be) replaced with another
emulator (x86emu comes to mind) at some point in the near future. In the
meantime, the default video mode for QEMU works with this and it's
enough to get us on real VESA instead of fake VBE. The `bochs` module
will be renamed in a future commit. Userspace programs have been
adjusted to work at bitrates other than 32 *POORLY*. If you write pixels
left-to-right, they should work fine. They only work with 24-bpp
otherwise, and then you need to be careful of what pixels you are
writing when, or you will overwrite things in other pixels.

You may pass a commandline argument like the following to set display
modes:

  vid=vesa,1024,768

Or for stranger modes under QEMU or Bochs, use the bochs VBE
initializer:

  vid=bochs,1280,720

Note that the address of the linear framebuffer is still found via
hackish probing instead of PCI or trusting the VBE information, so if
you have things in the wrong memory ranges (0xE0000000+), be prepared to
have them get read.

Once again, this entire commit is a massive hack. I am happy that it
worked, and I will continue to make it less hacky, but in the meantime,
this is what we've got.

Happy holidays.
2011-12-25 00:40:40 -06:00

46 lines
978 B
C

#ifndef VESA_H
#define VESA_H
#include <types.h>
typedef struct {
uint16_t Offset;
uint16_t Segment;
} t_farptr;
struct VesaControllerInfo {
char Signature[4]; // == "VBE2"
uint16_t Version; // == 0x0300 for Vesa 3.0
t_farptr OemString; // isa vbeFarPtr
uint8_t Capabilities[4];
t_farptr Videomodes; // isa vbeParPtr
uint16_t TotalMemory;// as # of 64KB blocks
};
struct VesaModeInfo {
uint16_t attributes;
uint8_t winA, winB;
uint16_t granularity;
uint16_t winsize;
uint16_t segmentA, segmentB;
t_farptr realFctPtr;
uint16_t pitch; // bytes per scanline
uint16_t Xres, Yres;
uint8_t Wchar, Ychar, planes, bpp, banks;
uint8_t memory_model, bank_size, image_pages;
uint8_t reserved0;
uint8_t red_mask, red_position;
uint8_t green_mask, green_position;
uint8_t blue_mask, blue_position;
uint8_t rsv_mask, rsv_position;
uint8_t directcolor_attributes;
uint32_t physbase; // your LFB address ;)
uint32_t reserved1;
uint16_t reserved2;
};
#endif