[idd] updated to a VS2022 project with Windows 10 support

This commit is contained in:
Geoffrey McRae 2023-04-14 12:08:23 +10:00
parent 0c3dce3ca6
commit 0c176acf94
6 changed files with 68 additions and 24 deletions

View File

@ -48,6 +48,14 @@ void CIndirectDeviceContext::InitAdapter()
IDDCX_ADAPTER_CAPS caps = {}; 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; caps.MaxMonitorsSupported = 1;
caps.EndPointDiagnostics.Size = sizeof(caps.EndPointDiagnostics); caps.EndPointDiagnostics.Size = sizeof(caps.EndPointDiagnostics);

View File

@ -60,6 +60,20 @@ void CSwapChainProcessor::SwapChainThreadCore()
return; 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 = {}; IDARG_IN_SWAPCHAINSETDEVICE setDevice = {};
setDevice.pDevice = dxgiDevice.Get(); setDevice.pDevice = dxgiDevice.Get();
@ -69,7 +83,7 @@ void CSwapChainProcessor::SwapChainThreadCore()
if (FAILED(hr)) if (FAILED(hr))
{ {
DBGPRINT("IddCxSwapChainSetDevice Failed"); DBGPRINT("IddCxSwapChainSetDevice Failed (%08x)", hr);
return; return;
} }

View File

@ -34,9 +34,9 @@ private:
struct StagingTexture struct StagingTexture
{ {
int width; int width = 0;
int height; int height = 0;
DXGI_FORMAT format; DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
Microsoft::WRL::ComPtr<ID3D11Texture2D> tex; Microsoft::WRL::ComPtr<ID3D11Texture2D> tex;
}; };

View File

@ -133,6 +133,16 @@ NTSTATUS LGIddMonitorUnassignSwapChain(IDDCX_MONITOR monitor)
NTSTATUS LGIddCreateDevice(_Inout_ PWDFDEVICE_INIT deviceInit) 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 pnpPowerCallbacks;
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
pnpPowerCallbacks.EvtDeviceD0Entry = LGIddDeviceD0Entry; pnpPowerCallbacks.EvtDeviceD0Entry = LGIddDeviceD0Entry;
@ -148,7 +158,7 @@ NTSTATUS LGIddCreateDevice(_Inout_ PWDFDEVICE_INIT deviceInit)
config.EvtIddCxMonitorAssignSwapChain = LGIddMonitorAssignSwapChain; config.EvtIddCxMonitorAssignSwapChain = LGIddMonitorAssignSwapChain;
config.EvtIddCxMonitorUnassignSwapChain = LGIddMonitorUnassignSwapChain; config.EvtIddCxMonitorUnassignSwapChain = LGIddMonitorUnassignSwapChain;
NTSTATUS status = IddCxDeviceInitConfig(deviceInit, &config); status = IddCxDeviceInitConfig(deviceInit, &config);
if (!NT_SUCCESS(status)) if (!NT_SUCCESS(status))
return status; return status;

View File

@ -72,7 +72,7 @@
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">Win32</Platform> <Platform Condition="'$(Platform)' == ''">Win32</Platform>
<RootNamespace>LGIdd</RootNamespace> <RootNamespace>LGIdd</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
@ -122,10 +122,10 @@
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation> <Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
<IndirectDisplayDriver>true</IndirectDisplayDriver> <IndirectDisplayDriver>true</IndirectDisplayDriver>
<IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR> <IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR>
<IDDCX_VERSION_MINOR>4</IDDCX_VERSION_MINOR> <IDDCX_VERSION_MINOR>9</IDDCX_VERSION_MINOR>
<UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR> <UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR>
<UMDF_MINIMUM_VERSION_REQUIRED> <UMDF_MINIMUM_VERSION_REQUIRED>25</UMDF_MINIMUM_VERSION_REQUIRED>
</UMDF_MINIMUM_VERSION_REQUIRED> <_NT_TARGET_VERSION>0xA000005</_NT_TARGET_VERSION>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion> <TargetVersion>Windows10</TargetVersion>
@ -134,10 +134,10 @@
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation> <Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
<IndirectDisplayDriver>true</IndirectDisplayDriver> <IndirectDisplayDriver>true</IndirectDisplayDriver>
<IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR> <IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR>
<IDDCX_VERSION_MINOR>4</IDDCX_VERSION_MINOR> <IDDCX_VERSION_MINOR>9</IDDCX_VERSION_MINOR>
<UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR> <UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR>
<UMDF_MINIMUM_VERSION_REQUIRED> <UMDF_MINIMUM_VERSION_REQUIRED>25</UMDF_MINIMUM_VERSION_REQUIRED>
</UMDF_MINIMUM_VERSION_REQUIRED> <_NT_TARGET_VERSION>0xA000005</_NT_TARGET_VERSION>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion> <TargetVersion>Windows10</TargetVersion>
@ -145,11 +145,11 @@
<UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR>
<IndirectDisplayDriver>true</IndirectDisplayDriver> <IndirectDisplayDriver>true</IndirectDisplayDriver>
<IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR> <IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR>
<IDDCX_VERSION_MINOR>4</IDDCX_VERSION_MINOR> <IDDCX_VERSION_MINOR>9</IDDCX_VERSION_MINOR>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation> <Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
<UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR> <UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR>
<UMDF_MINIMUM_VERSION_REQUIRED> <UMDF_MINIMUM_VERSION_REQUIRED>25</UMDF_MINIMUM_VERSION_REQUIRED>
</UMDF_MINIMUM_VERSION_REQUIRED> <_NT_TARGET_VERSION>0xA000005</_NT_TARGET_VERSION>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion> <TargetVersion>Windows10</TargetVersion>
@ -157,11 +157,11 @@
<UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR>
<IndirectDisplayDriver>true</IndirectDisplayDriver> <IndirectDisplayDriver>true</IndirectDisplayDriver>
<IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR> <IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR>
<IDDCX_VERSION_MINOR>4</IDDCX_VERSION_MINOR> <IDDCX_VERSION_MINOR>9</IDDCX_VERSION_MINOR>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation> <Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
<UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR> <UMDF_VERSION_MINOR>25</UMDF_VERSION_MINOR>
<UMDF_MINIMUM_VERSION_REQUIRED> <UMDF_MINIMUM_VERSION_REQUIRED>25</UMDF_MINIMUM_VERSION_REQUIRED>
</UMDF_MINIMUM_VERSION_REQUIRED> <_NT_TARGET_VERSION>0xA000005</_NT_TARGET_VERSION>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion> <TargetVersion>Windows10</TargetVersion>
@ -223,48 +223,60 @@
<WppEnabled>true</WppEnabled> <WppEnabled>true</WppEnabled>
<WppRecorderEnabled>true</WppRecorderEnabled> <WppRecorderEnabled>true</WppRecorderEnabled>
<WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData> <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies>
</Link> </Link>
<DriverSign>
<FileDigestAlgorithm>SHA1</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WppEnabled>true</WppEnabled> <WppEnabled>true</WppEnabled>
<WppRecorderEnabled>true</WppRecorderEnabled> <WppRecorderEnabled>true</WppRecorderEnabled>
<WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData> <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies>
</Link> </Link>
<DriverSign>
<FileDigestAlgorithm>SHA1</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<WppEnabled>true</WppEnabled> <WppEnabled>true</WppEnabled>
<WppRecorderEnabled>true</WppRecorderEnabled> <WppRecorderEnabled>true</WppRecorderEnabled>
<WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData> <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies>
</Link> </Link>
<DriverSign>
<FileDigestAlgorithm>SHA1</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WppEnabled>true</WppEnabled> <WppEnabled>true</WppEnabled>
<WppRecorderEnabled>true</WppRecorderEnabled> <WppRecorderEnabled>true</WppRecorderEnabled>
<WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData> <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=4 /IDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/EHsc /D_ATL_NO_WIN_SUPPORT /DIDDCX_VERSION_MAJOR=1 /DIDDCX_VERSION_MINOR=9 /DIDDCX_MINIMUM_VERSION_REQUIRED=4 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\repos\LGMP\lgmp\include;$(ProjectDir)..\..\vendor;$(ProjectDir)..\..\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);OneCoreUAP.lib;avrt.lib</AdditionalDependencies>
</Link> </Link>
<DriverSign>
<FileDigestAlgorithm>SHA1</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile> <ClCompile>

@ -1 +1 @@
Subproject commit 19d6aaf08bc4b3416732981067b2c0172f9da300 Subproject commit 5d352857fc4aa1c758475c6e1aa460d74491d207