mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
Switch into 1024x768x32bpp VESA LFB mode at boot.
This is going to be pretty cool once I can hook up the Widgets/ code to it.
This commit is contained in:
parent
9963da9005
commit
659c54e32b
9 changed files with 172 additions and 2 deletions
|
@ -1811,3 +1811,76 @@ Unix::clock_t Process::sys$times(Unix::tms* times)
|
|||
times->tms_cstime = m_ticks_in_kernel_for_dead_children;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct vbe_info_structure {
|
||||
char signature[4]; // must be "VESA" to indicate valid VBE support
|
||||
word version; // VBE version; high byte is major version, low byte is minor version
|
||||
dword oem; // segment:offset pointer to OEM
|
||||
dword capabilities; // bitfield that describes card capabilities
|
||||
dword video_modes; // segment:offset pointer to list of supported video modes
|
||||
word video_memory; // amount of video memory in 64KB blocks
|
||||
word software_rev; // software revision
|
||||
dword vendor; // segment:offset to card vendor string
|
||||
dword product_name; // segment:offset to card model name
|
||||
dword product_rev; // segment:offset pointer to product revision
|
||||
char reserved[222]; // reserved for future expansion
|
||||
char oem_data[256]; // OEM BIOSes store their strings in this area
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct vbe_mode_info_structure {
|
||||
word attributes; // deprecated, only bit 7 should be of interest to you, and it indicates the mode supports a linear frame buffer.
|
||||
byte window_a; // deprecated
|
||||
byte window_b; // deprecated
|
||||
word granularity; // deprecated; used while calculating bank numbers
|
||||
word window_size;
|
||||
word segment_a;
|
||||
word segment_b;
|
||||
dword win_func_ptr; // deprecated; used to switch banks from protected mode without returning to real mode
|
||||
word pitch; // number of bytes per horizontal line
|
||||
word width; // width in pixels
|
||||
word height; // height in pixels
|
||||
byte w_char; // unused...
|
||||
byte y_char; // ...
|
||||
byte planes;
|
||||
byte bpp; // bits per pixel in this mode
|
||||
byte banks; // deprecated; total number of banks in this mode
|
||||
byte memory_model;
|
||||
byte bank_size; // deprecated; size of a bank, almost always 64 KB but may be 16 KB...
|
||||
byte image_pages;
|
||||
byte reserved0;
|
||||
|
||||
byte red_mask;
|
||||
byte red_position;
|
||||
byte green_mask;
|
||||
byte green_position;
|
||||
byte blue_mask;
|
||||
byte blue_position;
|
||||
byte reserved_mask;
|
||||
byte reserved_position;
|
||||
byte direct_color_attributes;
|
||||
|
||||
dword framebuffer; // physical address of the linear frame buffer; write here to draw to the screen
|
||||
dword off_screen_mem_off;
|
||||
word off_screen_mem_size; // size of memory in the framebuffer but not being displayed on the screen
|
||||
byte reserved1[206];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
DisplayInfo Process::get_display_info()
|
||||
{
|
||||
DisplayInfo info;
|
||||
//auto* vinfo = reinterpret_cast<vbe_info_structure*>(0xc000);
|
||||
auto* vmode = reinterpret_cast<vbe_mode_info_structure*>(0x2000);
|
||||
dbgprintf("VESA framebuffer, %ux%u, %u bpp @ P%x\n", vmode->width, vmode->height, vmode->bpp, vmode->framebuffer);
|
||||
dbgprintf("Returning display info in %s<%u>\n", name().characters(), pid());
|
||||
info.width = vmode->width;
|
||||
info.height = vmode->height;
|
||||
info.bpp = vmode->bpp;
|
||||
info.pitch = vmode->pitch;
|
||||
size_t framebuffer_size = info.pitch * info.height;
|
||||
if (!m_display_framebuffer_region) {
|
||||
auto framebuffer_vmo = VMObject::create_framebuffer_wrapper(PhysicalAddress(vmode->framebuffer), framebuffer_size);
|
||||
m_display_framebuffer_region = allocate_region_with_vmo(LinearAddress(0xe0000000), framebuffer_size, move(framebuffer_vmo), 0, "framebuffer", true, true);
|
||||
}
|
||||
info.framebuffer = m_display_framebuffer_region->linearAddress.asPtr();
|
||||
return info;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue