mirror of
https://github.com/reactos/reactos.git
synced 2024-08-30 23:28:58 +00:00
[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.
svn path=/trunk/; revision=45778
This commit is contained in:
parent
52d93be892
commit
486e587cca
|
@ -20,13 +20,13 @@ typedef struct _HW_DEVICE_EXTENSION
|
||||||
LARGE_INTEGER VramSize;
|
LARGE_INTEGER VramSize;
|
||||||
PHYSICAL_ADDRESS VramBase;
|
PHYSICAL_ADDRESS VramBase;
|
||||||
ULONG MemSize;
|
ULONG MemSize;
|
||||||
ULONG IndexPort;
|
PULONG IndexPort;
|
||||||
ULONG ValuePort;
|
PULONG ValuePort;
|
||||||
PVOID FrameBufferBase;
|
PVOID FrameBufferBase;
|
||||||
PVOID Fifo;
|
PVOID Fifo;
|
||||||
ULONG InterruptPort;
|
ULONG InterruptPort;
|
||||||
ULONG InterruptState;
|
ULONG InterruptState;
|
||||||
PKEVENT SyncEvent;
|
PENG_EVENT SyncEvent;
|
||||||
VIDEO_MODE_INFORMATION CurrentMode;
|
VIDEO_MODE_INFORMATION CurrentMode;
|
||||||
ULONG VideoModeCount;
|
ULONG VideoModeCount;
|
||||||
ULONG Capabilities;
|
ULONG Capabilities;
|
||||||
|
|
|
@ -9,13 +9,76 @@
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS];
|
PHW_DEVICE_EXTENSION VmxDeviceExtensionArray[SVGA_MAX_DISPLAYS];
|
||||||
|
static PWCHAR AdapterString = L"VMware SVGA II";
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* 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
|
VP_STATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
VmxFindAdapter(IN PVOID HwDeviceExtension,
|
VmxFindAdapter(IN PVOID HwDeviceExtension,
|
||||||
|
@ -24,6 +87,82 @@ VmxFindAdapter(IN PVOID HwDeviceExtension,
|
||||||
IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
|
IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
|
||||||
OUT PUCHAR Again)
|
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;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +170,8 @@ BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
VmxInitialize(IN PVOID HwDeviceExtension)
|
VmxInitialize(IN PVOID HwDeviceExtension)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +180,8 @@ NTAPI
|
||||||
VmxStartIO(IN PVOID HwDeviceExtension,
|
VmxStartIO(IN PVOID HwDeviceExtension,
|
||||||
IN PVIDEO_REQUEST_PACKET RequestPacket)
|
IN PVIDEO_REQUEST_PACKET RequestPacket)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +191,8 @@ VmxResetHw(IN PVOID DeviceExtension,
|
||||||
IN ULONG Columns,
|
IN ULONG Columns,
|
||||||
IN ULONG Rows)
|
IN ULONG Rows)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +202,8 @@ VmxGetPowerState(IN PVOID HwDeviceExtension,
|
||||||
IN ULONG HwId,
|
IN ULONG HwId,
|
||||||
IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
|
IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +213,8 @@ VmxSetPowerState(IN PVOID HwDeviceExtension,
|
||||||
IN ULONG HwId,
|
IN ULONG HwId,
|
||||||
IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
|
IN PVIDEO_POWER_MANAGEMENT VideoPowerControl)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +222,8 @@ BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
VmxInterrupt(IN PVOID HwDeviceExtension)
|
VmxInterrupt(IN PVOID HwDeviceExtension)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +236,8 @@ VmxGetVideoChildDescriptor(IN PVOID HwDeviceExtension,
|
||||||
OUT PULONG UId,
|
OUT PULONG UId,
|
||||||
OUT PULONG pUnused)
|
OUT PULONG pUnused)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +249,7 @@ DriverEntry(IN PVOID Context1,
|
||||||
VIDEO_HW_INITIALIZATION_DATA InitData;
|
VIDEO_HW_INITIALIZATION_DATA InitData;
|
||||||
|
|
||||||
/* Zero initialization structure and array of extensions, one per screen */
|
/* Zero initialization structure and array of extensions, one per screen */
|
||||||
|
DPRINT1("VMX-SVGAII Loading...\n");
|
||||||
VideoPortZeroMemory(VmxDeviceExtensionArray, sizeof(VmxDeviceExtensionArray));
|
VideoPortZeroMemory(VmxDeviceExtensionArray, sizeof(VmxDeviceExtensionArray));
|
||||||
VideoPortZeroMemory(&InitData, sizeof(InitData));
|
VideoPortZeroMemory(&InitData, sizeof(InitData));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue