Skip to content

Commit fface5e

Browse files
committed
Working driver!
1 parent 8ca800d commit fface5e

File tree

9 files changed

+137
-10
lines changed

9 files changed

+137
-10
lines changed

CppProperties.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"configurations": [
3+
{
4+
"inheritEnvironments": [
5+
"msvc_x64"
6+
],
7+
"name": "x64-Debug",
8+
"includePath": [
9+
"${env.INCLUDE}",
10+
"${workspaceRoot}\\**"
11+
],
12+
"defines": [
13+
"WIN32",
14+
"_DEBUG",
15+
"UNICODE",
16+
"_UNICODE"
17+
],
18+
"intelliSenseMode": "windows-msvc-x64"
19+
}
20+
]
21+
}

IddSampleDriver.sln

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31129.286
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IddSampleDriver", "IddSampleDriver\IddSampleDriver.vcxproj", "{2D54CB75-8B17-4F11-97DC-847B0244CD46}"
77
EndProject
@@ -17,9 +17,9 @@ Global
1717
Release|x86 = Release|x86
1818
EndGlobalSection
1919
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20-
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.ActiveCfg = Debug|ARM
21-
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Build.0 = Debug|ARM
22-
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Deploy.0 = Debug|ARM
20+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.ActiveCfg = Debug|x64
21+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Build.0 = Debug|x64
22+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Deploy.0 = Debug|x64
2323
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.ActiveCfg = Debug|ARM64
2424
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Build.0 = Debug|ARM64
2525
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Deploy.0 = Debug|ARM64
@@ -45,4 +45,7 @@ Global
4545
GlobalSection(SolutionProperties) = preSolution
4646
HideSolutionNode = FALSE
4747
EndGlobalSection
48+
GlobalSection(ExtensibilityGlobals) = postSolution
49+
SolutionGuid = {DE75497E-BE4F-4215-8345-84C5F8358E3B}
50+
EndGlobalSection
4851
EndGlobal

IddSampleDriver/Driver.cpp

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,37 @@ const DISPLAYCONFIG_VIDEO_SIGNAL_INFO IndirectDeviceContext::s_KnownMonitorModes
375375
{ { 255, 0 } }, // video standard and vsync divider
376376
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
377377
},
378+
// 800 x 600 @ 60Hz
379+
{
380+
40 * MHZ, // pixel clock rate [Hz]
381+
{ 40 * MHZ, 800 + 256 }, // fractional horizontal refresh rate [Hz]
382+
{ 40 * MHZ, (800 + 256) * (600 + 28) }, // fractional vertical refresh rate [Hz]
383+
{ 1920, 1280 }, // (horizontal, vertical) active pixel resolution
384+
{ 1920 + 256, 1280 + 28 }, // (horizontal, vertical) total pixel resolution
385+
{ { 255, 0 }}, // video standard and vsync divider
386+
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
387+
},
378388
};
379389

380390
// This is a sample monitor EDID - FOR SAMPLE PURPOSES ONLY
381391
const BYTE IndirectDeviceContext::s_KnownMonitorEdid[] =
382392
{
383-
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x79,0x5E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x01,0x03,0x80,0x28,
393+
/* 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x79,0x5E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x01,0x03,0x80,0x28,
384394
0x1E,0x78,0x0A,0xEE,0x91,0xA3,0x54,0x4C,0x99,0x26,0x0F,0x50,0x54,0x20,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,
385395
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xA0,0x0F,0x20,0x00,0x31,0x58,0x1C,0x20,0x28,0x80,0x14,0x00,
386396
0x90,0x2C,0x11,0x00,0x00,0x1E,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
387397
0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
388-
0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E
398+
0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E */
399+
400+
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x31, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401+
0x05, 0x16, 0x01, 0x03, 0x6D, 0x32, 0x1C, 0x78, 0xEA, 0x5E, 0xC0, 0xA4, 0x59, 0x4A, 0x98, 0x25,
402+
0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0xD1, 0xC0, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
403+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C,
404+
0x45, 0x00, 0xF4, 0x19, 0x11, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x4C, 0x69, 0x6E,
405+
0x75, 0x78, 0x20, 0x23, 0x30, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x3B,
406+
0x3D, 0x42, 0x44, 0x0F, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC,
407+
0x00, 0x4C, 0x69, 0x6E, 0x75, 0x78, 0x20, 0x46, 0x48, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x00, 0x05
408+
389409
};
390410

391411
IndirectDeviceContext::IndirectDeviceContext(_In_ WDFDEVICE WdfDevice) :
@@ -398,6 +418,8 @@ IndirectDeviceContext::~IndirectDeviceContext()
398418
m_ProcessingThread.reset();
399419
}
400420

421+
#define NUM_VIRTUAL_DISPLAYS 5
422+
401423
void IndirectDeviceContext::InitAdapter()
402424
{
403425
// ==============================
@@ -411,7 +433,7 @@ void IndirectDeviceContext::InitAdapter()
411433
AdapterCaps.Size = sizeof(AdapterCaps);
412434

413435
// Declare basic feature support for the adapter (required)
414-
AdapterCaps.MaxMonitorsSupported = 1;
436+
AdapterCaps.MaxMonitorsSupported = NUM_VIRTUAL_DISPLAYS;
415437
AdapterCaps.EndPointDiagnostics.Size = sizeof(AdapterCaps.EndPointDiagnostics);
416438
AdapterCaps.EndPointDiagnostics.GammaSupport = IDDCX_FEATURE_IMPLEMENTATION_NONE;
417439
AdapterCaps.EndPointDiagnostics.TransmissionType = IDDCX_TRANSMISSION_TYPE_WIRED_OTHER;
@@ -454,6 +476,12 @@ void IndirectDeviceContext::InitAdapter()
454476

455477
void IndirectDeviceContext::FinishInit()
456478
{
479+
for (unsigned int i = 0; i < NUM_VIRTUAL_DISPLAYS; i++) {
480+
CreateMonitor(i);
481+
}
482+
}
483+
484+
void IndirectDeviceContext::CreateMonitor(unsigned int index) {
457485
// ==============================
458486
// TODO: In a real driver, the EDID should be retrieved dynamically from a connected physical monitor. The EDID
459487
// provided here is purely for demonstration, as it describes only 640x480 @ 60 Hz and 800x600 @ 60 Hz. Monitor
@@ -468,7 +496,7 @@ void IndirectDeviceContext::FinishInit()
468496
IDDCX_MONITOR_INFO MonitorInfo = {};
469497
MonitorInfo.Size = sizeof(MonitorInfo);
470498
MonitorInfo.MonitorType = DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI;
471-
MonitorInfo.ConnectorIndex = 0;
499+
MonitorInfo.ConnectorIndex = index;
472500
MonitorInfo.MonitorDescription.Size = sizeof(MonitorInfo.MonitorDescription);
473501
MonitorInfo.MonitorDescription.Type = IDDCX_MONITOR_DESCRIPTION_TYPE_EDID;
474502
MonitorInfo.MonitorDescription.DataSize = sizeof(s_KnownMonitorEdid);

IddSampleDriver/Driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ namespace Microsoft
8484
void InitAdapter();
8585
void FinishInit();
8686

87+
void CreateMonitor(unsigned int index);
88+
8789
void AssignSwapChain(IDDCX_SWAPCHAIN SwapChain, LUID RenderAdapter, HANDLE NewFrameEvent);
8890
void UnassignSwapChain();
8991

@@ -92,6 +94,7 @@ namespace Microsoft
9294
WDFDEVICE m_WdfDevice;
9395
IDDCX_ADAPTER m_Adapter;
9496
IDDCX_MONITOR m_Monitor;
97+
IDDCX_MONITOR m_Monitor2;
9598

9699
std::unique_ptr<SwapChainProcessor> m_ProcessingThread;
97100

30 Bytes
Binary file not shown.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31129.286
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IddSampleDriver", "IddSampleDriver.vcxproj", "{2D54CB75-8B17-4F11-97DC-847B0244CD46}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|ARM = Debug|ARM
11+
Debug|ARM64 = Debug|ARM64
12+
Debug|x64 = Debug|x64
13+
Debug|x86 = Debug|x86
14+
Release|ARM = Release|ARM
15+
Release|ARM64 = Release|ARM64
16+
Release|x64 = Release|x64
17+
Release|x86 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.ActiveCfg = Debug|ARM
21+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Build.0 = Debug|ARM
22+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Deploy.0 = Debug|ARM
23+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.ActiveCfg = Debug|ARM64
24+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Build.0 = Debug|ARM64
25+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Deploy.0 = Debug|ARM64
26+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x64.ActiveCfg = Debug|x64
27+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x64.Build.0 = Debug|x64
28+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x64.Deploy.0 = Debug|x64
29+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x86.ActiveCfg = Debug|Win32
30+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x86.Build.0 = Debug|Win32
31+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x86.Deploy.0 = Debug|Win32
32+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM.ActiveCfg = Release|ARM
33+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM.Build.0 = Release|ARM
34+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM.Deploy.0 = Release|ARM
35+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM64.ActiveCfg = Release|ARM64
36+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM64.Build.0 = Release|ARM64
37+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM64.Deploy.0 = Release|ARM64
38+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x64.ActiveCfg = Release|x64
39+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x64.Build.0 = Release|x64
40+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x64.Deploy.0 = Release|x64
41+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x86.ActiveCfg = Release|Win32
42+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x86.Build.0 = Release|Win32
43+
{2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x86.Deploy.0 = Release|Win32
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
GlobalSection(ExtensibilityGlobals) = postSolution
49+
SolutionGuid = {9A8BE7D9-9F0F-40A2-BA2D-8AE9E35890DB}
50+
EndGlobalSection
51+
EndGlobal

IddSampleDriver/IddSampleDriver.vcxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
55
<Configuration>Debug</Configuration>
@@ -117,6 +117,7 @@
117117
<IndirectDisplayDriver>true</IndirectDisplayDriver>
118118
<IDDCX_VERSION_MAJOR>1</IDDCX_VERSION_MAJOR>
119119
<IDDCX_VERSION_MINOR>0</IDDCX_VERSION_MINOR>
120+
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
120121
</PropertyGroup>
121122
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
122123
<TargetVersion>Windows10</TargetVersion>
@@ -296,6 +297,9 @@
296297
<ItemGroup>
297298
<FilesToPackage Include="$(TargetPath)" />
298299
</ItemGroup>
300+
<ItemGroup>
301+
<None Include="readme.md" />
302+
</ItemGroup>
299303
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
300304
<ImportGroup Label="ExtensionTargets">
301305
</ImportGroup>

IddSampleDriver/IddSampleDriver.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@
3636
<Filter>Source Files</Filter>
3737
</ClCompile>
3838
</ItemGroup>
39+
<ItemGroup>
40+
<None Include="readme.md" />
41+
</ItemGroup>
3942
</Project>

IddSampleDriver/readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Get 5 virtual monitors for the price of zero!
2+
3+
# Steps (for experienced pros only!!!)
4+
1. Download the latest release as a zip file.
5+
6+
2. As an administrator, Run the *.bat file to add the driver certificate as a trusted root certificate.
7+
8+
3. Don't install the inf. Open device manager, click on any device, then click on the "Action" menu and click "Add Legacy Hardware"
9+
10+
4. Select "Add hardware from a list (Advanced)" and then select Display adapters
11+
12+
5. Click "Have Disk..." and click the "Browse..." button. Navigate to the extracted files and select the inf file.
13+
14+
6. You are done! Go to display settings to customize the resolution of the additional displays. These displays show up in Oculus and should be able to be streamed from.

0 commit comments

Comments
 (0)