From 9c81f9ad19ca7f5e9ce043be52e2e2d48d58486b Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 15 Jun 2007 23:58:10 +0000 Subject: [PATCH] prepare vbe driver for two thing 1. a framebuf for VBE 1.2 this will be pretty hard to implement, I got some idea, this mean our vbe drv will work on vbe 1.2 without doing a bankswitch 2. prepare for some dx api for vbe by adding support for special mode 0x81FF meaing we getting full access to the video driver memory in vbe. Thx aleasky you remmid and long talk in some month how we can do it. svn path=/trunk/; revision=27197 --- reactos/drivers/video/miniport/vbe/vbemp.c | 74 ++++++++++++++++++++-- 1 file changed, 68 insertions(+), 6 deletions(-) diff --git a/reactos/drivers/video/miniport/vbe/vbemp.c b/reactos/drivers/video/miniport/vbe/vbemp.c index af7ca40b4e7..61e34178db9 100644 --- a/reactos/drivers/video/miniport/vbe/vbemp.c +++ b/reactos/drivers/video/miniport/vbe/vbemp.c @@ -251,6 +251,9 @@ VBEInitialize(PVOID HwDeviceExtension) VBEDeviceExtension->VbeInfo.Version & 0xFF, VBEDeviceExtension->VbeInfo.TotalMemory * 64); + + + #ifdef VBE12_SUPPORT if (VBEDeviceExtension->VbeInfo.Version < 0x102) #else @@ -295,14 +298,16 @@ VBEInitialize(PVOID HwDeviceExtension) break; } + + /* * Allocate space for video modes information. */ VBEDeviceExtension->ModeInfo = - VideoPortAllocatePool(HwDeviceExtension, VpPagedPool, ModeCount * sizeof(VBE_MODEINFO), TAG_VBE); + VideoPortAllocatePool(HwDeviceExtension, VpPagedPool, (ModeCount + 1) * sizeof(VBE_MODEINFO), TAG_VBE); VBEDeviceExtension->ModeNumbers = - VideoPortAllocatePool(HwDeviceExtension, VpPagedPool, ModeCount * sizeof(USHORT), TAG_VBE); + VideoPortAllocatePool(HwDeviceExtension, VpPagedPool, (ModeCount+ 1) * sizeof(USHORT), TAG_VBE); /* * Get the actual mode infos. @@ -355,14 +360,65 @@ VBEInitialize(PVOID HwDeviceExtension) } #ifdef VBE12_SUPPORT else - { - VBEDeviceExtension->ModeNumbers[SuitableModeCount] = ModeTemp; - SuitableModeCount++; + { + /* FIXME when PCI bus scanner are inplace we need add ModeTemp | 0x4000 + * for we will map the memory our self and do not use bankswitch */ + + if (VBEDeviceExtension->VbeInfo.Version < 0x200) + { + VBEDeviceExtension->ModeNumbers[SuitableModeCount] = ModeTemp; + SuitableModeCount++; + } } #endif } } + +#ifdef VBE12_SUPPORT + if (VBEDeviceExtension->VbeInfo.Version < 0x200) + { + /* FIXME add PCI bus scanner to detect the video ram phy address */ + } + else +#endif + if (VBEDeviceExtension->VbeInfo.Version >= 0x200) + { + + /* Call VBE BIOS to read the mode info.for the special mode */ + VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters)); + BiosRegisters.Eax = VBE_GET_MODE_INFORMATION; + BiosRegisters.Ecx = 0x81FF; + BiosRegisters.Edi = VBEDeviceExtension->TrampolineMemoryOffset + 0x200; + BiosRegisters.SegEs = VBEDeviceExtension->TrampolineMemorySegment; + VBEDeviceExtension->Int10Interface.Int10CallBios( + VBEDeviceExtension->Int10Interface.Context, + &BiosRegisters); + + VBEDeviceExtension->ModeNumbers[SuitableModeCount] = 0; + + if (BiosRegisters.Eax == VBE_SUCCESS) + { + /* transfer the special mode data to protected memory */ + VBEDeviceExtension->Int10Interface.Int10ReadMemory( + VBEDeviceExtension->Int10Interface.Context, + VBEDeviceExtension->TrampolineMemorySegment, + VBEDeviceExtension->TrampolineMemoryOffset + 0x200, + VBEDeviceExtension->ModeInfo + SuitableModeCount, + sizeof(VBE_MODEINFO)); + + VBEDeviceExtension->ModeNumbers[SuitableModeCount] = 0x81FF; + /* Do not add special mode to the list */ + //SuitableModeCount++; + + /* to gain full phy memory + * VBEDeviceExtension->ModeNumbers[SuitableModeCount].PhysBasePtr + * VBEDeviceExtension->VbeInfo.TotalMemory * 64 = x Memory on the card in Kbyte + */ + } + } + + if (SuitableModeCount == 0) { VideoPortDebugPrint(Warn, "VBEMP: No video modes supported\n"); @@ -391,6 +447,9 @@ VBEInitialize(PVOID HwDeviceExtension) VBEDeviceExtension->ModeInfo[CurrentMode].BitsPerPixel); } + + + /* * Enumerate our children. */ @@ -814,11 +873,14 @@ VBEMapVideoMemory( #ifdef VBE12_SUPPORT else { + // when pci bus scanner are in place we remove this one FrameBuffer.QuadPart = 0xA0000; MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress; MapInformation->VideoRamLength = 0x10000; } -#endif +#endif + + VideoPortMapMemory(DeviceExtension, FrameBuffer, &MapInformation->VideoRamLength, &inIoSpace,