mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
Implement non linear framebuffer detection for VBE multiboot
Real hardware doesn't often use a linear framebuffer. It can causes graphics issues.
This commit is contained in:
parent
274c5c8b7a
commit
2f2cd626e3
1 changed files with 15 additions and 2 deletions
|
|
@ -81,9 +81,22 @@ namespace Cosmos.HAL.Drivers
|
||||||
if (VBE.IsAvailable()) //VBE VESA Enabled Mulitboot Parsing
|
if (VBE.IsAvailable()) //VBE VESA Enabled Mulitboot Parsing
|
||||||
{
|
{
|
||||||
Global.mDebugger.SendInternal($"Creating VBE VESA driver with Mode {xres}*{yres}@{bpp}");
|
Global.mDebugger.SendInternal($"Creating VBE VESA driver with Mode {xres}*{yres}@{bpp}");
|
||||||
|
|
||||||
|
var ModeInfo = VBE.getModeInfo();
|
||||||
|
|
||||||
|
if ((ModeInfo.pitch / 4) == ModeInfo.width) //linear framebuffer detection
|
||||||
|
{
|
||||||
IO.LinearFrameBuffer = new MemoryBlock(VBE.getLfbOffset(), (uint)xres * yres * (uint)(bpp / 8));
|
IO.LinearFrameBuffer = new MemoryBlock(VBE.getLfbOffset(), (uint)xres * yres * (uint)(bpp / 8));
|
||||||
lastbuffer = new ManagedMemoryBlock((uint)xres * yres * (uint)(bpp / 8));
|
lastbuffer = new ManagedMemoryBlock((uint)xres * yres * (uint)(bpp / 8));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint OffScreenSize = (ModeInfo.pitch / (uint)(bpp / 8)) - ModeInfo.width;
|
||||||
|
|
||||||
|
IO.LinearFrameBuffer = new MemoryBlock(VBE.getLfbOffset(), (uint)(xres * yres * (uint)(bpp / 8)) + (OffScreenSize * yres * (uint)(bpp / 8)));
|
||||||
|
lastbuffer = new ManagedMemoryBlock((uint)(xres * yres * (uint)(bpp / 8)) + (OffScreenSize * yres * (uint)(bpp / 8)));
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (ISAModeAvailable()) //Bochs Graphics Adaptor ISA Mode
|
else if (ISAModeAvailable()) //Bochs Graphics Adaptor ISA Mode
|
||||||
{
|
{
|
||||||
Global.mDebugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}.");
|
Global.mDebugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}.");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue