diff --git a/CppProperties.json b/CppProperties.json new file mode 100644 index 0000000..f598ba5 --- /dev/null +++ b/CppProperties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "inheritEnvironments": [ + "msvc_x64" + ], + "name": "x64-Debug", + "includePath": [ + "${env.INCLUDE}", + "${workspaceRoot}\\**" + ], + "defines": [ + "WIN32", + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "intelliSenseMode": "windows-msvc-x64" + } + ] +} \ No newline at end of file diff --git a/IddSampleDriver.sln b/IddSampleDriver.sln index 242fb33..fb121d5 100644 --- a/IddSampleDriver.sln +++ b/IddSampleDriver.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IddSampleDriver", "IddSampleDriver\IddSampleDriver.vcxproj", "{2D54CB75-8B17-4F11-97DC-847B0244CD46}" EndProject @@ -17,9 +17,9 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.ActiveCfg = Debug|ARM - {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Build.0 = Debug|ARM - {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Deploy.0 = Debug|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.ActiveCfg = Debug|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Build.0 = Debug|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Deploy.0 = Debug|x64 {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.ActiveCfg = Debug|ARM64 {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Build.0 = Debug|ARM64 {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Deploy.0 = Debug|ARM64 @@ -45,4 +45,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DE75497E-BE4F-4215-8345-84C5F8358E3B} + EndGlobalSection EndGlobal diff --git a/IddSampleDriver/Driver.cpp b/IddSampleDriver/Driver.cpp index fe7c4ad..830e394 100644 --- a/IddSampleDriver/Driver.cpp +++ b/IddSampleDriver/Driver.cpp @@ -375,17 +375,37 @@ const DISPLAYCONFIG_VIDEO_SIGNAL_INFO IndirectDeviceContext::s_KnownMonitorModes { { 255, 0 } }, // video standard and vsync divider DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE }, + // 800 x 600 @ 60Hz +{ + 40 * MHZ, // pixel clock rate [Hz] + { 40 * MHZ, 800 + 256 }, // fractional horizontal refresh rate [Hz] + { 40 * MHZ, (800 + 256) * (600 + 28) }, // fractional vertical refresh rate [Hz] + { 1920, 1280 }, // (horizontal, vertical) active pixel resolution + { 1920 + 256, 1280 + 28 }, // (horizontal, vertical) total pixel resolution + { { 255, 0 }}, // video standard and vsync divider + DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE +}, }; // This is a sample monitor EDID - FOR SAMPLE PURPOSES ONLY const BYTE IndirectDeviceContext::s_KnownMonitorEdid[] = { - 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x79,0x5E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x01,0x03,0x80,0x28, + /* 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x79,0x5E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA6,0x01,0x03,0x80,0x28, 0x1E,0x78,0x0A,0xEE,0x91,0xA3,0x54,0x4C,0x99,0x26,0x0F,0x50,0x54,0x20,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xA0,0x0F,0x20,0x00,0x31,0x58,0x1C,0x20,0x28,0x80,0x14,0x00, 0x90,0x2C,0x11,0x00,0x00,0x1E,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E + 0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E */ + + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x31, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x16, 0x01, 0x03, 0x6D, 0x32, 0x1C, 0x78, 0xEA, 0x5E, 0xC0, 0xA4, 0x59, 0x4A, 0x98, 0x25, + 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0xD1, 0xC0, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, + 0x45, 0x00, 0xF4, 0x19, 0x11, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x4C, 0x69, 0x6E, + 0x75, 0x78, 0x20, 0x23, 0x30, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x3B, + 0x3D, 0x42, 0x44, 0x0F, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, + 0x00, 0x4C, 0x69, 0x6E, 0x75, 0x78, 0x20, 0x46, 0x48, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x00, 0x05 + }; IndirectDeviceContext::IndirectDeviceContext(_In_ WDFDEVICE WdfDevice) : @@ -398,6 +418,8 @@ IndirectDeviceContext::~IndirectDeviceContext() m_ProcessingThread.reset(); } +#define NUM_VIRTUAL_DISPLAYS 5 + void IndirectDeviceContext::InitAdapter() { // ============================== @@ -411,7 +433,7 @@ void IndirectDeviceContext::InitAdapter() AdapterCaps.Size = sizeof(AdapterCaps); // Declare basic feature support for the adapter (required) - AdapterCaps.MaxMonitorsSupported = 1; + AdapterCaps.MaxMonitorsSupported = NUM_VIRTUAL_DISPLAYS; AdapterCaps.EndPointDiagnostics.Size = sizeof(AdapterCaps.EndPointDiagnostics); AdapterCaps.EndPointDiagnostics.GammaSupport = IDDCX_FEATURE_IMPLEMENTATION_NONE; AdapterCaps.EndPointDiagnostics.TransmissionType = IDDCX_TRANSMISSION_TYPE_WIRED_OTHER; @@ -454,6 +476,12 @@ void IndirectDeviceContext::InitAdapter() void IndirectDeviceContext::FinishInit() { + for (unsigned int i = 0; i < NUM_VIRTUAL_DISPLAYS; i++) { + CreateMonitor(i); + } +} + +void IndirectDeviceContext::CreateMonitor(unsigned int index) { // ============================== // TODO: In a real driver, the EDID should be retrieved dynamically from a connected physical monitor. The EDID // 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() IDDCX_MONITOR_INFO MonitorInfo = {}; MonitorInfo.Size = sizeof(MonitorInfo); MonitorInfo.MonitorType = DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI; - MonitorInfo.ConnectorIndex = 0; + MonitorInfo.ConnectorIndex = index; MonitorInfo.MonitorDescription.Size = sizeof(MonitorInfo.MonitorDescription); MonitorInfo.MonitorDescription.Type = IDDCX_MONITOR_DESCRIPTION_TYPE_EDID; MonitorInfo.MonitorDescription.DataSize = sizeof(s_KnownMonitorEdid); diff --git a/IddSampleDriver/Driver.h b/IddSampleDriver/Driver.h index 7416b59..2502155 100644 --- a/IddSampleDriver/Driver.h +++ b/IddSampleDriver/Driver.h @@ -84,6 +84,8 @@ namespace Microsoft void InitAdapter(); void FinishInit(); + void CreateMonitor(unsigned int index); + void AssignSwapChain(IDDCX_SWAPCHAIN SwapChain, LUID RenderAdapter, HANDLE NewFrameEvent); void UnassignSwapChain(); @@ -92,6 +94,7 @@ namespace Microsoft WDFDEVICE m_WdfDevice; IDDCX_ADAPTER m_Adapter; IDDCX_MONITOR m_Monitor; + IDDCX_MONITOR m_Monitor2; std::unique_ptr m_ProcessingThread; diff --git a/IddSampleDriver/IddSampleDriver.inf b/IddSampleDriver/IddSampleDriver.inf index ed361e9..441c398 100644 Binary files a/IddSampleDriver/IddSampleDriver.inf and b/IddSampleDriver/IddSampleDriver.inf differ diff --git a/IddSampleDriver/IddSampleDriver.sln b/IddSampleDriver/IddSampleDriver.sln new file mode 100644 index 0000000..25c766a --- /dev/null +++ b/IddSampleDriver/IddSampleDriver.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IddSampleDriver", "IddSampleDriver.vcxproj", "{2D54CB75-8B17-4F11-97DC-847B0244CD46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.ActiveCfg = Debug|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Build.0 = Debug|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM.Deploy.0 = Debug|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Build.0 = Debug|ARM64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x64.ActiveCfg = Debug|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x64.Build.0 = Debug|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x64.Deploy.0 = Debug|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x86.ActiveCfg = Debug|Win32 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x86.Build.0 = Debug|Win32 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Debug|x86.Deploy.0 = Debug|Win32 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM.ActiveCfg = Release|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM.Build.0 = Release|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM.Deploy.0 = Release|ARM + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM64.ActiveCfg = Release|ARM64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM64.Build.0 = Release|ARM64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|ARM64.Deploy.0 = Release|ARM64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x64.ActiveCfg = Release|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x64.Build.0 = Release|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x64.Deploy.0 = Release|x64 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x86.ActiveCfg = Release|Win32 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x86.Build.0 = Release|Win32 + {2D54CB75-8B17-4F11-97DC-847B0244CD46}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9A8BE7D9-9F0F-40A2-BA2D-8AE9E35890DB} + EndGlobalSection +EndGlobal diff --git a/IddSampleDriver/IddSampleDriver.vcxproj b/IddSampleDriver/IddSampleDriver.vcxproj index a4685c5..2585554 100644 --- a/IddSampleDriver/IddSampleDriver.vcxproj +++ b/IddSampleDriver/IddSampleDriver.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -117,6 +117,7 @@ true 1 0 + Spectre Windows10 @@ -296,6 +297,9 @@ + + + diff --git a/IddSampleDriver/IddSampleDriver.vcxproj.filters b/IddSampleDriver/IddSampleDriver.vcxproj.filters index f47c380..ff0ef33 100644 --- a/IddSampleDriver/IddSampleDriver.vcxproj.filters +++ b/IddSampleDriver/IddSampleDriver.vcxproj.filters @@ -36,4 +36,7 @@ Source Files + + + \ No newline at end of file diff --git a/IddSampleDriver/readme.md b/IddSampleDriver/readme.md new file mode 100644 index 0000000..e7fd0c0 --- /dev/null +++ b/IddSampleDriver/readme.md @@ -0,0 +1,14 @@ +# Get 5 virtual monitors for the price of zero! + +# Steps (for experienced pros only!!!) +1. Download the latest release as a zip file. + +2. As an administrator, Run the *.bat file to add the driver certificate as a trusted root certificate. + +3. Don't install the inf. Open device manager, click on any device, then click on the "Action" menu and click "Add Legacy Hardware" + +4. Select "Add hardware from a list (Advanced)" and then select Display adapters + +5. Click "Have Disk..." and click the "Browse..." button. Navigate to the extracted files and select the inf file. + +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. \ No newline at end of file