[VGA_NEW]

- Lessons learnt: the more trivial, the more suspicious.
Fix build, and remind that MSDN is not always right.

svn path=/trunk/; revision=60066
This commit is contained in:
Jérôme Gardou 2013-09-12 21:22:42 +00:00
parent b77b18fac3
commit 4f9c6d1106
4 changed files with 38 additions and 38 deletions

View file

@ -470,7 +470,7 @@ Return Value:
if (pRequestedMode->hres == 320) if (pRequestedMode->hres == 320)
{ {
VideoDebugPrint(0, "ModeX not support!!!\n"); VideoDebugPrint((0, "ModeX not support!!!\n"));
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
} }
// eVb: 2.7 [END] // eVb: 2.7 [END]
@ -481,7 +481,7 @@ Return Value:
if (!(pRequestedMode->fbType & VIDEO_MODE_GRAPHICS)) if (!(pRequestedMode->fbType & VIDEO_MODE_GRAPHICS))
{ {
// eVb: 2.8 [TODO] - This code path is not implemented yet // eVb: 2.8 [TODO] - This code path is not implemented yet
VideoDebugPrint(0, "Text-mode not support!!!\n"); VideoDebugPrint((0, "Text-mode not support!!!\n"));
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
// eVb: 2.8 [END] // eVb: 2.8 [END]
} }

View file

@ -44,7 +44,7 @@ IsVesaBiosOk(IN PVIDEO_PORT_INT10_INTERFACE Interface,
CHAR Version[21]; CHAR Version[21];
/* If the broken VESA bios found, turn VESA off */ /* If the broken VESA bios found, turn VESA off */
VideoDebugPrint(0, "Vendor: %s Product: %s Revision: %s (%lx)\n", Vendor, Product, Revision, OemRevision); VideoDebugPrint((0, "Vendor: %s Product: %s Revision: %s (%lx)\n", Vendor, Product, Revision, OemRevision));
for (i = 0; i < (sizeof(BrokenVesaBiosList) / sizeof(PCHAR)); i++) for (i = 0; i < (sizeof(BrokenVesaBiosList) / sizeof(PCHAR)); i++)
{ {
if (!strncmp(Product, BrokenVesaBiosList[i], strlen(BrokenVesaBiosList[i]))) return FALSE; if (!strncmp(Product, BrokenVesaBiosList[i], strlen(BrokenVesaBiosList[i]))) return FALSE;
@ -69,7 +69,7 @@ IsVesaBiosOk(IN PVIDEO_PORT_INT10_INTERFACE Interface,
} }
/* VESA ok */ /* VESA ok */
VideoDebugPrint(0, "Vesa ok\n"); VideoDebugPrint((0, "Vesa ok\n"));
return TRUE; return TRUE;
} }
@ -153,7 +153,7 @@ VbeSetColorLookup(IN PHW_DEVICE_EXTENSION VgaExtension,
Entries = ClutBuffer->NumEntries; Entries = ClutBuffer->NumEntries;
VideoDebugPrint(0, "Setting %lu entries.\n", Entries); VideoDebugPrint((0, "Setting %lu entries.\n", Entries));
/* /*
* For Vga compatible modes, write them directly. * For Vga compatible modes, write them directly.
@ -209,7 +209,7 @@ VbeSetColorLookup(IN PHW_DEVICE_EXTENSION VgaExtension,
Status = VgaExtension->Int10Interface.Int10CallBios(Context, &BiosArguments); Status = VgaExtension->Int10Interface.Int10CallBios(Context, &BiosArguments);
if (Status != NO_ERROR) return ERROR_INVALID_PARAMETER; if (Status != NO_ERROR) return ERROR_INVALID_PARAMETER;
VideoPortFreePool(VgaExtension, VesaClut); VideoPortFreePool(VgaExtension, VesaClut);
VideoDebugPrint(Error, "VBE Status: %lx\n", BiosArguments.Eax); VideoDebugPrint((Error, "VBE Status: %lx\n", BiosArguments.Eax));
if (VBE_GETRETURNCODE(BiosArguments.Eax) == VBE_SUCCESS) if (VBE_GETRETURNCODE(BiosArguments.Eax) == VBE_SUCCESS)
return NO_ERROR; return NO_ERROR;
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;

View file

@ -98,12 +98,12 @@ VbeSetMode(IN PHW_DEVICE_EXTENSION VgaDeviceExtension,
ModeIndex = VgaMode->Mode; ModeIndex = VgaMode->Mode;
BiosArguments.Eax = VBE_SET_VBE_MODE; BiosArguments.Eax = VBE_SET_VBE_MODE;
BiosArguments.Ebx = HIWORD(ModeIndex); BiosArguments.Ebx = HIWORD(ModeIndex);
VideoDebugPrint(0, "Switching to %lx %lx\n", BiosArguments.Eax, BiosArguments.Ebx); VideoDebugPrint((0, "Switching to %lx %lx\n", BiosArguments.Eax, BiosArguments.Ebx));
Status = VideoPortInt10(VgaDeviceExtension, &BiosArguments); Status = VideoPortInt10(VgaDeviceExtension, &BiosArguments);
if (Status != NO_ERROR) return Status; if (Status != NO_ERROR) return Status;
if(VBE_GETRETURNCODE(BiosArguments.Eax) != VBE_SUCCESS) if(VBE_GETRETURNCODE(BiosArguments.Eax) != VBE_SUCCESS)
{ {
VideoDebugPrint(0, "Changing VBE mode failed, Eax %lx", BiosArguments.Eax); VideoDebugPrint((0, "Changing VBE mode failed, Eax %lx", BiosArguments.Eax));
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
} }
@ -202,7 +202,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
} }
/* Add ref */ /* Add ref */
VideoDebugPrint(0, "have int10 iface\n"); VideoDebugPrint((0, "have int10 iface\n"));
VgaExtension->Int10Interface.InterfaceReference(VgaExtension->Int10Interface.Context); VgaExtension->Int10Interface.InterfaceReference(VgaExtension->Int10Interface.Context);
Context = VgaExtension->Int10Interface.Context; Context = VgaExtension->Int10Interface.Context;
@ -217,7 +217,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
if (!VbeInfo) return; if (!VbeInfo) return;
/* Init VBE data and write to card buffer */ /* Init VBE data and write to card buffer */
VideoDebugPrint(0, "have int10 data\n"); VideoDebugPrint((0, "have int10 data\n"));
VbeInfo->ModeArray[128] = 0xFFFF; VbeInfo->ModeArray[128] = 0xFFFF;
VbeInfo->Info.Signature = VBE2_MAGIC; VbeInfo->Info.Signature = VBE2_MAGIC;
Status = VgaExtension->Int10Interface.Int10WriteMemory(Context, Status = VgaExtension->Int10Interface.Int10WriteMemory(Context,
@ -236,7 +236,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
if (Status != NO_ERROR) return; if (Status != NO_ERROR) return;
if(VBE_GETRETURNCODE(BiosArguments.Eax) != VBE_SUCCESS) if(VBE_GETRETURNCODE(BiosArguments.Eax) != VBE_SUCCESS)
{ {
VideoDebugPrint(0, "BiosArguments.Eax %lx\n", BiosArguments.Eax); VideoDebugPrint((0, "BiosArguments.Eax %lx\n", BiosArguments.Eax));
return; return;
} }
Status = VgaExtension->Int10Interface.Int10ReadMemory(Context, Status = VgaExtension->Int10Interface.Int10ReadMemory(Context,
@ -247,21 +247,21 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
if (Status != NO_ERROR) return; if (Status != NO_ERROR) return;
/* Check correct VBE BIOS */ /* Check correct VBE BIOS */
VideoDebugPrint(0, "have vbe data\n"); VideoDebugPrint((0, "have vbe data\n"));
TotalMemory = VbeInfo->Info.TotalMemory << 16; TotalMemory = VbeInfo->Info.TotalMemory << 16;
VbeVersion = VbeInfo->Info.Version; VbeVersion = VbeInfo->Info.Version;
VideoDebugPrint(0, "vbe version %lx memory %lx\n", VbeVersion, TotalMemory); VideoDebugPrint((0, "vbe version %lx memory %lx\n", VbeVersion, TotalMemory));
if (!ValidateVbeInfo(VgaExtension, VbeInfo)) return; if (!ValidateVbeInfo(VgaExtension, VbeInfo)) return;
/* Read modes */ /* Read modes */
VideoDebugPrint(0, "read modes from %p\n", VbeInfo->Info.VideoModePtr); VideoDebugPrint((0, "read modes from %p\n", VbeInfo->Info.VideoModePtr));
Status = VgaExtension->Int10Interface.Int10ReadMemory(Context, Status = VgaExtension->Int10Interface.Int10ReadMemory(Context,
HIWORD(VbeInfo->Info.VideoModePtr), HIWORD(VbeInfo->Info.VideoModePtr),
LOWORD(VbeInfo->Info.VideoModePtr), LOWORD(VbeInfo->Info.VideoModePtr),
VbeInfo->ModeArray, VbeInfo->ModeArray,
128 * sizeof(USHORT)); 128 * sizeof(USHORT));
if (Status != NO_ERROR) return; if (Status != NO_ERROR) return;
VideoDebugPrint(0, "Read modes at: %p\n", VbeInfo->ModeArray); VideoDebugPrint((0, "Read modes at: %p\n", VbeInfo->ModeArray));
/* Count modes, check for new 4bpp SVGA modes */ /* Count modes, check for new 4bpp SVGA modes */
ThisMode = VbeInfo->ModeArray; ThisMode = VbeInfo->ModeArray;
@ -269,7 +269,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
while (ModeResult != 0xFFFF) while (ModeResult != 0xFFFF)
{ {
Mode = ModeResult & 0x1FF; Mode = ModeResult & 0x1FF;
VideoDebugPrint(0, "Mode found: %lx\n", Mode); VideoDebugPrint((0, "Mode found: %lx\n", Mode));
if ((Mode == 0x102) || (Mode == 0x6A)) FourBppModeFound = TRUE; if ((Mode == 0x102) || (Mode == 0x6A)) FourBppModeFound = TRUE;
ModeResult = *++ThisMode; ModeResult = *++ThisMode;
NewModes++; NewModes++;
@ -287,19 +287,19 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
/* Apply fixup for Intel Brookdale */ /* Apply fixup for Intel Brookdale */
if (g_bIntelBrookdaleBIOS) if (g_bIntelBrookdaleBIOS)
{ {
VideoDebugPrint(0, "Intel Brookdale-G Video BIOS Not Support!\n"); VideoDebugPrint((0, "Intel Brookdale-G Video BIOS Not Support!\n"));
while (TRUE); while (TRUE);
} }
/* Scan SVGA modes */ /* Scan SVGA modes */
VideoDebugPrint(0, "Static modes: %d\n", NumVideoModes); VideoDebugPrint((0, "Static modes: %d\n", NumVideoModes));
VgaMode = &VgaModeList[NumVideoModes]; VgaMode = &VgaModeList[NumVideoModes];
ThisMode = VbeInfo->ModeArray; ThisMode = VbeInfo->ModeArray;
VideoDebugPrint(0, "new modes: %d\n", NewModes); VideoDebugPrint((0, "new modes: %d\n", NewModes));
while (NewModes--) while (NewModes--)
{ {
/* Get info on mode */ /* Get info on mode */
VideoDebugPrint(0, "Getting info of mode %lx.\n", *ThisMode); VideoDebugPrint((0, "Getting info of mode %lx.\n", *ThisMode));
VideoPortZeroMemory(&BiosArguments, sizeof(BiosArguments)); VideoPortZeroMemory(&BiosArguments, sizeof(BiosArguments));
BiosArguments.Eax = VBE_GET_MODE_INFORMATION; BiosArguments.Eax = VBE_GET_MODE_INFORMATION;
BiosArguments.Ecx = *ThisMode; BiosArguments.Ecx = *ThisMode;
@ -316,7 +316,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
if (Status != NO_ERROR) goto Next; if (Status != NO_ERROR) goto Next;
/* Parse graphics modes only if linear framebuffer support */ /* Parse graphics modes only if linear framebuffer support */
VideoDebugPrint(0, "attr: %lx\n", VbeModeInfo->ModeAttributes); VideoDebugPrint((0, "attr: %lx\n", VbeModeInfo->ModeAttributes));
if (!(VbeModeInfo->ModeAttributes & (VBE_MODEATTR_VALID | if (!(VbeModeInfo->ModeAttributes & (VBE_MODEATTR_VALID |
VBE_MODEATTR_GRAPHICS))) goto Next; VBE_MODEATTR_GRAPHICS))) goto Next;
LinearAddressing = ((VbeVersion >= 0x200) && LinearAddressing = ((VbeVersion >= 0x200) &&
@ -325,7 +325,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
TRUE : FALSE; TRUE : FALSE;
/* Check SVGA modes if 8bpp or higher */ /* Check SVGA modes if 8bpp or higher */
VideoDebugPrint(0, "PhysBase: %lx\n", VbeModeInfo->PhysBasePtr); VideoDebugPrint((0, "PhysBase: %lx\n", VbeModeInfo->PhysBasePtr));
if ((VbeModeInfo->XResolution >= 640) && if ((VbeModeInfo->XResolution >= 640) &&
(VbeModeInfo->YResolution >= 480) && (VbeModeInfo->YResolution >= 480) &&
(VbeModeInfo->NumberOfPlanes >= 1) && (VbeModeInfo->NumberOfPlanes >= 1) &&
@ -339,7 +339,7 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
VgaMode->Frequency = 1; VgaMode->Frequency = 1;
VgaMode->Mode = (*ThisMode << 16) | VBE_SET_VBE_MODE; VgaMode->Mode = (*ThisMode << 16) | VBE_SET_VBE_MODE;
VgaMode->Granularity = VbeModeInfo->WinGranularity << 10; VgaMode->Granularity = VbeModeInfo->WinGranularity << 10;
VideoDebugPrint(0, "Mode %lx (Granularity %d)\n", VgaMode->Mode, VgaMode->Granularity); VideoDebugPrint((0, "Mode %lx (Granularity %d)\n", VgaMode->Mode, VgaMode->Granularity));
/* Set flags */ /* Set flags */
if (VbeModeInfo->ModeAttributes & VBE_MODEATTR_COLOR) VgaMode->fbType |= VIDEO_MODE_COLOR; if (VbeModeInfo->ModeAttributes & VBE_MODEATTR_COLOR) VgaMode->fbType |= VIDEO_MODE_COLOR;
@ -349,12 +349,12 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
/* If no char data, say 80x25 */ /* If no char data, say 80x25 */
VgaMode->col = VbeModeInfo->XCharSize ? VbeModeInfo->XResolution / VbeModeInfo->XCharSize : 80; VgaMode->col = VbeModeInfo->XCharSize ? VbeModeInfo->XResolution / VbeModeInfo->XCharSize : 80;
VgaMode->row = VbeModeInfo->YCharSize ? VbeModeInfo->YResolution / VbeModeInfo->YCharSize : 25; VgaMode->row = VbeModeInfo->YCharSize ? VbeModeInfo->YResolution / VbeModeInfo->YCharSize : 25;
VideoDebugPrint(0, "%d by %d rows\n", VgaMode->col, VgaMode->row); VideoDebugPrint((0, "%d by %d rows\n", VgaMode->col, VgaMode->row));
/* Check RGB555 (15bpp only) */ /* Check RGB555 (15bpp only) */
VgaMode->bitsPerPlane = VbeModeInfo->BitsPerPixel / VbeModeInfo->NumberOfPlanes; VgaMode->bitsPerPlane = VbeModeInfo->BitsPerPixel / VbeModeInfo->NumberOfPlanes;
if ((VgaMode->bitsPerPlane == 16) && (VbeModeInfo->GreenMaskSize == 5)) VgaMode->bitsPerPlane = 15; if ((VgaMode->bitsPerPlane == 16) && (VbeModeInfo->GreenMaskSize == 5)) VgaMode->bitsPerPlane = 15;
VideoDebugPrint(0, "BPP: %d\n", VgaMode->bitsPerPlane); VideoDebugPrint((0, "BPP: %d\n", VgaMode->bitsPerPlane));
/* Do linear or banked frame buffers */ /* Do linear or banked frame buffers */
VgaMode->FrameBufferBase = 0; VgaMode->FrameBufferBase = 0;
@ -364,18 +364,18 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
ScreenStride = RaiseToPower2(VbeModeInfo->BytesPerScanLine); ScreenStride = RaiseToPower2(VbeModeInfo->BytesPerScanLine);
//ASSERT(ScreenStride <= MAX_USHORT); //ASSERT(ScreenStride <= MAX_USHORT);
VgaMode->wbytes = (USHORT)ScreenStride; VgaMode->wbytes = (USHORT)ScreenStride;
VideoDebugPrint(0, "ScanLines: %lx Stride: %lx\n", VbeModeInfo->BytesPerScanLine, VgaMode->wbytes); VideoDebugPrint((0, "ScanLines: %lx Stride: %lx\n", VbeModeInfo->BytesPerScanLine, VgaMode->wbytes));
/* Size of frame buffer is Height X ScanLine, align to bank/page size */ /* Size of frame buffer is Height X ScanLine, align to bank/page size */
ScreenSize = VgaMode->hres * ScreenStride; ScreenSize = VgaMode->hres * ScreenStride;
VideoDebugPrint(0, "Size: %lx\n", ScreenSize); VideoDebugPrint((0, "Size: %lx\n", ScreenSize));
Size = (ScreenSize + ((64 * 1024) - 1)) & ((64 * 1024) - 1); Size = (ScreenSize + ((64 * 1024) - 1)) & ((64 * 1024) - 1);
VideoDebugPrint(0, "Size: %lx\n", ScreenSize); VideoDebugPrint((0, "Size: %lx\n", ScreenSize));
if (Size > TotalMemory) Size = (Size + ((4 * 1024) - 1)) & ((4 * 1024) - 1); if (Size > TotalMemory) Size = (Size + ((4 * 1024) - 1)) & ((4 * 1024) - 1);
VideoDebugPrint(0, "Size: %lx\n", ScreenSize); VideoDebugPrint((0, "Size: %lx\n", ScreenSize));
/* Banked VGA at 0xA0000 (64K) */ /* Banked VGA at 0xA0000 (64K) */
VideoDebugPrint(0, "Final size: %lx\n", Size); VideoDebugPrint((0, "Final size: %lx\n", Size));
VgaMode->fbType |= VIDEO_MODE_BANKED; VgaMode->fbType |= VIDEO_MODE_BANKED;
VgaMode->sbytes = Size; VgaMode->sbytes = Size;
VgaMode->PhysSize = 64 * 1024; VgaMode->PhysSize = 64 * 1024;
@ -387,20 +387,20 @@ InitializeModeTable(IN PHW_DEVICE_EXTENSION VgaExtension)
else else
{ {
/* VBE 3.00+ has specific field, read legacy field if not */ /* VBE 3.00+ has specific field, read legacy field if not */
VideoDebugPrint(0, "LINEAR MODE!!!\n"); VideoDebugPrint((0, "LINEAR MODE!!!\n"));
ScreenStride = (VbeVersion >= 0x300) ? VbeModeInfo->LinBytesPerScanLine : 0; ScreenStride = (VbeVersion >= 0x300) ? VbeModeInfo->LinBytesPerScanLine : 0;
if (!ScreenStride) ScreenStride = VbeModeInfo->BytesPerScanLine; if (!ScreenStride) ScreenStride = VbeModeInfo->BytesPerScanLine;
//ASSERT(ScreenStride <= MAX_USHORT); //ASSERT(ScreenStride <= MAX_USHORT);
VgaMode->wbytes = (USHORT)ScreenStride; VgaMode->wbytes = (USHORT)ScreenStride;
VideoDebugPrint(0, "ScanLines: %lx Stride: %lx\n", VbeModeInfo->BytesPerScanLine, VgaMode->wbytes); VideoDebugPrint((0, "ScanLines: %lx Stride: %lx\n", VbeModeInfo->BytesPerScanLine, VgaMode->wbytes));
/* Size of frame buffer is Height X ScanLine, align to page size */ /* Size of frame buffer is Height X ScanLine, align to page size */
ScreenSize = VgaMode->hres * LOWORD(VgaMode->wbytes); ScreenSize = VgaMode->hres * LOWORD(VgaMode->wbytes);
VideoDebugPrint(0, "Size: %lx\n", ScreenSize); VideoDebugPrint((0, "Size: %lx\n", ScreenSize));
Size = RaiseToPower2Ulong(ScreenSize); Size = RaiseToPower2Ulong(ScreenSize);
VideoDebugPrint(0, "Size: %lx\n", ScreenSize); VideoDebugPrint((0, "Size: %lx\n", ScreenSize));
if (Size > TotalMemory) Size = (Size + ((4 * 1024) - 1)) & ((4 * 1024) - 1); if (Size > TotalMemory) Size = (Size + ((4 * 1024) - 1)) & ((4 * 1024) - 1);
VideoDebugPrint(0, "Size: %lx\n", ScreenSize); VideoDebugPrint((0, "Size: %lx\n", ScreenSize));
/* Linear VGA must read settings from VBE */ /* Linear VGA must read settings from VBE */
VgaMode->fbType |= VIDEO_MODE_LINEAR; VgaMode->fbType |= VIDEO_MODE_LINEAR;
@ -431,7 +431,7 @@ Next:
} }
/* Check if last mode was color to do test */ /* Check if last mode was color to do test */
VideoDebugPrint(0, "mode scan complete. Total modes: %d\n", ModeCount); VideoDebugPrint((0, "mode scan complete. Total modes: %d\n", ModeCount));
if (--VgaMode->fbType & VIDEO_MODE_COLOR) if (--VgaMode->fbType & VIDEO_MODE_COLOR)
{ {
/* Try map physical buffer and free if worked */ /* Try map physical buffer and free if worked */

View file

@ -478,7 +478,7 @@ Return Value:
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
} }
VideoDebugPrint(0, "vga mapped at %x\n", hwDeviceExtension->VideoMemoryAddress); VideoDebugPrint((0, "vga mapped at %x\n", hwDeviceExtension->VideoMemoryAddress));
#endif #endif
// eVb: 1.7 [VDM] - Disable VDM for now // eVb: 1.7 [VDM] - Disable VDM for now
ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0; ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0;
@ -1508,7 +1508,7 @@ Return Value:
--*/ --*/
{ {
VideoDebugPrint(Error, "Detected internal VGA chip on embedded board, todo\n"); VideoDebugPrint((Error, "Detected internal VGA chip on embedded board, todo\n"));
while (TRUE); while (TRUE);
return NO_ERROR; return NO_ERROR;