fix crashes when verifier is running
This commit is contained in:
parent
5f7bba4cbc
commit
4fc48d370f
61
qxldod.sln
61
qxldod.sln
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2013
|
||||||
|
VisualStudioVersion = 12.0.21005.1
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod", "qxldod\qxldod.vcxproj", "{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod", "qxldod\qxldod.vcxproj", "{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod Package", "qxldod Package\qxldod Package.vcxproj", "{B8C04B51-4207-491D-A7DD-C54861E8B528}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod Package", "qxldod Package\qxldod Package.vcxproj", "{B8C04B51-4207-491D-A7DD-C54861E8B528}"
|
||||||
@ -10,40 +11,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod Package", "qxldod Pa
|
|||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Win8.1 Debug|Win32 = Win8.1 Debug|Win32
|
|
||||||
Win8.1 Debug|x64 = Win8.1 Debug|x64
|
|
||||||
Win8.1 Release|Win32 = Win8.1 Release|Win32
|
|
||||||
Win8.1 Release|x64 = Win8.1 Release|x64
|
|
||||||
Win8 Debug|Win32 = Win8 Debug|Win32
|
Win8 Debug|Win32 = Win8 Debug|Win32
|
||||||
Win8 Debug|x64 = Win8 Debug|x64
|
Win8 Debug|x64 = Win8 Debug|x64
|
||||||
Win8 Release|Win32 = Win8 Release|Win32
|
Win8 Release|Win32 = Win8 Release|Win32
|
||||||
Win8 Release|x64 = Win8 Release|x64
|
Win8 Release|x64 = Win8 Release|x64
|
||||||
|
Win8.1 Debug|Win32 = Win8.1 Debug|Win32
|
||||||
|
Win8.1 Debug|x64 = Win8.1 Debug|x64
|
||||||
|
Win8.1 Release|Win32 = Win8.1 Release|Win32
|
||||||
|
Win8.1 Release|x64 = Win8.1 Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64
|
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64
|
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32
|
||||||
@ -56,6 +33,18 @@ Global
|
|||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.ActiveCfg = Win8 Release|x64
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.ActiveCfg = Win8 Release|x64
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.Build.0 = Win8 Release|x64
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.Build.0 = Win8 Release|x64
|
||||||
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.Deploy.0 = Win8 Release|x64
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.Deploy.0 = Win8 Release|x64
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64
|
||||||
|
{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32
|
||||||
@ -68,6 +57,18 @@ Global
|
|||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.ActiveCfg = Win8 Release|x64
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.ActiveCfg = Win8 Release|x64
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.Build.0 = Win8 Release|x64
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.Build.0 = Win8 Release|x64
|
||||||
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.Deploy.0 = Win8 Release|x64
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.Deploy.0 = Win8 Release|x64
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64
|
||||||
|
{B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,11 +136,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);
|
||||||
@ -401,9 +408,7 @@ 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;
|
||||||
|
|
||||||
@ -549,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,
|
||||||
@ -2426,7 +2431,23 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
|
|||||||
DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeCount %d\n", ModeCount));
|
DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeCount %d\n", ModeCount));
|
||||||
|
|
||||||
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)
|
||||||
@ -2992,7 +3013,23 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
|
|||||||
|
|
||||||
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;
|
||||||
@ -3423,32 +3460,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)
|
||||||
@ -3728,7 +3753,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);
|
||||||
@ -3770,18 +3795,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)
|
||||||
@ -3806,6 +3825,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__,
|
||||||
@ -3816,14 +3836,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
|
||||||
@ -3849,7 +3862,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));
|
||||||
@ -3870,16 +3883,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__));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4063,20 +4070,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__));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4086,20 +4087,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__));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4440,7 +4435,7 @@ NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
|
|||||||
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_FATAL, ("%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__));
|
||||||
@ -4458,7 +4453,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__));
|
||||||
}
|
}
|
||||||
@ -4488,7 +4483,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__));
|
||||||
|
@ -356,16 +356,34 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FORCEINLINE
|
||||||
|
ReleaseMutex(
|
||||||
|
PKMUTEX Mutex,
|
||||||
|
BOOLEAN locked)
|
||||||
|
{
|
||||||
|
if (locked)
|
||||||
|
{
|
||||||
|
KeReleaseMutex(Mutex, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define QXL_SLEEP(msec) do { \
|
#define QXL_SLEEP(msec) do { \
|
||||||
LARGE_INTEGER timeout; \
|
LARGE_INTEGER timeout; \
|
||||||
|
Loading…
Reference in New Issue
Block a user