read vga and cursor registry parameters

This commit is contained in:
Vadim Rozenfeld 2014-09-07 21:12:24 +10:00
parent 5c52e50bf8
commit c2872462a8
4 changed files with 63 additions and 7 deletions

View File

@ -98,7 +98,8 @@ 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;
} }
@ -391,16 +392,18 @@ 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()) { if (m_pHWDevice->EnablePointer() && m_PointerCaps) {
pDriverCaps->MaxPointerWidth = POINTER_SIZE; pDriverCaps->MaxPointerWidth = POINTER_SIZE;
pDriverCaps->MaxPointerHeight = POINTER_SIZE; pDriverCaps->MaxPointerHeight = POINTER_SIZE;
pDriverCaps->PointerCaps.Monochrome = 1; pDriverCaps->PointerCaps.Monochrome = m_PointerCaps & 0x00000001;
pDriverCaps->PointerCaps.Color = 1; pDriverCaps->PointerCaps.Color = m_PointerCaps & 0x00000002;
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;
@ -1870,6 +1873,56 @@ NTSTATUS QxlDod::RegisterHWInfo()
return Status; return Status;
} }
NTSTATUS QxlDod::ReadConfiguration()
{
PAGED_CODE();
NTSTATUS Status;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
HANDLE DevInstRegKeyHandle;
Status = IoOpenDeviceRegistryKey(m_pPhysicalDevice, PLUGPLAY_REGKEY_DRIVER, KEY_SET_VALUE, &DevInstRegKeyHandle);
if (!NT_SUCCESS(Status))
{
DbgPrint(TRACE_LEVEL_ERROR, ("IoOpenDeviceRegistryKey failed for PDO: 0x%I64x, Status: 0x%I64x", m_pPhysicalDevice, Status));
return Status;
}
UNICODE_STRING ValueName;
UCHAR Buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION)+sizeof(ULONG)];
PKEY_VALUE_PARTIAL_INFORMATION Value = (PKEY_VALUE_PARTIAL_INFORMATION)Buffer;
ULONG ValueLength = sizeof(Buffer);
ULONG ResultLength;
ULONG Length;
RtlInitUnicodeString(&ValueName, L"VgaCompatible");
Status = ZwQueryValueKey(DevInstRegKeyHandle,
&ValueName,
KeyValuePartialInformation,
Value,
ValueLength,
&ResultLength);
if (NT_SUCCESS(Status)) {
m_VgaCompatible = *(PULONG)(Value->Data);
}
RtlInitUnicodeString(&ValueName, L"PointerCaps");
Status = ZwQueryValueKey(DevInstRegKeyHandle,
&ValueName,
KeyValuePartialInformation,
Value,
ValueLength,
&ResultLength);
if (NT_SUCCESS(Status)) {
m_PointerCaps = *(PULONG)(Value->Data);
}
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return Status;
}
// //
// Non-Paged Code // Non-Paged Code

View File

@ -417,7 +417,7 @@ public:
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 FALSE; } BOOLEAN EnablePointer(void) { return TRUE; }
NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE* DstAddr, NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE* DstAddr,
_In_ UINT DstBitPerPixel, _In_ UINT DstBitPerPixel,
_In_ BYTE* SrcAddr, _In_ BYTE* SrcAddr,
@ -561,6 +561,8 @@ private:
D3DDDI_VIDEO_PRESENT_SOURCE_ID m_SystemDisplaySourceId; D3DDDI_VIDEO_PRESENT_SOURCE_ID m_SystemDisplaySourceId;
DXGKARG_SETPOINTERSHAPE m_PointerShape; DXGKARG_SETPOINTERSHAPE m_PointerShape;
HwDeviceIntrface* m_pHWDevice; HwDeviceIntrface* m_pHWDevice;
DWORD m_VgaCompatible;
DWORD m_PointerCaps;
public: public:
QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject); QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject);
~QxlDod(void); ~QxlDod(void);
@ -679,6 +681,7 @@ private:
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();
NTSTATUS ReadConfiguration();
}; };
NTSTATUS NTSTATUS

View File

@ -28,7 +28,7 @@ DriverEntry(
// Initialize DDI function pointers and dxgkrnl // Initialize DDI function pointers and dxgkrnl
KMDDOD_INITIALIZATION_DATA InitialData = {0}; KMDDOD_INITIALIZATION_DATA InitialData = {0};
InitialData.Version = DXGKDDI_INTERFACE_VERSION; InitialData.Version = DXGKDDI_INTERFACE_VERSION;
InitialData.DxgkDdiAddDevice = DodAddDevice; InitialData.DxgkDdiAddDevice = DodAddDevice;
InitialData.DxgkDdiStartDevice = DodStartDevice; InitialData.DxgkDdiStartDevice = DodStartDevice;

Binary file not shown.