remove useless using + VBEAvailable function

This commit is contained in:
valentinbreiz 2020-07-16 21:07:43 +02:00
parent 8c054b3e0b
commit d5cc9cd7fe
3 changed files with 32 additions and 4 deletions

View file

@ -84,7 +84,7 @@ namespace Cosmos.HAL.Drivers
IO.LinearFrameBuffer = new MemoryBlock(VBE.getLfbOffset(), (uint)xres * yres * (uint)(bpp / 8));
lastbuffer = new ManagedMemoryBlock((uint)xres * yres * (uint)(bpp / 8));
}
else if (Available()) //Bochs Graphics Adaptor ISA Mode
else if (AvailableISAMode()) //Bochs Graphics Adaptor ISA Mode
{
Global.mDebugger.SendInternal($"Creating VBE BGA driver with Mode {xres}*{yres}@{bpp}.");
@ -123,7 +123,7 @@ namespace Cosmos.HAL.Drivers
IO.VbeIndex.Word = (ushort)index;
return IO.VbeData.Word;
}
public static bool Available()
public static bool AvailableISAMode()
{
//This code wont work as long as Bochs uses BGA ISA, since it wont discover it in PCI
#if false

View file

@ -5,7 +5,6 @@ using System.Text;
using Cosmos.Core.IOGroup;
using Cosmos.Common.Extensions;
using Cosmos.Debug.Kernel;
using System.Threading;
namespace Cosmos.HAL
{

View file

@ -1,4 +1,5 @@
//#define COSMOSDEBUG
using Cosmos.Core;
using Cosmos.HAL;
using Cosmos.HAL.Drivers;
@ -66,7 +67,7 @@ namespace Cosmos.System.Graphics
{
return new SVGAIICanvas();
}
else if (BGAExists() || PCI.Exists(VendorID.VirtualBox, DeviceID.VBVGA) || PCI.Exists(VendorID.Bochs, DeviceID.BGA) || Core.VBE.IsAvailable())
if (VBEAvailable())
{
return new VBECanvas();
}
@ -76,6 +77,34 @@ namespace Cosmos.System.Graphics
}
}
/// <summary>
/// Checks is VBE is supported exists
/// </summary>
/// <returns></returns>
private static bool VBEAvailable()
{
if (BGAExists())
{
return true;
}
else if (PCI.Exists(VendorID.VirtualBox, DeviceID.VBVGA))
{
return true;
}
else if (PCI.Exists(VendorID.Bochs, DeviceID.BGA))
{
return true;
}
else if (VBE.IsAvailable())
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// Get video driver.
/// </summary>