diff --git a/reactos/drivers/video/miniport/vmx_svga/precomp.h b/reactos/drivers/video/miniport/vmx_svga/precomp.h index 245d90116c2..7555bc1f1ea 100644 --- a/reactos/drivers/video/miniport/vmx_svga/precomp.h +++ b/reactos/drivers/video/miniport/vmx_svga/precomp.h @@ -20,13 +20,13 @@ typedef struct _HW_DEVICE_EXTENSION LARGE_INTEGER VramSize; PHYSICAL_ADDRESS VramBase; ULONG MemSize; - ULONG IndexPort; - ULONG ValuePort; + PULONG IndexPort; + PULONG ValuePort; PVOID FrameBufferBase; PVOID Fifo; ULONG InterruptPort; ULONG InterruptState; - PKEVENT SyncEvent; + PENG_EVENT SyncEvent; VIDEO_MODE_INFORMATION CurrentMode; ULONG VideoModeCount; ULONG Capabilities; diff --git a/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c b/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c index ca5cab49f67..26c9da07b50 100644 --- a/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c +++ b/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c @@ -9,13 +9,76 @@ /* INCLUDES *******************************************************************/ #include "precomp.h" +#include "debug.h" /* GLOBALS ********************************************************************/ PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS]; +static PWCHAR AdapterString = L"VMware SVGA II"; /* FUNCTIONS ******************************************************************/ +ULONG +NTAPI +VmxReadUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, + IN ULONG Index) +{ + /* Program the index first, then read the value */ + VideoPortWritePortUlong(DeviceExtension->IndexPort, Index); + return VideoPortReadPortUlong(DeviceExtension->ValuePort); +} + +VOID +NTAPI +VmxWriteUlong(IN PHW_DEVICE_EXTENSION DeviceExtension, + IN ULONG Index, + IN ULONG Value) +{ + /* Program the index first, then write the value */ + VideoPortWritePortUlong(DeviceExtension->IndexPort, Index); + VideoPortWritePortUlong(DeviceExtension->ValuePort, Value); +} + +ULONG +NTAPI +VmxInitModes(IN PHW_DEVICE_EXTENSION DeviceExtension) +{ + /* Not here yet */ + UNIMPLEMENTED; + while (TRUE); + return 0; +} + +VP_STATUS +NTAPI +VmxInitDevice(IN PHW_DEVICE_EXTENSION DeviceExtension) +{ + /* Not here yet */ + UNIMPLEMENTED; + while (TRUE); + return NO_ERROR; +} + +BOOLEAN +NTAPI +VmxIsMultiMon(IN PHW_DEVICE_EXTENSION DeviceExtension) +{ + ULONG Capabilities; + + /* Get the caps */ + Capabilities = DeviceExtension->Capabilities; + + /* Check for multi-mon support */ + if ((Capabilities & SVGA_CAP_MULTIMON) && (Capabilities & SVGA_CAP_PITCHLOCK)) + { + /* Query the monitor count */ + if (VmxReadUlong(DeviceExtension, SVGA_REG_NUM_DISPLAYS) > 1) return TRUE; + } + + /* Either no support, or just one screen */ + return FALSE; +} + VP_STATUS NTAPI VmxFindAdapter(IN PVOID HwDeviceExtension, @@ -24,6 +87,82 @@ VmxFindAdapter(IN PVOID HwDeviceExtension, IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, OUT PUCHAR Again) { + VP_STATUS Status; + PHW_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension; + DPRINT1("VMX searching for adapter\n"); + + /* Zero out the fields */ + VideoPortZeroMemory(DeviceExtension, sizeof(HW_DEVICE_EXTENSION)); + + /* Validate the Config Info */ + if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO)) + { + /* Incorrect OS version? */ + DPRINT1("Invalid configuration info\n"); + return ERROR_INVALID_PARAMETER; + } + + /* Initialize the device extension and find the adapter */ + Status = VmxInitDevice(DeviceExtension); + DPRINT1("Init status: %lx\n", Status); + if (Status != NO_ERROR) return ERROR_DEV_NOT_EXIST; + + /* Save this adapter extension */ + VmxDeviceExtensionArray[0] = DeviceExtension; + + /* Create the sync event */ + VideoPortCreateEvent(DeviceExtension, + SynchronizationEvent, + FALSE, + &DeviceExtension->SyncEvent); + + /* Check for multi-monitor configuration */ + if (VmxIsMultiMon(DeviceExtension)) + { + /* Let's not go so far */ + UNIMPLEMENTED; + while (TRUE); + } + + /* Zero the frame buffer */ + VideoPortZeroMemory((PVOID)DeviceExtension->FrameBuffer.LowPart, + DeviceExtension->VramSize.LowPart); + + /* Initialize the video modes */ + VmxInitModes(DeviceExtension); + + /* Setup registry keys */ + VideoPortSetRegistryParameters(DeviceExtension, + L"HardwareInformation.ChipType", + AdapterString, + sizeof(AdapterString)); + VideoPortSetRegistryParameters(DeviceExtension, + L"HardwareInformation.DacType", + AdapterString, + sizeof(AdapterString)); + VideoPortSetRegistryParameters(DeviceExtension, + L"HardwareInformation.MemorySize", + &DeviceExtension->VramSize.LowPart, + sizeof(ULONG)); + VideoPortSetRegistryParameters(DeviceExtension, + L"HardwareInformation.AdapterString", + AdapterString, + sizeof(AdapterString)); + VideoPortSetRegistryParameters(DeviceExtension, + L"HardwareInformation.BiosString", + AdapterString, + sizeof(AdapterString)); + + /* No VDM support */ + ConfigInfo->NumEmulatorAccessEntries = 0; + ConfigInfo->EmulatorAccessEntries = 0; + ConfigInfo->EmulatorAccessEntriesContext = 0; + ConfigInfo->HardwareStateSize = 0; + ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0; + ConfigInfo->VdmPhysicalVideoMemoryLength = 0; + + /* Write that this is Windows XP or higher */ + VmxWriteUlong(DeviceExtension, SVGA_REG_GUEST_ID, 0x5000 | 0x08); return NO_ERROR; } @@ -31,6 +170,8 @@ BOOLEAN NTAPI VmxInitialize(IN PVOID HwDeviceExtension) { + UNIMPLEMENTED; + while (TRUE); return TRUE; } @@ -39,6 +180,8 @@ NTAPI VmxStartIO(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET RequestPacket) { + UNIMPLEMENTED; + while (TRUE); return TRUE; } @@ -48,6 +191,8 @@ VmxResetHw(IN PVOID DeviceExtension, IN ULONG Columns, IN ULONG Rows) { + UNIMPLEMENTED; + while (TRUE); return FALSE; } @@ -57,6 +202,8 @@ VmxGetPowerState(IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl) { + UNIMPLEMENTED; + while (TRUE); return NO_ERROR; } @@ -66,14 +213,17 @@ VmxSetPowerState(IN PVOID HwDeviceExtension, IN ULONG HwId, IN PVIDEO_POWER_MANAGEMENT VideoPowerControl) { - - return NO_ERROR; + UNIMPLEMENTED; + while (TRUE); + return NO_ERROR; } BOOLEAN NTAPI VmxInterrupt(IN PVOID HwDeviceExtension) { + UNIMPLEMENTED; + while (TRUE); return TRUE; } @@ -86,6 +236,8 @@ VmxGetVideoChildDescriptor(IN PVOID HwDeviceExtension, OUT PULONG UId, OUT PULONG pUnused) { + UNIMPLEMENTED; + while (TRUE); return NO_ERROR; } @@ -97,6 +249,7 @@ DriverEntry(IN PVOID Context1, VIDEO_HW_INITIALIZATION_DATA InitData; /* Zero initialization structure and array of extensions, one per screen */ + DPRINT1("VMX-SVGAII Loading...\n"); VideoPortZeroMemory(VmxDeviceExtensionArray, sizeof(VmxDeviceExtensionArray)); VideoPortZeroMemory(&InitData, sizeof(InitData));