[ros-diffs] [sir_richard] 45778: [VMX-SVGA]: Some work in progress from my tree. Abandonning this for now due to work reasons, but will likely have eVb hacking on it as some future time. The point of this driver was to expose Mm/VideoPrt issues AND support Qemu hosts with the VMX-SVGA driver option which do not have a way to obtain the driver itself but would still benefit from the acceleration. It was mostly just an experiment.

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Wed Mar 3 06:21:01 CET 2010


Author: sir_richard
Date: Wed Mar  3 06:21:00 2010
New Revision: 45778

URL: http://svn.reactos.org/svn/reactos?rev=45778&view=rev
Log:
[VMX-SVGA]: Some work in progress from my tree. Abandonning this for now due to work reasons, but will likely have eVb hacking on it as some future time. The point of this driver was to expose Mm/VideoPrt issues AND support Qemu hosts with the VMX-SVGA driver option which do not have a way to obtain the driver itself but would still benefit from the acceleration. It was mostly just an experiment.

Modified:
    trunk/reactos/drivers/video/miniport/vmx_svga/precomp.h
    trunk/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c

Modified: trunk/reactos/drivers/video/miniport/vmx_svga/precomp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/miniport/vmx_svga/precomp.h?rev=45778&r1=45777&r2=45778&view=diff
==============================================================================
--- trunk/reactos/drivers/video/miniport/vmx_svga/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/miniport/vmx_svga/precomp.h [iso-8859-1] Wed Mar  3 06:21:00 2010
@@ -20,13 +20,13 @@
     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;

Modified: trunk/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c?rev=45778&r1=45777&r2=45778&view=diff
==============================================================================
--- trunk/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/miniport/vmx_svga/vmx_svga.c [iso-8859-1] Wed Mar  3 06:21:00 2010
@@ -9,12 +9,75 @@
 /* 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
@@ -24,6 +87,82 @@
                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 @@
 NTAPI
 VmxInitialize(IN PVOID HwDeviceExtension)
 {
+    UNIMPLEMENTED;
+    while (TRUE);
     return TRUE;
 }
 
@@ -39,6 +180,8 @@
 VmxStartIO(IN PVOID HwDeviceExtension,
            IN PVIDEO_REQUEST_PACKET RequestPacket)
 {
+    UNIMPLEMENTED;
+    while (TRUE);
     return TRUE;
 }
 
@@ -48,6 +191,8 @@
            IN ULONG Columns,
            IN ULONG Rows)
 {
+    UNIMPLEMENTED;
+    while (TRUE);
     return FALSE;
 }
 
@@ -57,6 +202,8 @@
                  IN ULONG HwId,
                  IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 {
+    UNIMPLEMENTED;
+    while (TRUE);
     return NO_ERROR;
 }
 
@@ -66,14 +213,17 @@
                  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 @@
                            OUT PULONG UId,
                            OUT PULONG pUnused)
 {
+    UNIMPLEMENTED;
+    while (TRUE);
     return NO_ERROR;
 }
 
@@ -97,6 +249,7 @@
     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));
     




More information about the Ros-diffs mailing list