diff --git a/idd/LGIdd/CIndirectDeviceContext.cpp b/idd/LGIdd/CIndirectDeviceContext.cpp index 30ed13cd..2628d622 100644 --- a/idd/LGIdd/CIndirectDeviceContext.cpp +++ b/idd/LGIdd/CIndirectDeviceContext.cpp @@ -46,7 +46,15 @@ void CIndirectDeviceContext::InitAdapter() return; IDDCX_ADAPTER_CAPS caps = {}; - caps.Size = sizeof(caps); + caps.Size = sizeof(caps); + + /** + * For some reason if we do not set this flag sometimes windows will + * refuse to enumerate our virtual monitor. Intel also noted in their + * sources that if this is not set dynamic resolution changes from this + * driver will not work. This behaviour is not documented by Microsoft. + */ + caps.Flags = IDDCX_ADAPTER_FLAGS_USE_SMALLEST_MODE; caps.MaxMonitorsSupported = 1; diff --git a/idd/LGIdd/CSwapChainProcessor.cpp b/idd/LGIdd/CSwapChainProcessor.cpp index 764499fd..45e72c8a 100644 --- a/idd/LGIdd/CSwapChainProcessor.cpp +++ b/idd/LGIdd/CSwapChainProcessor.cpp @@ -60,6 +60,20 @@ void CSwapChainProcessor::SwapChainThreadCore() return; } + if (IDD_IS_FUNCTION_AVAILABLE(IddCxSetRealtimeGPUPriority)) + { + DBGPRINT("Using IddCxSetRealtimeGPUPriority"); + IDARG_IN_SETREALTIMEGPUPRIORITY arg; + arg.pDevice = dxgiDevice.Get(); + if (FAILED(IddCxSetRealtimeGPUPriority(m_hSwapChain, &arg))) + DBGPRINT("Failed to set realtime GPU thread priority"); + } + else + { + DBGPRINT("Using SetGPUThreadPriority"); + dxgiDevice->SetGPUThreadPriority(7); + } + IDARG_IN_SWAPCHAINSETDEVICE setDevice = {}; setDevice.pDevice = dxgiDevice.Get(); @@ -69,7 +83,7 @@ void CSwapChainProcessor::SwapChainThreadCore() if (FAILED(hr)) { - DBGPRINT("IddCxSwapChainSetDevice Failed"); + DBGPRINT("IddCxSwapChainSetDevice Failed (%08x)", hr); return; } diff --git a/idd/LGIdd/CSwapChainProcessor.h b/idd/LGIdd/CSwapChainProcessor.h index 43359712..aebd2474 100644 --- a/idd/LGIdd/CSwapChainProcessor.h +++ b/idd/LGIdd/CSwapChainProcessor.h @@ -34,9 +34,9 @@ private: struct StagingTexture { - int width; - int height; - DXGI_FORMAT format; + int width = 0; + int height = 0; + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN; Microsoft::WRL::ComPtr tex; }; diff --git a/idd/LGIdd/Device.cpp b/idd/LGIdd/Device.cpp index d0ca822a..ffcbd99b 100644 --- a/idd/LGIdd/Device.cpp +++ b/idd/LGIdd/Device.cpp @@ -133,6 +133,16 @@ NTSTATUS LGIddMonitorUnassignSwapChain(IDDCX_MONITOR monitor) NTSTATUS LGIddCreateDevice(_Inout_ PWDFDEVICE_INIT deviceInit) { + NTSTATUS status; + IDARG_OUT_GETVERSION ver; + status = IddCxGetVersion(&ver); + if (FAILED(status)) + { + DBGPRINT("IddCxGetVersion Failed"); + return status; + } + DBGPRINT("Version: 0x%04x", ver.IddCxVersion); + WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); pnpPowerCallbacks.EvtDeviceD0Entry = LGIddDeviceD0Entry; @@ -148,7 +158,7 @@ NTSTATUS LGIddCreateDevice(_Inout_ PWDFDEVICE_INIT deviceInit) config.EvtIddCxMonitorAssignSwapChain = LGIddMonitorAssignSwapChain; config.EvtIddCxMonitorUnassignSwapChain = LGIddMonitorUnassignSwapChain; - NTSTATUS status = IddCxDeviceInitConfig(deviceInit, &config); + status = IddCxDeviceInitConfig(deviceInit, &config); if (!NT_SUCCESS(status)) return status; diff --git a/idd/LGIdd/LGIdd.vcxproj b/idd/LGIdd/LGIdd.vcxproj index a109d080..39488c11 100644 --- a/idd/LGIdd/LGIdd.vcxproj +++ b/idd/LGIdd/LGIdd.vcxproj @@ -72,7 +72,7 @@ Debug Win32 LGIdd - 10.0.19041.0 + 10.0.22621.0 WindowsUserModeDriver10.0 @@ -122,10 +122,10 @@ Spectre true 1 - 4 + 9 25 - - + 25 + <_NT_TARGET_VERSION>0xA000005 Windows10 @@ -134,10 +134,10 @@ Spectre true 1 - 4 + 9 25 - - + 25 + <_NT_TARGET_VERSION>0xA000005 Windows10 @@ -145,11 +145,11 @@ 2 true 1 - 4 + 9 Spectre 25 - - + 25 + <_NT_TARGET_VERSION>0xA000005 Windows10 @@ -157,11 +157,11 @@ 2 true 1 - 4 + 9 Spectre 25 - - + 25 + <_NT_TARGET_VERSION>0xA000005 Windows10 @@ -223,48 +223,60 @@ true true trace.h - /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) + /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) $(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies);OneCoreUAP.lib;avrt.lib + + SHA1 + true true trace.h - /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) + /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) $(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies);OneCoreUAP.lib;avrt.lib + + SHA1 + true true trace.h - /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) + /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) $(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies);OneCoreUAP.lib;avrt.lib + + SHA1 + true true trace.h - /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) + /EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions) $(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories) %(AdditionalDependencies);OneCoreUAP.lib;avrt.lib + + SHA1 + diff --git a/repos/LGMP b/repos/LGMP index 19d6aaf0..5d352857 160000 --- a/repos/LGMP +++ b/repos/LGMP @@ -1 +1 @@ -Subproject commit 19d6aaf08bc4b3416732981067b2c0172f9da300 +Subproject commit 5d352857fc4aa1c758475c6e1aa460d74491d207