publish qxl device id

This commit is contained in:
Vadim Rozenfeld 2014-12-06 09:20:04 +11:00
parent 8ffc5298ad
commit 2885958174
2 changed files with 35 additions and 15 deletions

View File

@ -132,14 +132,6 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
return Status; return Status;
} }
Status = RegisterHWInfo();
if (!NT_SUCCESS(Status))
{
QXL_LOG_ASSERTION1("RegisterHWInfo failed with status 0x%X\n",
Status);
return Status;
}
// This sample driver only uses the frame buffer of the POST device. DxgkCbAcquirePostDisplayOwnership // This sample driver only uses the frame buffer of the POST device. DxgkCbAcquirePostDisplayOwnership
// gives you the frame buffer address and ensures that no one else is drawing to it. Be sure to give it back! // gives you the frame buffer address and ensures that no one else is drawing to it. Be sure to give it back!
Status = m_DxgkInterface.DxgkCbAcquirePostDisplayOwnership(m_DxgkInterface.DeviceHandle, &(m_CurrentModes[0].DispInfo)); Status = m_DxgkInterface.DxgkCbAcquirePostDisplayOwnership(m_DxgkInterface.DeviceHandle, &(m_CurrentModes[0].DispInfo));
@ -169,6 +161,14 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
return Status; return Status;
} }
Status = RegisterHWInfo(m_pHWDevice->GetId());
if (!NT_SUCCESS(Status))
{
QXL_LOG_ASSERTION1("RegisterHWInfo failed with status 0x%X\n",
Status);
return Status;
}
*pNumberOfViews = MAX_VIEWS; *pNumberOfViews = MAX_VIEWS;
*pNumberOfChildren = MAX_CHILDREN; *pNumberOfChildren = MAX_CHILDREN;
m_Flags.DriverStarted = TRUE; m_Flags.DriverStarted = TRUE;
@ -1805,7 +1805,7 @@ NTSTATUS QxlDod::WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR psz
return Status; return Status;
} }
NTSTATUS QxlDod::RegisterHWInfo() NTSTATUS QxlDod::RegisterHWInfo(ULONG Id)
{ {
PAGED_CODE(); PAGED_CODE();
@ -1866,6 +1866,21 @@ NTSTATUS QxlDod::RegisterHWInfo()
return Status; return Status;
} }
UNICODE_STRING ValueQxlDeviceID;
RtlInitUnicodeString(&ValueQxlDeviceID, L"QxlDeviceID");
DWORD DeviceId = Id; // BDD has no access to video memory
Status = ZwSetValueKey(DevInstRegKeyHandle,
&ValueQxlDeviceID,
0,
REG_BINARY,
&DeviceId,
sizeof(DeviceId));
if (!NT_SUCCESS(Status))
{
DbgPrint(TRACE_LEVEL_ERROR, ("ZwSetValueKey for MemorySize failed with Status: 0x%X\n", Status));
return Status;
}
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return Status; return Status;
} }
@ -2246,6 +2261,7 @@ VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
m_ModeCount = 0; m_ModeCount = 0;
m_ModeNumbers = NULL; m_ModeNumbers = NULL;
m_CurrentMode = 0; m_CurrentMode = 0;
m_Id = 0;
} }
VgaDevice::~VgaDevice(void) VgaDevice::~VgaDevice(void)
@ -2256,6 +2272,7 @@ VgaDevice::~VgaDevice(void)
m_ModeNumbers = NULL; m_ModeNumbers = NULL;
m_CurrentMode = 0; m_CurrentMode = 0;
m_ModeCount = 0; m_ModeCount = 0;
m_Id = 0;
} }
BOOL VgaDevice::SetVideoModeInfo(UINT Idx, PVBE_MODEINFO pModeInfo) BOOL VgaDevice::SetVideoModeInfo(UINT Idx, PVBE_MODEINFO pModeInfo)
@ -3000,7 +3017,7 @@ NTSTATUS QxlDevice::SetPowerState(_In_ DEVICE_POWER_STATE DevicePowerState, DXGK
switch (DevicePowerState) switch (DevicePowerState)
{ {
case PowerDeviceUnspecified: case PowerDeviceUnspecified:
case PowerDeviceD0: QxlInit(pDispInfo); break; case PowerDeviceD0: QxlInit(pDispInfo); break;
case PowerDeviceD1: case PowerDeviceD1:
case PowerDeviceD2: case PowerDeviceD2:
case PowerDeviceD3: QxlClose(); break; case PowerDeviceD3: QxlClose(); break;
@ -3141,6 +3158,7 @@ NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
m_LogBuf = m_RamHdr->log_buf; m_LogBuf = m_RamHdr->log_buf;
m_LogPort = m_IoBase + QXL_IO_LOG; m_LogPort = m_IoBase + QXL_IO_LOG;
m_Id = m_RomHdr->id;
CreateEvents(); CreateEvents();
@ -3152,11 +3170,11 @@ NTSTATUS QxlDevice::QxlInit(DXGK_DISPLAY_INFORMATION* pDispInfo)
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
if (!InitMemSlots()) { if (!InitMemSlots()) {
DestroyMemSlots(); DestroyMemSlots();
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
Status = GetModeList(pDispInfo); Status = GetModeList(pDispInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint(TRACE_LEVEL_ERROR, ("GetModeList failed with status 0x%X\n", DbgPrint(TRACE_LEVEL_ERROR, ("GetModeList failed with status 0x%X\n",

View File

@ -242,6 +242,7 @@ public:
virtual VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod) = 0; virtual VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod) = 0;
virtual NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape) = 0; virtual NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape) = 0;
virtual NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition) = 0; virtual NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition) = 0;
ULONG GetId(void) { return m_Id; }
protected: protected:
virtual NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) = 0; virtual NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
protected: protected:
@ -250,6 +251,7 @@ protected:
ULONG m_ModeCount; ULONG m_ModeCount;
PUSHORT m_ModeNumbers; PUSHORT m_ModeNumbers;
USHORT m_CurrentMode; USHORT m_CurrentMode;
ULONG m_Id;
}; };
class VgaDevice : class VgaDevice :
@ -678,7 +680,7 @@ private:
D3DDDI_VIDEO_PRESENT_SOURCE_ID FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero); D3DDDI_VIDEO_PRESENT_SOURCE_ID FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero);
NTSTATUS IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const; NTSTATUS IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const;
NTSTATUS IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const; NTSTATUS IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const;
NTSTATUS RegisterHWInfo(); NTSTATUS RegisterHWInfo(_In_ ULONG Id);
}; };
NTSTATUS NTSTATUS