Merge remote-tracking branch 'remotes/qxl-wddm-next/work'

Conflicts:
	qxldod/BaseObject.cpp
	qxldod/QxlDod.cpp
	qxldod/QxlDod.h
	qxldod/callVisualStudio.bat
	qxldod/checkWin8Tools.bat
	qxldod/driver.cpp
	qxldod/driver.h
	qxldod/getVisualStudioCmdLine.vbs
	qxldod/qxldod.vcxproj
	qxldod/qxldod.vcxproj.filters
This commit is contained in:
Vadim Rozenfeld 2015-04-10 15:30:05 +10:00
commit 89e4d5dd6f
12 changed files with 379 additions and 327 deletions

0
README Normal file
View File

View File

@ -18,13 +18,14 @@ void* __cdecl operator new(size_t Size, POOL_TYPE PoolType)
void* pObject = ExAllocatePoolWithTag(PoolType, Size, QXLTAG); void* pObject = ExAllocatePoolWithTag(PoolType, Size, QXLTAG);
#if DBG
if (pObject != NULL) if (pObject != NULL)
{ {
#if DBG
RtlFillMemory(pObject, Size, 0xCD); RtlFillMemory(pObject, Size, 0xCD);
} #else
RtlZeroMemory(pObject, Size);
#endif // DBG #endif // DBG
}
return pObject; return pObject;
} }
@ -39,13 +40,14 @@ void* __cdecl operator new[](size_t Size, POOL_TYPE PoolType)
void* pObject = ExAllocatePoolWithTag(PoolType, Size, QXLTAG); void* pObject = ExAllocatePoolWithTag(PoolType, Size, QXLTAG);
#if DBG
if (pObject != NULL) if (pObject != NULL)
{ {
#if DBG
RtlFillMemory(pObject, Size, 0xCD); RtlFillMemory(pObject, Size, 0xCD);
} #else
RtlZeroMemory(pObject, Size);
#endif // DBG #endif // DBG
}
return pObject; return pObject;
} }

View File

@ -64,11 +64,9 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) : m_pPhysicalDevice(pP
QxlDod::~QxlDod(void) QxlDod::~QxlDod(void)
{ {
PAGED_CODE(); PAGED_CODE();
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
CleanUp(); CleanUp();
delete m_pHWDevice; delete m_pHWDevice;
m_pHWDevice = NULL; m_pHWDevice = NULL;
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
} }
NTSTATUS QxlDod::CheckHardware() NTSTATUS QxlDod::CheckHardware()
@ -99,8 +97,7 @@ NTSTATUS QxlDod::CheckHardware()
Status = STATUS_GRAPHICS_DRIVER_MISMATCH; Status = STATUS_GRAPHICS_DRIVER_MISMATCH;
if (Header.VendorID == REDHAT_PCI_VENDOR_ID && if (Header.VendorID == REDHAT_PCI_VENDOR_ID &&
Header.DeviceID == 0x0100 && Header.DeviceID == 0x0100 &&
Header.RevisionID == 4 && Header.RevisionID == 4)
m_VgaCompatible == 0)
{ {
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
} }
@ -114,8 +111,8 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
_Out_ ULONG* pNumberOfViews, _Out_ ULONG* pNumberOfViews,
_Out_ ULONG* pNumberOfChildren) _Out_ ULONG* pNumberOfChildren)
{ {
PHYSICAL_ADDRESS PhysicAddress;
PAGED_CODE(); PAGED_CODE();
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
QXL_ASSERT(pDxgkStartInfo != NULL); QXL_ASSERT(pDxgkStartInfo != NULL);
QXL_ASSERT(pDxgkInterface != NULL); QXL_ASSERT(pDxgkInterface != NULL);
QXL_ASSERT(pNumberOfViews != NULL); QXL_ASSERT(pNumberOfViews != NULL);
@ -137,11 +134,18 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
Status = CheckHardware(); Status = CheckHardware();
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
m_pHWDevice = new(PagedPool) QxlDevice(this); m_pHWDevice = new(NonPagedPoolNx) QxlDevice(this);
} }
else else
{ {
m_pHWDevice = new(PagedPool) VgaDevice(this); m_pHWDevice = new(NonPagedPoolNx) VgaDevice(this);
}
if (!m_pHWDevice)
{
Status = STATUS_NO_MEMORY;
DbgPrint(TRACE_LEVEL_ERROR, ("HWInit failed to allocate memory\n"));
return Status;
} }
Status = m_pHWDevice->HWInit(m_DeviceInfo.TranslatedResourceList, &m_CurrentModes[0].DispInfo); Status = m_pHWDevice->HWInit(m_DeviceInfo.TranslatedResourceList, &m_CurrentModes[0].DispInfo);
@ -159,6 +163,7 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
return Status; return Status;
} }
PhysicAddress.QuadPart = m_CurrentModes[0].DispInfo.PhysicAddress.QuadPart;
if (m_pHWDevice->GetId() == 0) if (m_pHWDevice->GetId() == 0)
{ {
Status = m_DxgkInterface.DxgkCbAcquirePostDisplayOwnership(m_DxgkInterface.DeviceHandle, &(m_CurrentModes[0].DispInfo)); Status = m_DxgkInterface.DxgkCbAcquirePostDisplayOwnership(m_DxgkInterface.DeviceHandle, &(m_CurrentModes[0].DispInfo));
@ -178,6 +183,10 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
m_CurrentModes[0].DispInfo.Pitch = BPPFromPixelFormat(D3DDDIFMT_R8G8B8) / 8; m_CurrentModes[0].DispInfo.Pitch = BPPFromPixelFormat(D3DDDIFMT_R8G8B8) / 8;
m_CurrentModes[0].DispInfo.ColorFormat = D3DDDIFMT_R8G8B8; m_CurrentModes[0].DispInfo.ColorFormat = D3DDDIFMT_R8G8B8;
m_CurrentModes[0].DispInfo.TargetId = 0; m_CurrentModes[0].DispInfo.TargetId = 0;
if (PhysicAddress.QuadPart != 0L) {
m_CurrentModes[0].DispInfo.PhysicAddress.QuadPart = PhysicAddress.QuadPart;
}
} }
*pNumberOfViews = MAX_VIEWS; *pNumberOfViews = MAX_VIEWS;
@ -190,16 +199,13 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
NTSTATUS QxlDod::StopDevice(VOID) NTSTATUS QxlDod::StopDevice(VOID)
{ {
PAGED_CODE(); PAGED_CODE();
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
m_Flags.DriverStarted = FALSE; m_Flags.DriverStarted = FALSE;
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
VOID QxlDod::CleanUp(VOID) VOID QxlDod::CleanUp(VOID)
{ {
PAGED_CODE(); PAGED_CODE();
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
for (UINT Source = 0; Source < MAX_VIEWS; ++Source) for (UINT Source = 0; Source < MAX_VIEWS; ++Source)
{ {
if (m_CurrentModes[Source].FrameBuffer.Ptr) if (m_CurrentModes[Source].FrameBuffer.Ptr)
@ -402,19 +408,15 @@ NTSTATUS QxlDod::QueryAdapterInfo(_In_ CONST DXGKARG_QUERYADAPTERINFO* pQueryAda
} }
DXGK_DRIVERCAPS* pDriverCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData; DXGK_DRIVERCAPS* pDriverCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData;
RtlZeroMemory(pDriverCaps, pQueryAdapterInfo->OutputDataSize/*sizeof(DXGK_DRIVERCAPS)*/); RtlZeroMemory(pDriverCaps, pQueryAdapterInfo->OutputDataSize/*sizeof(DXGK_DRIVERCAPS)*/);
pDriverCaps->WDDMVersion = DXGKDDI_WDDMv1_2; pDriverCaps->WDDMVersion = DXGKDDI_WDDMv1_2;
pDriverCaps->HighestAcceptableAddress.QuadPart = -1; pDriverCaps->HighestAcceptableAddress.QuadPart = -1;
pDriverCaps->SupportNonVGA = TRUE;
if (m_pHWDevice->EnablePointer() && m_PointerCaps) { if (m_pHWDevice->EnablePointer()) {
pDriverCaps->MaxPointerWidth = POINTER_SIZE; pDriverCaps->MaxPointerWidth = POINTER_SIZE;
pDriverCaps->MaxPointerHeight = POINTER_SIZE; pDriverCaps->MaxPointerHeight = POINTER_SIZE;
pDriverCaps->PointerCaps.Monochrome = m_PointerCaps & 0x00000001; pDriverCaps->PointerCaps.Monochrome = 1;
pDriverCaps->PointerCaps.Color = m_PointerCaps & 0x00000002; pDriverCaps->PointerCaps.Color = 1;
pDriverCaps->PointerCaps.MaskedColor = m_PointerCaps & 0x00000004;
} }
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s 1\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s 1\n", __FUNCTION__));
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -552,7 +554,7 @@ NTSTATUS QxlDod::QueryInterface(_In_ CONST PQUERY_INTERFACE pQueryInterface)
DbgPrint(TRACE_LEVEL_VERBOSE, ("<---> %s Version = %d\n", __FUNCTION__, pQueryInterface->Version)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<---> %s Version = %d\n", __FUNCTION__, pQueryInterface->Version));
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_SUPPORTED;
} }
NTSTATUS QxlDod::StopDeviceAndReleasePostDisplayOwnership(_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, NTSTATUS QxlDod::StopDeviceAndReleasePostDisplayOwnership(_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
@ -738,7 +740,7 @@ NTSTATUS QxlDod::AddSingleSourceMode(_In_ CONST DXGK_VIDPNSOURCEMODESET_INTERFAC
if (Status != STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET) if (Status != STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET)
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnAddMode failed with Status = 0x%X, hVidPnSourceModeSet = 0x%I64x, pVidPnSourceModeInfo = 0x%I64x", Status, hVidPnSourceModeSet, pVidPnSourceModeInfo)); DbgPrint(TRACE_LEVEL_ERROR, ("pfnAddMode failed with Status = 0x%X, hVidPnSourceModeSet = 0x%I64x, pVidPnSourceModeInfo = %p", Status, hVidPnSourceModeSet, pVidPnSourceModeInfo));
return Status; return Status;
} }
} }
@ -760,7 +762,6 @@ NTSTATUS QxlDod::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMODESET_INTERFAC
D3DKMDT_VIDPN_TARGET_MODE* pVidPnTargetModeInfo = NULL; D3DKMDT_VIDPN_TARGET_MODE* pVidPnTargetModeInfo = NULL;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
//FIXME !!!!!!
for (UINT ModeIndex = 0; ModeIndex < m_pHWDevice->GetModeCount(); ++ModeIndex) for (UINT ModeIndex = 0; ModeIndex < m_pHWDevice->GetModeCount(); ++ModeIndex)
{ {
PVIDEO_MODE_INFORMATION pModeInfo = m_pHWDevice->GetModeInfo(SourceId); PVIDEO_MODE_INFORMATION pModeInfo = m_pHWDevice->GetModeInfo(SourceId);
@ -769,7 +770,7 @@ NTSTATUS QxlDod::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMODESET_INTERFAC
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
// If failed to create a new mode info, mode doesn't need to be released since it was never created // If failed to create a new mode info, mode doesn't need to be released since it was never created
DbgPrint(TRACE_LEVEL_ERROR, ("pfnCreateNewModeInfo failed with Status = 0x%I64x, hVidPnTargetModeSet = 0x%I64x", Status, hVidPnTargetModeSet)); DbgPrint(TRACE_LEVEL_ERROR, ("pfnCreateNewModeInfo failed with Status = 0x%X, hVidPnTargetModeSet = 0x%I64x", Status, hVidPnTargetModeSet));
return Status; return Status;
} }
pVidPnTargetModeInfo->VideoSignalInfo.VideoStandard = D3DKMDT_VSS_OTHER; pVidPnTargetModeInfo->VideoSignalInfo.VideoStandard = D3DKMDT_VSS_OTHER;
@ -790,7 +791,7 @@ NTSTATUS QxlDod::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMODESET_INTERFAC
{ {
if (Status != STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET) if (Status != STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET)
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnAddMode failed with Status = 0x%I64x, hVidPnTargetModeSet = 0x%I64x, pVidPnTargetModeInfo = 0x%I64x", Status, hVidPnTargetModeSet, pVidPnTargetModeInfo)); DbgPrint(TRACE_LEVEL_ERROR, ("pfnAddMode failed with Status = 0x%X, hVidPnTargetModeSet = 0x%I64x, pVidPnTargetModeInfo = %p", Status, hVidPnTargetModeSet, pVidPnTargetModeInfo));
} }
// If adding the mode failed, release the mode, if this doesn't work there is nothing that can be done, some memory will get leaked // If adding the mode failed, release the mode, if this doesn't work there is nothing that can be done, some memory will get leaked
@ -874,7 +875,7 @@ NTSTATUS QxlDod::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES*
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
// If failed to create a new mode info, mode doesn't need to be released since it was never created // If failed to create a new mode info, mode doesn't need to be released since it was never created
DbgPrint(TRACE_LEVEL_ERROR, ("pfnCreateNewModeInfo failed with Status = 0x%I64x, hMonitorSourceModeSet = 0x%I64x", Status, pRecommendMonitorModes->hMonitorSourceModeSet)); DbgPrint(TRACE_LEVEL_ERROR, ("pfnCreateNewModeInfo failed with Status = 0x%X, hMonitorSourceModeSet = 0x%I64x", Status, pRecommendMonitorModes->hMonitorSourceModeSet));
return Status; return Status;
} }
@ -892,11 +893,11 @@ NTSTATUS QxlDod::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES*
pMonitorSourceMode->VideoSignalInfo.HSyncFreq.Numerator = D3DKMDT_FREQUENCY_NOTSPECIFIED; pMonitorSourceMode->VideoSignalInfo.HSyncFreq.Numerator = D3DKMDT_FREQUENCY_NOTSPECIFIED;
pMonitorSourceMode->VideoSignalInfo.HSyncFreq.Denominator = D3DKMDT_FREQUENCY_NOTSPECIFIED; pMonitorSourceMode->VideoSignalInfo.HSyncFreq.Denominator = D3DKMDT_FREQUENCY_NOTSPECIFIED;
pMonitorSourceMode->VideoSignalInfo.PixelRate = D3DKMDT_FREQUENCY_NOTSPECIFIED; pMonitorSourceMode->VideoSignalInfo.PixelRate = D3DKMDT_FREQUENCY_NOTSPECIFIED;
pMonitorSourceMode->VideoSignalInfo.ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE; //??? pMonitorSourceMode->VideoSignalInfo.ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
pMonitorSourceMode->Origin = D3DKMDT_MCO_DRIVER; // ???? pMonitorSourceMode->Origin = D3DKMDT_MCO_DRIVER;
pMonitorSourceMode->Preference = D3DKMDT_MP_NOTPREFERRED; // TODO... pMonitorSourceMode->Preference = D3DKMDT_MP_NOTPREFERRED;
pMonitorSourceMode->ColorBasis = D3DKMDT_CB_SRGB; // ???? pMonitorSourceMode->ColorBasis = D3DKMDT_CB_SRGB;
pMonitorSourceMode->ColorCoeffDynamicRanges.FirstChannel = 8; pMonitorSourceMode->ColorCoeffDynamicRanges.FirstChannel = 8;
pMonitorSourceMode->ColorCoeffDynamicRanges.SecondChannel = 8; pMonitorSourceMode->ColorCoeffDynamicRanges.SecondChannel = 8;
pMonitorSourceMode->ColorCoeffDynamicRanges.ThirdChannel = 8; pMonitorSourceMode->ColorCoeffDynamicRanges.ThirdChannel = 8;
@ -907,7 +908,7 @@ NTSTATUS QxlDod::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES*
{ {
if (Status != STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET) if (Status != STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET)
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnAddMode failed with Status = 0x%I64x, hMonitorSourceModeSet = 0x%I64x, pMonitorSourceMode = 0x%I64x", DbgPrint(TRACE_LEVEL_ERROR, ("pfnAddMode failed with Status = 0x%X, hMonitorSourceModeSet = 0x%I64x, pMonitorSourceMode = 0x%p",
Status, pRecommendMonitorModes->hMonitorSourceModeSet, pMonitorSourceMode)); Status, pRecommendMonitorModes->hMonitorSourceModeSet, pMonitorSourceMode));
} }
@ -937,7 +938,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
CONST DXGK_VIDPNSOURCEMODESET_INTERFACE* pVidPnSourceModeSetInterface = NULL; CONST DXGK_VIDPNSOURCEMODESET_INTERFACE* pVidPnSourceModeSetInterface = NULL;
CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface = NULL; CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface = NULL;
CONST D3DKMDT_VIDPN_PRESENT_PATH* pVidPnPresentPath = NULL; CONST D3DKMDT_VIDPN_PRESENT_PATH* pVidPnPresentPath = NULL;
CONST D3DKMDT_VIDPN_PRESENT_PATH* pVidPnPresentPathTemp = NULL; // Used for AcquireNextPathInfo CONST D3DKMDT_VIDPN_PRESENT_PATH* pVidPnPresentPathTemp = NULL;
CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnPinnedSourceModeInfo = NULL; CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnPinnedSourceModeInfo = NULL;
CONST D3DKMDT_VIDPN_TARGET_MODE* pVidPnPinnedTargetModeInfo = NULL; CONST D3DKMDT_VIDPN_TARGET_MODE* pVidPnPinnedTargetModeInfo = NULL;
@ -1112,7 +1113,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
Status = pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pVidPnPinnedTargetModeInfo); Status = pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pVidPnPinnedTargetModeInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleaseModeInfo failed with Status = 0x%X, hVidPnTargetModeSet = 0x%I64x, pVidPnPinnedTargetModeInfo = 0x%I64x", DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleaseModeInfo failed with Status = 0x%X, hVidPnTargetModeSet = 0x%I64x, pVidPnPinnedTargetModeInfo = %p",
Status, hVidPnTargetModeSet, pVidPnPinnedTargetModeInfo)); Status, hVidPnTargetModeSet, pVidPnPinnedTargetModeInfo));
break; break;
} }
@ -1136,7 +1137,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
Status = pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hVidPnSourceModeSet, pVidPnPinnedSourceModeInfo); Status = pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hVidPnSourceModeSet, pVidPnPinnedSourceModeInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleaseModeInfo failed with Status = 0x%X, hVidPnSourceModeSet = 0x%I64x, pVidPnPinnedSourceModeInfo = 0x%I64x", DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleaseModeInfo failed with Status = 0x%X, hVidPnSourceModeSet = 0x%I64x, pVidPnPinnedSourceModeInfo = %p",
Status, hVidPnSourceModeSet, pVidPnPinnedSourceModeInfo)); Status, hVidPnSourceModeSet, pVidPnPinnedSourceModeInfo));
break; break;
} }
@ -1210,7 +1211,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pVidPnPresentPathTemp, &pVidPnPresentPath); Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pVidPnPresentPathTemp, &pVidPnPresentPath);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnAcquireNextPathInfo failed with Status = 0x%X, hVidPnTopology = 0x%I64x, pVidPnPresentPathTemp = 0x%I64x", Status, hVidPnTopology, pVidPnPresentPathTemp)); DbgPrint(TRACE_LEVEL_ERROR, ("pfnAcquireNextPathInfo failed with Status = 0x%X, hVidPnTopology = 0x%I64x, pVidPnPresentPathTemp = %p", Status, hVidPnTopology, pVidPnPresentPathTemp));
break; break;
} }
@ -1218,7 +1219,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
NTSTATUS TempStatus = pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathTemp); NTSTATUS TempStatus = pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathTemp);
if (!NT_SUCCESS(TempStatus)) if (!NT_SUCCESS(TempStatus))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleasePathInfo failed with Status = 0x%X, hVidPnTopology = 0x%I64x, pVidPnPresentPathTemp = 0x%I64x", TempStatus, hVidPnTopology, pVidPnPresentPathTemp)); DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleasePathInfo failed with Status = 0x%X, hVidPnTopology = 0x%I64x, pVidPnPresentPathTemp = %p", TempStatus, hVidPnTopology, pVidPnPresentPathTemp));
Status = TempStatus; Status = TempStatus;
break; break;
} }
@ -1283,7 +1284,7 @@ NTSTATUS QxlDod::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODAL
NTSTATUS QxlDod::SetVidPnSourceVisibility(_In_ CONST DXGKARG_SETVIDPNSOURCEVISIBILITY* pSetVidPnSourceVisibility) NTSTATUS QxlDod::SetVidPnSourceVisibility(_In_ CONST DXGKARG_SETVIDPNSOURCEVISIBILITY* pSetVidPnSourceVisibility)
{ {
PAGED_CODE(); PAGED_CODE();
// DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
QXL_ASSERT(pSetVidPnSourceVisibility != NULL); QXL_ASSERT(pSetVidPnSourceVisibility != NULL);
QXL_ASSERT((pSetVidPnSourceVisibility->VidPnSourceId < MAX_VIEWS) || QXL_ASSERT((pSetVidPnSourceVisibility->VidPnSourceId < MAX_VIEWS) ||
(pSetVidPnSourceVisibility->VidPnSourceId == D3DDDI_ID_ALL)); (pSetVidPnSourceVisibility->VidPnSourceId == D3DDDI_ID_ALL));
@ -1306,7 +1307,7 @@ NTSTATUS QxlDod::SetVidPnSourceVisibility(_In_ CONST DXGKARG_SETVIDPNSOURCEVISIB
m_CurrentModes[SourceId].Flags.SourceNotVisible = !(pSetVidPnSourceVisibility->Visible); m_CurrentModes[SourceId].Flags.SourceNotVisible = !(pSetVidPnSourceVisibility->Visible);
} }
// DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -1461,7 +1462,7 @@ NTSTATUS QxlDod::CommitVidPn(_In_ CONST DXGKARG_COMMITVIDPN* CONST pCommitVidPn)
Status = pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPath); Status = pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPath);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleasePathInfo failed with Status = 0x%X, hVidPnTopoogy = 0x%I64x, pVidPnPresentPath = 0x%I64x", DbgPrint(TRACE_LEVEL_ERROR, ("pfnReleasePathInfo failed with Status = 0x%X, hVidPnTopoogy = 0x%I64x, pVidPnPresentPath = %p",
Status, hVidPnTopology, pVidPnPresentPath)); Status, hVidPnTopology, pVidPnPresentPath));
goto CommitVidPnExit; goto CommitVidPnExit;
} }
@ -1505,7 +1506,6 @@ NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo
CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath)
{ {
PAGED_CODE(); PAGED_CODE();
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s SourceId = %d\n", __FUNCTION__, pPath->VidPnSourceId));
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
@ -1541,8 +1541,6 @@ NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo
for (USHORT ModeIndex = 0; ModeIndex < m_pHWDevice->GetModeCount(); ++ModeIndex) for (USHORT ModeIndex = 0; ModeIndex < m_pHWDevice->GetModeCount(); ++ModeIndex)
{ {
PVIDEO_MODE_INFORMATION pModeInfo = m_pHWDevice->GetModeInfo(ModeIndex); PVIDEO_MODE_INFORMATION pModeInfo = m_pHWDevice->GetModeInfo(ModeIndex);
DbgPrint(TRACE_LEVEL_INFORMATION, ("%d\t%d x %d\t%d x %d\n", ModeIndex, pCurrentBddMode->DispInfo.Width, pCurrentBddMode->DispInfo.Height,
pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight));
if (pCurrentBddMode->DispInfo.Width == pModeInfo->VisScreenWidth && if (pCurrentBddMode->DispInfo.Width == pModeInfo->VisScreenWidth &&
pCurrentBddMode->DispInfo.Height == pModeInfo->VisScreenHeight ) pCurrentBddMode->DispInfo.Height == pModeInfo->VisScreenHeight )
{ {
@ -1556,7 +1554,6 @@ NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo
} }
} }
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));
return Status; return Status;
} }
@ -1785,7 +1782,7 @@ VOID QxlDod::SystemDisplayWrite(_In_reads_bytes_(SourceHeight * SourceStride) VO
BltBits(&DstBltInfo, BltBits(&DstBltInfo,
&SrcBltInfo, &SrcBltInfo,
1, // NumRects 1,
&Rect); &Rect);
} }
@ -1842,7 +1839,6 @@ NTSTATUS QxlDod::RegisterHWInfo(ULONG Id)
NTSTATUS Status; NTSTATUS Status;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
// TODO: Replace these strings with proper information
PCSTR StrHWInfoChipType = "QEMU QXL"; PCSTR StrHWInfoChipType = "QEMU QXL";
PCSTR StrHWInfoDacType = "QXL 1B36"; PCSTR StrHWInfoDacType = "QXL 1B36";
PCSTR StrHWInfoAdapterString = "QXL"; PCSTR StrHWInfoAdapterString = "QXL";
@ -1852,7 +1848,7 @@ NTSTATUS QxlDod::RegisterHWInfo(ULONG Id)
Status = IoOpenDeviceRegistryKey(m_pPhysicalDevice, PLUGPLAY_REGKEY_DRIVER, KEY_SET_VALUE, &DevInstRegKeyHandle); Status = IoOpenDeviceRegistryKey(m_pPhysicalDevice, PLUGPLAY_REGKEY_DRIVER, KEY_SET_VALUE, &DevInstRegKeyHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("IoOpenDeviceRegistryKey failed for PDO: 0x%I64x, Status: 0x%I64x", m_pPhysicalDevice, Status)); DbgPrint(TRACE_LEVEL_ERROR, ("IoOpenDeviceRegistryKey failed for PDO: 0x%I64x, Status: 0x%X", m_pPhysicalDevice, Status));
return Status; return Status;
} }
@ -2006,7 +2002,7 @@ MapFrameBuffer(
(Length == 0) || (Length == 0) ||
(VirtualAddress == NULL)) (VirtualAddress == NULL))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("One of PhysicalAddress.QuadPart (0x%I64x), Length (0x%I64x), VirtualAddress (0x%I64x) is NULL or 0", DbgPrint(TRACE_LEVEL_ERROR, ("One of PhysicalAddress.QuadPart (0x%I64x), Length (%lu), VirtualAddress (%p) is NULL or 0\n",
PhysicalAddress.QuadPart, Length, VirtualAddress)); PhysicalAddress.QuadPart, Length, VirtualAddress));
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
@ -2024,7 +2020,7 @@ MapFrameBuffer(
MmNonCached); MmNonCached);
if (*VirtualAddress == NULL) if (*VirtualAddress == NULL)
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("MmMapIoSpace returned a NULL buffer when trying to allocate 0x%I64x bytes", Length)); DbgPrint(TRACE_LEVEL_ERROR, ("MmMapIoSpace returned a NULL buffer when trying to allocate %lu bytes", Length));
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
} }
} }
@ -2050,7 +2046,7 @@ UnmapFrameBuffer(
} }
else if ((VirtualAddress == NULL) || (Length == 0)) else if ((VirtualAddress == NULL) || (Length == 0))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("Only one of Length (0x%I64x), VirtualAddress (0x%I64x) is NULL or 0", DbgPrint(TRACE_LEVEL_ERROR, ("Only one of Length (%lu), VirtualAddress (%p) is NULL or 0",
Length, VirtualAddress)); Length, VirtualAddress));
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
@ -2346,6 +2342,7 @@ VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
VgaDevice::~VgaDevice(void) VgaDevice::~VgaDevice(void)
{ {
HWClose();
delete [] reinterpret_cast<BYTE*>(m_ModeInfo); delete [] reinterpret_cast<BYTE*>(m_ModeInfo);
delete [] reinterpret_cast<BYTE*>(m_ModeNumbers); delete [] reinterpret_cast<BYTE*>(m_ModeNumbers);
m_ModeInfo = NULL; m_ModeInfo = NULL;
@ -2362,7 +2359,7 @@ BOOL VgaDevice::SetVideoModeInfo(UINT Idx, PVBE_MODEINFO pModeInfo)
pMode = &m_ModeInfo[Idx]; pMode = &m_ModeInfo[Idx];
pMode->Length = sizeof(VIDEO_MODE_INFORMATION); pMode->Length = sizeof(VIDEO_MODE_INFORMATION);
pMode->ModeIndex = Idx;//m_ModeNumbers[Idx]; pMode->ModeIndex = Idx;
pMode->VisScreenWidth = pModeInfo->XResolution; pMode->VisScreenWidth = pModeInfo->XResolution;
pMode->VisScreenHeight = pModeInfo->YResolution; pMode->VisScreenHeight = pModeInfo->YResolution;
pMode->ScreenStride = pModeInfo->LinBytesPerScanLine; pMode->ScreenStride = pModeInfo->LinBytesPerScanLine;
@ -2409,7 +2406,6 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat); UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat);
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
//Get VBE Mode List
Length = 0x400; Length = 0x400;
Status = x86BiosAllocateBuffer (&Length, &m_Segment, &m_Offset); Status = x86BiosAllocateBuffer (&Length, &m_Segment, &m_Offset);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
@ -2478,8 +2474,29 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeCount %d\n", ModeCount)); DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeCount %d\n", ModeCount));
delete [] reinterpret_cast<BYTE*>(m_ModeInfo);
delete [] reinterpret_cast<BYTE*>(m_ModeNumbers);
m_ModeInfo = NULL;
m_ModeNumbers = NULL;
m_ModeInfo = reinterpret_cast<PVIDEO_MODE_INFORMATION> (new (PagedPool) BYTE[sizeof (VIDEO_MODE_INFORMATION) * ModeCount]); m_ModeInfo = reinterpret_cast<PVIDEO_MODE_INFORMATION> (new (PagedPool) BYTE[sizeof (VIDEO_MODE_INFORMATION) * ModeCount]);
if (!m_ModeInfo)
{
Status = STATUS_NO_MEMORY;
DbgPrint(TRACE_LEVEL_ERROR, ("VgaDevice::GetModeList failed to allocate m_ModeInfo memory\n"));
return Status;
}
RtlZeroMemory(m_ModeInfo, sizeof (VIDEO_MODE_INFORMATION) * ModeCount);
m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]); m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]);
if (!m_ModeNumbers)
{
Status = STATUS_NO_MEMORY;
DbgPrint(TRACE_LEVEL_ERROR, ("VgaDevice::GetModeList failed to allocate m_ModeNumbers memory\n"));
return Status;
}
RtlZeroMemory(m_ModeNumbers, sizeof (USHORT) * ModeCount);
m_CurrentMode = 0; m_CurrentMode = 0;
DbgPrint(TRACE_LEVEL_INFORMATION, ("m_ModeInfo = 0x%p, m_ModeNumbers = 0x%p\n", m_ModeInfo, m_ModeNumbers)); DbgPrint(TRACE_LEVEL_INFORMATION, ("m_ModeInfo = 0x%p, m_ModeNumbers = 0x%p\n", m_ModeInfo, m_ModeNumbers));
if (Width == 0 || Height == 0 || BitsPerPixel != VGA_BPP) if (Width == 0 || Height == 0 || BitsPerPixel != VGA_BPP)
@ -2569,7 +2586,6 @@ NTSTATUS VgaDevice::QueryCurrentMode(PVIDEO_MODE RequestedMode)
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
UNREFERENCED_PARAMETER(RequestedMode); UNREFERENCED_PARAMETER(RequestedMode);
// PVBE_MODEINFO VBEMode = &m_ModeInfo[m_CurrentMode];
return Status; return Status;
} }
@ -2706,7 +2722,6 @@ VgaDevice::ExecutePresentDisplayOnly(
RtlZeroMemory(ctx,size); RtlZeroMemory(ctx,size);
// const CURRENT_BDD_MODE* pModeCur = &m_CurrentModes[0];
ctx->DstAddr = DstAddr; ctx->DstAddr = DstAddr;
ctx->DstBitPerPixel = DstBitPerPixel; ctx->DstBitPerPixel = DstBitPerPixel;
ctx->DstStride = pModeCur->DispInfo.Pitch; ctx->DstStride = pModeCur->DispInfo.Pitch;
@ -2719,8 +2734,6 @@ VgaDevice::ExecutePresentDisplayOnly(
ctx->Moves = Moves; ctx->Moves = Moves;
ctx->NumDirtyRects = NumDirtyRects; ctx->NumDirtyRects = NumDirtyRects;
ctx->DirtyRect = DirtyRect; ctx->DirtyRect = DirtyRect;
// ctx->SourceID = m_SourceId;
// ctx->hAdapter = m_DevExt;
ctx->Mdl = NULL; ctx->Mdl = NULL;
ctx->DisplaySource = this; ctx->DisplaySource = this;
@ -2787,10 +2800,6 @@ VgaDevice::ExecutePresentDisplayOnly(
ctx->DirtyRect = reinterpret_cast<RECT*>(rects); ctx->DirtyRect = reinterpret_cast<RECT*>(rects);
} }
// HwExecutePresentDisplayOnly((PVOID)ctx);
// Set up destination blt info // Set up destination blt info
BLT_INFO DstBltInfo; BLT_INFO DstBltInfo;
DstBltInfo.pBits = ctx->DstAddr; DstBltInfo.pBits = ctx->DstAddr;
@ -2826,12 +2835,7 @@ VgaDevice::ExecutePresentDisplayOnly(
// Copy all the scroll rects from source image to video frame buffer. // Copy all the scroll rects from source image to video frame buffer.
for (UINT i = 0; i < ctx->NumMoves; i++) for (UINT i = 0; i < ctx->NumMoves; i++)
{ {
// POINT* pSourcePoint = &ctx->Moves[i].SourcePoint;
RECT* pDestRect = &ctx->Moves[i].DestRect; RECT* pDestRect = &ctx->Moves[i].DestRect;
// DbgPrint(TRACE_LEVEL_FATAL, ("--- %d SourcePoint.x = %ld, SourcePoint.y = %ld, DestRect.bottom = %ld, DestRect.left = %ld, DestRect.right = %ld, DestRect.top = %ld\n",
// i , pSourcePoint->x, pSourcePoint->y, pDestRect->bottom, pDestRect->left, pDestRect->right, pDestRect->top));
BltBits(&DstBltInfo, BltBits(&DstBltInfo,
&SrcBltInfo, &SrcBltInfo,
1, // NumRects 1, // NumRects
@ -2842,9 +2846,6 @@ VgaDevice::ExecutePresentDisplayOnly(
for (UINT i = 0; i < ctx->NumDirtyRects; i++) for (UINT i = 0; i < ctx->NumDirtyRects; i++)
{ {
RECT* pDirtyRect = &ctx->DirtyRect[i]; RECT* pDirtyRect = &ctx->DirtyRect[i];
// DbgPrint(TRACE_LEVEL_FATAL, ("--- %d pDirtyRect->bottom = %ld, pDirtyRect->left = %ld, pDirtyRect->right = %ld, pDirtyRect->top = %ld\n",
// i, pDirtyRect->bottom, pDirtyRect->left, pDirtyRect->right, pDirtyRect->top));
BltBits(&DstBltInfo, BltBits(&DstBltInfo,
&SrcBltInfo, &SrcBltInfo,
1, // NumRects 1, // NumRects
@ -2960,6 +2961,7 @@ QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod)
QxlDevice::~QxlDevice(void) QxlDevice::~QxlDevice(void)
{ {
HWClose();
delete [] reinterpret_cast<BYTE*>(m_ModeInfo); delete [] reinterpret_cast<BYTE*>(m_ModeInfo);
delete [] reinterpret_cast<BYTE*>(m_ModeNumbers); delete [] reinterpret_cast<BYTE*>(m_ModeNumbers);
m_ModeInfo = NULL; m_ModeInfo = NULL;
@ -2976,7 +2978,7 @@ BOOL QxlDevice::SetVideoModeInfo(UINT Idx, QXLMode* pModeInfo)
pMode = &m_ModeInfo[Idx]; pMode = &m_ModeInfo[Idx];
pMode->Length = sizeof(VIDEO_MODE_INFORMATION); pMode->Length = sizeof(VIDEO_MODE_INFORMATION);
pMode->ModeIndex = Idx;//m_ModeNumbers[Idx]; pMode->ModeIndex = Idx;
pMode->VisScreenWidth = pModeInfo->x_res; pMode->VisScreenWidth = pModeInfo->x_res;
pMode->VisScreenHeight = pModeInfo->y_res; pMode->VisScreenHeight = pModeInfo->y_res;
pMode->ScreenStride = pModeInfo->stride; pMode->ScreenStride = pModeInfo->stride;
@ -3041,11 +3043,30 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
DbgPrint(TRACE_LEVEL_INFORMATION, ("%s: ModeCount = %d\n", __FUNCTION__, ModeCount)); delete [] reinterpret_cast<BYTE*>(m_ModeInfo);
delete [] reinterpret_cast<BYTE*>(m_ModeNumbers);
m_ModeInfo = NULL;
m_ModeNumbers = NULL;
ModeCount += 2; ModeCount += 2;
m_ModeInfo = reinterpret_cast<PVIDEO_MODE_INFORMATION> (new (PagedPool) BYTE[sizeof (VIDEO_MODE_INFORMATION) * ModeCount]); m_ModeInfo = reinterpret_cast<PVIDEO_MODE_INFORMATION> (new (PagedPool) BYTE[sizeof (VIDEO_MODE_INFORMATION) * ModeCount]);
if (!m_ModeInfo)
{
Status = STATUS_NO_MEMORY;
DbgPrint(TRACE_LEVEL_ERROR, ("QxlDevice::GetModeList failed to allocate m_ModeInfo memory\n"));
return Status;
}
RtlZeroMemory(m_ModeInfo, sizeof (VIDEO_MODE_INFORMATION) * ModeCount);
m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]); m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]);
if (!m_ModeNumbers)
{
Status = STATUS_NO_MEMORY;
DbgPrint(TRACE_LEVEL_ERROR, ("QxlDevice::GetModeList failed to allocate m_ModeNumbers memory\n"));
return Status;
}
RtlZeroMemory(m_ModeNumbers, sizeof (USHORT) * ModeCount);
m_CurrentMode = 0; m_CurrentMode = 0;
UINT Height = pDispInfo->Height; UINT Height = pDispInfo->Height;
@ -3071,7 +3092,7 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
tmpModeInfo->y_res >= Height && tmpModeInfo->y_res >= Height &&
tmpModeInfo->bits == QXL_BPP) tmpModeInfo->bits == QXL_BPP)
{ {
m_ModeNumbers[SuitableModeCount] = SuitableModeCount;//CurrentMode; m_ModeNumbers[SuitableModeCount] = SuitableModeCount;
SetVideoModeInfo(SuitableModeCount, tmpModeInfo); SetVideoModeInfo(SuitableModeCount, tmpModeInfo);
if (tmpModeInfo->x_res == MIN_WIDTH_SIZE && if (tmpModeInfo->x_res == MIN_WIDTH_SIZE &&
tmpModeInfo->y_res == MIN_HEIGHT_SIZE) tmpModeInfo->y_res == MIN_HEIGHT_SIZE)
@ -3121,7 +3142,7 @@ NTSTATUS QxlDevice::QueryCurrentMode(PVIDEO_MODE RequestedMode)
NTSTATUS QxlDevice::SetCurrentMode(ULONG Mode) NTSTATUS QxlDevice::SetCurrentMode(ULONG Mode)
{ {
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s Mode = %x\n", __FUNCTION__, Mode)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s Mode = %x\n", __FUNCTION__, Mode));
for (ULONG idx = 0; idx < GetModeCount(); idx++) for (ULONG idx = 0; idx < GetModeCount(); idx++)
{ {
if (Mode == m_ModeNumbers[idx]) if (Mode == m_ModeNumbers[idx])
@ -3162,7 +3183,6 @@ NTSTATUS QxlDevice::SetPowerState(_In_ DEVICE_POWER_STATE DevicePowerState, DXGK
NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo) NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo)
{ {
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
// NTSTATUS Status = STATUS_SUCCESS;
PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterrface(); PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterrface();
UINT pci_range = QXL_RAM_RANGE_INDEX; UINT pci_range = QXL_RAM_RANGE_INDEX;
for (ULONG i = 0; i < pResList->Count; ++i) for (ULONG i = 0; i < pResList->Count; ++i)
@ -3178,7 +3198,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
PVOID IoBase = NULL; PVOID IoBase = NULL;
ULONG IoLength = pResDescriptor->u.Port.Length; ULONG IoLength = pResDescriptor->u.Port.Length;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
DbgPrint(TRACE_LEVEL_INFORMATION, ("IO Port Info [%08I64X-%08I64X]\n", DbgPrint(TRACE_LEVEL_VERBOSE, ("IO Port Info [%08I64X-%08I64X]\n",
pResDescriptor->u.Port.Start.QuadPart, pResDescriptor->u.Port.Start.QuadPart,
pResDescriptor->u.Port.Start.QuadPart + pResDescriptor->u.Port.Start.QuadPart +
pResDescriptor->u.Port.Length)); pResDescriptor->u.Port.Length));
@ -3200,7 +3220,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
} }
else else
{ {
DbgPrint(TRACE_LEVEL_INFORMATION, ("DxgkCbMapMemor failed with status 0x%X\n", Status)); DbgPrint(TRACE_LEVEL_ERROR, ("DxgkCbMapMemor (CmResourceTypePort) failed with status 0x%X\n", Status));
} }
} }
else else
@ -3208,7 +3228,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
m_IoBase = (PUCHAR)(ULONG_PTR)pResDescriptor->u.Port.Start.QuadPart; m_IoBase = (PUCHAR)(ULONG_PTR)pResDescriptor->u.Port.Start.QuadPart;
m_IoSize = pResDescriptor->u.Port.Length; m_IoSize = pResDescriptor->u.Port.Length;
} }
DbgPrint(TRACE_LEVEL_INFORMATION, ("io_base [%X-%X]\n", DbgPrint(TRACE_LEVEL_VERBOSE, ("io_base [%X-%X]\n",
m_IoBase, m_IoBase,
m_IoBase + m_IoBase +
m_IoSize)); m_IoSize));
@ -3224,7 +3244,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
PVOID MemBase = NULL; PVOID MemBase = NULL;
ULONG MemLength = pResDescriptor->u.Memory.Length; ULONG MemLength = pResDescriptor->u.Memory.Length;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
DbgPrint( TRACE_LEVEL_INFORMATION, ("Memory mapped: (%x:%x) Length:(%x)\n", DbgPrint( TRACE_LEVEL_VERBOSE, ("Memory mapped: (%x:%x) Length:(%x)\n",
pResDescriptor->u.Memory.Start.LowPart, pResDescriptor->u.Memory.Start.LowPart,
pResDescriptor->u.Memory.Start.HighPart, pResDescriptor->u.Memory.Start.HighPart,
pResDescriptor->u.Memory.Length)); pResDescriptor->u.Memory.Length));
@ -3264,6 +3284,11 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
break; break;
} }
} }
else
{
DbgPrint(TRACE_LEVEL_INFORMATION, ("DxgkCbMapMemor (CmResourceTypeMemory) failed with status 0x%X\n", Status));
}
} }
break; break;
case CmResourceTypeDma: case CmResourceTypeDma:
@ -3289,6 +3314,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
m_RamHdr->magic != QXL_RAM_MAGIC) m_RamHdr->magic != QXL_RAM_MAGIC)
{ {
UnmapMemory(); UnmapMemory();
DbgPrint(TRACE_LEVEL_ERROR, ("%s failed asslocateing HW resources\n", __FUNCTION__));
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
@ -3307,6 +3333,7 @@ NTSTATUS QxlDevice::QxlInit(DXGK_DISPLAY_INFORMATION* pDispInfo)
if (!InitMemSlots()) { if (!InitMemSlots()) {
DestroyMemSlots(); DestroyMemSlots();
DbgPrint(TRACE_LEVEL_ERROR, ("%s failed init mem slots\n", __FUNCTION__));
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
@ -3320,7 +3347,7 @@ NTSTATUS QxlDevice::QxlInit(DXGK_DISPLAY_INFORMATION* pDispInfo)
WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_RESET), 0); WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_RESET), 0);
CreateRings(); CreateRings();
m_RamHdr->int_mask = QXL_INTERRUPT_MASK; m_RamHdr->int_mask = ~0;
CreateMemSlots(); CreateMemSlots();
InitDeviceMemoryResources(); InitDeviceMemoryResources();
return Status; return Status;
@ -3476,32 +3503,20 @@ BOOL QxlDevice::CreateRings()
void QxlDevice::AsyncIo(UCHAR Port, UCHAR Value) void QxlDevice::AsyncIo(UCHAR Port, UCHAR Value)
{ {
LARGE_INTEGER timeout; LARGE_INTEGER timeout;
KeWaitForSingleObject BOOLEAN locked = FALSE;
( locked = WaitForObject(&m_IoLock, NULL);
&m_IoLock,
Executive,
KernelMode,
FALSE,
NULL
);
WRITE_PORT_UCHAR(m_IoBase + Port, Value); WRITE_PORT_UCHAR(m_IoBase + Port, Value);
timeout.QuadPart = -60000L * 1000 * 10; timeout.QuadPart = -60000L * 1000 * 10;
WAIT_FOR_EVENT(m_IoCmdEvent, &timeout); WaitForObject(&m_IoCmdEvent, &timeout);
KeReleaseMutex(&m_IoLock,FALSE); ReleaseMutex(&m_IoLock, locked);
} }
void QxlDevice::SyncIo(UCHAR Port, UCHAR Value) void QxlDevice::SyncIo(UCHAR Port, UCHAR Value)
{ {
KeWaitForSingleObject BOOLEAN locked = FALSE;
( locked = WaitForObject(&m_IoLock, NULL);
&m_IoLock,
Executive,
KernelMode,
FALSE,
NULL
);
WRITE_PORT_UCHAR(m_IoBase + Port, Value); WRITE_PORT_UCHAR(m_IoBase + Port, Value);
KeReleaseMutex(&m_IoLock,FALSE); ReleaseMutex(&m_IoLock, locked);
} }
UINT8 QxlDevice::SetupMemSlot(UINT8 Idx, UINT64 pastart, UINT64 paend, UINT64 vastart, UINT64 vaend) UINT8 QxlDevice::SetupMemSlot(UINT8 Idx, UINT64 pastart, UINT64 paend, UINT64 vastart, UINT64 vaend)
@ -3606,7 +3621,6 @@ QxlDevice::ExecutePresentDisplayOnly(
RtlZeroMemory(ctx,size); RtlZeroMemory(ctx,size);
// const CURRENT_BDD_MODE* pModeCur = &m_CurrentModes[0];
ctx->DstAddr = DstAddr; ctx->DstAddr = DstAddr;
ctx->DstBitPerPixel = DstBitPerPixel; ctx->DstBitPerPixel = DstBitPerPixel;
ctx->DstStride = pModeCur->DispInfo.Pitch; ctx->DstStride = pModeCur->DispInfo.Pitch;
@ -3619,8 +3633,6 @@ QxlDevice::ExecutePresentDisplayOnly(
ctx->Moves = Moves; ctx->Moves = Moves;
ctx->NumDirtyRects = NumDirtyRects; ctx->NumDirtyRects = NumDirtyRects;
ctx->DirtyRect = DirtyRect; ctx->DirtyRect = DirtyRect;
// ctx->SourceID = m_SourceId;
// ctx->hAdapter = m_DevExt;
ctx->Mdl = NULL; ctx->Mdl = NULL;
ctx->DisplaySource = this; ctx->DisplaySource = this;
@ -3730,7 +3742,7 @@ QxlDevice::ExecutePresentDisplayOnly(
BltBits(&DstBltInfo, BltBits(&DstBltInfo,
&SrcBltInfo, &SrcBltInfo,
1, // NumRects 1,
pDestRect); pDestRect);
} }
@ -3743,7 +3755,7 @@ QxlDevice::ExecutePresentDisplayOnly(
BltBits(&DstBltInfo, BltBits(&DstBltInfo,
&SrcBltInfo, &SrcBltInfo,
1, // NumRects 1,
pDirtyRect); pDirtyRect);
} }
@ -3781,7 +3793,7 @@ void QxlDevice::WaitForReleaseRing(void)
} }
timeout.QuadPart = -30 * 1000 * 10; //30ms timeout.QuadPart = -30 * 1000 * 10; //30ms
WAIT_FOR_EVENT(m_DisplayEvent, &timeout); WaitForObject(&m_DisplayEvent, &timeout);
if (SPICE_RING_IS_EMPTY(m_ReleaseRing)) { if (SPICE_RING_IS_EMPTY(m_ReleaseRing)) {
SyncIo(QXL_IO_NOTIFY_OOM, 0); SyncIo(QXL_IO_NOTIFY_OOM, 0);
@ -3823,18 +3835,12 @@ void QxlDevice::FlushReleaseRing()
void QxlDevice::EmptyReleaseRing() void QxlDevice::EmptyReleaseRing()
{ {
KeWaitForSingleObject BOOLEAN locked = FALSE;
( locked = WaitForObject(&m_MemLock, NULL);
&m_MemLock,
Executive,
KernelMode,
FALSE,
NULL
);
while (m_FreeOutputs || !SPICE_RING_IS_EMPTY(m_ReleaseRing)) { while (m_FreeOutputs || !SPICE_RING_IS_EMPTY(m_ReleaseRing)) {
FlushReleaseRing(); FlushReleaseRing();
} }
KeReleaseMutex(&m_MemLock,FALSE); ReleaseMutex(&m_MemLock, locked);
} }
UINT64 QxlDevice::ReleaseOutput(UINT64 output_id) UINT64 QxlDevice::ReleaseOutput(UINT64 output_id)
@ -3859,6 +3865,7 @@ UINT64 QxlDevice::ReleaseOutput(UINT64 output_id)
void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force) void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force)
{ {
PVOID ptr; PVOID ptr;
BOOLEAN locked = FALSE;
ASSERT(m_MSInfo[mspace_type]._mspace); ASSERT(m_MSInfo[mspace_type]._mspace);
DbgPrint(TRACE_LEVEL_VERBOSE, ("--->%s: %p(%d) size %u\n", __FUNCTION__, DbgPrint(TRACE_LEVEL_VERBOSE, ("--->%s: %p(%d) size %u\n", __FUNCTION__,
@ -3869,14 +3876,7 @@ void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force)
mspace_malloc_stats(m_MSInfo[mspace_type]._mspace); mspace_malloc_stats(m_MSInfo[mspace_type]._mspace);
#endif #endif
KeWaitForSingleObject locked = WaitForObject(&m_MemLock, NULL);
(
&m_MemLock,
Executive,
KernelMode,
FALSE,
NULL
);
while (1) { while (1) {
/* Release lots of queued resources, before allocating, as we /* Release lots of queued resources, before allocating, as we
@ -3902,7 +3902,7 @@ void *QxlDevice::AllocMem(UINT32 mspace_type, size_t size, BOOL force)
break; break;
} }
} }
KeReleaseMutex(&m_MemLock,FALSE); ReleaseMutex(&m_MemLock, locked);
ASSERT((!ptr && !force) || (ptr >= m_MSInfo[mspace_type].mspace_start && ASSERT((!ptr && !force) || (ptr >= m_MSInfo[mspace_type].mspace_start &&
ptr < m_MSInfo[mspace_type].mspace_end)); ptr < m_MSInfo[mspace_type].mspace_end));
@ -3923,16 +3923,10 @@ void QxlDevice::FreeMem(UINT32 mspace_type, void *ptr)
m_MSInfo[mspace_type].mspace_end, mspace_type)); m_MSInfo[mspace_type].mspace_end, mspace_type));
} }
#endif #endif
KeWaitForSingleObject BOOLEAN locked = FALSE;
( locked = WaitForObject(&m_MemLock, NULL);
&m_MemLock,
Executive,
KernelMode,
FALSE,
NULL
);
mspace_free(m_MSInfo[mspace_type]._mspace, ptr); mspace_free(m_MSInfo[mspace_type]._mspace, ptr);
KeReleaseMutex(&m_MemLock,FALSE); ReleaseMutex(&m_MemLock, locked);
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
} }
@ -4116,20 +4110,14 @@ void QxlDevice::PushDrawable(QXLDrawable *drawable) {
QXLCommand *cmd; QXLCommand *cmd;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
KeWaitForSingleObject BOOLEAN locked = FALSE;
( locked = WaitForObject(&m_CmdLock, NULL);
&m_CmdLock,
Executive,
KernelMode,
FALSE,
NULL
);
WaitForCmdRing(); WaitForCmdRing();
cmd = SPICE_RING_PROD_ITEM(m_CommandRing); cmd = SPICE_RING_PROD_ITEM(m_CommandRing);
cmd->type = QXL_CMD_DRAW; cmd->type = QXL_CMD_DRAW;
cmd->data = PA(drawable, m_MainMemSlot); cmd->data = PA(drawable, m_MainMemSlot);
PushCmd(); PushCmd();
KeReleaseMutex(&m_CmdLock,FALSE); ReleaseMutex(&m_CmdLock, locked);
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
} }
@ -4139,20 +4127,14 @@ void QxlDevice::PushCursorCmd(QXLCursorCmd *cursor_cmd)
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
KeWaitForSingleObject BOOLEAN locked = FALSE;
( locked = WaitForObject(&m_CrsLock, NULL);
&m_CrsLock,
Executive,
KernelMode,
FALSE,
NULL
);
WaitForCursorRing(); WaitForCursorRing();
cmd = SPICE_RING_PROD_ITEM(m_CursorRing); cmd = SPICE_RING_PROD_ITEM(m_CursorRing);
cmd->type = QXL_CMD_CURSOR; cmd->type = QXL_CMD_CURSOR;
cmd->data = PA(cursor_cmd, m_MainMemSlot); cmd->data = PA(cursor_cmd, m_MainMemSlot);
PushCursor(); PushCursor();
KeReleaseMutex(&m_CrsLock,FALSE); ReleaseMutex(&m_CrsLock, locked);
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
} }
@ -4199,7 +4181,6 @@ VOID QxlDevice::BltBits (
} }
CONST RECT* pRect = &pRects[0]; CONST RECT* pRect = &pRects[0];
// UpdateArea(pRect, 0);
drawable->u.copy.scale_mode = SPICE_IMAGE_SCALE_MODE_NEAREST; drawable->u.copy.scale_mode = SPICE_IMAGE_SCALE_MODE_NEAREST;
drawable->u.copy.mask.bitmap = 0; drawable->u.copy.mask.bitmap = 0;
drawable->u.copy.rop_descriptor = SPICE_ROPD_OP_PUT; drawable->u.copy.rop_descriptor = SPICE_ROPD_OP_PUT;
@ -4281,7 +4262,6 @@ VOID QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
QXLDataChunk *chunk = *chunk_ptr; QXLDataChunk *chunk = *chunk_ptr;
UINT8 *now = *now_ptr; UINT8 *now = *now_ptr;
UINT8 *end = *end_ptr; UINT8 *end = *end_ptr;
// int offset;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
while (size) { while (size) {
@ -4319,8 +4299,6 @@ VOID QxlDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
QXLDrawable *drawable; QXLDrawable *drawable;
RECT Rect; RECT Rect;
PAGED_CODE(); PAGED_CODE();
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s\n", __FUNCTION__));
if (pCurrentBddMod->Flags.FrameBufferIsActive) if (pCurrentBddMod->Flags.FrameBufferIsActive)
{ {
Rect.bottom = pCurrentBddMod->SrcModeHeight; Rect.bottom = pCurrentBddMod->SrcModeHeight;
@ -4341,15 +4319,12 @@ VOID QxlDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
drawable->u.fill.mask.bitmap = 0; drawable->u.fill.mask.bitmap = 0;
PushDrawable(drawable); PushDrawable(drawable);
} }
DbgPrint(TRACE_LEVEL_FATAL, ("<--- %s\n", __FUNCTION__));
} }
NTSTATUS QxlDevice::HWClose(void) NTSTATUS QxlDevice::HWClose(void)
{ {
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
QxlClose(); QxlClose();
UnmapMemory(); UnmapMemory();
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -4373,7 +4348,6 @@ NTSTATUS QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
QXLCursor *cursor; QXLCursor *cursor;
Resource *res; Resource *res;
QXLDataChunk *chunk; QXLDataChunk *chunk;
// ULONG unique;
UINT8 *src; UINT8 *src;
UINT8 *src_end; UINT8 *src_end;
UINT8 *now; UINT8 *now;
@ -4468,12 +4442,12 @@ NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
UINT bpp; UINT bpp;
if (pEscap->PrivateDriverDataSize != sizeof(QXLEscapeSetCustomDisplay)) { if (pEscap->PrivateDriverDataSize != sizeof(QXLEscapeSetCustomDisplay)) {
DbgPrint(TRACE_LEVEL_FATAL, ("<--> %s Incorrect buffer size %d instead of %d\n", __FUNCTION__, pEscap->PrivateDriverDataSize, sizeof(QXLEscapeSetCustomDisplay))); DbgPrint(TRACE_LEVEL_ERROR, ("<--> %s Incorrect buffer size %d instead of %d\n", __FUNCTION__, pEscap->PrivateDriverDataSize, sizeof(QXLEscapeSetCustomDisplay)));
return STATUS_INVALID_BUFFER_SIZE; return STATUS_INVALID_BUFFER_SIZE;
} }
custom_display = (QXLEscapeSetCustomDisplay*)pEscap->pPrivateDriverData; custom_display = (QXLEscapeSetCustomDisplay*)pEscap->pPrivateDriverData;
xres = custom_display->xres; xres = custom_display->xres & ~0x3;
yres = custom_display->yres; yres = custom_display->yres & ~0x3;
bpp = custom_display->bpp; bpp = custom_display->bpp;
if (bpp != QXL_BPP) if (bpp != QXL_BPP)
{ {
@ -4481,7 +4455,7 @@ NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
} }
if (xres < MIN_WIDTH_SIZE || yres < MIN_HEIGHT_SIZE) if (xres < MIN_WIDTH_SIZE || yres < MIN_HEIGHT_SIZE)
{ {
DbgPrint(TRACE_LEVEL_FATAL, ("%s: xres = %d, yres = %d\n", __FUNCTION__, xres, yres)); DbgPrint(TRACE_LEVEL_ERROR, ("%s: xres = %d, yres = %d\n", __FUNCTION__, xres, yres));
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
} }
@ -4491,9 +4465,9 @@ NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
m_CustomMode = (USHORT)(m_ModeCount - 1); m_CustomMode = (USHORT)(m_ModeCount - 1);
if ((xres * yres * bpp / 8) > m_RomHdr->surface0_area_size) { if ((xres * yres * bpp / 8) > m_RomHdr->surface0_area_size) {
DbgPrint(TRACE_LEVEL_FATAL, ("%s: Mode (%dx%d#%d) doesn't fit in memory (%d)\n", DbgPrint(TRACE_LEVEL_ERROR, ("%s: Mode (%dx%d#%d) doesn't fit in memory (%d)\n",
__FUNCTION__, xres, yres, bpp, m_RomHdr->surface0_area_size)); __FUNCTION__, xres, yres, bpp, m_RomHdr->surface0_area_size));
return ERROR_NOT_ENOUGH_MEMORY; return STATUS_INVALID_PARAMETER;
} }
UpdateVideoModeInfo(m_CustomMode, xres, yres, bpp); UpdateVideoModeInfo(m_CustomMode, xres, yres, bpp);
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
@ -4511,7 +4485,7 @@ VOID QxlDevice::WaitForCmdRing()
if (!wait) { if (!wait) {
break; break;
} }
WAIT_FOR_EVENT(m_DisplayEvent, NULL); WaitForObject(&m_DisplayEvent, NULL);
} }
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
} }
@ -4541,7 +4515,7 @@ VOID QxlDevice::WaitForCursorRing(VOID)
LARGE_INTEGER timeout; // 1 => 100 nanoseconds LARGE_INTEGER timeout; // 1 => 100 nanoseconds
timeout.QuadPart = -1 * (1000 * 1000 * 10); //negative => relative // 1s timeout.QuadPart = -1 * (1000 * 1000 * 10); //negative => relative // 1s
WAIT_FOR_EVENT(m_CursorEvent, &timeout); WaitForObject(&m_CursorEvent, &timeout);
if (SPICE_RING_IS_FULL(m_CursorRing)) { if (SPICE_RING_IS_FULL(m_CursorRing)) {
DbgPrint(TRACE_LEVEL_ERROR, ("%s: timeout\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_ERROR, ("%s: timeout\n", __FUNCTION__));
@ -4572,13 +4546,13 @@ BOOLEAN QxlDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_
m_Pending |= m_RamHdr->int_pending; m_Pending |= m_RamHdr->int_pending;
m_RamHdr->int_pending = 0; m_RamHdr->int_pending = 0;
DXGKARGCB_NOTIFY_INTERRUPT_DATA notifyInt;// = {0}; DXGKARGCB_NOTIFY_INTERRUPT_DATA notifyInt;
notifyInt.InterruptType = DXGK_INTERRUPT_DISPLAYONLY_PRESENT_PROGRESS; notifyInt.InterruptType = DXGK_INTERRUPT_DISPLAYONLY_PRESENT_PROGRESS;
notifyInt.DisplayOnlyPresentProgress.VidPnSourceId = 0;//FIXME pPath->VidPnSourceId; notifyInt.DisplayOnlyPresentProgress.VidPnSourceId = 0;
pDxgkInterface->DxgkCbNotifyInterrupt(pDxgkInterface->DeviceHandle,&notifyInt); pDxgkInterface->DxgkCbNotifyInterrupt(pDxgkInterface->DeviceHandle,&notifyInt);
if (!pDxgkInterface->DxgkCbQueueDpc(pDxgkInterface->DeviceHandle)) { if (!pDxgkInterface->DxgkCbQueueDpc(pDxgkInterface->DeviceHandle)) {
m_RamHdr->int_mask = QXL_INTERRUPT_MASK; m_RamHdr->int_mask = ~0;
WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0); WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0);
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s DxgkCbQueueDpc failed\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_FATAL, ("---> %s DxgkCbQueueDpc failed\n", __FUNCTION__));
} }
@ -4613,7 +4587,7 @@ VOID QxlDevice::DpcRoutine(PVOID ptr)
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s m_IoCmdEvent\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s m_IoCmdEvent\n", __FUNCTION__));
KeSetEvent (&m_IoCmdEvent, IO_NO_INCREMENT, FALSE); KeSetEvent (&m_IoCmdEvent, IO_NO_INCREMENT, FALSE);
} }
m_RamHdr->int_mask = QXL_INTERRUPT_MASK; m_RamHdr->int_mask = ~0;
WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0); WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0);
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));

View File

@ -48,7 +48,6 @@ typedef struct
ULONG OemProductNamePtr; ULONG OemProductNamePtr;
ULONG OemProductRevPtr; ULONG OemProductRevPtr;
CHAR Reserved[222]; CHAR Reserved[222];
// CHAR OemData[256];
} VBE_INFO, *PVBE_INFO; } VBE_INFO, *PVBE_INFO;
typedef struct typedef struct
@ -215,6 +214,7 @@ class QxlDod;
class HwDeviceIntrface { class HwDeviceIntrface {
public: public:
virtual ~HwDeviceIntrface() {;}
virtual NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode) = 0; virtual NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode) = 0;
virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0; virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0;
virtual NTSTATUS GetCurrentMode(ULONG* Mode) = 0; virtual NTSTATUS GetCurrentMode(ULONG* Mode) = 0;
@ -265,7 +265,7 @@ class VgaDevice :
{ {
public: public:
VgaDevice(_In_ QxlDod* pQxlDod); VgaDevice(_In_ QxlDod* pQxlDod);
virtual ~VgaDevice(void); ~VgaDevice(void);
NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode); NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode);
NTSTATUS SetCurrentMode(ULONG Mode); NTSTATUS SetCurrentMode(ULONG Mode);
NTSTATUS GetCurrentMode(ULONG* Mode); NTSTATUS GetCurrentMode(ULONG* Mode);
@ -356,20 +356,38 @@ struct Resource {
#define TIMEOUT_TO_MS ((LONGLONG) 1 * 10 * 1000) #define TIMEOUT_TO_MS ((LONGLONG) 1 * 10 * 1000)
#define WAIT_FOR_EVENT(event, timeout) do { \ BOOLEAN
NTSTATUS status; \ FORCEINLINE
status = KeWaitForSingleObject ( \ WaitForObject(
&event, \ PVOID Object,
Executive, \ PLARGE_INTEGER Timeout)
KernelMode, \ {
FALSE, \ NTSTATUS status;
timeout); \ status = KeWaitForSingleObject (
ASSERT(NT_SUCCESS(status)); \ Object,
} while (0); Executive,
KernelMode,
FALSE,
Timeout);
ASSERT(NT_SUCCESS(status));
return (status == STATUS_SUCCESS);
}
#define QXL_SLEEP(msec) do { \ VOID
LARGE_INTEGER timeout; \ FORCEINLINE
timeout.QuadPart = -msec * TIMEOUT_TO_MS; \ ReleaseMutex(
PKMUTEX Mutex,
BOOLEAN locked)
{
if (locked)
{
KeReleaseMutex(Mutex, FALSE);
}
}
#define QXL_SLEEP(msec) do { \
LARGE_INTEGER timeout; \
timeout.QuadPart = -msec * TIMEOUT_TO_MS; \
KeDelayExecutionThread (KernelMode, FALSE, &timeout);\ KeDelayExecutionThread (KernelMode, FALSE, &timeout);\
} while (0); } while (0);
@ -420,15 +438,15 @@ class QxlDevice :
{ {
public: public:
QxlDevice(_In_ QxlDod* pQxlDod); QxlDevice(_In_ QxlDod* pQxlDod);
virtual ~QxlDevice(void); ~QxlDevice(void);
NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode); NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode);
NTSTATUS SetCurrentMode(ULONG Mode); NTSTATUS SetCurrentMode(ULONG Mode);
NTSTATUS GetCurrentMode(ULONG* Mode); NTSTATUS GetCurrentMode(ULONG* Mode);
ULONG GetModeCount(void) {return m_ModeCount/* - 2*/;} ULONG GetModeCount(void) {return m_ModeCount;}
NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo); NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo);
NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo); NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo);
NTSTATUS HWClose(void); NTSTATUS HWClose(void);
BOOLEAN EnablePointer(void) { return TRUE; } BOOLEAN EnablePointer(void) { return FALSE; }
NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE* DstAddr, NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE* DstAddr,
_In_ UINT DstBitPerPixel, _In_ UINT DstBitPerPixel,
_In_ BYTE* SrcAddr, _In_ BYTE* SrcAddr,

View File

@ -1,28 +1,28 @@
@echo off @echo off
call %~dp0\checkWin8Tools.bat call %~dp0\checkWin8Tools.bat
for /f "tokens=*" %%a in ( for /f "tokens=*" %%a in (
'cscript.exe /nologo "%~dp0\getVisualStudioCmdLine.vbs" %*' 'cscript.exe /nologo "%~dp0\getVisualStudioCmdLine.vbs" %*'
) do ( ) do (
set vs_cmd=%%a set vs_cmd=%%a
) )
IF NOT DEFINED vs_cmd ( IF NOT DEFINED vs_cmd (
echo Visual Studio not found echo Visual Studio not found
EXIT /b 1 EXIT /b 1
) )
SET vs_cmd_no_quotes="%vs_cmd:"=%" SET vs_cmd_no_quotes="%vs_cmd:"=%"
IF "vs_cmd_no_quotes" == "" ( IF "vs_cmd_no_quotes" == "" (
echo Visual Studio not found echo Visual Studio not found
EXIT /b 2 EXIT /b 2
) )
call %vs_cmd% call %vs_cmd%
if %ERRORLEVEL% GEQ 1 ( if %ERRORLEVEL% GEQ 1 (
echo Build with Visual Studio FAILED echo Build with Visual Studio FAILED
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%
) )
exit /b 0 exit /b 0

View File

@ -9,7 +9,7 @@
// Driver Entry point // Driver Entry point
// //
int nDebugLevel = TRACE_LEVEL_INFORMATION; int nDebugLevel = TRACE_LEVEL_ERROR;
extern "C" extern "C"
@ -22,9 +22,6 @@ DriverEntry(
DbgPrint(TRACE_LEVEL_FATAL, ("---> KMDOD build on on %s %s\n", __DATE__, __TIME__)); DbgPrint(TRACE_LEVEL_FATAL, ("---> KMDOD build on on %s %s\n", __DATE__, __TIME__));
#ifdef DBG
// KdBreakPoint();
#endif
// Initialize DDI function pointers and dxgkrnl // Initialize DDI function pointers and dxgkrnl
KMDDOD_INITIALIZATION_DATA InitialData = {0}; KMDDOD_INITIALIZATION_DATA InitialData = {0};
@ -252,7 +249,7 @@ DodQueryDeviceDescriptor(
// The first call queues a worker thread item indicating that it now has a child device, the second queues a worker thread // The first call queues a worker thread item indicating that it now has a child device, the second queues a worker thread
// item that it no longer has any child device. This function gets called based on the first worker thread item, but after // item that it no longer has any child device. This function gets called based on the first worker thread item, but after
// the driver has been stopped. Therefore instead of asserting like other functions, we only warn. // the driver has been stopped. Therefore instead of asserting like other functions, we only warn.
DbgPrint(TRACE_LEVEL_WARNING, ("QXL (0x%I64x) is being called when not active!", pQxl)); DbgPrint(TRACE_LEVEL_WARNING, ("QXL (%p) is being called when not active!", pQxl));
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->QueryDeviceDescriptor(ChildUid, pDeviceDescriptor); return pQxl->QueryDeviceDescriptor(ChildUid, pDeviceDescriptor);
@ -290,7 +287,7 @@ DodSetPointerPosition(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->SetPointerPosition(pSetPointerPosition); return pQxl->SetPointerPosition(pSetPointerPosition);
@ -309,7 +306,7 @@ DodSetPointerShape(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->SetPointerShape(pSetPointerShape); return pQxl->SetPointerShape(pSetPointerShape);
@ -357,7 +354,7 @@ DodPresentDisplayOnly(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->PresentDisplayOnly(pPresentDisplayOnly); return pQxl->PresentDisplayOnly(pPresentDisplayOnly);
@ -394,7 +391,7 @@ DodIsSupportedVidPn(
// This path might hit because win32k/dxgport doesn't check that an adapter is active when taking the adapter lock. // This path might hit because win32k/dxgport doesn't check that an adapter is active when taking the adapter lock.
// The adapter lock is the main thing QXL Fallback relies on to not be called while it's inactive. It is still a rare // The adapter lock is the main thing QXL Fallback relies on to not be called while it's inactive. It is still a rare
// timing issue around PnpStart/Stop and isn't expected to have any effect on the stability of the system. // timing issue around PnpStart/Stop and isn't expected to have any effect on the stability of the system.
DbgPrint(TRACE_LEVEL_WARNING, ("QXL (0x%I64x) is being called when not active!", pQxl)); DbgPrint(TRACE_LEVEL_WARNING, ("QXL (%p) is being called when not active!", pQxl));
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->IsSupportedVidPn(pIsSupportedVidPn); return pQxl->IsSupportedVidPn(pIsSupportedVidPn);
@ -413,7 +410,7 @@ DodRecommendFunctionalVidPn(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->RecommendFunctionalVidPn(pRecommendFunctionalVidPn); return pQxl->RecommendFunctionalVidPn(pRecommendFunctionalVidPn);
@ -432,7 +429,7 @@ DodRecommendVidPnTopology(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->RecommendVidPnTopology(pRecommendVidPnTopology); return pQxl->RecommendVidPnTopology(pRecommendVidPnTopology);
@ -451,7 +448,7 @@ DodRecommendMonitorModes(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->RecommendMonitorModes(pRecommendMonitorModes); return pQxl->RecommendMonitorModes(pRecommendMonitorModes);
@ -470,7 +467,7 @@ DodEnumVidPnCofuncModality(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->EnumVidPnCofuncModality(pEnumCofuncModality); return pQxl->EnumVidPnCofuncModality(pEnumCofuncModality);
@ -489,7 +486,7 @@ DodSetVidPnSourceVisibility(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->SetVidPnSourceVisibility(pSetVidPnSourceVisibility); return pQxl->SetVidPnSourceVisibility(pSetVidPnSourceVisibility);
@ -508,7 +505,7 @@ DodCommitVidPn(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->CommitVidPn(pCommitVidPn); return pQxl->CommitVidPn(pCommitVidPn);
@ -527,7 +524,7 @@ DodUpdateActiveVidPnPresentPath(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->UpdateActiveVidPnPresentPath(pUpdateActiveVidPnPresentPath); return pQxl->UpdateActiveVidPnPresentPath(pUpdateActiveVidPnPresentPath);
@ -546,7 +543,7 @@ DodQueryVidPnHWCapability(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter); QxlDod* pQxl = reinterpret_cast<QxlDod*>(hAdapter);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return pQxl->QueryVidPnHWCapability(pVidPnHWCaps); return pQxl->QueryVidPnHWCapability(pVidPnHWCaps);
@ -569,7 +566,7 @@ DodDpcRoutine(
QxlDod* pQxl = reinterpret_cast<QxlDod*>(pDeviceContext); QxlDod* pQxl = reinterpret_cast<QxlDod*>(pDeviceContext);
if (!pQxl->IsDriverActive()) if (!pQxl->IsDriverActive())
{ {
QXL_LOG_ASSERTION1("QXL (0x%I64x) is being called when not active!", pQxl); QXL_LOG_ASSERTION1("QXL (%p) is being called when not active!", pQxl);
return; return;
} }
pQxl->DpcRoutine(); pQxl->DpcRoutine();

View File

@ -207,8 +207,6 @@ DodSystemDisplayWrite(
_In_ UINT PositionX, _In_ UINT PositionX,
_In_ UINT PositionY); _In_ UINT PositionY);
#if DBG #if DBG
extern int nDebugLevel; extern int nDebugLevel;

View File

@ -1,28 +1,28 @@
' $1 - Visual studio version to run (10 or 11) ' $1 - Visual studio version to run (10 or 11)
' $2 ... Parameters to pass ' $2 ... Parameters to pass
Dim strCmdLine, strTemp Dim strCmdLine, strTemp
Set WshShell = Wscript.CreateObject("Wscript.Shell") Set WshShell = Wscript.CreateObject("Wscript.Shell")
On Error Resume Next On Error Resume Next
strCmdLine = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\VisualStudio\" + Wscript.Arguments(0) + ".0\InstallDir") strCmdLine = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\VisualStudio\" + Wscript.Arguments(0) + ".0\InstallDir")
' In case of error assume WoW64 case ' In case of error assume WoW64 case
If Err <> 0 Then If Err <> 0 Then
On Error Goto 0 On Error Goto 0
strCmdLine = WshShell.RegRead("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\" + Wscript.Arguments(0) + ".0\InstallDir") strCmdLine = WshShell.RegRead("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\" + Wscript.Arguments(0) + ".0\InstallDir")
End If End If
On Error Goto 0 On Error Goto 0
strCmdLine = chr(34) + strCmdLine + "devenv.com" + chr(34) strCmdLine = chr(34) + strCmdLine + "devenv.com" + chr(34)
For i = 0 to (Wscript.Arguments.Count - 1) For i = 0 to (Wscript.Arguments.Count - 1)
If i > 0 Then If i > 0 Then
strTemp = Wscript.Arguments(i) strTemp = Wscript.Arguments(i)
If InStr(strTemp, " ") Or InStr(strTemp, "|") Then If InStr(strTemp, " ") Or InStr(strTemp, "|") Then
strCmdLine = strCmdLine + " " + chr(34) + strTemp + chr(34) strCmdLine = strCmdLine + " " + chr(34) + strTemp + chr(34)
Else Else
strCmdLine = strCmdLine + " " + strTemp strCmdLine = strCmdLine + " " + strTemp
End If End If
End If End If
Next Next
WScript.Echo strCmdLine + vbCrLf WScript.Echo strCmdLine + vbCrLf

14
qxldod/include/qxl_windows.h Executable file
View File

@ -0,0 +1,14 @@
#ifndef _H_QXL_WINDOWS
#define _H_QXL_WINDOWS
enum {
QXL_ESCAPE_SET_CUSTOM_DISPLAY = 0x10001,
};
typedef struct QXLEscapeSetCustomDisplay {
uint32_t xres;
uint32_t yres;
uint32_t bpp;
} QXLEscapeSetCustomDisplay;
#endif /* _H_QXL_WINDOWS */

BIN
qxldod/qxldod.inx Executable file

Binary file not shown.

View File

@ -55,21 +55,25 @@
<TargetVersion>WindowsV6.3</TargetVersion> <TargetVersion>WindowsV6.3</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
<ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'" Label="Configuration">
<TargetVersion>Windows8</TargetVersion> <TargetVersion>Windows8</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
<ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|Win32'"> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|Win32'">
<TargetVersion>WindowsV6.3</TargetVersion> <TargetVersion>WindowsV6.3</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
<ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'" Label="Configuration">
<TargetVersion>Windows8</TargetVersion> <TargetVersion>Windows8</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
<ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'"> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'">
<TargetVersion>WindowsV6.3</TargetVersion> <TargetVersion>WindowsV6.3</TargetVersion>
@ -90,6 +94,7 @@
<TargetVersion>Windows8</TargetVersion> <TargetVersion>Windows8</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
<ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -157,6 +162,11 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">
<Link> <Link>
@ -173,6 +183,15 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<KmdfVersionNumber />
</Inf>
<Inf>
<UmdfVersionNumber />
</Inf>
<Inf>
<EnableVerbose>true</EnableVerbose>
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|Win32'">
<Link> <Link>
@ -188,6 +207,11 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">
<Link> <Link>
@ -203,6 +227,11 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'">
<Link> <Link>
@ -217,6 +246,11 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">
<Link> <Link>
@ -231,6 +265,11 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|x64'">
<Link> <Link>
@ -246,6 +285,11 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">
<Link> <Link>
@ -261,10 +305,12 @@
<PostBuildEvent> <PostBuildEvent>
<Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command> <Command>Inf2Cat /driver:$(OutDir) /os:8_X64,Server8_X64,Server6_3_X64,6_3_X64</Command>
</PostBuildEvent> </PostBuildEvent>
<Inf>
<EnableVerbose>true</EnableVerbose>
<KmdfVersionNumber />
<UmdfVersionNumber />
</Inf>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup>
<Inf Include="qxldod.inf" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<FilesToPackage Include="$(TargetPath)" /> <FilesToPackage Include="$(TargetPath)" />
<FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" />
@ -284,7 +330,10 @@
<ItemGroup> <ItemGroup>
<ResourceCompile Include="qxldod.rc" /> <ResourceCompile Include="qxldod.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Inf Include="qxldod.inx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,59 +1,59 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter> </Filter>
<Filter Include="Resource Files"> <Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
<Filter Include="Driver Files"> <Filter Include="Driver Files">
<UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier> <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>
<Extensions>inf;inv;inx;mof;mc;</Extensions> <Extensions>inf;inv;inx;mof;mc;</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Inf Include="qxldod.inf"> <ClInclude Include="BaseObject.h">
<Filter>Driver Files</Filter> <Filter>Header Files</Filter>
</Inf> </ClInclude>
</ItemGroup> <ClInclude Include="resource.h">
<ItemGroup> <Filter>Header Files</Filter>
<ClInclude Include="BaseObject.h"> </ClInclude>
<Filter>Header Files</Filter> <ClInclude Include="driver.h">
</ClInclude> <Filter>Header Files</Filter>
<ClInclude Include="resource.h"> </ClInclude>
<Filter>Header Files</Filter> <ClInclude Include="QxlDod.h">
</ClInclude> <Filter>Header Files</Filter>
<ClInclude Include="driver.h"> </ClInclude>
<Filter>Header Files</Filter> </ItemGroup>
</ClInclude> <ItemGroup>
<ClInclude Include="QxlDod.h"> <ClCompile Include="BaseObject.cpp">
<Filter>Header Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClCompile>
</ItemGroup> <ClCompile Include="driver.cpp">
<ItemGroup> <Filter>Source Files</Filter>
<ClCompile Include="BaseObject.cpp"> </ClCompile>
<Filter>Source Files</Filter> <ClCompile Include="QxlDod.cpp">
</ClCompile> <Filter>Source Files</Filter>
<ClCompile Include="driver.cpp"> </ClCompile>
<Filter>Source Files</Filter> <ClCompile Include="mspace.c">
</ClCompile> <Filter>Source Files</Filter>
<ClCompile Include="QxlDod.cpp"> </ClCompile>
<Filter>Source Files</Filter> </ItemGroup>
</ClCompile> <ItemGroup>
<ClCompile Include="mspace.c"> <ResourceCompile Include="qxldod.rc">
<Filter>Source Files</Filter> <Filter>Resource Files</Filter>
</ClCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="qxldod.rc"> <Inf Include="qxldod.inx">
<Filter>Resource Files</Filter> <Filter>Driver Files</Filter>
</ResourceCompile> </Inf>
</ItemGroup> </ItemGroup>
</Project> </Project>