Skip to content

Commit 930582b

Browse files
committed
Add more target modes
1 parent a2ddf27 commit 930582b

File tree

2 files changed

+81
-40
lines changed

2 files changed

+81
-40
lines changed

IddSampleDriver/Driver.cpp

Lines changed: 80 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,31 @@ void SwapChainProcessor::RunCore()
352352
const UINT64 MHZ = 1000000;
353353
const UINT64 KHZ = 1000;
354354

355+
constexpr DISPLAYCONFIG_VIDEO_SIGNAL_INFO dispinfo(UINT32 h, UINT32 v) {
356+
const UINT32 clock_rate = 60 * (v + 4) * (v + 4) + 1000;
357+
return {
358+
clock_rate, // pixel clock rate [Hz]
359+
{ clock_rate, v + 4 }, // fractional horizontal refresh rate [Hz]
360+
{ clock_rate, (v + 4) * (v + 4) }, // fractional vertical refresh rate [Hz]
361+
{ h, v }, // (horizontal, vertical) active pixel resolution
362+
{ h + 4, v + 4 }, // (horizontal, vertical) total pixel resolution
363+
{ { 255, 0 }}, // video standard and vsync divider
364+
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
365+
};
366+
}
355367
// A list of modes exposed by the sample monitor EDID - FOR SAMPLE PURPOSES ONLY
356368
const DISPLAYCONFIG_VIDEO_SIGNAL_INFO IndirectDeviceContext::s_KnownMonitorModes[] =
357369
{
370+
// 640 x 480 @ 60Hz
371+
{
372+
25249 * KHZ, // pixel clock rate [Hz]
373+
{ 25249 * KHZ, 640 + 160 }, // fractional horizontal refresh rate [Hz]
374+
{ 25249 * KHZ, (640 + 160) * (480 + 46) }, // fractional vertical refresh rate [Hz]
375+
{ 640, 480 }, // (horizontal, vertical) active pixel resolution
376+
{ 640 + 160, 480 + 46 }, // (horizontal, vertical) blanking pixel resolution
377+
{ { 255, 0 } }, // video standard and vsync divider
378+
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
379+
},
358380
// 800 x 600 @ 60Hz
359381
{
360382
40 * MHZ, // pixel clock rate [Hz]
@@ -365,17 +387,7 @@ const DISPLAYCONFIG_VIDEO_SIGNAL_INFO IndirectDeviceContext::s_KnownMonitorModes
365387
{ { 255, 0 }}, // video standard and vsync divider
366388
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
367389
},
368-
// 640 x 480 @ 60Hz
369-
{
370-
25175 * KHZ, // pixel clock rate [Hz]
371-
{ 25175 * KHZ, 640 + 160 }, // fractional horizontal refresh rate [Hz]
372-
{ 25175 * KHZ, (640 + 160) * (480 + 46) }, // fractional vertical refresh rate [Hz]
373-
{ 640, 480 }, // (horizontal, vertical) active pixel resolution
374-
{ 640 + 160, 480 + 46 }, // (horizontal, vertical) blanking pixel resolution
375-
{ { 255, 0 } }, // video standard and vsync divider
376-
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
377-
},
378-
// 800 x 600 @ 60Hz
390+
// 1920 x 1280 @ 60Hz
379391
{
380392
40 * MHZ, // pixel clock rate [Hz]
381393
{ 40 * MHZ, 800 + 256 }, // fractional horizontal refresh rate [Hz]
@@ -385,24 +397,22 @@ const DISPLAYCONFIG_VIDEO_SIGNAL_INFO IndirectDeviceContext::s_KnownMonitorModes
385397
{ { 255, 0 }}, // video standard and vsync divider
386398
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
387399
},
388-
{
389-
229009 * KHZ, // pixel clock rate [Hz]
390-
{ 229009 * KHZ, 2560 + 40 }, // fractional horizontal refresh rate [Hz]
391-
{ 229009 * KHZ, (2560 + 40) * (1440 + 28) }, // fractional vertical refresh rate [Hz]
392-
{ 2560, 1440 }, // (horizontal, vertical) active pixel resolution
393-
{ 2560 + 40, 1440 + 28 }, // (horizontal, vertical) total pixel resolution
394-
{ { 255, 0 }}, // video standard and vsync divider
395-
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
396-
},
397-
{
398-
509367 * KHZ, // pixel clock rate [Hz]
399-
{ 509367 * KHZ, 3840 + 40 }, // fractional horizontal refresh rate [Hz]
400-
{ 509367 * KHZ, (3840 + 40) * (2160 + 28) }, // fractional vertical refresh rate [Hz]
401-
{ 3840, 2160 }, // (horizontal, vertical) active pixel resolution
402-
{ 3840 + 40, 2160 + 28 }, // (horizontal, vertical) total pixel resolution
403-
{ { 255, 0 }}, // video standard and vsync divider
404-
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE
405-
},
400+
dispinfo(1920, 1200),
401+
dispinfo(1920, 1440),
402+
dispinfo(2560, 1440),
403+
dispinfo(2560, 1600),
404+
dispinfo(2880, 1620),
405+
dispinfo(2880, 1800),
406+
dispinfo(3008, 1692),
407+
dispinfo(3200, 1800),
408+
dispinfo(3200, 2400),
409+
dispinfo(3840, 2160),
410+
dispinfo(3840, 2400),
411+
dispinfo(4096, 2304),
412+
dispinfo(4096, 2560),
413+
dispinfo(5120, 2880),
414+
dispinfo(6016, 3384),
415+
dispinfo(7680, 4320),
406416
};
407417

408418
// This is a sample monitor EDID - FOR SAMPLE PURPOSES ONLY
@@ -423,7 +433,7 @@ const BYTE IndirectDeviceContext::s_KnownMonitorEdid[] =
423433
0x75, 0x78, 0x20, 0x23, 0x30, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x3B,
424434
0x3D, 0x42, 0x44, 0x0F, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC,
425435
0x00, 0x4C, 0x69, 0x6E, 0x75, 0x78, 0x20, 0x46, 0x48, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x00, 0x05
426-
436+
427437
};
428438

429439
IndirectDeviceContext::IndirectDeviceContext(_In_ WDFDEVICE WdfDevice) :
@@ -446,16 +456,16 @@ void IndirectDeviceContext::InitAdapter()
446456
//
447457
// This is also where static per-adapter capabilities are determined.
448458
// ==============================
449-
459+
450460
IDDCX_ADAPTER_CAPS AdapterCaps = {};
451461
AdapterCaps.Size = sizeof(AdapterCaps);
452-
462+
453463
// Declare basic feature support for the adapter (required)
454464
AdapterCaps.MaxMonitorsSupported = NUM_VIRTUAL_DISPLAYS;
455465
AdapterCaps.EndPointDiagnostics.Size = sizeof(AdapterCaps.EndPointDiagnostics);
456466
AdapterCaps.EndPointDiagnostics.GammaSupport = IDDCX_FEATURE_IMPLEMENTATION_NONE;
457467
AdapterCaps.EndPointDiagnostics.TransmissionType = IDDCX_TRANSMISSION_TYPE_WIRED_OTHER;
458-
468+
459469
// Declare your device strings for telemetry (required)
460470
AdapterCaps.EndPointDiagnostics.pEndPointFriendlyName = L"IddSample Device";
461471
AdapterCaps.EndPointDiagnostics.pEndPointManufacturerName = L"Microsoft";
@@ -690,18 +700,48 @@ NTSTATUS IddSampleMonitorQueryModes(IDDCX_MONITOR MonitorObject, const IDARG_IN_
690700
{
691701
UNREFERENCED_PARAMETER(MonitorObject);
692702

693-
vector<IDDCX_TARGET_MODE> TargetModes(6);
703+
vector<IDDCX_TARGET_MODE> TargetModes(34);
694704

695705
// Create a set of modes supported for frame processing and scan-out. These are typically not based on the
696706
// monitor's descriptor and instead are based on the static processing capability of the device. The OS will
697707
// report the available set of modes for a given output as the intersection of monitor modes with target modes.
698708

699-
CreateTargetMode(TargetModes[0], 3840, 2160, 60);
700-
CreateTargetMode(TargetModes[1], 2560, 1440, 60);
701-
CreateTargetMode(TargetModes[2], 1920, 1080, 60);
702-
CreateTargetMode(TargetModes[3], 1024, 768, 60);
703-
CreateTargetMode(TargetModes[4], 800, 600, 60);
704-
CreateTargetMode(TargetModes[5], 640, 480, 60);
709+
710+
CreateTargetMode(TargetModes[0], 7680, 4320, 60);
711+
CreateTargetMode(TargetModes[1], 6016, 3384, 60);
712+
CreateTargetMode(TargetModes[2], 5120, 2880, 60);
713+
CreateTargetMode(TargetModes[3], 4096, 2560, 60);
714+
CreateTargetMode(TargetModes[4], 4096, 2304, 60);
715+
CreateTargetMode(TargetModes[5], 3840, 2400, 60);
716+
CreateTargetMode(TargetModes[6], 3840, 2160, 60);
717+
CreateTargetMode(TargetModes[7], 3200, 2400, 60);
718+
CreateTargetMode(TargetModes[8], 3200, 1800, 60);
719+
CreateTargetMode(TargetModes[9], 3008, 1692, 60);
720+
CreateTargetMode(TargetModes[10], 2880, 1800, 60);
721+
CreateTargetMode(TargetModes[11], 2880, 1620, 60);
722+
CreateTargetMode(TargetModes[12], 2560, 1600, 60);
723+
CreateTargetMode(TargetModes[13], 2560, 1440, 60);
724+
CreateTargetMode(TargetModes[14], 1920, 1440, 60);
725+
CreateTargetMode(TargetModes[15], 1920, 1200, 60);
726+
727+
CreateTargetMode(TargetModes[16], 1920, 1080, 60);
728+
CreateTargetMode(TargetModes[17], 1600, 1024, 60);
729+
CreateTargetMode(TargetModes[18], 1680, 1050, 60);
730+
CreateTargetMode(TargetModes[19], 1600, 900, 60);
731+
CreateTargetMode(TargetModes[20], 1440, 900, 60);
732+
CreateTargetMode(TargetModes[21], 1400, 1050, 60);
733+
CreateTargetMode(TargetModes[22], 1366, 768, 60);
734+
CreateTargetMode(TargetModes[23], 1360, 768, 60);
735+
CreateTargetMode(TargetModes[24], 1280, 1024, 60);
736+
CreateTargetMode(TargetModes[25], 1280, 960, 60);
737+
CreateTargetMode(TargetModes[26], 1280, 800, 60);
738+
CreateTargetMode(TargetModes[27], 1280, 768, 60);
739+
CreateTargetMode(TargetModes[28], 1280, 720, 60);
740+
CreateTargetMode(TargetModes[29], 1280, 600, 60);
741+
CreateTargetMode(TargetModes[30], 1152, 864, 60);
742+
CreateTargetMode(TargetModes[31], 1024, 768, 60);
743+
CreateTargetMode(TargetModes[32], 800, 600, 60);
744+
CreateTargetMode(TargetModes[33], 640, 480, 60);
705745

706746
pOutArgs->TargetModeBufferOutputCount = (UINT)TargetModes.size();
707747

IddSampleDriver/IddSampleDriver.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
183183
<DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>
184184
<RunCodeAnalysis>true</RunCodeAnalysis>
185+
<Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
185186
</PropertyGroup>
186187
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
187188
<DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>

0 commit comments

Comments
 (0)