ReactOS 0.4.16-dev-550-g2186ce3
d3dkmthk.h
Go to the documentation of this file.
1/******************************Module*Header**********************************\
2*
3* Module Name: d3dkmthk.h
4*
5* Content: Windows Display Driver Model (WDDM) kernel mode thunk interfaces
6*
7* Copyright (c) Microsoft Corporation.
8* Licensed under the MIT License.
9*
10\*****************************************************************************/
11#ifndef _D3DKMTHK_H_
12#define _D3DKMTHK_H_
13
14#include <d3dkmdt.h>
15
16#pragma region Desktop Family
17#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
18
19#pragma warning(push)
20#pragma warning(disable:4201) // anonymous unions warning
21#pragma warning(disable:4200) // zero-sized array in struct/union
22#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int
23
24
27
28//
29// Available only for Vista (LONGHORN) and later and for
30// multiplatform tools such as debugger extensions
31//
32#if defined(__REACTOS__) || ((NTDDI_VERSION >= NTDDI_LONGHORN) || defined(D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL))
33
34typedef struct _D3DKMT_CREATEDEVICEFLAGS
35{
36 UINT LegacyMode : 1; // 0x00000001
37 UINT RequestVSync : 1; // 0x00000002
38#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
39 UINT DisableGpuTimeout : 1; // 0x00000004
40 UINT Reserved : 29; // 0xFFFFFFF8
41#else
42 UINT Reserved : 30; // 0xFFFFFFFC
43#endif
44} D3DKMT_CREATEDEVICEFLAGS;
45
46typedef struct _D3DKMT_CREATEDEVICE
47{
48 union
49 {
50 D3DKMT_HANDLE hAdapter; // in: identifies the adapter for user-mode creation
51 VOID* pAdapter; // in: identifies the adapter for kernel-mode creation
52 D3DKMT_PTR_HELPER(pAdapter_Align)
53 };
54
55 D3DKMT_CREATEDEVICEFLAGS Flags;
56
57 D3DKMT_HANDLE hDevice; // out: Identifies the device
58 D3DKMT_PTR(VOID*, pCommandBuffer); // out: D3D10 compatibility.
59 UINT CommandBufferSize; // out: D3D10 compatibility.
60 D3DKMT_PTR(D3DDDI_ALLOCATIONLIST*, pAllocationList); // out: D3D10 compatibility.
61 UINT AllocationListSize; // out: D3D10 compatibility.
62 D3DKMT_PTR(D3DDDI_PATCHLOCATIONLIST*, pPatchLocationList); // out: D3D10 compatibility.
63 UINT PatchLocationListSize; // out: D3D10 compatibility.
64} D3DKMT_CREATEDEVICE;
65
66typedef struct _D3DKMT_DESTROYDEVICE
67{
68 D3DKMT_HANDLE hDevice; // in: Indentifies the device
69}D3DKMT_DESTROYDEVICE;
70
71typedef enum _D3DKMT_CLIENTHINT
72{
73 D3DKMT_CLIENTHINT_UNKNOWN = 0,
74 D3DKMT_CLIENTHINT_OPENGL = 1,
75 D3DKMT_CLIENTHINT_CDD = 2, // Internal
76 D3DKMT_CLIENTHINT_OPENCL = 3,
77 D3DKMT_CLIENTHINT_VULKAN = 4,
78 D3DKMT_CLIENTHINT_CUDA = 5,
79 D3DKMT_CLIENTHINT_RESERVED = 6,
80 D3DKMT_CLIENTHINT_DX7 = 7,
81 D3DKMT_CLIENTHINT_DX8 = 8,
82 D3DKMT_CLIENTHINT_DX9 = 9,
83 D3DKMT_CLIENTHINT_DX10 = 10,
84 D3DKMT_CLIENTHINT_DX11 = 11,
85 D3DKMT_CLIENTHINT_DX12 = 12,
86 D3DKMT_CLIENTHINT_9ON12 = 13,
87 D3DKMT_CLIENTHINT_11ON12 = 14,
88 D3DKMT_CLIENTHINT_MFT_ENCODE = 15,
89 D3DKMT_CLIENTHINT_GLON12 = 16,
90 D3DKMT_CLIENTHINT_CLON12 = 17,
91 D3DKMT_CLIENTHINT_DML_TENSORFLOW = 18,
92 D3DKMT_CLIENTHINT_ONEAPI_LEVEL0 = 19,
93 D3DKMT_CLIENTHINT_MAX
94} D3DKMT_CLIENTHINT;
95
96typedef struct _D3DKMT_CREATECONTEXT
97{
98 D3DKMT_HANDLE hDevice; // in: Handle to the device owning this context.
99 UINT NodeOrdinal; // in: Identifier for the node targetted by this context.
100 UINT EngineAffinity; // in: Engine affinity within the specified node.
101 D3DDDI_CREATECONTEXTFLAGS Flags; // in: Context creation flags.
102 D3DKMT_PTR(VOID*, pPrivateDriverData); // in: Private driver data
103 UINT PrivateDriverDataSize; // in: Size of private driver data
104 D3DKMT_CLIENTHINT ClientHint; // in: Hints which client is creating this
105 D3DKMT_HANDLE hContext; // out: Handle of the created context.
106 D3DKMT_PTR(VOID*, pCommandBuffer); // out: Pointer to the first command buffer.
107 UINT CommandBufferSize; // out: Command buffer size (bytes).
108 D3DKMT_PTR(D3DDDI_ALLOCATIONLIST*, pAllocationList); // out: Pointer to the first allocation list.
109 UINT AllocationListSize; // out: Allocation list size (elements).
110 D3DKMT_PTR(D3DDDI_PATCHLOCATIONLIST*, pPatchLocationList); // out: Pointer to the first patch location list.
111 UINT PatchLocationListSize; // out: Patch location list size (elements).
112 D3DGPU_VIRTUAL_ADDRESS CommandBuffer; // out: GPU virtual address of the command buffer. _ADVSCH_
113} D3DKMT_CREATECONTEXT;
114
115typedef struct _D3DKMT_DESTROYCONTEXT
116{
117 D3DKMT_HANDLE hContext; // in: Identifies the context being destroyed.
118} D3DKMT_DESTROYCONTEXT;
119
120typedef struct _D3DKMT_CREATESYNCHRONIZATIONOBJECT
121{
122 D3DKMT_HANDLE hDevice; // in: Handle to the device.
123 D3DDDI_SYNCHRONIZATIONOBJECTINFO Info; // in: Attributes of the synchronization object.
124 D3DKMT_HANDLE hSyncObject; // out: Handle to the synchronization object created.
125} D3DKMT_CREATESYNCHRONIZATIONOBJECT;
126
127typedef struct _D3DKMT_CREATESYNCHRONIZATIONOBJECT2
128{
129 D3DKMT_HANDLE hDevice; // in: Handle to the device.
130 D3DDDI_SYNCHRONIZATIONOBJECTINFO2 Info; // in/out: Attributes of the synchronization object.
131 D3DKMT_HANDLE hSyncObject; // out: Handle to the synchronization object created.
132} D3DKMT_CREATESYNCHRONIZATIONOBJECT2;
133
134typedef struct _D3DKMT_DESTROYSYNCHRONIZATIONOBJECT
135{
136 D3DKMT_HANDLE hSyncObject; // in: Identifies the synchronization objects being destroyed.
137} D3DKMT_DESTROYSYNCHRONIZATIONOBJECT;
138
139typedef struct _D3DKMT_OPENSYNCHRONIZATIONOBJECT
140{
141 D3DKMT_HANDLE hSharedHandle; // in: shared handle to synchronization object to be opened.
142 D3DKMT_HANDLE hSyncObject; // out: Handle to sync object in this process.
143
144 D3DKMT_ALIGN64 UINT64 Reserved[8];
145} D3DKMT_OPENSYNCHRONIZATIONOBJECT;
146
147typedef struct _D3DKMT_WAITFORSYNCHRONIZATIONOBJECT
148{
149 D3DKMT_HANDLE hContext; // in: Identifies the context that needs to wait.
150 UINT ObjectCount; // in: Specifies the number of object to wait on.
151 D3DKMT_HANDLE ObjectHandleArray[D3DDDI_MAX_OBJECT_WAITED_ON]; // in: Specifies the object to wait on.
152} D3DKMT_WAITFORSYNCHRONIZATIONOBJECT;
153
154typedef struct _D3DKMT_WAITFORSYNCHRONIZATIONOBJECT2
155{
156 D3DKMT_HANDLE hContext; // in: Identifies the context that needs to wait.
157 UINT ObjectCount; // in: Specifies the number of object to wait on.
158 D3DKMT_HANDLE ObjectHandleArray[D3DDDI_MAX_OBJECT_WAITED_ON]; // in: Specifies the object to wait on.
159 union
160 {
161 struct {
162 D3DKMT_ALIGN64 UINT64 FenceValue; // in: fence value to be waited.
163 } Fence;
164 D3DKMT_ALIGN64 UINT64 Reserved[8];
165 };
166} D3DKMT_WAITFORSYNCHRONIZATIONOBJECT2;
167
168typedef struct _D3DKMT_SIGNALSYNCHRONIZATIONOBJECT
169{
170 D3DKMT_HANDLE hContext; // in: Identifies the context that needs to signal.
171 UINT ObjectCount; // in: Specifies the number of object to signal.
172 D3DKMT_HANDLE ObjectHandleArray[D3DDDI_MAX_OBJECT_SIGNALED]; // in: Specifies the object to be signaled.
173 D3DDDICB_SIGNALFLAGS Flags; // in: Specifies signal behavior.
174} D3DKMT_SIGNALSYNCHRONIZATIONOBJECT;
175
176typedef struct _D3DKMT_SIGNALSYNCHRONIZATIONOBJECT2
177{
178 D3DKMT_HANDLE hContext; // in: Identifies the context that needs to signal.
179 UINT ObjectCount; // in: Specifies the number of object to signal.
180 D3DKMT_HANDLE ObjectHandleArray[D3DDDI_MAX_OBJECT_SIGNALED]; // in: Specifies the object to be signaled.
181 D3DDDICB_SIGNALFLAGS Flags; // in: Specifies signal behavior.
182 ULONG BroadcastContextCount; // in: Specifies the number of context
183 // to broadcast this command buffer to.
184 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT]; // in: Specifies the handle of the context to
185 // broadcast to.
186 union
187 {
188 struct {
189 D3DKMT_ALIGN64 UINT64 FenceValue; // in: fence value to be signaled;
190 } Fence;
191#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
192 HANDLE CpuEventHandle; // in: handle of a CPU event to be signaled
193#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
194 D3DKMT_ALIGN64 UINT64 Reserved[8];
195 };
196} D3DKMT_SIGNALSYNCHRONIZATIONOBJECT2;
197
198typedef struct _D3DKMT_LOCK
199{
200 D3DKMT_HANDLE hDevice; // in: identifies the device
201 D3DKMT_HANDLE hAllocation; // in: allocation to lock
202 // out: New handle representing the allocation after the lock.
203 UINT PrivateDriverData; // in: Used by UMD for AcquireAperture
204 UINT NumPages;
205 D3DKMT_PTR(CONST UINT*, pPages);
206 D3DKMT_PTR(VOID*, pData); // out: pointer to memory
207 D3DDDICB_LOCKFLAGS Flags; // in: Bit field defined by D3DDDI_LOCKFLAGS
208 D3DGPU_VIRTUAL_ADDRESS GpuVirtualAddress; // out: GPU's Virtual Address of locked allocation. _ADVSCH_
209} D3DKMT_LOCK;
210
211typedef struct _D3DKMT_UNLOCK
212{
213 D3DKMT_HANDLE hDevice; // in: Identifies the device
214 UINT NumAllocations; // in: Number of allocations in the array
215 D3DKMT_PTR(CONST D3DKMT_HANDLE*, phAllocations); // in: array of allocations to unlock
216} D3DKMT_UNLOCK;
217
218typedef enum _D3DKMDT_MODE_PRUNING_REASON
219{
220 D3DKMDT_MPR_UNINITIALIZED = 0, // mode was pruned or is supported because of:
221 D3DKMDT_MPR_ALLCAPS = 1, // all of the monitor caps (only used to imply lack of support - for support, specific reason is always indicated)
222 D3DKMDT_MPR_DESCRIPTOR_MONITOR_SOURCE_MODE = 2, // monitor source mode in the monitor descriptor
223 D3DKMDT_MPR_DESCRIPTOR_MONITOR_FREQUENCY_RANGE = 3, // monitor frequency range in the monitor descriptor
224 D3DKMDT_MPR_DESCRIPTOR_OVERRIDE_MONITOR_SOURCE_MODE = 4, // monitor source mode in the monitor descriptor override
225 D3DKMDT_MPR_DESCRIPTOR_OVERRIDE_MONITOR_FREQUENCY_RANGE = 5, // monitor frequency range in the monitor descriptor override
226 D3DKMDT_MPR_DEFAULT_PROFILE_MONITOR_SOURCE_MODE = 6, // monitor source mode in the default monitor profile
227 D3DKMDT_MPR_DRIVER_RECOMMENDED_MONITOR_SOURCE_MODE = 7, // monitor source mode recommended by the driver
228 D3DKMDT_MPR_MONITOR_FREQUENCY_RANGE_OVERRIDE = 8, // monitor frequency range override
229 D3DKMDT_MPR_CLONE_PATH_PRUNED = 9, // Mode is pruned because other path(s) in clone cluster has(have) no mode supported by monitor
230 D3DKMDT_MPR_MAXVALID = 10
231}
232D3DKMDT_MODE_PRUNING_REASON;
233
234// This structure takes 8 bytes.
235// The unnamed UINT of size 0 forces alignment of the structure to
236// make it exactly occupy 8 bytes, see MSDN docs on C++ bitfields
237// for more details
238typedef struct _D3DKMDT_DISPLAYMODE_FLAGS
239{
240#if (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WIN8)
241 BOOLEAN ValidatedAgainstMonitorCaps : 1;
242 BOOLEAN RoundedFakeMode : 1;
243 D3DKMDT_MODE_PRUNING_REASON ModePruningReason : 4;
244 UINT Reserved : 28;
245#else
246 UINT ValidatedAgainstMonitorCaps : 1;
247 UINT RoundedFakeMode : 1;
248 UINT : 0;
249 D3DKMDT_MODE_PRUNING_REASON ModePruningReason : 4;
250 UINT Stereo : 1;
251 UINT AdvancedScanCapable : 1;
252#if (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WDDM2_0)
253 UINT Reserved : 26;
254#else
255 UINT PreferredTiming : 1;
256 UINT PhysicalModeSupported : 1;
257#if (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WDDM2_9)
258 UINT Reserved : 24;
259#else
260 UINT VirtualRefreshRate : 1;
261 UINT Reserved : 23;
262#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9
263#endif
264#endif
265}
266D3DKMDT_DISPLAYMODE_FLAGS;
267
268typedef struct _D3DKMT_DISPLAYMODE
269{
270 UINT Width;
271 UINT Height;
272 D3DDDIFORMAT Format;
273 UINT IntegerRefreshRate;
274 D3DDDI_RATIONAL RefreshRate;
275 D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING ScanLineOrdering;
276 D3DDDI_ROTATION DisplayOrientation;
277 UINT DisplayFixedOutput;
278 D3DKMDT_DISPLAYMODE_FLAGS Flags;
279} D3DKMT_DISPLAYMODE;
280
281typedef struct _D3DKMT_GETDISPLAYMODELIST
282{
283 D3DKMT_HANDLE hAdapter; // in: adapter handle
284 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN source ID
285 D3DKMT_PTR(D3DKMT_DISPLAYMODE*, pModeList); // out:
286 UINT ModeCount; // in/out:
287} D3DKMT_GETDISPLAYMODELIST;
288
289typedef struct _D3DKMT_DISPLAYMODELIST
290{
291 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
292 UINT ModeCount;
293 D3DKMT_DISPLAYMODE pModeList[0];
294} D3DKMT_DISPLAYMODELIST;
295
296typedef struct _D3DKMT_SETDISPLAYMODE_FLAGS
297{
298 BOOLEAN PreserveVidPn : 1;
299 UINT Reserved : 31;
300}
301D3DKMT_SETDISPLAYMODE_FLAGS;
302
303typedef struct _D3DKMT_SETDISPLAYMODE
304{
305 D3DKMT_HANDLE hDevice; // in: Identifies the device
306 D3DKMT_HANDLE hPrimaryAllocation; // in:
307 D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING ScanLineOrdering; // in:
308 D3DDDI_ROTATION DisplayOrientation; // in:
309 UINT PrivateDriverFormatAttribute; // out: Private Format Attribute of the current primary surface if DxgkSetDisplayMode failed with STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT
310 D3DKMT_SETDISPLAYMODE_FLAGS Flags; // in:
311} D3DKMT_SETDISPLAYMODE;
312
313
314typedef struct _D3DKMT_MULTISAMPLEMETHOD
315{
316 UINT NumSamples;
317 UINT NumQualityLevels;
318 UINT Reserved; //workaround for NTRAID#Longhorn-1124385-2005/03/14-kanqiu
319} D3DKMT_MULTISAMPLEMETHOD;
320
321typedef struct _D3DKMT_GETMULTISAMPLEMETHODLIST
322{
323 D3DKMT_HANDLE hAdapter; // in: adapter handle
324 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN source ID
325 UINT Width; // in:
326 UINT Height; // in:
327 D3DDDIFORMAT Format; // in:
328 D3DKMT_PTR(D3DKMT_MULTISAMPLEMETHOD*, pMethodList); // out:
329 UINT MethodCount; // in/out:
330} D3DKMT_GETMULTISAMPLEMETHODLIST;
331
332typedef struct _D3DKMT_PRESENTFLAGS
333{
334 union
335 {
336 struct
337 {
338 UINT Blt : 1; // 0x00000001
339 UINT ColorFill : 1; // 0x00000002
340 UINT Flip : 1; // 0x00000004
341 UINT FlipDoNotFlip : 1; // 0x00000008
342 UINT FlipDoNotWait : 1; // 0x00000010
343 UINT FlipRestart : 1; // 0x00000020
344 UINT DstRectValid : 1; // 0x00000040
345 UINT SrcRectValid : 1; // 0x00000080
346 UINT RestrictVidPnSource : 1; // 0x00000100
347 UINT SrcColorKey : 1; // 0x00000200
348 UINT DstColorKey : 1; // 0x00000400
349 UINT LinearToSrgb : 1; // 0x00000800
350 UINT PresentCountValid : 1; // 0x00001000
351 UINT Rotate : 1; // 0x00002000
352 UINT PresentToBitmap : 1; // 0x00004000
353 UINT RedirectedFlip : 1; // 0x00008000
354 UINT RedirectedBlt : 1; // 0x00010000
355#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
356 UINT FlipStereo : 1; // 0x00020000 // This is a flip from a stereo alloc. Used in addition to Flip.
357 UINT FlipStereoTemporaryMono : 1; // 0x00040000 // This is a flip from a stereo alloc. The left image should used to produce both images. Used in addition to Flip.
358 UINT FlipStereoPreferRight : 1; // 0x00080000 // This is a flip from a stereo alloc. Use the right image when cloning to a mono monitor. Used in addition to Flip.
359 UINT BltStereoUseRight : 1; // 0x00100000 // This is a Blt from a stereo alloc to a mono alloc. The right image should be used.
360 UINT PresentHistoryTokenOnly : 1; // 0x00200000 // Submit Present History Token only.
361 UINT PresentRegionsValid : 1; // 0x00400000 // Ptr to present regions is valid
362 UINT PresentDDA : 1; // 0x00800000 // Present from a DDA swapchain
363 UINT ProtectedContentBlankedOut : 1; // 0x01000000
364 UINT RemoteSession : 1; // 0x02000000
365#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
366 UINT CrossAdapter : 1; // 0x04000000
367 UINT DurationValid : 1; // 0x08000000
368 UINT PresentIndirect : 1; // 0x10000000 // Present to an indirect-display adapter
369 UINT PresentHMD : 1; // 0x20000000 // Present from an HMD swapchain.
370 UINT Reserved : 2; // 0xC0000000
371#else
372 UINT Reserved : 6; // 0xFC000000
373#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
374#else
375 UINT Reserved : 15; // 0xFFFE0000
376#endif
377 };
378 UINT Value;
379 };
380} D3DKMT_PRESENTFLAGS;
381
382typedef enum _D3DKMT_PRESENT_MODEL
383{
384 D3DKMT_PM_UNINITIALIZED = 0,
385 D3DKMT_PM_REDIRECTED_GDI = 1,
386 D3DKMT_PM_REDIRECTED_FLIP = 2,
387 D3DKMT_PM_REDIRECTED_BLT = 3,
388 D3DKMT_PM_REDIRECTED_VISTABLT = 4,
389 D3DKMT_PM_SCREENCAPTUREFENCE = 5,
390 D3DKMT_PM_REDIRECTED_GDI_SYSMEM = 6,
391 D3DKMT_PM_REDIRECTED_COMPOSITION = 7,
392#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
393 D3DKMT_PM_SURFACECOMPLETE = 8,
394#endif
395 D3DKMT_PM_FLIPMANAGER = 9,
396} D3DKMT_PRESENT_MODEL;
397
398typedef enum _D3DKMT_FLIPMODEL_INDEPENDENT_FLIP_STAGE
399{
400 D3DKMT_FLIPMODEL_INDEPENDENT_FLIP_STAGE_FLIP_SUBMITTED = 0,
401 D3DKMT_FLIPMODEL_INDEPENDENT_FLIP_STAGE_FLIP_COMPLETE = 1
402} D3DKMT_FLIPMODEL_INDEPENDENT_FLIP_STAGE;
403
404typedef struct _D3DKMT_FLIPMODEL_PRESENTHISTORYTOKENFLAGS
405{
406 union
407 {
408 struct
409 {
410 UINT Video : 1; // 0x00000001
411 UINT RestrictedContent : 1; // 0x00000002
412 UINT ClipToView : 1; // 0x00000004
413#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
414 UINT StereoPreferRight : 1; // 0x00000008
415 UINT TemporaryMono : 1; // 0x00000010
416 UINT FlipRestart : 1; // 0x00000020
417 UINT HDRMetaDataChanged : 1; // 0x00000040
418 UINT AlphaMode : 2; // 0x00000180
419 UINT SignalLimitOnTokenCompletion : 1; // 0x00000200
420 UINT YCbCrFlags : 3; // 0x00001C00
421 UINT IndependentFlip : 1; // 0x00002000
422 D3DKMT_FLIPMODEL_INDEPENDENT_FLIP_STAGE IndependentFlipStage : 2; // 0x0000C000
423 UINT IndependentFlipReleaseCount : 2; // 0x00030000
424 UINT IndependentFlipForceNotifyDwm : 1; // 0x00040000
425 UINT UseCustomDuration : 1; // 0x00080000
426 UINT IndependentFlipRequestDwmConfirm:1; // 0x00100000
427 UINT IndependentFlipCandidate : 1; // 0x00200000
428 UINT IndependentFlipCheckNeeded : 1; // 0x00400000
429 UINT IndependentFlipTrueImmediate : 1; // 0x00800000
430 UINT IndependentFlipRequestDwmExit : 1; // 0x01000000
431 UINT CompSurfaceNotifiedEarly : 1; // 0x02000000
432 UINT IndependentFlipDoNotFlip : 1; // 0x04000000
433 UINT RequirePairedToken : 1; // 0x08000000
434 UINT VariableRefreshOverrideEligible :1; // 0x10000000
435 UINT Reserved : 3; // 0xE0000000
436#else
437 UINT Reserved : 29; // 0xFFFFFFF8
438#endif
439 };
440
441 UINT Value;
442 };
443} D3DKMT_FLIPMODEL_PRESENTHISTORYTOKENFLAGS;
444
445#define D3DKMT_MAX_PRESENT_HISTORY_RECTS 16
446
447typedef struct _D3DKMT_DIRTYREGIONS
448{
449 UINT NumRects;
450 RECT Rects[D3DKMT_MAX_PRESENT_HISTORY_RECTS];
451} D3DKMT_DIRTYREGIONS;
452
453typedef struct _D3DKMT_COMPOSITION_PRESENTHISTORYTOKEN
454{
455 D3DKMT_ALIGN64 ULONG64 hPrivateData;
456} D3DKMT_COMPOSITION_PRESENTHISTORYTOKEN;
457
458typedef struct _D3DKMT_FLIPMANAGER_PRESENTHISTORYTOKEN
459{
460 D3DKMT_ALIGN64 ULONG64 hPrivateData;
461 D3DKMT_ALIGN64 ULONGLONG PresentAtQpc;
462 union
463 {
464 struct
465 {
466 UINT Discard : 1;
467 UINT PresentAt : 1;
468 UINT hPrivateDataIsPointer : 1;
469 UINT Reserved : 29;
470 };
471 UINT Value;
472 }Flags;
473} D3DKMT_FLIPMANAGER_PRESENTHISTORYTOKEN;
474
475typedef enum _D3DKMT_AUXILIARYPRESENTINFO_TYPE
476{
477 D3DKMT_AUXILIARYPRESENTINFO_TYPE_FLIPMANAGER = 0
478} D3DKMT_AUXILIARYPRESENTINFO_TYPE;
479
480typedef struct _D3DKMT_AUXILIARYPRESENTINFO
481{
482 UINT size;
483 D3DKMT_AUXILIARYPRESENTINFO_TYPE type;
484} D3DKMT_AUXILIARYPRESENTINFO;
485
486typedef struct _D3DKMT_FLIPMANAGER_AUXILIARYPRESENTINFO
487{
488 // in: Base information
489 D3DKMT_AUXILIARYPRESENTINFO auxiliaryPresentInfo;
490
491 // in: Tracing ID of owner flip manager
492 UINT flipManagerTracingId;
493
494 // in: Whether or not the application requested a different custom duration
495 // than the previous present
496 BOOL customDurationChanged;
497
498 // out: The adapter LUID/VidPn source of the flip output
499 LUID FlipAdapterLuid;
500 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
501
502 // out: Independent flip stage
503 D3DKMT_FLIPMODEL_INDEPENDENT_FLIP_STAGE independentFlipStage;
504
505 // out: The DPC frame time of the frame on which the flip was completed
506 D3DKMT_ALIGN64 ULONGLONG FlipCompletedQpc;
507
508 // out: The approved frame duration
509 UINT HwPresentDurationQpc;
510
511 // out: Whether or not the present was canceled in the scheduler
512 BOOL WasCanceled;
513} D3DKMT_FLIPMANAGER_AUXILIARYPRESENTINFO;
514
515typedef struct _D3DKMT_GDIMODEL_PRESENTHISTORYTOKEN
516{
517 D3DKMT_ALIGN64 ULONG64 hLogicalSurface;
518 D3DKMT_ALIGN64 ULONG64 hPhysicalSurface;
519#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
520 RECT ScrollRect;
521 POINT ScrollOffset;
522#endif
523 D3DKMT_DIRTYREGIONS DirtyRegions;
524} D3DKMT_GDIMODEL_PRESENTHISTORYTOKEN;
525
526typedef struct _D3DKMT_GDIMODEL_SYSMEM_PRESENTHISTORYTOKEN
527{
528 D3DKMT_ALIGN64 ULONG64 hlsurf;
529 DWORD dwDirtyFlags;
530 D3DKMT_ALIGN64 UINT64 uiCookie;
531} D3DKMT_GDIMODEL_SYSMEM_PRESENTHISTORYTOKEN;
532
533typedef ULONGLONG D3DKMT_VISTABLTMODEL_PRESENTHISTORYTOKEN;
534
535typedef struct _D3DKMT_FENCE_PRESENTHISTORYTOKEN
536{
537 D3DKMT_ALIGN64 UINT64 Key;
538} D3DKMT_FENCE_PRESENTHISTORYTOKEN;
539
540typedef struct _D3DKMT_BLTMODEL_PRESENTHISTORYTOKEN
541{
542 D3DKMT_ALIGN64 ULONG64 hLogicalSurface;
543 D3DKMT_ALIGN64 ULONG64 hPhysicalSurface;
544 D3DKMT_ALIGN64 ULONG64 EventId;
545 D3DKMT_DIRTYREGIONS DirtyRegions;
546} D3DKMT_BLTMODEL_PRESENTHISTORYTOKEN;
547
548#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
549#define D3DKMT_MAX_PRESENT_HISTORY_SCATTERBLTS 12
550
551typedef struct _D3DKMT_SCATTERBLT
552{
553 D3DKMT_ALIGN64 ULONG64 hLogicalSurfaceDestination;
554 D3DKMT_ALIGN64 LONG64 hDestinationCompSurfDWM;
555 D3DKMT_ALIGN64 UINT64 DestinationCompositionBindingId;
556 RECT SourceRect;
558} D3DKMT_SCATTERBLT;
559
560typedef struct _D3DKMT_SCATTERBLTS
561{
562 UINT NumBlts;
563 D3DKMT_SCATTERBLT Blts[D3DKMT_MAX_PRESENT_HISTORY_SCATTERBLTS];
564} D3DKMT_SCATTERBLTS;
565#endif
566
567typedef struct _D3DKMT_FLIPMODEL_PRESENTHISTORYTOKEN
568{
569 D3DKMT_ALIGN64 UINT64 FenceValue;
570 D3DKMT_ALIGN64 ULONG64 hLogicalSurface;
571 D3DKMT_ALIGN64 D3DKMT_UINT_PTR dxgContext;
572 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
573 UINT SwapChainIndex;
574 D3DKMT_ALIGN64 UINT64 PresentLimitSemaphoreId;
575 D3DDDI_FLIPINTERVAL_TYPE FlipInterval;
576 D3DKMT_FLIPMODEL_PRESENTHISTORYTOKENFLAGS Flags;
577#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
578 D3DKMT_ALIGN64 LONG64 hCompSurf;
579 LUID compSurfLuid;
580 D3DKMT_ALIGN64 UINT64 confirmationCookie;
581 D3DKMT_ALIGN64 UINT64 CompositionSyncKey;
582 UINT RemainingTokens;
583 RECT ScrollRect;
584 POINT ScrollOffset;
585 UINT PresentCount;
586 FLOAT RevealColor[4]; // index 0 == R, ... , 3 == A
587 D3DDDI_ROTATION Rotation;
588 union
589 {
590 D3DKMT_SCATTERBLTS ScatterBlts; // Unused
591 struct
592 {
593 HANDLE hSyncObject; // NT handle to FlipEx fence.
594 D3DDDI_HDR_METADATA_TYPE HDRMetaDataType;
595 union
596 {
597 D3DDDI_HDR_METADATA_HDR10 HDRMetaDataHDR10;
598 D3DDDI_HDR_METADATA_HDR10PLUS HDRMetaDataHDR10Plus;
599 };
600 };
601 };
602 UINT InkCookie;
603 RECT SourceRect;
604 UINT DestWidth;
605 UINT DestHeight;
606 RECT TargetRect;
607 // DXGI_MATRIX_3X2_F: _11 _12 _21 _22 _31 _32
608 FLOAT Transform[6];
609 UINT CustomDuration;
610 D3DDDI_FLIPINTERVAL_TYPE CustomDurationFlipInterval;
611 UINT PlaneIndex;
612#endif
613#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
614 D3DDDI_COLOR_SPACE_TYPE ColorSpace;
615#endif
616 D3DKMT_DIRTYREGIONS DirtyRegions;
617} D3DKMT_FLIPMODEL_PRESENTHISTORYTOKEN;
618
619// User mode timeout is in milliseconds, kernel mode timeout is in 100 nanoseconds
620#define FLIPEX_TIMEOUT_USER (2000)
621#define FLIPEX_TIMEOUT_KERNEL (FLIPEX_TIMEOUT_USER*10000)
622
623#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
624typedef struct _D3DKMT_SURFACECOMPLETE_PRESENTHISTORYTOKEN
625{
626 D3DKMT_ALIGN64 ULONG64 hLogicalSurface;
627} D3DKMT_SURFACECOMPLETE_PRESENTHISTORYTOKEN;
628#endif
629
630typedef struct _D3DKMT_PRESENTHISTORYTOKEN
631{
632 D3DKMT_PRESENT_MODEL Model;
633 // The size of the present history token in bytes including Model.
634 // Should be set to zero by when submitting a token.
635 // It will be initialized when reading present history and can be used to
636 // go to the next token in the present history buffer.
637 UINT TokenSize;
638
639#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
640 // The binding id as specified by the Composition Surface
641 UINT64 CompositionBindingId;
642#endif
643
644 union
645 {
646 D3DKMT_FLIPMODEL_PRESENTHISTORYTOKEN Flip;
647 D3DKMT_BLTMODEL_PRESENTHISTORYTOKEN Blt;
648 D3DKMT_VISTABLTMODEL_PRESENTHISTORYTOKEN VistaBlt;
649 D3DKMT_GDIMODEL_PRESENTHISTORYTOKEN Gdi;
650 D3DKMT_FENCE_PRESENTHISTORYTOKEN Fence;
651 D3DKMT_GDIMODEL_SYSMEM_PRESENTHISTORYTOKEN GdiSysMem;
652 D3DKMT_COMPOSITION_PRESENTHISTORYTOKEN Composition;
653 D3DKMT_FLIPMANAGER_PRESENTHISTORYTOKEN FlipManager;
654#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
655 D3DKMT_SURFACECOMPLETE_PRESENTHISTORYTOKEN SurfaceComplete;
656#endif
657 }
658 Token;
659} D3DKMT_PRESENTHISTORYTOKEN;
660
661#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
662typedef struct _D3DKMT_PRESENT_RGNS
663{
664 UINT DirtyRectCount;
665 D3DKMT_PTR(_Field_size_( DirtyRectCount ) const RECT*, pDirtyRects);
666 UINT MoveRectCount;
667 D3DKMT_PTR(_Field_size_( MoveRectCount ) const D3DKMT_MOVE_RECT*, pMoveRects);
668}D3DKMT_PRESENT_RGNS;
669#endif
670
671typedef struct _D3DKMT_PRESENT
672{
673 union
674 {
675 D3DKMT_HANDLE hDevice; // in: D3D10 compatibility.
676 D3DKMT_HANDLE hContext; // in: Indentifies the context
677 };
678 D3DKMT_PTR(HWND, hWindow); // in: window to present to
679 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn source ID if RestrictVidPnSource is flagged
680 D3DKMT_HANDLE hSource; // in: Source allocation to present from
681 D3DKMT_HANDLE hDestination; // in: Destination allocation whenever non-zero
682 UINT Color; // in: color value in ARGB 32 bit format
683 RECT DstRect; // in: unclipped dest rect
684 RECT SrcRect; // in: unclipped src rect
685 UINT SubRectCnt; // in: count of sub rects
686 D3DKMT_PTR(CONST RECT*, pSrcSubRects); // in: sub rects in source space
687 UINT PresentCount; // in: present counter
688 D3DDDI_FLIPINTERVAL_TYPE FlipInterval; // in: flip interval
689 D3DKMT_PRESENTFLAGS Flags; // in:
690 ULONG BroadcastContextCount; // in: Specifies the number of context
691 // to broadcast this command buffer to.
692 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT]; // in: Specifies the handle of the context to
693 // broadcast to.
694 HANDLE PresentLimitSemaphore;
695 D3DKMT_PRESENTHISTORYTOKEN PresentHistoryToken;
696#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
697 D3DKMT_PRESENT_RGNS* pPresentRegions;
698#endif
699#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
700 union
701 {
702 D3DKMT_HANDLE hAdapter; // in: iGpu adapter for PHT redirection. Valid only when the CrossAdapter flag is set.
703 D3DKMT_HANDLE hIndirectContext; // in: indirect adapter context for redirecting through the DoD present path. Only
704 // valid if PresentIndirect flag is set.
705 };
706 UINT Duration; // in: Per-present duration. Valid only when the DurationValid flag is set.
707#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
708 D3DKMT_PTR(_Field_size_(BroadcastContextCount)
709 D3DKMT_HANDLE*, BroadcastSrcAllocation); // in: LDA
710 D3DKMT_PTR(_Field_size_opt_(BroadcastContextCount)
711 D3DKMT_HANDLE*, BroadcastDstAllocation); // in: LDA
712 UINT PrivateDriverDataSize; // in:
713 D3DKMT_PTR(_Field_size_bytes_(PrivateDriverDataSize)
714 PVOID, pPrivateDriverData); // in: Private driver data to pass to DdiPresent and DdiSetVidPnSourceAddress
715 BOOLEAN bOptimizeForComposition; // out: DWM is involved in composition
716#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
717#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
718} D3DKMT_PRESENT;
719
720#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
721typedef struct _D3DKMT_PRESENT_REDIRECTEDS_FLAGS
722{
723 union
724 {
725 struct
726 {
727 UINT Reserved : 32; // 0xFFFFFFFF
728 };
729 UINT Value;
730 };
731}D3DKMT_PRESENT_REDIRECTED_FLAGS;
732
733typedef struct _D3DKMT_PRESENT_REDIRECTED
734{
735 D3DKMT_HANDLE hSyncObj; // in: Sync object PHT waits on
736 D3DKMT_HANDLE hDevice; // in: Device associated with the present
737 D3DKMT_ALIGN64 ULONGLONG WaitedFenceValue; // in: Fence value of hSyncObj that PHT waits on
738 D3DKMT_PRESENTHISTORYTOKEN PresentHistoryToken;
739 D3DKMT_PRESENT_REDIRECTED_FLAGS Flags;
740 D3DKMT_HANDLE hSource; // in: Source allocation to present from
741 UINT PrivateDriverDataSize; // in:
742 D3DKMT_PTR(_Field_size_bytes_(PrivateDriverDataSize)
743 PVOID, pPrivateDriverData); // in: Private driver data to pass to DdiPresent and DdiSetVidPnSourceAddress
744}D3DKMT_PRESENT_REDIRECTED;
745#endif
746
747#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
748typedef struct _D3DKMT_CANCEL_PRESENTS_FLAGS
749{
750 union
751 {
752 // D3DKMT_CANCEL_PRESENTS_OPERATION_REPROGRAM_INTERRUPT flags
753 struct
754 {
755 UINT NewVSyncInterruptState : 1;
756 UINT Reserved : 31;
757 } ReprogramInterrupt;
758
759 UINT Value;
760 };
761}D3DKMT_CANCEL_PRESENTS_FLAGS;
762
763
764typedef enum D3DKMT_CANCEL_PRESENTS_OPERATION
765{
766 D3DKMT_CANCEL_PRESENTS_OPERATION_CANCEL_FROM = 0,
767 D3DKMT_CANCEL_PRESENTS_OPERATION_REPROGRAM_INTERRUPT = 1
768} D3DKMT_CANCEL_PRESENTS_OPERATION;
769
770typedef struct _D3DKMT_CANCEL_PRESENTS
771{
772 UINT cbSize;
773 D3DKMT_HANDLE hDevice;
774 D3DKMT_CANCEL_PRESENTS_FLAGS Flags;
775 D3DKMT_CANCEL_PRESENTS_OPERATION Operation;
776 D3DKMT_ALIGN64 UINT64 CancelFromPresentId;
777 LUID CompSurfaceLuid;
778 D3DKMT_ALIGN64 UINT64 BindId;
779}D3DKMT_CANCEL_PRESENTS;
780#endif
781
782#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
783
784typedef struct _D3DKMT_SUBMITPRESENTBLTTOHWQUEUE
785{
786 D3DKMT_HANDLE hHwQueue;
787 D3DKMT_ALIGN64 UINT64 HwQueueProgressFenceId;
788 D3DKMT_PRESENT PrivatePresentData;
789} D3DKMT_SUBMITPRESENTBLTTOHWQUEUE;
790
791#endif
792
793#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5)
794
795typedef struct _D3DKMT_SUBMITPRESENTTOHWQUEUE
796{
797 D3DKMT_PTR(_Field_size_(PrivatePresentData.BroadcastContextCount + 1)
798 D3DKMT_HANDLE*, hHwQueues);
799 D3DKMT_PRESENT PrivatePresentData;
800} D3DKMT_SUBMITPRESENTTOHWQUEUE;
801
802#endif
803
804#define D3DKMT_MAX_MULTIPLANE_OVERLAY_PLANES 8
805#define D3DKMT_MAX_MULTIPLANE_OVERLAY_ALLOCATIONS_PER_PLANE 256
806
807typedef enum D3DKMT_MULTIPLANE_OVERLAY_FLAGS
808{
809 D3DKMT_MULTIPLANE_OVERLAY_FLAG_VERTICAL_FLIP = 0x1,
810 D3DKMT_MULTIPLANE_OVERLAY_FLAG_HORIZONTAL_FLIP = 0x2,
811#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
812 D3DKMT_MULTIPLANE_OVERLAY_FLAG_STATIC_CHECK = 0x4,
813#endif // DXGKDDI_INTERFACE_VERSION_WDDM3_0
814} D3DKMT_MULTIPLANE_OVERLAY_FLAGS;
815
816typedef enum D3DKMT_MULTIPLANE_OVERLAY_BLEND
817{
818 D3DKMT_MULTIPLANE_OVERLAY_BLEND_OPAQUE = 0x0,
819 D3DKMT_MULTIPLANE_OVERLAY_BLEND_ALPHABLEND = 0x1,
820} D3DKMT_MULTIPLANE_OVERLAY_BLEND;
821
822typedef enum D3DKMT_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT
823{
824 D3DKMT_MULIIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0,
825 D3DKMT_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1,
826 D3DKMT_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2
827} D3DKMT_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT;
828
829typedef enum D3DKMT_MULTIPLANE_OVERLAY_YCbCr_FLAGS
830{
831 D3DKMT_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, // 16 - 235 vs. 0 - 255
832 D3DKMT_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, // BT.709 vs. BT.601
833 D3DKMT_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, // xvYCC vs. conventional YCbCr
834} D3DKMT_MULTIPLANE_OVERLAY_YCbCr_FLAGS;
835
836typedef enum D3DKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT
837{
838 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_MONO = 0,
839 D3DKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_HORIZONTAL = 1,
840 D3DKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_VERTICAL = 2,
841 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_SEPARATE = 3,
842 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_MONO_OFFSET = 4,
843 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_ROW_INTERLEAVED = 5,
844 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_COLUMN_INTERLEAVED = 6,
845 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT_CHECKERBOARD = 7
846} D3DKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT;
847
848typedef enum _DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE
849{
850 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_NONE = 0,
851 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_FRAME0 = 1,
852 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_FRAME1 = 2,
853} DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE;
854
855typedef enum _DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY
856{
857 DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY_BILINEAR = 0x1, // Bilinear
858 DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY_HIGH = 0x2, // Maximum
859} DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY;
860
861typedef struct D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES
862{
863 UINT Flags; // D3DKMT_MULTIPLANE_OVERLAY_FLAGS
864 RECT SrcRect;
865 RECT DstRect;
866#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
867 RECT ClipRect;
868#endif
869 D3DDDI_ROTATION Rotation;
870 D3DKMT_MULTIPLANE_OVERLAY_BLEND Blend;
871#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
872 UINT DirtyRectCount;
873 D3DKMT_PTR(RECT*, pDirtyRects);
874#else
875 UINT NumFilters;
876 D3DKMT_PTR(void*, pFilters);
877#endif
878 D3DKMT_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT VideoFrameFormat;
879 UINT YCbCrFlags; // D3DKMT_MULTIPLANE_OVERLAY_YCbCr_FLAGS
880 D3DKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT StereoFormat;
881 BOOL StereoLeftViewFrame0;
882 BOOL StereoBaseViewFrame0;
883 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE StereoFlipMode;
884#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
885 DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality;
886#endif
887} D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES;
888
889#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM_1_3)
890typedef struct D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE
891{
892 D3DKMT_HANDLE hResource;
893 LUID CompSurfaceLuid;
894 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
895 D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes;
896} D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE;
897
898typedef struct D3DKMT_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO
899{
900 union
901 {
902 struct
903 {
904 UINT FailingPlane : 4; // The 0 based index of the first plane that could not be supported
905 UINT TryAgain : 1; // The configuration is not supported due to a transition condition, which should shortly go away
906 UINT Reserved : 27;
907 };
908 UINT Value;
909 };
910} D3DKMT_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO;
911
912typedef struct _D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT
913{
914 D3DKMT_HANDLE hDevice; // in : Indentifies the device
915 UINT PlaneCount; // in : Number of resources to pin
916 D3DKMT_PTR(D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE*, pOverlayPlanes); // in : Array of resource handles to pin
918 D3DKMT_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO ReturnInfo;
919} D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT;
920#endif
921
922#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM_2_0)
923typedef struct _D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES2
924{
925 UINT Flags; // D3DKMT_MULTIPLANE_OVERLAY_FLAGS
926 RECT SrcRect; // Specifies the source rectangle, of type RECT, relative to the source resource.
927 RECT DstRect; // Specifies the destination rectangle, of type RECT, relative to the monitor resolution.
928 RECT ClipRect; // Specifies any additional clipping, of type RECT, relative to the DstRect rectangle,
929 // after the data has been stretched according to the values of SrcRect and DstRect.
930
931 // The driver and hardware can use the ClipRect member to apply a common stretch factor
932 // as the clipping changes when an app occludes part of the DstRect destination rectangle.
933 D3DDDI_ROTATION Rotation; // Specifies the clockwise rotation of the overlay plane, given as a value from the D3DDDI_ROTATION enumeration.
934 D3DKMT_MULTIPLANE_OVERLAY_BLEND Blend; // Specifies the blend mode that applies to this overlay plane and the plane beneath it, given as a value from the DXGK_MULTIPLANE_OVERLAY_BLEND enumeration.
935 UINT DirtyRectCount;
936 D3DKMT_PTR(RECT*, pDirtyRects);
937 D3DKMT_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT VideoFrameFormat; // DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT
938 D3DDDI_COLOR_SPACE_TYPE ColorSpace;
939 D3DKMT_MULTIPLANE_OVERLAY_STEREO_FORMAT StereoFormat; // DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT
940 BOOL StereoLeftViewFrame0; // Reserved for system use. Must always be FALSE.
941 BOOL StereoBaseViewFrame0; // Reserved for system use. Must always be FALSE.
942 DXGKMT_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE StereoFlipMode; // DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE
943 DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; // DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY
945} D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES2;
946
947typedef struct _D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE2
948{
949 UINT LayerIndex;
950 D3DKMT_HANDLE hResource;
951 LUID CompSurfaceLuid;
952 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
953 D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES2 PlaneAttributes;
954} D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE2;
955
956typedef struct _D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT2
957{
958 D3DKMT_HANDLE hAdapter; // in: adapter handle
959 D3DKMT_HANDLE hDevice; // in : Indentifies the device
960 UINT PlaneCount; // in : Number of resources to pin
961 D3DKMT_PTR(D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE2*, pOverlayPlanes); // in : Array of resource handles to pin
963 D3DKMT_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO ReturnInfo;
964} D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT2;
965
966typedef struct _D3DKMT_MULTIPLANE_OVERLAY2
967{
968 UINT LayerIndex;
970 D3DKMT_HANDLE hAllocation;
971 D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES2 PlaneAttributes;
972} D3DKMT_MULTIPLANE_OVERLAY2;
973
974typedef struct _D3DKMT_PRESENT_MULTIPLANE_OVERLAY2
975{
976 D3DKMT_HANDLE hAdapter; // in: adapter handle
977 union
978 {
979 D3DKMT_HANDLE hDevice; // in: D3D10 compatibility.
980 D3DKMT_HANDLE hContext; // in: Indentifies the context
981 };
982 ULONG BroadcastContextCount; // in: Specifies the number of context
983 // to broadcast this command buffer to.
984 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT]; // in: Specifies the handle of the context to
985 // broadcast to.
986
987 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn source ID if RestrictVidPnSource is flagged
988 UINT PresentCount; // in: present counter
989 D3DDDI_FLIPINTERVAL_TYPE FlipInterval; // in: flip interval
990 D3DKMT_PRESENTFLAGS Flags; // in:
991
992 UINT PresentPlaneCount;
993 D3DKMT_PTR(D3DKMT_MULTIPLANE_OVERLAY2*, pPresentPlanes);
994 UINT Duration;
995} D3DKMT_PRESENT_MULTIPLANE_OVERLAY2;
996#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0
997
998#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
999typedef struct _D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES3
1000{
1001 UINT Flags; // D3DKMT_MULTIPLANE_OVERLAY_FLAGS
1002 RECT SrcRect; // Specifies the source rectangle, of type RECT, relative to the source resource.
1003 RECT DstRect; // Specifies the destination rectangle, of type RECT, relative to the monitor resolution.
1004 RECT ClipRect; // Specifies any additional clipping, of type RECT, relative to the DstRect rectangle,
1005 // after the data has been stretched according to the values of SrcRect and DstRect.
1006
1007 // The driver and hardware can use the ClipRect member to apply a common stretch factor
1008 // as the clipping changes when an app occludes part of the DstRect destination rectangle.
1009 D3DDDI_ROTATION Rotation; // Specifies the clockwise rotation of the overlay plane, given as a value from the D3DDDI_ROTATION enumeration.
1010 D3DKMT_MULTIPLANE_OVERLAY_BLEND Blend; // Specifies the blend mode that applies to this overlay plane and the plane beneath it, given as a value from the DXGK_MULTIPLANE_OVERLAY_BLEND enumeration.
1011 UINT DirtyRectCount;
1012 D3DKMT_PTR(_Field_size_(DirtyRectCount) RECT*, pDirtyRects);
1013 D3DDDI_COLOR_SPACE_TYPE ColorSpace;
1014 DXGKMT_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; // DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY
1015#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
1016 UINT SDRWhiteLevel;
1017#endif
1018} D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES3;
1019
1020typedef struct _D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE3
1021{
1022 UINT LayerIndex;
1023 D3DKMT_HANDLE hResource;
1024 LUID CompSurfaceLuid;
1025 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1026 D3DKMT_PTR(D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES3*, pPlaneAttributes);
1027} D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE3;
1028
1029typedef struct _D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION_FLAGS
1030{
1031 union
1032 {
1033 struct
1034 {
1035 UINT VerticalFlip : 1; // 0x00000001
1036 UINT HorizontalFlip : 1; // 0x00000002
1037 UINT Reserved :30; // 0xFFFFFFFC
1038 };
1039 UINT Value;
1040 };
1041} D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION_FLAGS;
1042
1043typedef struct _D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION
1044{
1045 D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION_FLAGS Flags;
1046 RECT SrcRect;
1047 RECT DstRect;
1048 D3DDDI_ROTATION Rotation;
1049} D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION;
1050
1051typedef struct _D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION_WITH_SOURCE
1052{
1053 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1054 D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION PostComposition;
1055} D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION_WITH_SOURCE;
1056
1057typedef struct _D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT3
1058{
1059 D3DKMT_HANDLE hAdapter; // in: adapter handle
1060 D3DKMT_HANDLE hDevice; // in : Indentifies the device
1061 UINT PlaneCount; // in : Number of resources to pin
1062 // Note: Array-of-pointers don't work in 32bit WSL
1063 _Field_size_(PlaneCount)
1064 D3DKMT_CHECK_MULTIPLANE_OVERLAY_PLANE3** ppOverlayPlanes; // in : Array of pointers to overlay planes
1065 UINT PostCompositionCount; // in : Number of resources to pin
1066 _Field_size_(PostCompositionCount)
1067 D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION_WITH_SOURCE** ppPostComposition; // in : Array of pointers to overlay planes
1069 D3DKMT_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO ReturnInfo;
1070} D3DKMT_CHECKMULTIPLANEOVERLAYSUPPORT3;
1071
1072typedef struct _D3DKMT_PLANE_SPECIFIC_INPUT_FLAGS
1073{
1074 union
1075 {
1076 struct
1077 {
1078 UINT Enabled : 1; // 0x00000001
1079 UINT Reserved :31; // 0xFFFFFFFE
1080 };
1081 UINT Value;
1082 };
1083} D3DKMT_PLANE_SPECIFIC_INPUT_FLAGS;
1084
1085typedef struct _D3DKMT_PLANE_SPECIFIC_OUTPUT_FLAGS
1086{
1087 union
1088 {
1089 struct
1090 {
1091 UINT FlipConvertedToImmediate : 1; // 0x00000001
1092 UINT Reserved :31; // 0xFFFFFFFE
1093 };
1094 UINT Value;
1095 };
1096} D3DKMT_PLANE_SPECIFIC_OUTPUT_FLAGS;
1097
1098typedef struct _D3DKMT_MULTIPLANE_OVERLAY3
1099{
1100 UINT LayerIndex;
1101 D3DKMT_PLANE_SPECIFIC_INPUT_FLAGS InputFlags;
1102 D3DDDI_FLIPINTERVAL_TYPE FlipInterval;
1103 UINT MaxImmediateFlipLine;
1104 UINT AllocationCount;
1105 D3DKMT_PTR(_Field_size_(AllocationCount)
1106 D3DKMT_HANDLE*, pAllocationList);
1107 UINT DriverPrivateDataSize;
1108 D3DKMT_PTR(_Field_size_bytes_(DriverPrivateDataSize)
1109 VOID*, pDriverPrivateData);
1110 D3DKMT_PTR(const D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES3*, pPlaneAttributes);
1111 D3DKMT_HANDLE hFlipToFence;
1112 D3DKMT_HANDLE hFlipAwayFence;
1113 D3DKMT_ALIGN64 UINT64 FlipToFenceValue;
1114 D3DKMT_ALIGN64 UINT64 FlipAwayFenceValue;
1115} D3DKMT_MULTIPLANE_OVERLAY3;
1116
1117typedef struct _D3DKMT_PRESENT_MULTIPLANE_OVERLAY_FLAGS
1118{
1119 union
1120 {
1121 struct
1122 {
1123 UINT FlipStereo : 1; // 0x00000001 This is a flip from a stereo alloc. Used in addition to FlipImmediate or FlipOnNextVSync.
1124 UINT FlipStereoTemporaryMono : 1; // 0x00000002 This is a flip from a stereo alloc. The left image should used. Used in addition to FlipImmediate or FlipOnNextVSync.
1125 UINT FlipStereoPreferRight : 1; // 0x00000004 This is a flip from a stereo alloc. The right image should used when cloning to a mono monitor. Used in addition to FlipImmediate or FlipOnNextVSync.
1126 UINT FlipDoNotWait : 1; // 0x00000008
1127 UINT FlipDoNotFlip : 1; // 0x00000010
1128 UINT FlipRestart : 1; // 0x00000020
1129 UINT DurationValid : 1; // 0x00000040
1130 UINT HDRMetaDataValid : 1; // 0x00000080
1131 UINT HMD : 1; // 0x00000100
1132 UINT TrueImmediate : 1; // 0x00000200 If a present interval is 0, allow tearing rather than override a previously queued flip
1133 UINT Reserved :22; // 0xFFFFFE00
1134 };
1135 UINT Value;
1136 };
1137} D3DKMT_PRESENT_MULTIPLANE_OVERLAY_FLAGS;
1138
1139typedef struct _D3DKMT_PRESENT_MULTIPLANE_OVERLAY3
1140{
1141 D3DKMT_HANDLE hAdapter; // in: adapter handle
1142 UINT ContextCount;
1143 D3DKMT_PTR(_Field_size_(ContextCount)
1144 D3DKMT_HANDLE*, pContextList);
1145
1146 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn source ID if RestrictVidPnSource is flagged
1147 UINT PresentCount; // in: present counter
1148 D3DKMT_PRESENT_MULTIPLANE_OVERLAY_FLAGS Flags; // in:
1149
1150 UINT PresentPlaneCount;
1151 // Note: Array-of-pointers don't work in 32bit WSL
1152 _Field_size_(PresentPlaneCount)
1153 D3DKMT_MULTIPLANE_OVERLAY3** ppPresentPlanes;
1154 D3DKMT_PTR(D3DKMT_MULTIPLANE_OVERLAY_POST_COMPOSITION*, pPostComposition);
1155 UINT Duration;
1156 D3DDDI_HDR_METADATA_TYPE HDRMetaDataType;
1157 UINT HDRMetaDataSize;
1158 D3DKMT_PTR(_Field_size_bytes_(HDRMetaDataSize)
1159 const VOID*, pHDRMetaData);
1160 UINT BoostRefreshRateMultiplier;
1161} D3DKMT_PRESENT_MULTIPLANE_OVERLAY3;
1162#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1
1163
1164#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
1165typedef struct _D3DKMT_MULTIPLANE_OVERLAY_CAPS
1166{
1167 union
1168 {
1169 struct
1170 {
1171 UINT Rotation : 1; // Full rotation
1172 UINT RotationWithoutIndependentFlip : 1; // Rotation, but without simultaneous IndependentFlip support
1173 UINT VerticalFlip : 1; // Can flip the data vertically
1174 UINT HorizontalFlip : 1; // Can flip the data horizontally
1175 UINT StretchRGB : 1; // Supports stretching RGB formats
1176 UINT StretchYUV : 1; // Supports stretching YUV formats
1177 UINT BilinearFilter : 1; // Blinear filtering
1178 UINT HighFilter : 1; // Better than bilinear filtering
1179 UINT Shared : 1; // MPO resources are shared across VidPnSources
1180 UINT Immediate : 1; // Immediate flip support
1181 UINT Plane0ForVirtualModeOnly : 1; // Stretching plane 0 will also stretch the HW cursor and should only be used for virtual mode support
1182 UINT Version3DDISupport : 1; // Driver supports the 2.2 MPO DDIs
1183 UINT Reserved : 20;
1184 };
1185 UINT Value;
1186 };
1187} D3DKMT_MULTIPLANE_OVERLAY_CAPS;
1188
1189typedef struct _D3DKMT_GET_MULTIPLANE_OVERLAY_CAPS
1190{
1191 D3DKMT_HANDLE hAdapter; // in: adapter handle
1192 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in
1193 UINT MaxPlanes; // out: Total number of planes currently supported
1194 UINT MaxRGBPlanes; // out: Number of RGB planes currently supported
1195 UINT MaxYUVPlanes; // out: Number of YUV planes currently supported
1196 D3DKMT_MULTIPLANE_OVERLAY_CAPS OverlayCaps; // out: Overlay capabilities
1197 float MaxStretchFactor; // out
1198 float MaxShrinkFactor; // out
1199} D3DKMT_GET_MULTIPLANE_OVERLAY_CAPS;
1200
1201typedef struct _D3DKMT_GET_POST_COMPOSITION_CAPS
1202{
1203 D3DKMT_HANDLE hAdapter; // in: adapter handle
1204 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in
1205 float MaxStretchFactor; // out
1206 float MaxShrinkFactor; // out
1207} D3DKMT_GET_POST_COMPOSITION_CAPS;
1208
1209typedef struct _D3DKMT_MULTIPLANEOVERLAY_STRETCH_SUPPORT
1210{
1211 UINT VidPnSourceId;
1212 BOOL Update;
1214} D3DKMT_MULTIPLANEOVERLAY_STRETCH_SUPPORT;
1215#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2
1216
1217typedef struct D3DKMT_MULTIPLANE_OVERLAY
1218{
1219 UINT LayerIndex;
1220 BOOL Enabled;
1221 D3DKMT_HANDLE hAllocation;
1222 D3DKMT_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes;
1223} D3DKMT_MULTIPLANE_OVERLAY;
1224
1225typedef struct D3DKMT_PRESENT_MULTIPLANE_OVERLAY
1226{
1227 union
1228 {
1229 D3DKMT_HANDLE hDevice; // in: D3D10 compatibility.
1230 D3DKMT_HANDLE hContext; // in: Indentifies the context
1231 };
1232 ULONG BroadcastContextCount; // in: Specifies the number of context
1233 // to broadcast this command buffer to.
1234 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT]; // in: Specifies the handle of the context to
1235 // broadcast to.
1236
1237 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn source ID if RestrictVidPnSource is flagged
1238 UINT PresentCount; // in: present counter
1239 D3DDDI_FLIPINTERVAL_TYPE FlipInterval; // in: flip interval
1240 D3DKMT_PRESENTFLAGS Flags; // in:
1241
1242 UINT PresentPlaneCount;
1243 D3DKMT_MULTIPLANE_OVERLAY* pPresentPlanes;
1244 UINT Duration;
1245} D3DKMT_PRESENT_MULTIPLANE_OVERLAY;
1246
1247typedef struct _D3DKMT_RENDERFLAGS
1248{
1249 UINT ResizeCommandBuffer : 1; // 0x00000001
1250 UINT ResizeAllocationList : 1; // 0x00000002
1251 UINT ResizePatchLocationList : 1; // 0x00000004
1252 UINT NullRendering : 1; // 0x00000008
1253 UINT PresentRedirected : 1; // 0x00000010
1254 UINT RenderKm : 1; // 0x00000020 Cannot be used with DxgkRender
1255 UINT RenderKmReadback : 1; // 0x00000040 Cannot be used with DxgkRender
1256 UINT Reserved : 25; // 0xFFFFFF80
1257} D3DKMT_RENDERFLAGS;
1258
1259#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
1260typedef struct _D3DKMT_OUTPUTDUPLPRESENTFLAGS
1261{
1262 union
1263 {
1264 struct
1265 {
1266 UINT ProtectedContentBlankedOut : 1;
1267 UINT RemoteSession : 1;
1268 UINT FullScreenPresent : 1;
1269 UINT PresentIndirect : 1;
1270 UINT Reserved : 28;
1271 };
1272 UINT Value;
1273 };
1274}D3DKMT_OUTPUTDUPLPRESENTFLAGS;
1275
1276typedef struct _D3DKMT_OUTPUTDUPLPRESENT
1277{
1278 D3DKMT_HANDLE hContext; // in: Indentifies the context
1279 D3DKMT_HANDLE hSource; // in: Source allocation to present from
1280 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1281 ULONG BroadcastContextCount; // in: Specifies the number of context
1282 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT]; // in: Specifies the handle of the context to
1283 D3DKMT_PRESENT_RGNS PresentRegions; // in: Dirty and move regions
1284 D3DKMT_OUTPUTDUPLPRESENTFLAGS Flags;
1285 D3DKMT_HANDLE hIndirectContext;
1286} D3DKMT_OUTPUTDUPLPRESENT;
1287#endif
1288
1289#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
1290
1291typedef struct _D3DKMT_OUTPUTDUPLPRESENTTOHWQUEUE
1292{
1293 D3DKMT_HANDLE hSource; // in: Source allocation to present from
1294 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1295 ULONG BroadcastHwQueueCount;
1296 D3DKMT_PTR(_Field_size_(BroadcastHwQueueCount)
1297 D3DKMT_HANDLE*, hHwQueues);
1298 D3DKMT_PRESENT_RGNS PresentRegions; // in: Dirty and move regions
1299 D3DKMT_OUTPUTDUPLPRESENTFLAGS Flags;
1300 D3DKMT_HANDLE hIndirectHwQueue;
1301} D3DKMT_OUTPUTDUPLPRESENTTOHWQUEUE;
1302
1303#endif
1304
1305typedef struct _D3DKMT_RENDER
1306{
1307 union
1308 {
1309 D3DKMT_HANDLE hDevice; // in: D3D10 compatibility.
1310 D3DKMT_HANDLE hContext; // in: Indentifies the context
1311 };
1312 UINT CommandOffset; // in: offset in bytes from start
1313 UINT CommandLength; // in: number of bytes
1314 UINT AllocationCount; // in: Number of allocations in allocation list.
1315 UINT PatchLocationCount; // in: Number of patch locations in patch allocation list.
1316 D3DKMT_PTR(VOID*, pNewCommandBuffer); // out: Pointer to the next command buffer to use.
1317 // in: When RenderKm flag is set, it points to a command buffer.
1318 UINT NewCommandBufferSize; // in: Size requested for the next command buffer.
1319 // out: Size of the next command buffer to use.
1320 D3DKMT_PTR(D3DDDI_ALLOCATIONLIST*, pNewAllocationList); // out: Pointer to the next allocation list to use.
1321 // in: When RenderKm flag is set, it points to an allocation list.
1322 UINT NewAllocationListSize; // in: Size requested for the next allocation list.
1323 // out: Size of the new allocation list.
1324 D3DKMT_PTR(D3DDDI_PATCHLOCATIONLIST*, pNewPatchLocationList); // out: Pointer to the next patch location list.
1325 UINT NewPatchLocationListSize; // in: Size requested for the next patch location list.
1326 // out: Size of the new patch location list.
1327 D3DKMT_RENDERFLAGS Flags; // in:
1328 D3DKMT_ALIGN64 ULONGLONG PresentHistoryToken; // in: Present history token for redirected present calls
1329 ULONG BroadcastContextCount; // in: Specifies the number of context
1330 // to broadcast this command buffer to.
1331 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT]; // in: Specifies the handle of the context to
1332 // broadcast to.
1333 ULONG QueuedBufferCount; // out: Number of DMA buffer queued to this context after this submission.
1334 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS NewCommandBuffer; // out: GPU virtual address of next command buffer to use. _ADVSCH_
1335 D3DKMT_PTR(VOID*, pPrivateDriverData); // in: pointer to private driver data. _ADVSCH_
1336 UINT PrivateDriverDataSize; // in: size of private driver data. _ADVSCH_
1337} D3DKMT_RENDER;
1338
1339
1340typedef enum _D3DKMT_STANDARDALLOCATIONTYPE
1341{
1342 D3DKMT_STANDARDALLOCATIONTYPE_EXISTINGHEAP = 1,
1343 D3DKMT_STANDARDALLOCATIONTYPE_INTERNALBACKINGSTORE = 2,
1344 D3DKMT_STANDARDALLOCATIONTYPE_MAX,
1345} D3DKMT_STANDARDALLOCATIONTYPE;
1346
1347typedef struct _D3DKMT_STANDARDALLOCATION_EXISTINGHEAP
1348{
1349 D3DKMT_ALIGN64 D3DKMT_SIZE_T Size; // in: Size in bytes of existing heap
1350} D3DKMT_STANDARDALLOCATION_EXISTINGHEAP;
1351
1352typedef struct _D3DKMT_CREATESTANDARDALLOCATIONFLAGS
1353{
1354 union
1355 {
1356 struct
1357 {
1358 UINT Reserved : 32; // 0xFFFFFFFF
1359 };
1360 UINT Value;
1361 };
1362} D3DKMT_CREATESTANDARDALLOCATIONFLAGS;
1363
1364typedef struct _D3DKMT_CREATESTANDARDALLOCATION
1365{
1366 //
1367 // update onecoreuap/windows/core/ntuser/inc/whwin32.tpl when adding new memeber
1368 // to this struct
1369 //
1370 D3DKMT_STANDARDALLOCATIONTYPE Type;
1371 union
1372 {
1373 D3DKMT_STANDARDALLOCATION_EXISTINGHEAP ExistingHeapData;
1374 };
1375 D3DKMT_CREATESTANDARDALLOCATIONFLAGS Flags;
1376} D3DKMT_CREATESTANDARDALLOCATION;
1377
1378typedef struct _D3DKMT_CREATEALLOCATIONFLAGS
1379{
1380 UINT CreateResource : 1; // 0x00000001
1381 UINT CreateShared : 1; // 0x00000002
1382 UINT NonSecure : 1; // 0x00000004
1383 UINT CreateProtected : 1; // 0x00000008 Cannot be used when allocation is created from the user mode.
1384 UINT RestrictSharedAccess : 1; // 0x00000010
1385 UINT ExistingSysMem : 1; // 0x00000020 Cannot be used when allocation is created from the user mode.
1386#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
1387 UINT NtSecuritySharing : 1; // 0x00000040
1388 UINT ReadOnly : 1; // 0x00000080
1389 UINT CreateWriteCombined : 1; // 0x00000100 Cannot be used when allocation is created from the user mode.
1390 UINT CreateCached : 1; // 0x00000200 Cannot be used when allocation is created from the user mode.
1391 UINT SwapChainBackBuffer : 1; // 0x00000400 Specifies whether an allocation corresponds to a swap chain back buffer.
1392#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
1393 UINT CrossAdapter : 1; // 0x00000800
1394 UINT OpenCrossAdapter : 1; // 0x00001000 Cannot be used when allocation is created from the user mode.
1395 UINT PartialSharedCreation : 1; // 0x00002000
1396 UINT Zeroed : 1; // 0x00004000 // out: set when allocation fulfilled by zero pages
1397 UINT WriteWatch : 1; // 0x00008000 // in: request Mm to track writes to pages of this allocation
1398#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
1399 UINT StandardAllocation : 1; // 0x00010000 // in: use pStandardAllocation instead of pPrivateDriverData
1400 UINT ExistingSection : 1; // 0x00020000 // in: Use Section Handle instead of SysMem in D3DDI_ALLOCATIONINFO2
1401#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
1402 UINT AllowNotZeroed : 1; // 0x00040000 // in: indicate zeroed pages are not required
1403#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
1404 UINT PhysicallyContiguous : 1; // 0x00080000 // in: indicate allocation must be physically contguous
1405 UINT NoKmdAccess : 1; // 0x00100000 // in: KMD is not notified about the allocation
1406#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
1407 UINT SharedDisplayable : 1; // 0x00200000
1408 UINT Reserved : 10; // 0xFFC00000
1409#else
1410 UINT Reserved : 11; // 0xFFE00000
1411#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
1412#else
1413 UINT Reserved : 13; // 0xFFF80000
1414#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
1415#else
1416 UINT Reserved : 14; // 0xFFFC0000
1417#endif //(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
1418#else
1419 UINT Reserved : 16; // 0xFFFF0000
1420#endif //(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
1421#else
1422 UINT Reserved : 21; // 0xFFFFF800
1423#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
1424#else
1425 UINT Reserved : 26; // 0xFFFFFFC0
1426#endif
1427} D3DKMT_CREATEALLOCATIONFLAGS;
1428
1429typedef struct _D3DKMT_CREATEALLOCATION
1430{
1431 D3DKMT_HANDLE hDevice;
1432 D3DKMT_HANDLE hResource; //in/out:valid only within device
1433 D3DKMT_HANDLE hGlobalShare; //out:Shared handle if CreateShared and not NtSecuritySharing
1434 D3DKMT_PTR(_Field_size_bytes_(PrivateRuntimeDataSize)
1435 CONST VOID*, pPrivateRuntimeData);
1436 UINT PrivateRuntimeDataSize;
1437 union
1438 {
1439 //
1440 // update onecoreuap/windows/core/ntuser/inc/whwin32.tpl when adding new memeber
1441 // to this union
1442 //
1443 D3DKMT_CREATESTANDARDALLOCATION* pStandardAllocation;
1444 _Field_size_bytes_(PrivateDriverDataSize)
1445 CONST VOID* pPrivateDriverData;
1446 D3DKMT_PTR_HELPER( AlignUnionTo64_1)
1447 };
1448 UINT PrivateDriverDataSize;
1449 UINT NumAllocations;
1450 union
1451 {
1452 _Field_size_(NumAllocations) D3DDDI_ALLOCATIONINFO* pAllocationInfo;
1453#if ((DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) || \
1454 (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN7))
1455 _Field_size_(NumAllocations) D3DDDI_ALLOCATIONINFO2* pAllocationInfo2; // _ADVSCH_
1456#endif
1457 D3DKMT_PTR_HELPER( AlignUnionTo64_2)
1458 };
1459 D3DKMT_CREATEALLOCATIONFLAGS Flags;
1460 D3DKMT_PTR(HANDLE, hPrivateRuntimeResourceHandle); // opaque handle used for event tracing
1461} D3DKMT_CREATEALLOCATION;
1462
1463typedef struct _D3DKMT_OPENRESOURCE
1464{
1465 D3DKMT_HANDLE hDevice; // in : Indentifies the device
1466 D3DKMT_HANDLE hGlobalShare; // in : Shared resource handle
1467 UINT NumAllocations; // in : Number of allocations associated with the resource
1468 union {
1469 _Field_size_(NumAllocations) D3DDDI_OPENALLOCATIONINFO* pOpenAllocationInfo; // in : Array of open allocation structs
1470#if ((DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) || \
1471 (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN7))
1472 _Field_size_(NumAllocations) D3DDDI_OPENALLOCATIONINFO2* pOpenAllocationInfo2; // in : Array of open allocation structs // _ADVSCH_
1473#endif
1474 D3DKMT_PTR_HELPER(AlignUnionTo64)
1475 };
1476 D3DKMT_PTR(_Field_size_bytes_(PrivateRuntimeDataSize) VOID*, pPrivateRuntimeData); // in : Caller supplied buffer where the runtime private data associated with this resource will be copied
1477 UINT PrivateRuntimeDataSize; // in : Size in bytes of the pPrivateRuntimeData buffer
1478 D3DKMT_PTR(_Field_size_bytes_(ResourcePrivateDriverDataSize) VOID*, pResourcePrivateDriverData); // in : Caller supplied buffer where the driver private data associated with the resource will be copied
1479 UINT ResourcePrivateDriverDataSize; // in : Size in bytes of the pResourcePrivateDriverData buffer
1480 D3DKMT_PTR(_Field_size_bytes_(TotalPrivateDriverDataBufferSize) VOID*, pTotalPrivateDriverDataBuffer); // in : Caller supplied buffer where the Driver private data will be stored
1481 UINT TotalPrivateDriverDataBufferSize; // in/out : Size in bytes of pTotalPrivateDriverDataBuffer / Size in bytes of data written to pTotalPrivateDriverDataBuffer
1482 D3DKMT_HANDLE hResource; // out : Handle for this resource in this process
1483}D3DKMT_OPENRESOURCE;
1484
1485#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
1486typedef struct _D3DKMT_OPENRESOURCEFROMNTHANDLE
1487{
1488 D3DKMT_HANDLE hDevice; // in : Indentifies the device
1489 D3DKMT_PTR( HANDLE, hNtHandle); // in : Process's NT handle
1490 UINT NumAllocations; // in : Number of allocations associated with the resource
1491 D3DKMT_PTR(_Field_size_(NumAllocations) D3DDDI_OPENALLOCATIONINFO2*, pOpenAllocationInfo2); // in : Array of open allocation structs // _ADVSCH_
1492 UINT PrivateRuntimeDataSize; // in : Size in bytes of the pPrivateRuntimeData buffer
1493 D3DKMT_PTR(_Field_size_bytes_(PrivateRuntimeDataSize) VOID*, pPrivateRuntimeData); // in : Caller supplied buffer where the runtime private data associated with this resource will be copied
1494 UINT ResourcePrivateDriverDataSize; // in : Size in bytes of the pResourcePrivateDriverData buffer
1495 D3DKMT_PTR(_Field_size_bytes_(ResourcePrivateDriverDataSize) VOID*, pResourcePrivateDriverData); // in : Caller supplied buffer where the driver private data associated with the resource will be copied
1496 UINT TotalPrivateDriverDataBufferSize; // in/out : Size in bytes of pTotalPrivateDriverDataBuffer / Size in bytes of data written to pTotalPrivateDriverDataBuffer
1497 D3DKMT_PTR(_Field_size_bytes_(TotalPrivateDriverDataBufferSize) VOID*, pTotalPrivateDriverDataBuffer); // in : Caller supplied buffer where the Driver private data will be stored
1498 D3DKMT_HANDLE hResource; // out : Handle for this resource in this process
1499
1500 D3DKMT_HANDLE hKeyedMutex; // out: Handle to the keyed mutex in this process
1501 D3DKMT_PTR(_In_reads_bytes_opt_(PrivateRuntimeDataSize) VOID*, pKeyedMutexPrivateRuntimeData); // in: Buffer containing initial private data.
1502 // If NULL then PrivateRuntimeDataSize must be 0.
1503 // It will only be copied if the keyed mutex does not already have private data.
1504 UINT KeyedMutexPrivateRuntimeDataSize; // in: Size in bytes of pPrivateRuntimeData.
1505 D3DKMT_HANDLE hSyncObject; // out: Handle to sync object in this process.
1506} D3DKMT_OPENRESOURCEFROMNTHANDLE;
1507
1508typedef struct _D3DKMT_OPENSYNCOBJECTFROMNTHANDLE
1509{
1510 D3DKMT_PTR(HANDLE, hNtHandle); // in : NT handle for the sync object.
1511 D3DKMT_HANDLE hSyncObject; // out: Handle to sync object in this process.
1512} D3DKMT_OPENSYNCOBJECTFROMNTHANDLE;
1513
1514#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
1515
1516typedef struct _D3DKMT_OPENSYNCOBJECTFROMNTHANDLE2
1517{
1518 D3DKMT_PTR(HANDLE, hNtHandle); // in : NT handle for the sync object.
1519 D3DKMT_HANDLE hDevice; // in : Device handle to use this sync object on.
1520 D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS Flags; // in : specifies sync object behavior for this device.
1521 D3DKMT_HANDLE hSyncObject; // out: Handle to sync object in this process.
1522
1523 union
1524 {
1525
1526 struct
1527 {
1528 D3DKMT_PTR(VOID*, FenceValueCPUVirtualAddress); // out: Read-only mapping of the fence value for the CPU
1529 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS FenceValueGPUVirtualAddress; // out: Read/write mapping of the fence value for the GPU
1530 UINT EngineAffinity; // in: Defines physical adapters where the GPU VA should be mapped
1531 } MonitoredFence;
1532
1533 D3DKMT_ALIGN64 UINT64 Reserved[8];
1534 };
1535
1536} D3DKMT_OPENSYNCOBJECTFROMNTHANDLE2;
1537
1538typedef struct _D3DKMT_OPENSYNCOBJECTNTHANDLEFROMNAME
1539{
1540 DWORD dwDesiredAccess;
1541 D3DKMT_PTR(OBJECT_ATTRIBUTES*, pObjAttrib);
1542 D3DKMT_PTR(HANDLE, hNtHandle);
1543} D3DKMT_OPENSYNCOBJECTNTHANDLEFROMNAME;
1544
1545#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
1546
1547typedef struct _D3DKMT_OPENNTHANDLEFROMNAME
1548{
1549 DWORD dwDesiredAccess;
1550 D3DKMT_PTR(OBJECT_ATTRIBUTES*, pObjAttrib);
1551 D3DKMT_PTR(HANDLE, hNtHandle);
1552} D3DKMT_OPENNTHANDLEFROMNAME;
1553
1554#define SHARED_ALLOCATION_WRITE 0x1
1555#define SHARED_ALLOCATION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SHARED_ALLOCATION_WRITE)
1556
1557typedef struct _D3DKMT_QUERYRESOURCEINFOFROMNTHANDLE
1558{
1559 D3DKMT_HANDLE hDevice; // in : Indentifies the device
1560 D3DKMT_PTR(HANDLE, hNtHandle); // in : Global resource handle to open
1561 D3DKMT_PTR(VOID*, pPrivateRuntimeData); // in : Ptr to buffer that will receive runtime private data for the resource
1562 UINT PrivateRuntimeDataSize; // in/out : Size in bytes of buffer passed in for runtime private data / If pPrivateRuntimeData was NULL then size in bytes of buffer required for the runtime private data otherwise size in bytes of runtime private data copied into the buffer
1563 UINT TotalPrivateDriverDataSize; // out : Size in bytes of buffer required to hold all the DriverPrivate data for all of the allocations associated withe the resource
1564 UINT ResourcePrivateDriverDataSize; // out : Size in bytes of the driver's resource private data
1565 UINT NumAllocations; // out : Number of allocations associated with this resource
1566}D3DKMT_QUERYRESOURCEINFOFROMNTHANDLE;
1567
1568#endif
1569
1570typedef struct _D3DKMT_QUERYRESOURCEINFO
1571{
1572 D3DKMT_HANDLE hDevice; // in : Indentifies the device
1573 D3DKMT_HANDLE hGlobalShare; // in : Global resource handle to open
1574 D3DKMT_PTR(VOID*, pPrivateRuntimeData); // in : Ptr to buffer that will receive runtime private data for the resource
1575 UINT PrivateRuntimeDataSize; // in/out : Size in bytes of buffer passed in for runtime private data / If pPrivateRuntimeData was NULL then size in bytes of buffer required for the runtime private data otherwise size in bytes of runtime private data copied into the buffer
1576 UINT TotalPrivateDriverDataSize; // out : Size in bytes of buffer required to hold all the DriverPrivate data for all of the allocations associated withe the resource
1577 UINT ResourcePrivateDriverDataSize; // out : Size in bytes of the driver's resource private data
1578 UINT NumAllocations; // out : Number of allocations associated with this resource
1579}D3DKMT_QUERYRESOURCEINFO;
1580
1581typedef struct _D3DKMT_DESTROYALLOCATION
1582{
1583 D3DKMT_HANDLE hDevice; // in: Indentifies the device
1584 D3DKMT_HANDLE hResource;
1585 D3DKMT_PTR(CONST D3DKMT_HANDLE*, phAllocationList); // in: pointer to an array allocation handles to destroy
1586 UINT AllocationCount; // in: Number of allocations in phAllocationList
1587} D3DKMT_DESTROYALLOCATION;
1588
1589#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
1590
1591typedef struct _D3DKMT_DESTROYALLOCATION2
1592{
1593 D3DKMT_HANDLE hDevice; // in: Indentifies the device
1594 D3DKMT_HANDLE hResource;
1595 D3DKMT_PTR(CONST D3DKMT_HANDLE*, phAllocationList); // in: pointer to an array allocation handles to destroy
1596 UINT AllocationCount; // in: Number of allocations in phAllocationList
1597 D3DDDICB_DESTROYALLOCATION2FLAGS Flags; // in: Bit field defined by D3DDDICB_DESTROYALLOCATION2FLAGS
1598} D3DKMT_DESTROYALLOCATION2;
1599
1600#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
1601
1602typedef struct _D3DKMT_SETALLOCATIONPRIORITY
1603{
1604 D3DKMT_HANDLE hDevice; // in: Indentifies the device
1605 D3DKMT_HANDLE hResource; // in: Specify the resource to set priority to.
1606 D3DKMT_PTR(CONST D3DKMT_HANDLE*, phAllocationList); // in: pointer to an array allocation handles to destroy
1607 UINT AllocationCount; // in: Number of allocations in phAllocationList
1608 D3DKMT_PTR(CONST UINT*, pPriorities); // in: New priority for each of the allocation in the array.
1609} D3DKMT_SETALLOCATIONPRIORITY;
1610
1611typedef enum _D3DKMT_ALLOCATIONRESIDENCYSTATUS
1612{
1613 D3DKMT_ALLOCATIONRESIDENCYSTATUS_RESIDENTINGPUMEMORY=1,
1614 D3DKMT_ALLOCATIONRESIDENCYSTATUS_RESIDENTINSHAREDMEMORY=2,
1615 D3DKMT_ALLOCATIONRESIDENCYSTATUS_NOTRESIDENT=3,
1616} D3DKMT_ALLOCATIONRESIDENCYSTATUS;
1617
1618typedef struct _D3DKMT_QUERYALLOCATIONRESIDENCY
1619{
1620 D3DKMT_HANDLE hDevice; // in: Indentifies the device
1621 D3DKMT_HANDLE hResource; // in: pointer to resource owning the list of allocation.
1622 D3DKMT_PTR(CONST D3DKMT_HANDLE*, phAllocationList); // in: pointer to an array allocation to get residency status.
1623 UINT AllocationCount; // in: Number of allocations in phAllocationList
1624 D3DKMT_PTR(D3DKMT_ALLOCATIONRESIDENCYSTATUS*, pResidencyStatus); // out: Residency status of each allocation in the array.
1625} D3DKMT_QUERYALLOCATIONRESIDENCY;
1626
1627typedef struct _D3DKMT_GETRUNTIMEDATA
1628{
1629 D3DKMT_HANDLE hAdapter;
1630 D3DKMT_HANDLE hGlobalShare; // in: shared handle
1631 D3DKMT_PTR(VOID*, pRuntimeData); // out: in: for a version?
1632 UINT RuntimeDataSize; // in:
1633} D3DKMT_GETRUNTIMEDATA;
1634
1635typedef enum _KMTUMDVERSION
1636{
1637 KMTUMDVERSION_DX9 = 0,
1638 KMTUMDVERSION_DX10,
1639 KMTUMDVERSION_DX11,
1640 KMTUMDVERSION_DX12,
1641 NUM_KMTUMDVERSIONS
1642} KMTUMDVERSION;
1643
1644typedef struct _D3DKMT_UMDFILENAMEINFO
1645{
1646 KMTUMDVERSION Version; // In: UMD version
1647 WCHAR UmdFileName[MAX_PATH]; // Out: UMD file name
1648} D3DKMT_UMDFILENAMEINFO;
1649
1650#define D3DKMT_COMPONENTIZED_INDICATOR L'#'
1651#define D3DKMT_SUBKEY_DX9 L"DX9"
1652#define D3DKMT_SUBKEY_OPENGL L"OpenGL"
1653
1654typedef struct _D3DKMT_OPENGLINFO
1655{
1656 WCHAR UmdOpenGlIcdFileName[MAX_PATH];
1657 ULONG Version;
1658 ULONG Flags;
1659} D3DKMT_OPENGLINFO;
1660
1661typedef struct _D3DKMT_SEGMENTSIZEINFO
1662{
1663 D3DKMT_ALIGN64 ULONGLONG DedicatedVideoMemorySize;
1664 D3DKMT_ALIGN64 ULONGLONG DedicatedSystemMemorySize;
1665 D3DKMT_ALIGN64 ULONGLONG SharedSystemMemorySize;
1666} D3DKMT_SEGMENTSIZEINFO;
1667
1668typedef struct _D3DKMT_SEGMENTGROUPSIZEINFO
1669{
1670 UINT32 PhysicalAdapterIndex;
1671 D3DKMT_SEGMENTSIZEINFO LegacyInfo;
1672 D3DKMT_ALIGN64 ULONGLONG LocalMemory;
1673 D3DKMT_ALIGN64 ULONGLONG NonLocalMemory;
1674 D3DKMT_ALIGN64 ULONGLONG NonBudgetMemory;
1675} D3DKMT_SEGMENTGROUPSIZEINFO;
1676
1677typedef struct _D3DKMT_WORKINGSETFLAGS
1678{
1679 UINT UseDefault : 1; // 0x00000001
1680 UINT Reserved : 31; // 0xFFFFFFFE
1681} D3DKMT_WORKINGSETFLAGS;
1682
1683typedef struct _D3DKMT_WORKINGSETINFO
1684{
1685 D3DKMT_WORKINGSETFLAGS Flags;
1686 ULONG MinimumWorkingSetPercentile;
1687 ULONG MaximumWorkingSetPercentile;
1688} D3DKMT_WORKINGSETINFO;
1689
1690typedef struct _D3DKMT_FLIPINFOFLAGS
1691{
1692 UINT FlipInterval : 1; // 0x00000001 // Set when kmd driver support FlipInterval natively
1693 UINT Reserved : 31; // 0xFFFFFFFE
1694} D3DKMT_FLIPINFOFLAGS;
1695
1696typedef struct _D3DKMT_FLIPQUEUEINFO
1697{
1698 UINT MaxHardwareFlipQueueLength; // Max flip can be queued for hardware flip queue.
1699 UINT MaxSoftwareFlipQueueLength; // Max flip can be queued for software flip queue for non-legacy device.
1700 D3DKMT_FLIPINFOFLAGS FlipFlags;
1701} D3DKMT_FLIPQUEUEINFO;
1702
1703typedef struct _D3DKMT_ADAPTERADDRESS
1704{
1705 UINT BusNumber; // Bus number on which the physical device is located.
1706 UINT DeviceNumber; // Index of the physical device on the bus.
1707 UINT FunctionNumber; // Function number of the adapter on the physical device.
1708} D3DKMT_ADAPTERADDRESS;
1709
1710typedef struct _D3DKMT_ADAPTERREGISTRYINFO
1711{
1713 WCHAR BiosString[MAX_PATH];
1714 WCHAR DacType[MAX_PATH];
1715 WCHAR ChipType[MAX_PATH];
1716} D3DKMT_ADAPTERREGISTRYINFO;
1717
1718typedef struct _D3DKMT_CURRENTDISPLAYMODE
1719{
1720 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1721 D3DKMT_DISPLAYMODE DisplayMode;
1722} D3DKMT_CURRENTDISPLAYMODE;
1723
1724typedef struct _D3DKMT_VIRTUALADDRESSFLAGS // _ADVSCH_
1725{
1726 UINT VirtualAddressSupported : 1;
1727 UINT Reserved : 31;
1728} D3DKMT_VIRTUALADDRESSFLAGS;
1729
1730typedef struct _D3DKMT_VIRTUALADDRESSINFO // _ADVSCH_
1731{
1732 D3DKMT_VIRTUALADDRESSFLAGS VirtualAddressFlags;
1733} D3DKMT_VIRTUALADDRESSINFO;
1734
1735typedef enum _QAI_DRIVERVERSION
1736{
1737 KMT_DRIVERVERSION_WDDM_1_0 = 1000,
1738 KMT_DRIVERVERSION_WDDM_1_1_PRERELEASE = 1102,
1739 KMT_DRIVERVERSION_WDDM_1_1 = 1105,
1740#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
1741 KMT_DRIVERVERSION_WDDM_1_2 = 1200,
1742#endif
1743#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
1744 KMT_DRIVERVERSION_WDDM_1_3 = 1300,
1745#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3
1746#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
1747 KMT_DRIVERVERSION_WDDM_2_0 = 2000,
1748#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
1749#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
1750 KMT_DRIVERVERSION_WDDM_2_1 = 2100,
1751#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1
1752#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
1753 KMT_DRIVERVERSION_WDDM_2_2 = 2200,
1754#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2
1755#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
1756 KMT_DRIVERVERSION_WDDM_2_3 = 2300,
1757#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3
1758#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
1759 KMT_DRIVERVERSION_WDDM_2_4 = 2400,
1760#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4
1761#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5)
1762 KMT_DRIVERVERSION_WDDM_2_5 = 2500,
1763#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_5
1764#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
1765 KMT_DRIVERVERSION_WDDM_2_6 = 2600,
1766#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6
1767#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
1768 KMT_DRIVERVERSION_WDDM_2_7 = 2700,
1769#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_7
1770#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8)
1771 KMT_DRIVERVERSION_WDDM_2_8 = 2800,
1772#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_8
1773#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
1774 KMT_DRIVERVERSION_WDDM_2_9 = 2900,
1775#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9
1776#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
1777 KMT_DRIVERVERSION_WDDM_3_0 = 3000
1778#endif // DXGKDDI_INTERFACE_VERSION_WDDM3_0
1779} D3DKMT_DRIVERVERSION;
1780
1781#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
1782typedef struct _D3DKMT_ADAPTERTYPE
1783{
1784 union
1785 {
1786 struct
1787 {
1788 UINT RenderSupported : 1;
1789 UINT DisplaySupported : 1;
1790 UINT SoftwareDevice : 1;
1791 UINT PostDevice : 1;
1792#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
1793 UINT HybridDiscrete : 1;
1794 UINT HybridIntegrated : 1;
1795 UINT IndirectDisplayDevice : 1;
1796#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
1797 UINT Paravirtualized : 1;
1798 UINT ACGSupported : 1;
1799 UINT SupportSetTimingsFromVidPn : 1;
1800 UINT Detachable : 1;
1801#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
1802 UINT ComputeOnly : 1;
1803 UINT Prototype : 1;
1804#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
1805 UINT RuntimePowerManagement : 1;
1806 UINT Reserved : 18;
1807#else
1808 UINT Reserved : 19;
1809#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
1810#else
1811 UINT Reserved : 21;
1812#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
1813#else
1814 UINT Reserved : 25;
1815#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
1816#else
1817 UINT Reserved : 28;
1818#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
1819 };
1820 UINT Value;
1821 };
1822} D3DKMT_ADAPTERTYPE;
1823
1824typedef struct _D3DKMT_OUTPUTDUPLCONTEXTSCOUNT
1825{
1826 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
1827 UINT OutputDuplicationCount;
1828} D3DKMT_OUTPUTDUPLCONTEXTSCOUNT;
1829
1830typedef struct _D3DKMT_UMD_DRIVER_VERSION
1831{
1832 D3DKMT_ALIGN64 LARGE_INTEGER DriverVersion;
1833} D3DKMT_UMD_DRIVER_VERSION;
1834
1835typedef struct _D3DKMT_KMD_DRIVER_VERSION
1836{
1837 D3DKMT_ALIGN64 LARGE_INTEGER DriverVersion;
1838} D3DKMT_KMD_DRIVER_VERSION;
1839
1840typedef struct _D3DKMT_DIRECTFLIP_SUPPORT
1841{
1843} D3DKMT_DIRECTFLIP_SUPPORT;
1844
1845typedef struct _D3DKMT_MULTIPLANEOVERLAY_SUPPORT
1846{
1848} D3DKMT_MULTIPLANEOVERLAY_SUPPORT;
1849#endif
1850
1851#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3_PATH_INDEPENDENT_ROTATION)
1852typedef struct _D3DKMT_MULTIPLANEOVERLAY_HUD_SUPPORT
1853{
1854 UINT VidPnSourceId; // Not yet used.
1855 BOOL Update;
1856 BOOL KernelSupported;
1857 BOOL HudSupported;
1858} D3DKMT_MULTIPLANEOVERLAY_HUD_SUPPORT;
1859#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3_PATH_INDEPENDENT_ROTATION
1860
1861#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
1862
1863typedef struct _D3DKMT_DLIST_DRIVER_NAME
1864{
1865 WCHAR DListFileName[MAX_PATH]; // Out: DList driver file name
1866} D3DKMT_DLIST_DRIVER_NAME;
1867
1868typedef struct _D3DKMT_CPDRIVERNAME
1869{
1870 WCHAR ContentProtectionFileName[MAX_PATH];
1871} D3DKMT_CPDRIVERNAME;
1872
1873typedef struct _D3DKMT_MIRACASTCOMPANIONDRIVERNAME
1874{
1875 WCHAR MiracastCompanionDriverName[MAX_PATH];
1876} D3DKMT_MIRACASTCOMPANIONDRIVERNAME;
1877
1878#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3
1879
1880#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
1881
1882typedef struct _D3DKMT_XBOX
1883{
1884 BOOL IsXBOX;
1885} D3DKMT_XBOX;
1886
1887typedef struct _D3DKMT_INDEPENDENTFLIP_SUPPORT
1888{
1890} D3DKMT_INDEPENDENTFLIP_SUPPORT;
1891
1892typedef struct _D3DKMT_MULTIPLANEOVERLAY_DECODE_SUPPORT
1893{
1895} D3DKMT_MULTIPLANEOVERLAY_DECODE_SUPPORT;
1896
1897typedef struct _D3DKMT_ISBADDRIVERFORHWPROTECTIONDISABLED
1898{
1899 BOOL Disabled;
1900} D3DKMT_ISBADDRIVERFORHWPROTECTIONDISABLED;
1901
1902typedef struct _D3DKMT_MULTIPLANEOVERLAY_SECONDARY_SUPPORT
1903{
1905} D3DKMT_MULTIPLANEOVERLAY_SECONDARY_SUPPORT;
1906
1907typedef struct _D3DKMT_INDEPENDENTFLIP_SECONDARY_SUPPORT
1908{
1910} D3DKMT_INDEPENDENTFLIP_SECONDARY_SUPPORT;
1911
1912typedef struct _D3DKMT_PANELFITTER_SUPPORT
1913{
1915} D3DKMT_PANELFITTER_SUPPORT;
1916
1917typedef struct _D3DKMT_PHYSICAL_ADAPTER_COUNT
1918{
1919 UINT Count;
1920} D3DKMT_PHYSICAL_ADAPTER_COUNT;
1921
1922typedef struct _D3DKMT_DEVICE_IDS
1923{
1924 UINT VendorID;
1925 UINT DeviceID;
1929 UINT BusType;
1930} D3DKMT_DEVICE_IDS;
1931
1932typedef struct _D3DKMT_QUERY_DEVICE_IDS
1933{
1934 UINT PhysicalAdapterIndex; // in:
1935 D3DKMT_DEVICE_IDS DeviceIds; // out:
1936} D3DKMT_QUERY_DEVICE_IDS;
1937
1938typedef enum _D3DKMT_PNP_KEY_TYPE
1939{
1940 D3DKMT_PNP_KEY_HARDWARE = 1,
1941 D3DKMT_PNP_KEY_SOFTWARE = 2
1942} D3DKMT_PNP_KEY_TYPE;
1943
1944typedef struct _D3DKMT_QUERY_PHYSICAL_ADAPTER_PNP_KEY
1945{
1946 UINT PhysicalAdapterIndex;
1947 D3DKMT_PNP_KEY_TYPE PnPKeyType;
1948 D3DKMT_PTR(_Field_size_opt_(*pCchDest) WCHAR*, pDest);
1949 D3DKMT_PTR(UINT*, pCchDest);
1950} D3DKMT_QUERY_PHYSICAL_ADAPTER_PNP_KEY;
1951
1952typedef enum _D3DKMT_MIRACAST_DRIVER_TYPE
1953{
1954 D3DKMT_MIRACAST_DRIVER_NOT_SUPPORTED = 0,
1955 D3DKMT_MIRACAST_DRIVER_IHV = 1,
1956 D3DKMT_MIRACAST_DRIVER_MS = 2,
1957} D3DKMT_MIRACAST_DRIVER_TYPE;
1958
1959typedef struct _D3DKMT_QUERY_MIRACAST_DRIVER_TYPE
1960{
1961 D3DKMT_MIRACAST_DRIVER_TYPE MiracastDriverType;
1962} D3DKMT_QUERY_MIRACAST_DRIVER_TYPE;
1963
1964typedef struct _D3DKMT_GPUMMU_CAPS
1965{
1966 union
1967 {
1968 struct
1969 {
1970 UINT ReadOnlyMemorySupported : 1;
1971 UINT NoExecuteMemorySupported : 1;
1972 UINT CacheCoherentMemorySupported : 1;
1973 UINT Reserved : 29;
1974 };
1975 UINT Value;
1976 } Flags;
1977 UINT VirtualAddressBitCount;
1978} D3DKMT_GPUMMU_CAPS;
1979
1980typedef struct _D3DKMT_QUERY_GPUMMU_CAPS
1981{
1982 UINT PhysicalAdapterIndex; // in:
1983 D3DKMT_GPUMMU_CAPS Caps; // out:
1984} D3DKMT_QUERY_GPUMMU_CAPS;
1985
1986#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
1987
1988#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
1989
1990typedef struct _D3DKMT_MPO3DDI_SUPPORT
1991{
1993} D3DKMT_MPO3DDI_SUPPORT;
1994
1995typedef struct _D3DKMT_HWDRM_SUPPORT
1996{
1998} D3DKMT_HWDRM_SUPPORT;
1999
2000typedef struct _D3DKMT_MPOKERNELCAPS_SUPPORT
2001{
2003} D3DKMT_MPOKERNELCAPS_SUPPORT;
2004
2005typedef struct _D3DKMT_GET_DEVICE_VIDPN_OWNERSHIP_INFO
2006{
2007 D3DKMT_HANDLE hDevice; // in : Indentifies the device
2008 BOOLEAN bFailedDwmAcquireVidPn; // out : True if Dwm Acquire VidPn failed due to another Dwm device having ownership
2009} D3DKMT_GET_DEVICE_VIDPN_OWNERSHIP_INFO;
2010
2011#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2
2012
2013#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
2014
2015typedef struct _D3DKMT_BLOCKLIST_INFO
2016{
2017 UINT Size;
2018 WCHAR BlockList[1];
2019} D3DKMT_BLOCKLIST_INFO;
2020
2021typedef struct _D3DKMT_QUERY_ADAPTER_UNIQUE_GUID
2022{
2023 WCHAR AdapterUniqueGUID[40];
2024} D3DKMT_QUERY_ADAPTER_UNIQUE_GUID;
2025
2026typedef struct _D3DKMT_NODE_PERFDATA
2027{
2028 UINT32 NodeOrdinal; // in: Node ordinal of the requested engine.
2029 UINT32 PhysicalAdapterIndex; // in: The physical adapter index, in an LDA chain
2030 D3DKMT_ALIGN64 ULONGLONG Frequency; // out: Clock frequency of the engine in hertz
2031 D3DKMT_ALIGN64 ULONGLONG MaxFrequency; // out: Max engine clock frequency
2032 D3DKMT_ALIGN64 ULONGLONG MaxFrequencyOC;// out: Max engine over clock frequency
2033 ULONG Voltage; // out: Voltage of the engine in milli volts mV
2034 ULONG VoltageMax; // out: Max voltage levels in milli volts.
2035 ULONG VoltageMaxOC; // out: Max voltage level while overclocked in milli volts.
2036#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5)
2037 D3DKMT_ALIGN64 ULONGLONG MaxTransitionLatency; // out: Max transition latency to change the frequency in 100 nanoseconds
2038#else
2039 D3DKMT_ALIGN64 ULONGLONG Reserved;
2040#endif
2041} D3DKMT_NODE_PERFDATA;
2042
2043typedef struct _D3DKMT_ADAPTER_PERFDATA
2044{
2045 UINT32 PhysicalAdapterIndex; // in: The physical adapter index, in an LDA chain
2046 D3DKMT_ALIGN64 ULONGLONG MemoryFrequency; // out: Clock frequency of the memory in hertz
2047 D3DKMT_ALIGN64 ULONGLONG MaxMemoryFrequency; // out: Max memory clock frequency
2048 D3DKMT_ALIGN64 ULONGLONG MaxMemoryFrequencyOC; // out: Clock frequency of the memory while overclocked in hertz.
2049 D3DKMT_ALIGN64 ULONGLONG MemoryBandwidth; // out: Amount of memory transferred in bytes
2050 D3DKMT_ALIGN64 ULONGLONG PCIEBandwidth; // out: Amount of memory transferred over PCI-E in bytes
2051 ULONG FanRPM; // out: Fan rpm
2052 ULONG Power; // out: Power draw of the adapter in tenths of a percentage
2053 ULONG Temperature; // out: Temperature in deci-Celsius 1 = 0.1C
2054 UCHAR PowerStateOverride; // out: Overrides dxgkrnls power view of linked adapters.
2055} D3DKMT_ADAPTER_PERFDATA;
2056
2057typedef struct _D3DKMT_ADAPTER_PERFDATACAPS
2058{
2059 UINT32 PhysicalAdapterIndex; // in: The physical adapter index, in an LDA chain
2060 D3DKMT_ALIGN64 ULONGLONG MaxMemoryBandwidth; // out: Max memory bandwidth in bytes for 1 second
2061 D3DKMT_ALIGN64 ULONGLONG MaxPCIEBandwidth; // out: Max pcie bandwidth in bytes for 1 second
2062 ULONG MaxFanRPM; // out: Max fan rpm
2063 ULONG TemperatureMax; // out: Max temperature before damage levels
2064 ULONG TemperatureWarning; // out: The temperature level where throttling begins.
2065} D3DKMT_ADAPTER_PERFDATACAPS;
2066
2067#define DXGK_MAX_GPUVERSION_NAME_LENGTH 32
2068typedef struct _D3DKMT_GPUVERSION
2069{
2070 UINT32 PhysicalAdapterIndex; // in: The physical adapter index, in an LDA chain
2071 WCHAR BiosVersion[DXGK_MAX_GPUVERSION_NAME_LENGTH]; //out: The gpu bios version
2072 WCHAR GpuArchitecture[DXGK_MAX_GPUVERSION_NAME_LENGTH]; //out: The gpu architectures name.
2073} D3DKMT_GPUVERSION;
2074
2075#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4
2076
2077#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
2078
2079typedef struct _D3DKMT_DRIVER_DESCRIPTION
2080{
2081 WCHAR DriverDescription[4096]; //out: The driver description
2082} D3DKMT_DRIVER_DESCRIPTION;
2083
2084typedef struct _D3DKMT_QUERY_SCANOUT_CAPS
2085{
2086 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
2087 UINT Caps;
2088} D3DKMT_QUERY_SCANOUT_CAPS;
2089
2090typedef enum _KMT_DISPLAY_UMD_VERSION
2091{
2092 KMT_DISPLAY_UMDVERSION_1 = 0,
2093 NUM_KMT_DISPLAY_UMDVERSIONS
2094} KMT_DISPLAY_UMD_VERSION;
2095
2096typedef struct _D3DKMT_DISPLAY_UMD_FILENAMEINFO
2097{
2098 KMT_DISPLAY_UMD_VERSION Version; // In: UMD version
2099 WCHAR UmdFileName[MAX_PATH]; // Out: UMD file name
2100} D3DKMT_DISPLAY_UMD_FILENAMEINFO;
2101
2102typedef struct _D3DKMT_PARAVIRTUALIZATION
2103{
2104 // This adapter property originates from the VM/ Container, and is currently replicated on adapters.
2105 // It precludes extended device functions (i.e. Escapes) for paravirtualized devices which not known at all,
2106 // and therefore assumed not to be secure enough for demanding server scenarios.
2107 BOOLEAN SecureContainer;
2108} D3DKMT_PARAVIRTUALIZATION;
2109
2110#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6
2111
2112#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8)
2113
2114typedef struct _D3DKMT_HYBRID_DLIST_DLL_SUPPORT
2115{
2117} D3DKMT_HYBRID_DLIST_DLL_SUPPORT;
2118
2119#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_8
2120
2121#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
2122
2123
2124typedef enum _D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER
2125{
2126 D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER_NONE = 0,
2127 D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER_COPY = 1,
2128 D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER_TEXTURE = 2,
2129 D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER_SCANOUT = 3,
2130} D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER;
2131
2132typedef struct _D3DKMT_CROSSADAPTERRESOURCE_SUPPORT
2133{
2134 D3DKMT_CROSSADAPTERRESOURCE_SUPPORT_TIER SupportTier;
2135} D3DKMT_CROSSADAPTERRESOURCE_SUPPORT;
2136
2137#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9
2138
2139typedef enum _KMTQUERYADAPTERINFOTYPE
2140{
2141 KMTQAITYPE_UMDRIVERPRIVATE = 0,
2142 KMTQAITYPE_UMDRIVERNAME = 1,
2143 KMTQAITYPE_UMOPENGLINFO = 2,
2144 KMTQAITYPE_GETSEGMENTSIZE = 3,
2145 KMTQAITYPE_ADAPTERGUID = 4,
2146 KMTQAITYPE_FLIPQUEUEINFO = 5,
2147 KMTQAITYPE_ADAPTERADDRESS = 6,
2148 KMTQAITYPE_SETWORKINGSETINFO = 7,
2149 KMTQAITYPE_ADAPTERREGISTRYINFO = 8,
2150 KMTQAITYPE_CURRENTDISPLAYMODE = 9,
2151 KMTQAITYPE_MODELIST = 10,
2152 KMTQAITYPE_CHECKDRIVERUPDATESTATUS = 11,
2153 KMTQAITYPE_VIRTUALADDRESSINFO = 12, // _ADVSCH_
2154 KMTQAITYPE_DRIVERVERSION = 13,
2155#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2156 KMTQAITYPE_ADAPTERTYPE = 15,
2157 KMTQAITYPE_OUTPUTDUPLCONTEXTSCOUNT = 16,
2158 KMTQAITYPE_WDDM_1_2_CAPS = 17,
2159 KMTQAITYPE_UMD_DRIVER_VERSION = 18,
2160 KMTQAITYPE_DIRECTFLIP_SUPPORT = 19,
2161#endif
2162#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
2163 KMTQAITYPE_MULTIPLANEOVERLAY_SUPPORT = 20,
2164 KMTQAITYPE_DLIST_DRIVER_NAME = 21,
2165 KMTQAITYPE_WDDM_1_3_CAPS = 22,
2166#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3
2167#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3_PATH_INDEPENDENT_ROTATION)
2168 KMTQAITYPE_MULTIPLANEOVERLAY_HUD_SUPPORT = 23,
2169#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3_PATH_INDEPENDENT_ROTATION
2170#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
2171 KMTQAITYPE_WDDM_2_0_CAPS = 24,
2172 KMTQAITYPE_NODEMETADATA = 25,
2173 KMTQAITYPE_CPDRIVERNAME = 26,
2174 KMTQAITYPE_XBOX = 27,
2175 KMTQAITYPE_INDEPENDENTFLIP_SUPPORT = 28,
2176 KMTQAITYPE_MIRACASTCOMPANIONDRIVERNAME = 29,
2177 KMTQAITYPE_PHYSICALADAPTERCOUNT = 30,
2178 KMTQAITYPE_PHYSICALADAPTERDEVICEIDS = 31,
2179 KMTQAITYPE_DRIVERCAPS_EXT = 32,
2180 KMTQAITYPE_QUERY_MIRACAST_DRIVER_TYPE = 33,
2181 KMTQAITYPE_QUERY_GPUMMU_CAPS = 34,
2182 KMTQAITYPE_QUERY_MULTIPLANEOVERLAY_DECODE_SUPPORT = 35,
2183 KMTQAITYPE_QUERY_HW_PROTECTION_TEARDOWN_COUNT = 36,
2184 KMTQAITYPE_QUERY_ISBADDRIVERFORHWPROTECTIONDISABLED = 37,
2185 KMTQAITYPE_MULTIPLANEOVERLAY_SECONDARY_SUPPORT = 38,
2186 KMTQAITYPE_INDEPENDENTFLIP_SECONDARY_SUPPORT = 39,
2187#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
2188#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
2189 KMTQAITYPE_PANELFITTER_SUPPORT = 40,
2190#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1
2191#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
2192 KMTQAITYPE_PHYSICALADAPTERPNPKEY = 41,
2193 KMTQAITYPE_GETSEGMENTGROUPSIZE = 42,
2194 KMTQAITYPE_MPO3DDI_SUPPORT = 43,
2195 KMTQAITYPE_HWDRM_SUPPORT = 44,
2196 KMTQAITYPE_MPOKERNELCAPS_SUPPORT = 45,
2197 KMTQAITYPE_MULTIPLANEOVERLAY_STRETCH_SUPPORT = 46,
2198 KMTQAITYPE_GET_DEVICE_VIDPN_OWNERSHIP_INFO = 47,
2199#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2
2200#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
2201 KMTQAITYPE_QUERYREGISTRY = 48,
2202 KMTQAITYPE_KMD_DRIVER_VERSION = 49,
2203 KMTQAITYPE_BLOCKLIST_KERNEL = 50,
2204 KMTQAITYPE_BLOCKLIST_RUNTIME = 51,
2205 KMTQAITYPE_ADAPTERGUID_RENDER = 52,
2206 KMTQAITYPE_ADAPTERADDRESS_RENDER = 53,
2207 KMTQAITYPE_ADAPTERREGISTRYINFO_RENDER = 54,
2208 KMTQAITYPE_CHECKDRIVERUPDATESTATUS_RENDER = 55,
2209 KMTQAITYPE_DRIVERVERSION_RENDER = 56,
2210 KMTQAITYPE_ADAPTERTYPE_RENDER = 57,
2211 KMTQAITYPE_WDDM_1_2_CAPS_RENDER = 58,
2212 KMTQAITYPE_WDDM_1_3_CAPS_RENDER = 59,
2213 KMTQAITYPE_QUERY_ADAPTER_UNIQUE_GUID = 60,
2214 KMTQAITYPE_NODEPERFDATA = 61,
2215 KMTQAITYPE_ADAPTERPERFDATA = 62,
2216 KMTQAITYPE_ADAPTERPERFDATA_CAPS = 63,
2217 KMTQUITYPE_GPUVERSION = 64,
2218#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4
2219#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
2220 KMTQAITYPE_DRIVER_DESCRIPTION = 65,
2221 KMTQAITYPE_DRIVER_DESCRIPTION_RENDER = 66,
2222 KMTQAITYPE_SCANOUT_CAPS = 67,
2223 KMTQAITYPE_DISPLAY_UMDRIVERNAME = 71, // Added in 19H2
2224 KMTQAITYPE_PARAVIRTUALIZATION_RENDER = 68,
2225#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6
2226#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
2227 KMTQAITYPE_SERVICENAME = 69,
2228 KMTQAITYPE_WDDM_2_7_CAPS = 70,
2229 KMTQAITYPE_TRACKEDWORKLOAD_SUPPORT = 72,
2230#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_7
2231#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8)
2232 KMTQAITYPE_HYBRID_DLIST_DLL_SUPPORT = 73,
2233 KMTQAITYPE_DISPLAY_CAPS = 74,
2234#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_8
2235#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
2236 KMTQAITYPE_WDDM_2_9_CAPS = 75,
2237 KMTQAITYPE_CROSSADAPTERRESOURCE_SUPPORT = 76,
2238#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9
2239#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
2240 KMTQAITYPE_WDDM_3_0_CAPS = 77,
2241#endif // DXGKDDI_INTERFACE_VERSION_WDDM3_0
2242// If a new enum will be used by DXGI or D3D11 software driver code, update the test content in the area.
2243// Search for KMTQAITYPE_PARAVIRTUALIZATION_RENDER in directx\dxg\dxgi\unittests for references.
2244} KMTQUERYADAPTERINFOTYPE;
2245
2246typedef struct _D3DKMT_QUERYADAPTERINFO
2247{
2248 D3DKMT_HANDLE hAdapter;
2249 KMTQUERYADAPTERINFOTYPE Type;
2250 D3DKMT_PTR(VOID*, pPrivateDriverData);
2251 UINT PrivateDriverDataSize;
2252} D3DKMT_QUERYADAPTERINFO;
2253
2254typedef struct _D3DKMT_OPENADAPTERFROMHDC
2255{
2256 D3DKMT_PTR(HDC, hDc); // in: DC that maps to a single display
2257 D3DKMT_HANDLE hAdapter; // out: adapter handle
2258 LUID AdapterLuid; // out: adapter LUID
2259 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // out: VidPN source ID for that particular display
2260} D3DKMT_OPENADAPTERFROMHDC;
2261
2262typedef struct _D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME
2263{
2264 WCHAR DeviceName[32]; // in: Name of GDI device from which to open an adapter instance
2265 D3DKMT_HANDLE hAdapter; // out: adapter handle
2266 LUID AdapterLuid; // out: adapter LUID
2267 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // out: VidPN source ID for that particular display
2268} D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME;
2269
2270typedef struct _D3DKMT_OPENADAPTERFROMDEVICENAME
2271{
2272 D3DKMT_PTR(PCWSTR, pDeviceName); // in: NULL terminated string containing the device name to open
2273 D3DKMT_HANDLE hAdapter; // out: adapter handle
2274 LUID AdapterLuid; // out: adapter LUID
2275} D3DKMT_OPENADAPTERFROMDEVICENAME;
2276
2277#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2278
2279#define MAX_ENUM_ADAPTERS 16
2280
2281typedef struct _D3DKMT_ADAPTERINFO
2282{
2283 D3DKMT_HANDLE hAdapter;
2284 LUID AdapterLuid;
2285 ULONG NumOfSources;
2286 BOOL bPrecisePresentRegionsPreferred;
2287} D3DKMT_ADAPTERINFO;
2288
2289typedef struct _D3DKMT_ENUMADAPTERS
2290{
2291 _In_range_(0, MAX_ENUM_ADAPTERS) ULONG NumAdapters;
2292 D3DKMT_ADAPTERINFO Adapters[MAX_ENUM_ADAPTERS];
2293} D3DKMT_ENUMADAPTERS;
2294
2295typedef struct _D3DKMT_ENUMADAPTERS2
2296{
2297 ULONG NumAdapters; // in/out: On input, the count of the pAdapters array buffer. On output, the number of adapters enumerated.
2298 D3DKMT_PTR(D3DKMT_ADAPTERINFO*, pAdapters); // out: Array of enumerated adapters containing NumAdapters elements
2299} D3DKMT_ENUMADAPTERS2;
2300
2301typedef struct _D3DKMT_OPENADAPTERFROMLUID
2302{
2303 LUID AdapterLuid;
2304 D3DKMT_HANDLE hAdapter;
2305} D3DKMT_OPENADAPTERFROMLUID;
2306
2307typedef struct _D3DKMT_QUERYREMOTEVIDPNSOURCEFROMGDIDISPLAYNAME
2308{
2309 WCHAR DeviceName[32]; // in: Name of GDI device from which to open an adapter instance
2310 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // out: VidPN source ID for that particular display
2311} D3DKMT_QUERYREMOTEVIDPNSOURCEFROMGDIDISPLAYNAME;
2312#endif
2313
2314#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
2315typedef union _D3DKMT_ENUMADAPTERS_FILTER
2316{
2317 // Setting none of these flags will still enumerate adapters,
2318 // but there are fewer adapters than EnumAdapters2 enumerates.
2319 // ComputeOnly adapters are left out of the default enumeration, to avoid breaking applications.
2320 // DisplayOnly adapters are also left out of the default enumeration.
2321 struct
2322 {
2323 ULONGLONG IncludeComputeOnly : 1;
2324 ULONGLONG IncludeDisplayOnly : 1;
2325 ULONGLONG Reserved : 62;
2326 };
2327 D3DKMT_ALIGN64 ULONGLONG Value;
2328} D3DKMT_ENUMADAPTERS_FILTER;
2329
2330typedef struct _D3DKMT_ENUMADAPTERS3
2331{
2332 D3DKMT_ENUMADAPTERS_FILTER Filter; // in: Defines the filter
2333 ULONG NumAdapters; // in/out: On input, the count of the pAdapters array buffer. On output, the number of adapters enumerated.
2334 D3DKMT_PTR(D3DKMT_ADAPTERINFO*, pAdapters); // out: Array of enumerated adapters containing NumAdapters elements
2335} D3DKMT_ENUMADAPTERS3;
2336#endif
2337
2338typedef struct _D3DKMT_CLOSEADAPTER
2339{
2340 D3DKMT_HANDLE hAdapter; // in: adapter handle
2341} D3DKMT_CLOSEADAPTER;
2342
2343typedef struct _D3DKMT_GETSHAREDPRIMARYHANDLE
2344{
2345 D3DKMT_HANDLE hAdapter; // in: adapter handle
2346 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN source ID
2347 D3DKMT_HANDLE hSharedPrimary; // out: global shared primary handle (if one exists currently)
2348} D3DKMT_GETSHAREDPRIMARYHANDLE;
2349
2350typedef struct _D3DKMT_SHAREDPRIMARYLOCKNOTIFICATION
2351{
2352 LUID AdapterLuid;
2353 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
2354 RECTL LockRect; // in: If zero rect then we are locking the whole primary else the lock sub-rect
2355} D3DKMT_SHAREDPRIMARYLOCKNOTIFICATION;
2356
2357typedef struct _D3DKMT_SHAREDPRIMARYUNLOCKNOTIFICATION
2358{
2359 LUID AdapterLuid;
2360 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
2361} D3DKMT_SHAREDPRIMARYUNLOCKNOTIFICATION;
2362
2363#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2364typedef struct _D3DKMT_PINDIRECTFLIPRESOURCES
2365{
2366 D3DKMT_HANDLE hDevice; // in : Indentifies the device
2367 UINT ResourceCount; // in : Number of resources to pin
2368 D3DKMT_PTR(_Field_size_(ResourceCount) D3DKMT_HANDLE*, pResourceList); // in : Array of resource handles to pin
2369} D3DKMT_PINDIRECTFLIPRESOURCES;
2370
2371typedef struct _D3DKMT_UNPINDIRECTFLIPRESOURCES
2372{
2373 D3DKMT_HANDLE hDevice; // in : Indentifies the device
2374 UINT ResourceCount; // in : Number of resources to unpin
2375 D3DKMT_PTR(_Field_size_(ResourceCount) D3DKMT_HANDLE*, pResourceList); // in : Array of resource handles to unpin
2376} D3DKMT_UNPINDIRECTFLIPRESOURCES;
2377#endif
2378
2379#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
2380typedef union _D3DKMT_PINRESOURCEFLAGS
2381{
2382 struct
2383 {
2384 UINT DirectFlipResources : 1; // Used by DWM to indicate the resources are DirectFlip resources
2385 // and should be pinned in-place.
2386 UINT Reserved : 31;
2387 };
2388 UINT Value;
2389} D3DKMT_PINRESOURCEFLAGS;
2390
2391typedef struct _D3DKMT_PINRESOURCES
2392{
2393 D3DKMT_HANDLE hDevice; // in : Indentifies the device
2394 UINT ResourceCount; // in : Number of resources to pin
2395 D3DKMT_PTR(_Field_size_(ResourceCount) D3DKMT_HANDLE*, pResourceList); // in : Array of resource handles to pin
2396 D3DKMT_PINRESOURCEFLAGS Flags; // in : Flags
2397 D3DKMT_HANDLE hPagingQueue; // in opt : Handle to a paging queue used to synchronize the operation
2398 D3DKMT_ALIGN64 UINT64 PagingFence; // out : Fence value returned if hPagingQueue is not NULL
2399} D3DKMT_PINRESOURCES;
2400
2401typedef struct _D3DKMT_UNPINRESOURCES
2402{
2403 D3DKMT_HANDLE hDevice; // in : Indentifies the device
2404 UINT ResourceCount; // in : Number of resources to unpin
2405 D3DKMT_PTR(_Field_size_(ResourceCount) D3DKMT_HANDLE*, pResourceList); // in : Array of resource handles to unpin
2406 UINT Reserved;
2407} D3DKMT_UNPINRESOURCES;
2408#endif
2409
2410typedef enum _D3DKMT_ESCAPETYPE
2411{
2412 D3DKMT_ESCAPE_DRIVERPRIVATE = 0,
2413 D3DKMT_ESCAPE_VIDMM = 1,
2414 D3DKMT_ESCAPE_TDRDBGCTRL = 2,
2415 D3DKMT_ESCAPE_VIDSCH = 3,
2416 D3DKMT_ESCAPE_DEVICE = 4,
2417 D3DKMT_ESCAPE_DMM = 5,
2418 D3DKMT_ESCAPE_DEBUG_SNAPSHOT = 6,
2419 // unused (7 was previously used to set driver update in-progress status, D3DKMT_ESCAPE_SETDRIVERUPDATESTATUS)
2420 D3DKMT_ESCAPE_DRT_TEST = 8,
2421#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2422 D3DKMT_ESCAPE_DIAGNOSTICS = 9,
2423 D3DKMT_ESCAPE_OUTPUTDUPL_SNAPSHOT = 10,
2424 D3DKMT_ESCAPE_OUTPUTDUPL_DIAGNOSTICS = 11,
2425 D3DKMT_ESCAPE_BDD_PNP = 12,
2426 D3DKMT_ESCAPE_BDD_FALLBACK = 13,
2427 D3DKMT_ESCAPE_ACTIVATE_SPECIFIC_DIAG = 14,
2428 D3DKMT_ESCAPE_MODES_PRUNED_OUT = 15,
2429 D3DKMT_ESCAPE_WHQL_INFO = 16,
2430 D3DKMT_ESCAPE_BRIGHTNESS = 17,
2431 D3DKMT_ESCAPE_EDID_CACHE = 18,
2432 // unused (19 was previously D3DKMT_ESCAPE_GENERIC_ADAPTER_DIAG_INFO)
2433#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
2434 D3DKMT_ESCAPE_MIRACAST_DISPLAY_REQUEST = 20,
2435 D3DKMT_ESCAPE_HISTORY_BUFFER_STATUS = 21,
2436 // 22 can be reused for future needs as it was never exposed for external purposes
2437 D3DKMT_ESCAPE_MIRACAST_ADAPTER_DIAG_INFO = 23,
2438#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
2439 D3DKMT_ESCAPE_FORCE_BDDFALLBACK_HEADLESS = 24,
2440 D3DKMT_ESCAPE_REQUEST_MACHINE_CRASH = 25,
2441 // unused (26 was previously D3DKMT_ESCAPE_HMD_GET_EDID_BASE_BLOCK)
2442 D3DKMT_ESCAPE_SOFTGPU_ENABLE_DISABLE_HMD = 27,
2443 D3DKMT_ESCAPE_PROCESS_VERIFIER_OPTION = 28,
2444 D3DKMT_ESCAPE_ADAPTER_VERIFIER_OPTION = 29,
2445#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
2446 D3DKMT_ESCAPE_IDD_REQUEST = 30,
2447 D3DKMT_ESCAPE_DOD_SET_DIRTYRECT_MODE = 31,
2448 D3DKMT_ESCAPE_LOG_CODEPOINT_PACKET = 32,
2449#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
2450 D3DKMT_ESCAPE_LOG_USERMODE_DAIG_PACKET = 33,
2451 D3DKMT_ESCAPE_GET_EXTERNAL_DIAGNOSTICS = 34,
2452 // unused (35 previously was D3DKMT_ESCAPE_GET_PREFERRED_MODE)
2453#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
2454 D3DKMT_ESCAPE_GET_DISPLAY_CONFIGURATIONS = 36,
2455#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
2456 D3DKMT_ESCAPE_QUERY_IOMMU_STATUS = 37,
2457#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
2458 D3DKMT_ESCAPE_CCD_DATABASE = 38,
2459#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0)
2460 D3DKMT_ESCAPE_QUERY_DMA_REMAPPING_STATUS = 39,
2461#endif // DXGKDDI_INTERFACE_VERSION_WDDM3_0
2462#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6
2463#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4
2464#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3
2465#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2
2466#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1
2467#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
2468#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3
2469
2470 D3DKMT_ESCAPE_WIN32K_START = 1024,
2471 D3DKMT_ESCAPE_WIN32K_HIP_DEVICE_INFO = 1024,
2472 D3DKMT_ESCAPE_WIN32K_QUERY_CD_ROTATION_BLOCK = 1025,
2473#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
2474 D3DKMT_ESCAPE_WIN32K_DPI_INFO = 1026, // Use hContext for the desired hdev
2475 D3DKMT_ESCAPE_WIN32K_PRESENTER_VIEW_INFO = 1027,
2476 D3DKMT_ESCAPE_WIN32K_SYSTEM_DPI = 1028,
2477#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
2478 D3DKMT_ESCAPE_WIN32K_BDD_FALLBACK = 1029,
2479 D3DKMT_ESCAPE_WIN32K_DDA_TEST_CTL = 1030,
2480 D3DKMT_ESCAPE_WIN32K_USER_DETECTED_BLACK_SCREEN = 1031,
2481 // unused (1032 was previously D3DKMT_ESCAPE_WIN32K_HMD_ENUM)
2482 // unused (1033 was previously D3DKMT_ESCAPE_WIN32K_HMD_CONTROL)
2483 // unused (1034 was previously D3DKMT_ESCAPE_WIN32K_LPMDISPLAY_CONTROL)
2484#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5)
2485 D3DKMT_ESCAPE_WIN32K_DISPBROKER_TEST = 1035,
2486#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
2487 D3DKMT_ESCAPE_WIN32K_COLOR_PROFILE_INFO = 1036,
2488#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
2489 D3DKMT_ESCAPE_WIN32K_SET_DIMMED_STATE = 1037,
2490 D3DKMT_ESCAPE_WIN32K_SPECIALIZED_DISPLAY_TEST = 1038,
2491#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_7
2492#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6
2493#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_5
2494#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
2495#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3
2496#endif // DXGKDDI_INTERFACE_VERSION_WIN8
2497} D3DKMT_ESCAPETYPE;
2498
2499typedef struct _D3DKMT_DOD_SET_DIRTYRECT_MODE
2500{
2501 BOOL bForceFullScreenDirty; // in: indicates if this adapter should always give full screen dirty for every Dod present
2502}D3DKMT_DOD_SET_DIRTYRECT_MODE;
2503
2504typedef enum _D3DKMT_TDRDBGCTRLTYPE
2505{
2506 D3DKMT_TDRDBGCTRLTYPE_FORCETDR = 0, //Simulate a TDR
2507 D3DKMT_TDRDBGCTRLTYPE_DISABLEBREAK = 1, //Disable DebugBreak on timeout
2508 D3DKMT_TDRDBGCTRLTYPE_ENABLEBREAK = 2, //Enable DebugBreak on timeout
2509 D3DKMT_TDRDBGCTRLTYPE_UNCONDITIONAL = 3, //Disables all safety conditions (e.g. check for consecutive recoveries)
2510 D3DKMT_TDRDBGCTRLTYPE_VSYNCTDR = 4, //Simulate a Vsync TDR
2511 D3DKMT_TDRDBGCTRLTYPE_GPUTDR = 5, //Simulate a GPU TDR
2512#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2513 D3DKMT_TDRDBGCTRLTYPE_FORCEDODTDR = 6, //Simulate a Display Only Present TDR
2514 D3DKMT_TDRDBGCTRLTYPE_FORCEDODVSYNCTDR = 7, //Simulate a Display Only Vsync TDR
2515 D3DKMT_TDRDBGCTRLTYPE_ENGINETDR = 8, //Simulate an engine TDR
2516#endif
2517} D3DKMT_TDRDBGCTRLTYPE;
2518
2519typedef enum _D3DKMT_VIDMMESCAPETYPE
2520{
2521 D3DKMT_VIDMMESCAPETYPE_SETFAULT = 0,
2522 D3DKMT_VIDMMESCAPETYPE_RUN_COHERENCY_TEST = 1,
2523 D3DKMT_VIDMMESCAPETYPE_RUN_UNMAP_TO_DUMMY_PAGE_TEST = 2,
2524 D3DKMT_VIDMMESCAPETYPE_APERTURE_CORRUPTION_CHECK = 3,
2525 D3DKMT_VIDMMESCAPETYPE_SUSPEND_CPU_ACCESS_TEST = 4,
2526 D3DKMT_VIDMMESCAPETYPE_EVICT = 5,
2527 D3DKMT_VIDMMESCAPETYPE_EVICT_BY_NT_HANDLE = 6,
2528 D3DKMT_VIDMMESCAPETYPE_GET_VAD_INFO = 7,
2529 D3DKMT_VIDMMESCAPETYPE_SET_BUDGET = 8,
2530 D3DKMT_VIDMMESCAPETYPE_SUSPEND_PROCESS = 9,
2531 D3DKMT_VIDMMESCAPETYPE_RESUME_PROCESS = 10,
2532 D3DKMT_VIDMMESCAPETYPE_GET_BUDGET = 11,
2533 D3DKMT_VIDMMESCAPETYPE_SET_TRIM_INTERVALS = 12,
2534 D3DKMT_VIDMMESCAPETYPE_EVICT_BY_CRITERIA = 13,
2535 D3DKMT_VIDMMESCAPETYPE_WAKE = 14,
2536 D3DKMT_VIDMMESCAPETYPE_DEFRAG = 15,
2537 D3DKMT_VIDMMESCAPETYPE_DELAYEXECUTION = 16,
2538#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
2539 D3DKMT_VIDMMESCAPETYPE_VALIDATE_INTEGRITY = 17,
2540#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
2541 D3DKMT_VIDMMESCAPETYPE_SET_EVICTION_CONFIG = 18,
2542#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9
2543#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_7
2544} D3DKMT_VIDMMESCAPETYPE;
2545
2546typedef enum _D3DKMT_VIDSCHESCAPETYPE
2547{
2548 D3DKMT_VIDSCHESCAPETYPE_PREEMPTIONCONTROL = 0, //Enable/Disable preemption
2549 D3DKMT_VIDSCHESCAPETYPE_SUSPENDSCHEDULER = 1, //Suspend/Resume scheduler (obsolate)
2550 D3DKMT_VIDSCHESCAPETYPE_TDRCONTROL = 2, //Tdr control
2551 D3DKMT_VIDSCHESCAPETYPE_SUSPENDRESUME = 3, //Suspend/Resume scheduler
2552#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2553 D3DKMT_VIDSCHESCAPETYPE_ENABLECONTEXTDELAY = 4, //Enable/Disable context delay
2554#endif
2555 D3DKMT_VIDSCHESCAPETYPE_CONFIGURE_TDR_LIMIT = 5, // Configure TdrLimitCount and TdrLimitTime
2556 D3DKMT_VIDSCHESCAPETYPE_VGPU_RESET = 6, // Trigger VGPU reset
2557 D3DKMT_VIDSCHESCAPETYPE_PFN_CONTROL = 7, // Periodic frame notification control
2558 D3DKMT_VIDSCHESCAPETYPE_VIRTUAL_REFRESH_RATE = 8,
2559} D3DKMT_VIDSCHESCAPETYPE;
2560
2561typedef enum _D3DKMT_DMMESCAPETYPE
2562{
2563 D3DKMT_DMMESCAPETYPE_UNINITIALIZED = 0,
2564 D3DKMT_DMMESCAPETYPE_GET_SUMMARY_INFO = 1,
2565 D3DKMT_DMMESCAPETYPE_GET_VIDEO_PRESENT_SOURCES_INFO = 2,
2566 D3DKMT_DMMESCAPETYPE_GET_VIDEO_PRESENT_TARGETS_INFO = 3,
2567 D3DKMT_DMMESCAPETYPE_GET_ACTIVEVIDPN_INFO = 4,
2568 D3DKMT_DMMESCAPETYPE_GET_MONITORS_INFO = 5,
2569 D3DKMT_DMMESCAPETYPE_RECENTLY_COMMITTED_VIDPNS_INFO = 6,
2570 D3DKMT_DMMESCAPETYPE_RECENT_MODECHANGE_REQUESTS_INFO = 7,
2571 D3DKMT_DMMESCAPETYPE_RECENTLY_RECOMMENDED_VIDPNS_INFO = 8,
2572 D3DKMT_DMMESCAPETYPE_RECENT_MONITOR_PRESENCE_EVENTS_INFO = 9,
2573 D3DKMT_DMMESCAPETYPE_ACTIVEVIDPN_SOURCEMODESET_INFO = 10,
2574 D3DKMT_DMMESCAPETYPE_ACTIVEVIDPN_COFUNCPATHMODALITY_INFO = 11,
2575 D3DKMT_DMMESCAPETYPE_GET_LASTCLIENTCOMMITTEDVIDPN_INFO = 12,
2576 D3DKMT_DMMESCAPETYPE_GET_VERSION_INFO = 13,
2577 D3DKMT_DMMESCAPETYPE_VIDPN_MGR_DIAGNOSTICS = 14
2578} D3DKMT_DMMESCAPETYPE;
2579
2580typedef struct _D3DKMT_HISTORY_BUFFER_STATUS
2581{
2583 UINT Reserved;
2584} D3DKMT_HISTORY_BUFFER_STATUS;
2585
2586typedef enum _D3DKMT_VAD_ESCAPE_COMMAND
2587{
2588 D3DKMT_VAD_ESCAPE_GETNUMVADS,
2589 D3DKMT_VAD_ESCAPE_GETVAD,
2590 D3DKMT_VAD_ESCAPE_GETVADRANGE,
2591 D3DKMT_VAD_ESCAPE_GET_PTE,
2592 D3DKMT_VAD_ESCAPE_GET_GPUMMU_CAPS,
2593 D3DKMT_VAD_ESCAPE_GET_SEGMENT_CAPS,
2594} D3DKMT_VAD_ESCAPE_COMMAND;
2595
2596typedef struct _D3DKMT_VAD_DESC
2597{
2598 UINT VadIndex; // in: 0xFFFFFFFF to use the VAD address
2599 D3DKMT_ALIGN64 UINT64 VadAddress; // in
2600 UINT NumMappedRanges; // out
2601 UINT VadType; // out: 0 - reserved, 1 - Mapped
2602 D3DKMT_ALIGN64 UINT64 StartAddress; // out
2603 D3DKMT_ALIGN64 UINT64 EndAddress; // out
2604} D3DKMT_VAD_DESC;
2605
2606typedef struct _D3DKMT_VA_RANGE_DESC
2607{
2608 D3DKMT_ALIGN64 UINT64 VadAddress; // in
2609 UINT VaRangeIndex; // in
2610 UINT PhysicalAdapterIndex; // in
2611 D3DKMT_ALIGN64 UINT64 StartAddress; // out
2612 D3DKMT_ALIGN64 UINT64 EndAddress; // out
2613 D3DKMT_ALIGN64 UINT64 DriverProtection; // out
2614 UINT OwnerType; // out: VIDMM_VAD_OWNER_TYPE
2615 D3DKMT_ALIGN64 UINT64 pOwner; // out
2616 D3DKMT_ALIGN64 UINT64 OwnerOffset; // out
2617 UINT Protection; // out: D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE
2618} D3DKMT_VA_RANGE_DESC;
2619
2620typedef struct _D3DKMT_EVICTION_CRITERIA
2621{
2622 D3DKMT_ALIGN64 UINT64 MinimumSize;
2623 D3DKMT_ALIGN64 UINT64 MaximumSize;
2624 struct
2625 {
2626 union
2627 {
2628 struct
2629 {
2630 UINT Primary : 1; // 0x00000001
2631 UINT Reserved : 31; // 0xFFFFFFFE
2632 } Flags;
2633 UINT Value;
2634 };
2635 };
2636} D3DKMT_EVICTION_CRITERIA;
2637
2638typedef enum _D3DKMT_DEFRAG_ESCAPE_OPERATION
2639{
2640 D3DKMT_DEFRAG_ESCAPE_GET_FRAGMENTATION_STATS = 0,
2641 D3DKMT_DEFRAG_ESCAPE_DEFRAG_UPWARD = 1,
2642 D3DKMT_DEFRAG_ESCAPE_DEFRAG_DOWNWARD = 2,
2643 D3DKMT_DEFRAG_ESCAPE_DEFRAG_PASS = 3,
2644 D3DKMT_DEFRAG_ESCAPE_VERIFY_TRANSFER = 4,
2645} D3DKMT_DEFRAG_ESCAPE_OPERATION;
2646
2647typedef struct _D3DKMT_PAGE_TABLE_LEVEL_DESC
2648{
2649 UINT IndexBitCount;
2650 D3DKMT_ALIGN64 UINT64 IndexMask;
2651 D3DKMT_ALIGN64 UINT64 IndexShift;
2652 D3DKMT_ALIGN64 UINT64 LowerLevelsMask;
2653 D3DKMT_ALIGN64 UINT64 EntryCoverageInPages;
2654} D3DKMT_PAGE_TABLE_LEVEL_DESC;
2655
2656typedef struct _DXGK_ESCAPE_GPUMMUCAPS
2657{
2658 BOOLEAN ReadOnlyMemorySupported;
2659 BOOLEAN NoExecuteMemorySupported;
2660 BOOLEAN ZeroInPteSupported;
2661 BOOLEAN CacheCoherentMemorySupported;
2662 BOOLEAN LargePageSupported;
2663 BOOLEAN DualPteSupported;
2664 BOOLEAN AllowNonAlignedLargePageAddress;
2665 UINT VirtualAddressBitCount;
2666 UINT PageTableLevelCount;
2667 D3DKMT_PAGE_TABLE_LEVEL_DESC PageTableLevelDesk[DXGK_MAX_PAGE_TABLE_LEVEL_COUNT];
2668} DXGK_ESCAPE_GPUMMUCAPS;
2669
2670typedef struct _D3DKMT_GET_GPUMMU_CAPS
2671{
2672 UINT PhysicalAdapterIndex; // In
2673 DXGK_ESCAPE_GPUMMUCAPS GpuMmuCaps; // Out
2674} D3DKMT_GET_GPUMMU_CAPS;
2675
2676#define D3DKMT_GET_PTE_MAX 64
2677
2678typedef struct _D3DKMT_GET_PTE
2679{
2680 UINT PhysicalAdapterIndex; // In
2681 UINT PageTableLevel; // In
2682 UINT PageTableIndex[DXGK_MAX_PAGE_TABLE_LEVEL_COUNT]; // In
2683 BOOLEAN b64KBPte; // In - Valid only when dual PTEs are supported. Out - PT is 64KB.
2684 UINT NumPtes; // In - Number of PTEs to fill. Out - number of filled PTEs
2685 DXGK_PTE Pte[D3DKMT_GET_PTE_MAX]; // Out
2686 UINT NumValidEntries; // Out
2687} D3DKMT_GET_PTE;
2688
2689#define D3DKMT_MAX_SEGMENT_COUNT 32
2690
2691typedef enum _D3DKMT_MEMORY_SEGMENT_GROUP
2692{
2693 D3DKMT_MEMORY_SEGMENT_GROUP_LOCAL = 0,
2694 D3DKMT_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1
2695} D3DKMT_MEMORY_SEGMENT_GROUP;
2696
2697typedef struct _D3DKMT_SEGMENT_CAPS
2698{
2699 D3DKMT_ALIGN64 UINT64 Size;
2700 UINT PageSize;
2701 ULONG SegmentId;
2702 BOOLEAN bAperture;
2703 BOOLEAN bReservedSysMem;
2704 D3DKMT_MEMORY_SEGMENT_GROUP BudgetGroup;
2705} D3DKMT_SEGMENT_CAPS;
2706
2707typedef struct _D3DKMT_GET_SEGMENT_CAPS
2708{
2709 UINT PhysicalAdapterIndex; // In
2710 UINT NumSegments; // Out
2711 D3DKMT_SEGMENT_CAPS SegmentCaps[D3DKMT_MAX_SEGMENT_COUNT]; // Out
2712} D3DKMT_GET_SEGMENT_CAPS;
2713
2714typedef enum _D3DKMT_ESCAPE_PFN_CONTROL_COMMAND
2715{
2716 D3DKMT_ESCAPE_PFN_CONTROL_DEFAULT,
2717 D3DKMT_ESCAPE_PFN_CONTROL_FORCE_CPU,
2718 D3DKMT_ESCAPE_PFN_CONTROL_FORCE_GPU
2719} D3DKMT_ESCAPE_PFN_CONTROL_COMMAND;
2720
2721// params for D3DKMT_VIDSCHESCAPETYPE_VIRTUAL_REFRESH_RATE
2722typedef enum _D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE
2723{
2724 D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE_SET_BASE_DESKTOP_DURATION = 0,
2725 D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE_SET_VSYNC_MULTIPLIER = 1,
2726 D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE_SET_PROCESS_BOOST_ELIGIBLE = 2,
2727} D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE;
2728
2729typedef struct _D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE
2730{
2731 D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE_TYPE Type;
2732 UINT VidPnSourceId;
2733 BOOLEAN ProcessBoostEligible;
2734 UINT VSyncMultiplier;
2735 UINT BaseDesktopDuration;
2736 UCHAR Reserved[16];
2737} D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE;
2738
2739typedef struct _D3DKMT_VIDMM_ESCAPE
2740{
2741 D3DKMT_VIDMMESCAPETYPE Type;
2742 union
2743 {
2744 struct
2745 {
2746 union
2747 {
2748 struct
2749 {
2750 ULONG ProbeAndLock : 1;
2751 ULONG SplitPoint : 1;
2752 ULONG NoDemotion : 1;
2753 ULONG SwizzlingAperture : 1;
2754 ULONG PagingPathLockSubRange : 1;
2755 ULONG PagingPathLockMinRange : 1;
2756 ULONG ComplexLock : 1;
2757 ULONG FailVARotation : 1;
2758 ULONG NoWriteCombined : 1;
2759 ULONG NoPrePatching : 1;
2760 ULONG AlwaysRepatch : 1;
2761 ULONG ExpectPreparationFailure : 1;
2762 ULONG FailUserModeVAMapping : 1;
2763#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2764 ULONG NeverDiscardOfferedAllocation : 1;
2765 ULONG AlwaysDiscardOfferedAllocation : 1;
2766 ULONG Reserved : 17;
2767#else
2768 ULONG Reserved : 19;
2769#endif
2770 };
2771 ULONG Value;
2772 };
2773 } SetFault;
2774 struct
2775 {
2776 D3DKMT_HANDLE ResourceHandle;
2777 D3DKMT_HANDLE AllocationHandle;
2778 D3DKMT_PTR(HANDLE, hProcess); // 0 to evict memory for the current process, otherwise it is a process handle from OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessId).
2779 } Evict;
2780 struct
2781 {
2782 D3DKMT_ALIGN64 UINT64 NtHandle; // Used by D3DKMT_VIDMMESCAPETYPE_EVICT_BY_NT_HANDLE
2783 } EvictByNtHandle;
2784 struct
2785 {
2786 union
2787 {
2788 struct
2789 {
2790 UINT NumVads;
2791 } GetNumVads;
2792 D3DKMT_VAD_DESC GetVad;
2793 D3DKMT_VA_RANGE_DESC GetVadRange;
2794 D3DKMT_GET_GPUMMU_CAPS GetGpuMmuCaps;
2795 D3DKMT_GET_PTE GetPte;
2796 D3DKMT_GET_SEGMENT_CAPS GetSegmentCaps;
2797 };
2798 D3DKMT_VAD_ESCAPE_COMMAND Command; // in
2799 NTSTATUS Status; // out
2800 } GetVads;
2801 struct
2802 {
2803 D3DKMT_ALIGN64 ULONGLONG LocalMemoryBudget;
2804 D3DKMT_ALIGN64 ULONGLONG SystemMemoryBudget;
2805 } SetBudget;
2806 struct
2807 {
2808 D3DKMT_PTR(HANDLE, hProcess);
2809 BOOL bAllowWakeOnSubmission;
2810 } SuspendProcess;
2811 struct
2812 {
2813 D3DKMT_PTR(HANDLE, hProcess);
2814 } ResumeProcess;
2815 struct
2816 {
2817 D3DKMT_ALIGN64 UINT64 NumBytesToTrim;
2818 } GetBudget;
2819 struct
2820 {
2821 ULONG MinTrimInterval; // In 100ns units
2822 ULONG MaxTrimInterval; // In 100ns units
2823 ULONG IdleTrimInterval; // In 100ns units
2824 } SetTrimIntervals;
2825 D3DKMT_EVICTION_CRITERIA EvictByCriteria;
2826 struct
2827 {
2828 BOOL bFlush;
2829 } Wake;
2830 struct
2831 {
2832 D3DKMT_DEFRAG_ESCAPE_OPERATION Operation;
2833
2834 UINT SegmentId;
2835
2836 D3DKMT_ALIGN64 ULONGLONG TotalCommitted;
2837 D3DKMT_ALIGN64 ULONGLONG TotalFree;
2838 D3DKMT_ALIGN64 ULONGLONG LargestGapBefore;
2839 D3DKMT_ALIGN64 ULONGLONG LargestGapAfter;
2840 } Defrag;
2841 struct
2842 {
2843 D3DKMT_HANDLE hPagingQueue;
2844 UINT PhysicalAdapterIndex;
2845 ULONG Milliseconds;
2846 D3DKMT_ALIGN64 ULONGLONG PagingFenceValue;
2848#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
2849 struct
2850 {
2851 UINT SegmentId;
2852 } VerifyIntegrity;
2853#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
2854 struct
2855 {
2856 D3DKMT_ALIGN64 LONGLONG TimerValue;
2857 } DelayedEvictionConfig;
2858#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9
2859#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_7
2860 };
2861} D3DKMT_VIDMM_ESCAPE;
2862
2863typedef struct _D3DKMT_VIDSCH_ESCAPE
2864{
2865 D3DKMT_VIDSCHESCAPETYPE Type;
2866 union
2867 {
2868 BOOL PreemptionControl; // enable/disable preemption
2869#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2870 BOOL EnableContextDelay; // enable/disable context delay
2871 struct
2872 {
2873 ULONG TdrControl; // control tdr
2874 union
2875 {
2876 ULONG NodeOrdinal; // valid if TdrControl is set to D3DKMT_TDRDBGCTRLTYPE_ENGINETDR
2877 };
2878 } TdrControl2;
2879#endif
2880 BOOL SuspendScheduler; // suspend/resume scheduler (obsolate)
2881 ULONG TdrControl; // control tdr
2882 ULONG SuspendTime; // time period to suspend.
2883 struct
2884 {
2885 UINT Count;
2886 UINT Time; // In seconds
2887 } TdrLimit;
2888
2889 D3DKMT_ESCAPE_PFN_CONTROL_COMMAND PfnControl; // periodic frame notification control
2890 };
2891 D3DKMT_ESCAPE_VIRTUAL_REFRESH_RATE VirtualRefreshRateControl;
2892} D3DKMT_VIDSCH_ESCAPE;
2893
2894typedef struct _D3DKMT_TDRDBGCTRL_ESCAPE
2895{
2896 D3DKMT_TDRDBGCTRLTYPE TdrControl; // control tdr
2897#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
2898 union
2899 {
2900 ULONG NodeOrdinal; // valid if TdrControl is set to D3DKMT_TDRDBGCTRLTYPE_ENGINETDR
2901 };
2902#endif
2903} D3DKMT_TDRDBGCTRL_ESCAPE;
2904
2905// Upper boundary on the DMM escape data size (in bytes).
2906enum
2907{
2908 D3DKMT_MAX_DMM_ESCAPE_DATASIZE = 100*1024
2909};
2910
2911// NOTE: If (ProvidedBufferSize >= MinRequiredBufferSize), then MinRequiredBufferSize = size of the actual complete data set in the Data[] array.
2912typedef struct _D3DKMT_DMM_ESCAPE
2913{
2914 _In_ D3DKMT_DMMESCAPETYPE Type;
2915 _In_ D3DKMT_ALIGN64 D3DKMT_SIZE_T ProvidedBufferSize; // actual size of Data[] array, in bytes.
2916 _Out_ D3DKMT_ALIGN64 D3DKMT_SIZE_T MinRequiredBufferSize; // minimum required size of Data[] array to contain requested data.
2917 _Out_writes_bytes_(ProvidedBufferSize) UCHAR Data[1];
2918} D3DKMT_DMM_ESCAPE;
2919
2920typedef enum _D3DKMT_BRIGHTNESS_INFO_TYPE
2921{
2922 D3DKMT_BRIGHTNESS_INFO_GET_POSSIBLE_LEVELS = 1,
2923 D3DKMT_BRIGHTNESS_INFO_GET = 2,
2924 D3DKMT_BRIGHTNESS_INFO_SET = 3,
2925 D3DKMT_BRIGHTNESS_INFO_GET_CAPS = 4,
2926 D3DKMT_BRIGHTNESS_INFO_SET_STATE = 5,
2927 D3DKMT_BRIGHTNESS_INFO_SET_OPTIMIZATION = 6,
2928 D3DKMT_BRIGHTNESS_INFO_GET_REDUCTION = 7,
2929 D3DKMT_BRIGHTNESS_INFO_BEGIN_MANUAL_MODE = 8,
2930 D3DKMT_BRIGHTNESS_INFO_END_MANUAL_MODE = 9,
2931 D3DKMT_BRIGHTNESS_INFO_TOGGLE_LOGGING = 10,
2932 D3DKMT_BRIGHTNESS_INFO_GET_NIT_RANGES = 11,
2933} D3DKMT_BRIGHTNESS_INFO_TYPE;
2934
2935typedef struct _D3DKMT_BRIGHTNESS_POSSIBLE_LEVELS
2936{
2937 UCHAR LevelCount;
2938 UCHAR BrightnessLevels[256];
2939} D3DKMT_BRIGHTNESS_POSSIBLE_LEVELS;
2940
2941typedef struct _D3DKMT_BRIGHTNESS_INFO
2942{
2943 D3DKMT_BRIGHTNESS_INFO_TYPE Type;
2944 ULONG ChildUid;
2945 union
2946 {
2947 D3DKMT_BRIGHTNESS_POSSIBLE_LEVELS PossibleLevels;
2948 UCHAR Brightness;
2949 DXGK_BRIGHTNESS_CAPS BrightnessCaps;
2950 DXGK_BRIGHTNESS_STATE BrightnessState;
2951 DXGK_BACKLIGHT_OPTIMIZATION_LEVEL OptimizationLevel;
2952 DXGK_BACKLIGHT_INFO ReductionInfo;
2953 BOOLEAN VerboseLogging;
2954 DXGK_BRIGHTNESS_GET_NIT_RANGES_OUT NitRanges;
2955 DXGK_BRIGHTNESS_GET_OUT GetBrightnessMillinits;
2956 DXGK_BRIGHTNESS_SET_IN SetBrightnessMillinits;
2957 };
2958} D3DKMT_BRIGHTNESS_INFO;
2959
2960#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
2961typedef struct _D3DKMT_BDDFALLBACK_CTL
2962{
2963 BOOLEAN ForceBddHeadlessNextFallback;
2964} D3DKMT_BDDFALLBACK_CTL;
2965
2966typedef struct _D3DKMT_REQUEST_MACHINE_CRASH_ESCAPE
2967{
2968 D3DKMT_ALIGN64 D3DKMT_ULONG_PTR Param1;
2969 D3DKMT_ALIGN64 D3DKMT_ULONG_PTR Param2;
2970 D3DKMT_ALIGN64 D3DKMT_ULONG_PTR Param3;
2971} D3DKMT_REQUEST_MACHINE_CRASH_ESCAPE;
2972
2973//
2974// VERIFIER OPTIONS
2975//
2976typedef enum _D3DKMT_VERIFIER_OPTION_MODE
2977{
2978 D3DKMT_VERIFIER_OPTION_QUERY,
2979 D3DKMT_VERIFIER_OPTION_SET
2980} D3DKMT_VERIFIER_OPTION_MODE;
2981
2982typedef enum _D3DKMT_PROCESS_VERIFIER_OPTION_TYPE
2983{
2984 //
2985 // Dxgkrnl (0xxx)
2986 //
2987
2988 //
2989 // VidMm (1xxx)
2990 //
2991 D3DKMT_PROCESS_VERIFIER_OPTION_VIDMM_FLAGS = 1000,
2992 D3DKMT_PROCESS_VERIFIER_OPTION_VIDMM_RESTRICT_BUDGET = 1001,
2993
2994 //
2995 // VidSch (2xxx)
2996 //
2997
2998} D3DKMT_PROCESS_VERIFIER_OPTION_TYPE;
2999
3000typedef union _D3DKMT_PROCESS_VERIFIER_VIDMM_FLAGS
3001{
3002 struct
3003 {
3004 UINT ForceSynchronousEvict : 1;
3005 UINT NeverDeferEvictions : 1;
3006 UINT AlwaysFailCommitOnReclaim : 1;
3007 UINT AlwaysPlaceInDemotedLocation : 1;
3008 UINT Reserved : 28;
3009 };
3010 UINT32 Value;
3011} D3DKMT_PROCESS_VERIFIER_VIDMM_FLAGS;
3012
3013typedef struct _D3DKMT_PROCESS_VERIFIER_VIDMM_RESTRICT_BUDGET
3014{
3015 D3DKMT_ALIGN64 UINT64 LocalBudget;
3016 D3DKMT_ALIGN64 UINT64 NonLocalBudget;
3017} D3DKMT_PROCESS_VERIFIER_VIDMM_RESTRICT_BUDGET;
3018
3019typedef union _D3DKMT_PROCESS_VERIFIER_OPTION_DATA
3020{
3021 D3DKMT_PROCESS_VERIFIER_VIDMM_FLAGS VidMmFlags;
3022 D3DKMT_PROCESS_VERIFIER_VIDMM_RESTRICT_BUDGET VidMmRestrictBudget;
3023} D3DKMT_PROCESS_VERIFIER_OPTION_DATA;
3024
3025typedef struct _D3DKMT_PROCESS_VERIFIER_OPTION
3026{
3027 D3DKMT_PTR(HANDLE, hProcess);
3028 D3DKMT_PROCESS_VERIFIER_OPTION_TYPE Type;
3029 D3DKMT_VERIFIER_OPTION_MODE Mode;
3030 D3DKMT_PROCESS_VERIFIER_OPTION_DATA Data;
3031} D3DKMT_PROCESS_VERIFIER_OPTION;
3032
3033typedef enum _D3DKMT_ADAPTER_VERIFIER_OPTION_TYPE
3034{
3035 //
3036 // Dxgkrnl (0xxx)
3037 //
3038
3039 //
3040 // VidMm (1xxx)
3041 //
3042 D3DKMT_ADAPTER_VERIFIER_OPTION_VIDMM_FLAGS = 1000,
3043 D3DKMT_ADAPTER_VERIFIER_OPTION_VIDMM_TRIM_INTERVAL = 1001,
3044
3045 //
3046 // VidSch (2xxx)
3047 //
3048} D3DKMT_ADAPTER_VERIFIER_OPTION_TYPE;
3049
3050typedef union _D3DKMT_ADAPTER_VERIFIER_VIDMM_FLAGS
3051{
3052 struct
3053 {
3054 UINT AlwaysRepatch : 1;
3055 UINT FailSharedPrimary : 1;
3056 UINT FailProbeAndLock : 1;
3057 UINT AlwaysDiscardOffer : 1;
3058 UINT NeverDiscardOffer : 1;
3059 UINT ForceComplexLock : 1;
3060 UINT NeverPrepatch : 1;
3061 UINT ExpectPreparationFailure : 1;
3062 UINT TakeSplitPoint : 1;
3063 UINT FailAcquireSwizzlingRange : 1;
3064 UINT PagingPathLockSubrange : 1;
3065 UINT PagingPathLockMinrange : 1;
3066 UINT FailVaRotation : 1;
3067 UINT NoDemotion : 1;
3068 UINT FailDefragPass : 1;
3069 UINT AlwaysProcessOfferList : 1;
3070 UINT AlwaysDecommitOffer : 1;
3071 UINT NeverMoveDefrag : 1;
3072 UINT AlwaysRelocateDisplayableResources : 1;
3073 UINT AlwaysFailGrowVPRMoves : 1;
3074 UINT Reserved : 12;
3075 };
3076 UINT32 Value;
3077} D3DKMT_ADAPTER_VERIFIER_VIDMM_FLAGS;
3078
3079typedef struct _D3DKMT_ADAPTER_VERIFIER_VIDMM_TRIM_INTERVAL
3080{
3081 D3DKMT_ALIGN64 UINT64 MinimumTrimInterval;
3082 D3DKMT_ALIGN64 UINT64 MaximumTrimInterval;
3083 D3DKMT_ALIGN64 UINT64 IdleTrimInterval;
3084} D3DKMT_ADAPTER_VERIFIER_VIDMM_TRIM_INTERVAL;
3085
3086typedef union _D3DKMT_ADAPTER_VERIFIER_OPTION_DATA
3087{
3088 D3DKMT_ADAPTER_VERIFIER_VIDMM_FLAGS VidMmFlags;
3089 D3DKMT_ADAPTER_VERIFIER_VIDMM_TRIM_INTERVAL VidMmTrimInterval;
3090} D3DKMT_ADAPTER_VERIFIER_OPTION_DATA;
3091
3092typedef struct _D3DKMT_ADAPTER_VERIFIER_OPTION
3093{
3094 D3DKMT_ADAPTER_VERIFIER_OPTION_TYPE Type;
3095 D3DKMT_VERIFIER_OPTION_MODE Mode;
3096 D3DKMT_ADAPTER_VERIFIER_OPTION_DATA Data;
3097} D3DKMT_ADAPTER_VERIFIER_OPTION;
3098
3099#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
3100
3101typedef enum _D3DKMT_DEVICEESCAPE_TYPE
3102{
3103 D3DKMT_DEVICEESCAPE_VIDPNFROMALLOCATION = 0,
3104 D3DKMT_DEVICEESCAPE_RESTOREGAMMA = 1,
3105} D3DKMT_DEVICEESCAPE_TYPE;
3106
3107typedef struct _D3DKMT_DEVICE_ESCAPE
3108{
3109 D3DKMT_DEVICEESCAPE_TYPE Type;
3110 union
3111 {
3112 struct
3113 {
3114 D3DKMT_HANDLE hPrimaryAllocation; // in: Primary allocation handle
3115 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // out: VidPnSoureId of primary allocation
3116 } VidPnFromAllocation;
3117 };
3118} D3DKMT_DEVICE_ESCAPE;
3119
3120typedef struct _D3DKMT_DEBUG_SNAPSHOT_ESCAPE
3121{
3122 ULONG Length; // out: Actual length of the snapshot written in Buffer
3123 BYTE Buffer[1]; // out: Buffer to place snapshot
3124} D3DKMT_DEBUG_SNAPSHOT_ESCAPE;
3125
3126#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3127#ifndef DXGK_DIAG_PROCESS_NAME_LENGTH
3128#define DXGK_DIAG_PROCESS_NAME_LENGTH 16
3129#endif
3130
3131typedef enum _OUTPUTDUPL_CONTEXT_DEBUG_STATUS
3132{
3133 OUTPUTDUPL_CONTEXT_DEBUG_STATUS_INACTIVE = 0,
3134 OUTPUTDUPL_CONTEXT_DEBUG_STATUS_ACTIVE = 1,
3135 OUTPUTDUPL_CONTEXT_DEBUG_STATUS_PENDING_DESTROY = 2,
3136 OUTPUTDUPL_CONTEXT_DEBUG_STATUS_FORCE_UINT32 = 0xffffffff
3137}OUTPUTDUPL_CONTEXT_DEBUG_STATUS;
3138
3139typedef struct _OUTPUTDUPL_CONTEXT_DEBUG_INFO
3140{
3141 OUTPUTDUPL_CONTEXT_DEBUG_STATUS Status;
3142 D3DKMT_PTR(HANDLE, ProcessID);
3143 UINT32 AccumulatedPresents;
3144 D3DKMT_ALIGN64 LARGE_INTEGER LastPresentTime;
3145 D3DKMT_ALIGN64 LARGE_INTEGER LastMouseTime;
3146 CHAR ProcessName[DXGK_DIAG_PROCESS_NAME_LENGTH];
3147} OUTPUTDUPL_CONTEXT_DEBUG_INFO;
3148
3149#define GET_OUTPUT_DUPL_DEBUG_INFO_FROM_SNAPSHOT(pSnapshot, VidPnSource, OutputDuplContextIndex) \
3150 (pSnapshot->OutputDuplDebugInfos[(VidPnSource * pSnapshot->NumOutputDuplContexts) + OutputDuplContextIndex])
3151
3152typedef struct _D3DKMT_OUTPUTDUPL_SNAPSHOT
3153{
3154 UINT Size; // _In_/out: Size of entire structure
3155
3156 UINT SessionProcessCount; // _Out_: Number of processes currently duplicating output in this session (max possible will be equal to NumOutputDuplContexts)
3157 UINT SessionActiveConnectionsCount; // _Out_: Total number of active contexts in this session, may be more than number active in 2D array because that is per adapter
3158
3159 UINT NumVidPnSources; // _Out_: Max of first array index
3160 UINT NumOutputDuplContexts; // _Out_: Max of second array index
3161
3162 UINT Padding;
3163
3164 // This field is in reality a two dimensional array, use GET_OUTPUT_DUPL_DEBUG_INFO_FROM_SNAPSHOT macro to get a specific one
3165 _Field_size_bytes_(Size - sizeof(_D3DKMT_OUTPUTDUPL_SNAPSHOT)) OUTPUTDUPL_CONTEXT_DEBUG_INFO OutputDuplDebugInfos[0];
3166} D3DKMT_OUTPUTDUPL_SNAPSHOT;
3167#endif
3168
3169typedef enum _D3DKMT_ACTIVATE_SPECIFIC_DIAG_TYPE
3170{
3171 D3DKMT_ACTIVATE_SPECIFIC_DIAG_TYPE_EXTRA_CCD_DATABASE_INFO = 0,
3172 D3DKMT_ACTIVATE_SPECIFIC_DIAG_TYPE_MODES_PRUNED = 15,
3173}D3DKMT_ACTIVATE_SPECIFIC_DIAG_TYPE;
3174
3175typedef struct _D3DKMT_ACTIVATE_SPECIFIC_DIAG_ESCAPE
3176{
3177 D3DKMT_ACTIVATE_SPECIFIC_DIAG_TYPE Type; // The escape type that needs to be (de)activated
3178 BOOL Activate; // FALSE means deactivate
3179} D3DKMT_ACTIVATE_SPECIFIC_DIAG_ESCAPE;
3180
3181typedef struct _D3DKMT_ESCAPE
3182{
3183 D3DKMT_HANDLE hAdapter; // in: adapter handle
3184 D3DKMT_HANDLE hDevice; // in: device handle [Optional]
3185 D3DKMT_ESCAPETYPE Type; // in: escape type.
3186 D3DDDI_ESCAPEFLAGS Flags; // in: flags
3187 D3DKMT_PTR(VOID*, pPrivateDriverData); // in/out: escape data
3188 UINT PrivateDriverDataSize; // in: size of escape data
3189 D3DKMT_HANDLE hContext; // in: context handle [Optional]
3190} D3DKMT_ESCAPE;
3191
3192//
3193// begin D3DKMT_QUERYSTATISTICS
3194//
3195
3196typedef enum _D3DKMT_QUERYRESULT_PREEMPTION_ATTEMPT_RESULT
3197{
3198 D3DKMT_PreemptionAttempt = 0,
3199 D3DKMT_PreemptionAttemptSuccess = 1,
3200 D3DKMT_PreemptionAttemptMissNoCommand = 2,
3201 D3DKMT_PreemptionAttemptMissNotEnabled = 3,
3202 D3DKMT_PreemptionAttemptMissNextFence = 4,
3203 D3DKMT_PreemptionAttemptMissPagingCommand = 5,
3204 D3DKMT_PreemptionAttemptMissSplittedCommand = 6,
3205 D3DKMT_PreemptionAttemptMissFenceCommand = 7,
3206 D3DKMT_PreemptionAttemptMissRenderPendingFlip = 8,
3207 D3DKMT_PreemptionAttemptMissNotMakingProgress = 9,
3208 D3DKMT_PreemptionAttemptMissLessPriority = 10,
3209 D3DKMT_PreemptionAttemptMissRemainingQuantum = 11,
3210 D3DKMT_PreemptionAttemptMissRemainingPreemptionQuantum = 12,
3211 D3DKMT_PreemptionAttemptMissAlreadyPreempting = 13,
3212 D3DKMT_PreemptionAttemptMissGlobalBlock = 14,
3213 D3DKMT_PreemptionAttemptMissAlreadyRunning = 15,
3214 D3DKMT_PreemptionAttemptStatisticsMax = 16,
3215} D3DKMT_QUERYRESULT_PREEMPTION_ATTEMPT_RESULT;
3216
3217//
3218// WOW will not allow enum member as array length, so define it as a constant
3219//
3220#define D3DKMT_QUERYRESULT_PREEMPTION_ATTEMPT_RESULT_MAX 16
3221C_ASSERT(D3DKMT_QUERYRESULT_PREEMPTION_ATTEMPT_RESULT_MAX == D3DKMT_PreemptionAttemptStatisticsMax);
3222
3223//
3224// Command packet type
3225//
3226typedef enum _D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE {
3227 D3DKMT_ClientRenderBuffer = 0, // (Dma packet) should be 0 base.
3228 D3DKMT_ClientPagingBuffer = 1, // (Dma packet)
3229 D3DKMT_SystemPagingBuffer = 2, // (Dma packet)
3230 D3DKMT_SystemPreemptionBuffer = 3, // (Dma packet)
3231 D3DKMT_DmaPacketTypeMax = 4
3232} D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE;
3233
3234//
3235// WOW will not allow enum member as array length, so define it as a constant
3236//
3237#define D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE_MAX 4
3238C_ASSERT(D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE_MAX == D3DKMT_DmaPacketTypeMax);
3239
3240typedef enum _D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE {
3241 D3DKMT_RenderCommandBuffer = 0, // (Queue Packet) should be 0 base.
3242 D3DKMT_DeferredCommandBuffer = 1, // (Queue Packet)
3243 D3DKMT_SystemCommandBuffer = 2, // (Queue Packet)
3244 D3DKMT_MmIoFlipCommandBuffer = 3, // (Queue Packet)
3245 D3DKMT_WaitCommandBuffer = 4, // (Queue Packet)
3246 D3DKMT_SignalCommandBuffer = 5, // (Queue Packet)
3247 D3DKMT_DeviceCommandBuffer = 6, // (Queue Packet)
3248 D3DKMT_SoftwareCommandBuffer = 7, // (Queue Packet)
3249 D3DKMT_QueuePacketTypeMax = 8
3250} D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE;
3251
3252//
3253// WOW will not allow enum member as array length, so define it as a constant
3254//
3255#define D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE_MAX 8
3256C_ASSERT(D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE_MAX == D3DKMT_QueuePacketTypeMax);
3257
3258typedef enum _D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS
3259{
3260 D3DKMT_AllocationPriorityClassMinimum = 0,
3261 D3DKMT_AllocationPriorityClassLow = 1,
3262 D3DKMT_AllocationPriorityClassNormal = 2,
3263 D3DKMT_AllocationPriorityClassHigh = 3,
3264 D3DKMT_AllocationPriorityClassMaximum = 4,
3265 D3DKMT_MaxAllocationPriorityClass = 5
3266} D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS;
3267
3268//
3269// WOW will not allow enum member as array length, so define it as a constant
3270//
3271
3272#define D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS_MAX 5
3273C_ASSERT(D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS_MAX == D3DKMT_MaxAllocationPriorityClass);
3274
3275//
3276// Allocation segment preference set can contain 5 preferences
3277//
3278#define D3DKMT_QUERYSTATISTICS_SEGMENT_PREFERENCE_MAX 5
3279
3280typedef struct _D3DKMT_QUERYSTATISTICS_COUNTER
3281{
3282 ULONG Count;
3284} D3DKMT_QUERYSTATISTICS_COUNTER;
3285
3286typedef struct _D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE_INFORMATION {
3287 ULONG PacketSubmited;
3288 ULONG PacketCompleted;
3289 ULONG PacketPreempted;
3290 ULONG PacketFaulted;
3291} D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE_INFORMATION;
3292
3293typedef struct _D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE_INFORMATION {
3294 ULONG PacketSubmited;
3295 ULONG PacketCompleted;
3296} D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE_INFORMATION;
3297
3298typedef struct _D3DKMT_QUERYSTATISTICS_PACKET_INFORMATION {
3299 D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE_INFORMATION QueuePacket[D3DKMT_QUERYSTATISTICS_QUEUE_PACKET_TYPE_MAX]; //Size = D3DKMT_QueuePacketTypeMax
3300 D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE_INFORMATION DmaPacket[D3DKMT_QUERYSTATISTICS_DMA_PACKET_TYPE_MAX]; //Size = D3DKMT_DmaPacketTypeMax
3301} D3DKMT_QUERYSTATISTICS_PACKET_INFORMATION;
3302
3303typedef struct _D3DKMT_QUERYSTATISTICS_PREEMPTION_INFORMATION {
3304 ULONG PreemptionCounter[D3DKMT_QUERYRESULT_PREEMPTION_ATTEMPT_RESULT_MAX];
3305} D3DKMT_QUERYSTATISTICS_PREEMPTION_INFORMATION;
3306
3307typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_NODE_INFORMATION {
3308 D3DKMT_ALIGN64 LARGE_INTEGER RunningTime; // Running time in micro-second.
3309 ULONG ContextSwitch;
3310 D3DKMT_QUERYSTATISTICS_PREEMPTION_INFORMATION PreemptionStatistics;
3311 D3DKMT_QUERYSTATISTICS_PACKET_INFORMATION PacketStatistics;
3312 D3DKMT_ALIGN64 UINT64 Reserved[8];
3313} D3DKMT_QUERYSTATISTICS_PROCESS_NODE_INFORMATION;
3314
3315typedef struct _D3DKMT_QUERYSTATISTICS_NODE_INFORMATION {
3316 D3DKMT_QUERYSTATISTICS_PROCESS_NODE_INFORMATION GlobalInformation; //Global statistics
3317 D3DKMT_QUERYSTATISTICS_PROCESS_NODE_INFORMATION SystemInformation; //Statistics for system thread
3318#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3319 D3DKMT_NODE_PERFDATA NodePerfData;
3320 UINT32 Reserved[3];
3321#else
3322 D3DKMT_ALIGN64 UINT64 Reserved[8];
3323#endif
3324} D3DKMT_QUERYSTATISTICS_NODE_INFORMATION;
3325
3326typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE_INFORMATION {
3327 ULONG Frame; // both by Blt and Flip.
3328 ULONG CancelledFrame; // by restart (flip only).
3329 ULONG QueuedPresent; // queued present.
3330 UINT Padding;
3331#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
3332 D3DKMT_ALIGN64 UINT64 IsVSyncEnabled;
3333 D3DKMT_ALIGN64 UINT64 VSyncOnTotalTimeMs;
3334 D3DKMT_ALIGN64 UINT64 VSyncOffKeepPhaseTotalTimeMs;
3335 D3DKMT_ALIGN64 UINT64 VSyncOffNoPhaseTotalTimeMs;
3336 D3DKMT_ALIGN64 UINT64 Reserved[4];
3337#else
3338 D3DKMT_ALIGN64 UINT64 Reserved[8];
3339#endif
3340
3341} D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE_INFORMATION;
3342
3343typedef struct _D3DKMT_QUERYSTATISTICS_VIDPNSOURCE_INFORMATION {
3344 D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE_INFORMATION GlobalInformation; //Global statistics
3345 D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE_INFORMATION SystemInformation; //Statistics for system thread
3346 D3DKMT_ALIGN64 UINT64 Reserved[8];
3347} D3DKMT_QUERYSTATISTICS_VIDPNSOURCE_INFORMATION;
3348
3349typedef struct _D3DKMT_QUERYSTATSTICS_REFERENCE_DMA_BUFFER
3350{
3351 ULONG NbCall;
3352 ULONG NbAllocationsReferenced;
3353 ULONG MaxNbAllocationsReferenced;
3354 ULONG NbNULLReference;
3355 ULONG NbWriteReference;
3356 ULONG NbRenamedAllocationsReferenced;
3357 ULONG NbIterationSearchingRenamedAllocation;
3358 ULONG NbLockedAllocationReferenced;
3359 ULONG NbAllocationWithValidPrepatchingInfoReferenced;
3360 ULONG NbAllocationWithInvalidPrepatchingInfoReferenced;
3361 ULONG NbDMABufferSuccessfullyPrePatched;
3362 ULONG NbPrimariesReferencesOverflow;
3363 ULONG NbAllocationWithNonPreferredResources;
3364 ULONG NbAllocationInsertedInMigrationTable;
3365} D3DKMT_QUERYSTATSTICS_REFERENCE_DMA_BUFFER;
3366
3367typedef struct _D3DKMT_QUERYSTATSTICS_RENAMING
3368{
3369 ULONG NbAllocationsRenamed;
3370 ULONG NbAllocationsShrinked;
3371 ULONG NbRenamedBuffer;
3372 ULONG MaxRenamingListLength;
3373 ULONG NbFailuresDueToRenamingLimit;
3374 ULONG NbFailuresDueToCreateAllocation;
3375 ULONG NbFailuresDueToOpenAllocation;
3376 ULONG NbFailuresDueToLowResource;
3377 ULONG NbFailuresDueToNonRetiredLimit;
3378} D3DKMT_QUERYSTATSTICS_RENAMING;
3379
3380typedef struct _D3DKMT_QUERYSTATSTICS_PREPRATION
3381{
3382 ULONG BroadcastStall;
3383 ULONG NbDMAPrepared;
3384 ULONG NbDMAPreparedLongPath;
3385 ULONG ImmediateHighestPreparationPass;
3386 D3DKMT_QUERYSTATISTICS_COUNTER AllocationsTrimmed;
3387} D3DKMT_QUERYSTATSTICS_PREPRATION;
3388
3389typedef struct _D3DKMT_QUERYSTATSTICS_PAGING_FAULT
3390{
3391 D3DKMT_QUERYSTATISTICS_COUNTER Faults;
3392 D3DKMT_QUERYSTATISTICS_COUNTER FaultsFirstTimeAccess;
3393 D3DKMT_QUERYSTATISTICS_COUNTER FaultsReclaimed;
3394 D3DKMT_QUERYSTATISTICS_COUNTER FaultsMigration;
3395 D3DKMT_QUERYSTATISTICS_COUNTER FaultsIncorrectResource;
3396 D3DKMT_QUERYSTATISTICS_COUNTER FaultsLostContent;
3397 D3DKMT_QUERYSTATISTICS_COUNTER FaultsEvicted;
3398 D3DKMT_QUERYSTATISTICS_COUNTER AllocationsMEM_RESET;
3399 D3DKMT_QUERYSTATISTICS_COUNTER AllocationsUnresetSuccess;
3400 D3DKMT_QUERYSTATISTICS_COUNTER AllocationsUnresetFail;
3401 ULONG AllocationsUnresetSuccessRead;
3402 ULONG AllocationsUnresetFailRead;
3403
3404 D3DKMT_QUERYSTATISTICS_COUNTER Evictions;
3405 D3DKMT_QUERYSTATISTICS_COUNTER EvictionsDueToPreparation;
3406 D3DKMT_QUERYSTATISTICS_COUNTER EvictionsDueToLock;
3407 D3DKMT_QUERYSTATISTICS_COUNTER EvictionsDueToClose;
3408 D3DKMT_QUERYSTATISTICS_COUNTER EvictionsDueToPurge;
3409 D3DKMT_QUERYSTATISTICS_COUNTER EvictionsDueToSuspendCPUAccess;
3410} D3DKMT_QUERYSTATSTICS_PAGING_FAULT;
3411
3412typedef struct _D3DKMT_QUERYSTATSTICS_PAGING_TRANSFER
3413{
3414 D3DKMT_ALIGN64 ULONGLONG BytesFilled;
3415 D3DKMT_ALIGN64 ULONGLONG BytesDiscarded;
3416 D3DKMT_ALIGN64 ULONGLONG BytesMappedIntoAperture;
3417 D3DKMT_ALIGN64 ULONGLONG BytesUnmappedFromAperture;
3418 D3DKMT_ALIGN64 ULONGLONG BytesTransferredFromMdlToMemory;
3419 D3DKMT_ALIGN64 ULONGLONG BytesTransferredFromMemoryToMdl;
3420 D3DKMT_ALIGN64 ULONGLONG BytesTransferredFromApertureToMemory;
3421 D3DKMT_ALIGN64 ULONGLONG BytesTransferredFromMemoryToAperture;
3422} D3DKMT_QUERYSTATSTICS_PAGING_TRANSFER;
3423
3424typedef struct _D3DKMT_QUERYSTATSTICS_SWIZZLING_RANGE
3425{
3426 ULONG NbRangesAcquired;
3427 ULONG NbRangesReleased;
3428} D3DKMT_QUERYSTATSTICS_SWIZZLING_RANGE;
3429
3430typedef struct _D3DKMT_QUERYSTATSTICS_LOCKS
3431{
3432 ULONG NbLocks;
3433 ULONG NbLocksWaitFlag;
3434 ULONG NbLocksDiscardFlag;
3435 ULONG NbLocksNoOverwrite;
3436 ULONG NbLocksNoReadSync;
3437 ULONG NbLocksLinearization;
3438 ULONG NbComplexLocks;
3439} D3DKMT_QUERYSTATSTICS_LOCKS;
3440
3441typedef struct _D3DKMT_QUERYSTATSTICS_ALLOCATIONS
3442{
3443 D3DKMT_QUERYSTATISTICS_COUNTER Created;
3444 D3DKMT_QUERYSTATISTICS_COUNTER Destroyed;
3445 D3DKMT_QUERYSTATISTICS_COUNTER Opened;
3446 D3DKMT_QUERYSTATISTICS_COUNTER Closed;
3447 D3DKMT_QUERYSTATISTICS_COUNTER MigratedSuccess;
3448 D3DKMT_QUERYSTATISTICS_COUNTER MigratedFail;
3449 D3DKMT_QUERYSTATISTICS_COUNTER MigratedAbandoned;
3450} D3DKMT_QUERYSTATSTICS_ALLOCATIONS;
3451
3452typedef struct _D3DKMT_QUERYSTATSTICS_TERMINATIONS
3453{
3454 //
3455 // We separate shared / nonshared because for nonshared we know that every alloc
3456 // terminated will lead cause a global alloc destroyed, but not for nonshared.
3457 //
3458 D3DKMT_QUERYSTATISTICS_COUNTER TerminatedShared;
3459 D3DKMT_QUERYSTATISTICS_COUNTER TerminatedNonShared;
3460 D3DKMT_QUERYSTATISTICS_COUNTER DestroyedShared;
3461 D3DKMT_QUERYSTATISTICS_COUNTER DestroyedNonShared;
3462} D3DKMT_QUERYSTATSTICS_TERMINATIONS;
3463
3464#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3465typedef struct _D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION_FLAGS
3466{
3467 union
3468 {
3469 struct
3470 {
3471 UINT64 NumberOfMemoryGroups : 2;
3472 UINT64 SupportsDemotion : 1;
3473 UINT64 Reserved :61;
3474 };
3475 D3DKMT_ALIGN64 UINT64 Value;
3476 };
3477} D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION_FLAGS;
3478#endif
3479
3480typedef struct _D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION
3481{
3482 ULONG NbSegments;
3483 ULONG NodeCount;
3484 ULONG VidPnSourceCount;
3485
3486 ULONG VSyncEnabled;
3487 ULONG TdrDetectedCount;
3488
3489 D3DKMT_ALIGN64 LONGLONG ZeroLengthDmaBuffers;
3490 D3DKMT_ALIGN64 ULONGLONG RestartedPeriod;
3491
3492 D3DKMT_QUERYSTATSTICS_REFERENCE_DMA_BUFFER ReferenceDmaBuffer;
3493 D3DKMT_QUERYSTATSTICS_RENAMING Renaming;
3494 D3DKMT_QUERYSTATSTICS_PREPRATION Preparation;
3495 D3DKMT_QUERYSTATSTICS_PAGING_FAULT PagingFault;
3496 D3DKMT_QUERYSTATSTICS_PAGING_TRANSFER PagingTransfer;
3497 D3DKMT_QUERYSTATSTICS_SWIZZLING_RANGE SwizzlingRange;
3498 D3DKMT_QUERYSTATSTICS_LOCKS Locks;
3499 D3DKMT_QUERYSTATSTICS_ALLOCATIONS Allocations;
3500 D3DKMT_QUERYSTATSTICS_TERMINATIONS Terminations;
3501
3502#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
3503 D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION_FLAGS Flags;
3504 D3DKMT_ALIGN64 UINT64 Reserved[7];
3505#else
3506 D3DKMT_ALIGN64 UINT64 Reserved[8];
3507#endif
3508} D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION;
3509
3510#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3511typedef struct _D3DKMT_QUERYSTATISTICS_PHYSICAL_ADAPTER_INFORMATION
3512{
3513 D3DKMT_ADAPTER_PERFDATA AdapterPerfData;
3514 D3DKMT_ADAPTER_PERFDATACAPS AdapterPerfDataCaps;
3515 D3DKMT_GPUVERSION GpuVersion;
3516} D3DKMT_QUERYSTATISTICS_PHYSICAL_ADAPTER_INFORMATION;
3517#endif
3518
3519typedef struct _D3DKMT_QUERYSTATISTICS_SYSTEM_MEMORY
3520{
3521 D3DKMT_ALIGN64 ULONGLONG BytesAllocated;
3522 D3DKMT_ALIGN64 ULONGLONG BytesReserved;
3523 ULONG SmallAllocationBlocks;
3524 ULONG LargeAllocationBlocks;
3525 D3DKMT_ALIGN64 ULONGLONG WriteCombinedBytesAllocated;
3526 D3DKMT_ALIGN64 ULONGLONG WriteCombinedBytesReserved;
3527 D3DKMT_ALIGN64 ULONGLONG CachedBytesAllocated;
3528 D3DKMT_ALIGN64 ULONGLONG CachedBytesReserved;
3529 D3DKMT_ALIGN64 ULONGLONG SectionBytesAllocated;
3530 D3DKMT_ALIGN64 ULONGLONG SectionBytesReserved;
3531#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3532 D3DKMT_ALIGN64 ULONGLONG BytesZeroed;
3533#else
3534 D3DKMT_ALIGN64 ULONGLONG Reserved;
3535#endif
3536} D3DKMT_QUERYSTATISTICS_SYSTEM_MEMORY;
3537
3538typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_INFORMATION
3539{
3540 ULONG NodeCount;
3541 ULONG VidPnSourceCount;
3542
3543 D3DKMT_QUERYSTATISTICS_SYSTEM_MEMORY SystemMemory;
3544
3545 D3DKMT_ALIGN64 UINT64 Reserved[7];
3546} D3DKMT_QUERYSTATISTICS_PROCESS_INFORMATION;
3547
3548typedef struct _D3DKMT_QUERYSTATISTICS_DMA_BUFFER
3549{
3550 D3DKMT_QUERYSTATISTICS_COUNTER Size;
3551 ULONG AllocationListBytes;
3552 ULONG PatchLocationListBytes;
3553} D3DKMT_QUERYSTATISTICS_DMA_BUFFER;
3554
3555typedef struct _D3DKMT_QUERYSTATISTICS_COMMITMENT_DATA
3556{
3557 D3DKMT_ALIGN64 UINT64 TotalBytesEvictedFromProcess;
3558 D3DKMT_ALIGN64 UINT64 BytesBySegmentPreference[D3DKMT_QUERYSTATISTICS_SEGMENT_PREFERENCE_MAX];
3559} D3DKMT_QUERYSTATISTICS_COMMITMENT_DATA;
3560
3561typedef struct _D3DKMT_QUERYSTATISTICS_POLICY
3562{
3563 D3DKMT_ALIGN64 ULONGLONG PreferApertureForRead[D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS_MAX];
3564 D3DKMT_ALIGN64 ULONGLONG PreferAperture[D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS_MAX];
3565 D3DKMT_ALIGN64 ULONGLONG MemResetOnPaging;
3566 D3DKMT_ALIGN64 ULONGLONG RemovePagesFromWorkingSetOnPaging;
3567 D3DKMT_ALIGN64 ULONGLONG MigrationEnabled;
3568} D3DKMT_QUERYSTATISTICS_POLICY;
3569
3570// Process interference counters indicate how much this process GPU workload interferes with packets
3571// attempting to preempt it. 9 buckets will be exposed based on how long preemption took:
3572// [0] 100 microseconds <= preemption time < 250 microseconds
3573// [1] 250 microseconds <= preemption time < 500 microseconds
3574// [2] 500 microseconds <= preemption time < 1 milliseconds
3575// [3] 1 milliseconds <= preemption time < 2.5 milliseconds
3576// [4] 2.5 milliseconds <= preemption time < 5 milliseconds
3577// [5] 5 milliseconds <= preemption time < 10 milliseconds
3578// [6] 10 milliseconds <= preemption time < 25 milliseconds
3579// [7] 25 milliseconds <= preemption time < 50 milliseconds
3580// [8] 50 milliseconds <= preemption time
3581//
3582#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3583#define D3DKMT_QUERYSTATISTICS_PROCESS_INTERFERENCE_BUCKET_COUNT 9
3584
3585typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_INTERFERENCE_COUNTERS
3586{
3587 D3DKMT_ALIGN64 UINT64 InterferenceCount[D3DKMT_QUERYSTATISTICS_PROCESS_INTERFERENCE_BUCKET_COUNT];
3588} D3DKMT_QUERYSTATISTICS_PROCESS_INTERFERENCE_COUNTERS;
3589#endif
3590
3591typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_ADAPTER_INFORMATION
3592{
3593 ULONG NbSegments;
3594 ULONG NodeCount;
3595 ULONG VidPnSourceCount;
3596
3597 //
3598 // Virtual address space used by vidmm for this process
3599 //
3600 ULONG VirtualMemoryUsage;
3601
3602 D3DKMT_QUERYSTATISTICS_DMA_BUFFER DmaBuffer;
3603 D3DKMT_QUERYSTATISTICS_COMMITMENT_DATA CommitmentData;
3604 D3DKMT_QUERYSTATISTICS_POLICY _Policy;
3605
3606#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3607 D3DKMT_QUERYSTATISTICS_PROCESS_INTERFERENCE_COUNTERS ProcessInterferenceCounters;
3608#else
3609 D3DKMT_ALIGN64 UINT64 Reserved[9];
3610#endif
3611
3612#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
3613 D3DKMT_CLIENTHINT ClientHint;
3614#else
3615 UINT Reserve;
3616#endif
3617} D3DKMT_QUERYSTATISTICS_PROCESS_ADAPTER_INFORMATION;
3618
3619typedef struct _D3DKMT_QUERYSTATISTICS_MEMORY
3620{
3621 D3DKMT_ALIGN64 ULONGLONG TotalBytesEvicted;
3622 ULONG AllocsCommitted;
3623 ULONG AllocsResident;
3624} D3DKMT_QUERYSTATISTICS_MEMORY;
3625
3626typedef struct _D3DKMT_QUERYSTATISTICS_SEGMENT_INFORMATION
3627{
3628#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3629 D3DKMT_ALIGN64 ULONGLONG CommitLimit;
3630 D3DKMT_ALIGN64 ULONGLONG BytesCommitted;
3631 D3DKMT_ALIGN64 ULONGLONG BytesResident;
3632#else
3633 ULONG CommitLimit;
3634 ULONG BytesCommitted;
3635 ULONG BytesResident;
3636#endif
3637
3638 D3DKMT_QUERYSTATISTICS_MEMORY Memory;
3639
3640 //
3641 // Boolean, whether this is an aperture segment
3642 //
3643 ULONG Aperture;
3644
3645 //
3646 // Breakdown of bytes evicted by priority class
3647 //
3648 D3DKMT_ALIGN64 ULONGLONG TotalBytesEvictedByPriority[D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS_MAX]; //Size = D3DKMT_MaxAllocationPriorityClass
3649
3650#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3651 D3DKMT_ALIGN64 UINT64 SystemMemoryEndAddress;
3652 struct D3DKMT_ALIGN64
3653 {
3654 UINT64 PreservedDuringStandby : 1;
3655 UINT64 PreservedDuringHibernate : 1;
3656 UINT64 PartiallyPreservedDuringHibernate : 1;
3657 UINT64 Reserved : 61;
3658 } PowerFlags;
3659
3660#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
3661 struct D3DKMT_ALIGN64
3662 {
3663 UINT64 SystemMemory : 1;
3664 UINT64 PopulatedByReservedDDRByFirmware : 1;
3665 UINT64 Reserved : 62;
3666 } SegmentProperties;
3667 D3DKMT_ALIGN64 UINT64 Reserved[5];
3668#else
3669 D3DKMT_ALIGN64 UINT64 Reserved[6];
3670#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9)
3671#else
3672 D3DKMT_ALIGN64 UINT64 Reserved[8];
3673#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3674} D3DKMT_QUERYSTATISTICS_SEGMENT_INFORMATION;
3675
3676//
3677// Video memory statistics.
3678//
3679typedef struct _D3DKMT_QUERYSTATISTICS_VIDEO_MEMORY
3680{
3681 ULONG AllocsCommitted;
3682 D3DKMT_QUERYSTATISTICS_COUNTER AllocsResidentInP[D3DKMT_QUERYSTATISTICS_SEGMENT_PREFERENCE_MAX];
3683 D3DKMT_QUERYSTATISTICS_COUNTER AllocsResidentInNonPreferred;
3684 D3DKMT_ALIGN64 ULONGLONG TotalBytesEvictedDueToPreparation;
3685} D3DKMT_QUERYSTATISTICS_VIDEO_MEMORY;
3686
3687//
3688// VidMM Policies
3689//
3690typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_POLICY
3691{
3692 D3DKMT_ALIGN64 ULONGLONG UseMRU;
3693} D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_POLICY;
3694
3695typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_INFORMATION
3696{
3697#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3698 D3DKMT_ALIGN64 ULONGLONG BytesCommitted;
3699 D3DKMT_ALIGN64 ULONGLONG MaximumWorkingSet;
3700 D3DKMT_ALIGN64 ULONGLONG MinimumWorkingSet;
3701
3702 ULONG NbReferencedAllocationEvictedInPeriod;
3703 UINT Padding;
3704#else
3705 ULONG BytesCommitted;
3706 ULONG NbReferencedAllocationEvictedInPeriod;
3707 ULONG MaximumWorkingSet;
3708 ULONG MinimumWorkingSet;
3709#endif
3710
3711 D3DKMT_QUERYSTATISTICS_VIDEO_MEMORY VideoMemory;
3712 D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_POLICY _Policy;
3713
3714 D3DKMT_ALIGN64 UINT64 Reserved[8];
3715} D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_INFORMATION;
3716
3717#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3718typedef struct _D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_GROUP_INFORMATION
3719{
3720 D3DKMT_ALIGN64 UINT64 Budget;
3721 D3DKMT_ALIGN64 UINT64 Requested;
3722 D3DKMT_ALIGN64 UINT64 Usage;
3723 D3DKMT_ALIGN64 UINT64 Demoted[D3DKMT_QUERYSTATISTICS_ALLOCATION_PRIORITY_CLASS_MAX];
3724} D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_GROUP_INFORMATION;
3725#endif
3726
3727typedef enum _D3DKMT_QUERYSTATISTICS_TYPE
3728{
3729 D3DKMT_QUERYSTATISTICS_ADAPTER = 0,
3730 D3DKMT_QUERYSTATISTICS_PROCESS = 1,
3731 D3DKMT_QUERYSTATISTICS_PROCESS_ADAPTER = 2,
3732 D3DKMT_QUERYSTATISTICS_SEGMENT = 3,
3733 D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT = 4,
3734 D3DKMT_QUERYSTATISTICS_NODE = 5,
3735 D3DKMT_QUERYSTATISTICS_PROCESS_NODE = 6,
3736 D3DKMT_QUERYSTATISTICS_VIDPNSOURCE = 7,
3737 D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE = 8,
3738#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3739 D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_GROUP = 9,
3740#endif
3741#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3742 D3DKMT_QUERYSTATISTICS_PHYSICAL_ADAPTER = 10,
3743#endif
3744} D3DKMT_QUERYSTATISTICS_TYPE;
3745
3746typedef struct _D3DKMT_QUERYSTATISTICS_QUERY_SEGMENT
3747{
3748 ULONG SegmentId; // in: id of node to get statistics for
3749} D3DKMT_QUERYSTATISTICS_QUERY_SEGMENT;
3750
3751typedef struct _D3DKMT_QUERYSTATISTICS_QUERY_NODE
3752{
3753 ULONG NodeId;
3754} D3DKMT_QUERYSTATISTICS_QUERY_NODE;
3755
3756typedef struct _D3DKMT_QUERYSTATISTICS_QUERY_VIDPNSOURCE
3757{
3758 ULONG VidPnSourceId; // in: id of segment to get statistics for
3759} D3DKMT_QUERYSTATISTICS_QUERY_VIDPNSOURCE;
3760
3761#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3762typedef struct _D3DKMT_QUERYSTATISTICS_QUERY_PHYSICAL_ADAPTER
3763{
3764 ULONG PhysicalAdapterIndex;
3765} D3DKMT_QUERYSTATISTICS_QUERY_PHYSICAL_ADAPTER;
3766#endif
3767
3768typedef union _D3DKMT_QUERYSTATISTICS_RESULT
3769{
3770 D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION AdapterInformation; // out: result of D3DKMT_QUERYSTATISTICS_ADAPTER query
3771#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3772 D3DKMT_QUERYSTATISTICS_PHYSICAL_ADAPTER_INFORMATION PhysAdapterInformation; // out: result of D3DKMT_QUERYSTATISTICS_PHYSICAL_ADAPTER query
3773#endif
3774 D3DKMT_QUERYSTATISTICS_SEGMENT_INFORMATION SegmentInformation; // out: result of D3DKMT_QUERYSTATISTICS_SEGMENT query
3775 D3DKMT_QUERYSTATISTICS_NODE_INFORMATION NodeInformation; // out: result of D3DKMT_QUERYSTATISTICS_NODE query
3776 D3DKMT_QUERYSTATISTICS_VIDPNSOURCE_INFORMATION VidPnSourceInformation; // out: result of D3DKMT_QUERYSTATISTICS_VIDPNSOURCE query
3777 D3DKMT_QUERYSTATISTICS_PROCESS_INFORMATION ProcessInformation; // out: result of D3DKMT_QUERYSTATISTICS_PROCESS query
3778 D3DKMT_QUERYSTATISTICS_PROCESS_ADAPTER_INFORMATION ProcessAdapterInformation; // out: result of D3DKMT_QUERYSTATISTICS_PROCESS_ADAPTER query
3779 D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_INFORMATION ProcessSegmentInformation; // out: result of D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT query
3780 D3DKMT_QUERYSTATISTICS_PROCESS_NODE_INFORMATION ProcessNodeInformation; // out: result of D3DKMT_QUERYSTATISTICS_PROCESS_NODE query
3781 D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE_INFORMATION ProcessVidPnSourceInformation; // out: result of D3DKMT_QUERYSTATISTICS_PROCESS_VIDPNSOURCE query
3782#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3783 D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_GROUP_INFORMATION ProcessSegmentGroupInformation;// out: result of D3DKMT_QUERYSTATISTICS_PROCESS_SEGMENT_GROUP query
3784#endif
3785} D3DKMT_QUERYSTATISTICS_RESULT;
3786
3787typedef struct _D3DKMT_QUERYSTATISTICS
3788{
3789 D3DKMT_QUERYSTATISTICS_TYPE Type; // in: type of data requested
3790 LUID AdapterLuid; // in: adapter to get export / statistics from
3791 D3DKMT_PTR(HANDLE, hProcess); // in: process to get statistics for, if required for this query type
3792 D3DKMT_QUERYSTATISTICS_RESULT QueryResult; // out: requested data
3793
3794 union
3795 {
3796 D3DKMT_QUERYSTATISTICS_QUERY_SEGMENT QuerySegment; // in: id of segment to get statistics for
3797 D3DKMT_QUERYSTATISTICS_QUERY_SEGMENT QueryProcessSegment; // in: id of segment to get statistics for
3798#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
3799 D3DKMT_MEMORY_SEGMENT_GROUP QueryProcessSegmentGroup; // in: id of segment group to get statistics for
3800#endif
3801 D3DKMT_QUERYSTATISTICS_QUERY_NODE QueryNode; // in: id of node to get statistics for
3802 D3DKMT_QUERYSTATISTICS_QUERY_NODE QueryProcessNode; // in: id of node to get statistics for
3803 D3DKMT_QUERYSTATISTICS_QUERY_VIDPNSOURCE QueryVidPnSource; // in: id of vidpnsource to get statistics for
3804 D3DKMT_QUERYSTATISTICS_QUERY_VIDPNSOURCE QueryProcessVidPnSource; // in: id of vidpnsource to get statistics for
3805#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4)
3806 D3DKMT_QUERYSTATISTICS_QUERY_PHYSICAL_ADAPTER QueryPhysAdapter; // in: id of physical adapter to get statistics for
3807#endif
3808 };
3809} D3DKMT_QUERYSTATISTICS;
3810#if defined(_AMD64_)
3811C_ASSERT(sizeof(D3DKMT_QUERYSTATISTICS) == 0x328);
3812#endif
3813
3814//
3815// end D3DKMT_QUERYSTATISTICS
3816//
3817
3818
3819typedef struct _D3DKMT_PRESENT_STATS_DWM2
3820{
3821 ULONG cbSize; // in: size of struct for versioning
3822 UINT PresentCount;
3823 UINT PresentRefreshCount;
3824 D3DKMT_ALIGN64 LARGE_INTEGER PresentQPCTime;
3825 UINT SyncRefreshCount;
3826 D3DKMT_ALIGN64 LARGE_INTEGER SyncQPCTime;
3827 UINT CustomPresentDuration;
3828 UINT VirtualSyncRefreshCount;
3829 D3DKMT_ALIGN64 LARGE_INTEGER VirtualSyncQPCTime;
3830} D3DKMT_PRESENT_STATS_DWM2;
3831
3832
3833typedef enum _D3DKMT_VIDPNSOURCEOWNER_TYPE
3834{
3835 D3DKMT_VIDPNSOURCEOWNER_UNOWNED = 0, //Has no owner or GDI is the owner
3836 D3DKMT_VIDPNSOURCEOWNER_SHARED = 1, //Has shared owner, that is owner can yield to any exclusive owner, not available to legacy devices
3837 D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE = 2, //Has exclusive owner without shared gdi primary,
3838 D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVEGDI = 3, //Has exclusive owner with shared gdi primary and must be exclusive owner of all VidPn sources, only available to legacy devices
3839 D3DKMT_VIDPNSOURCEOWNER_EMULATED = 4, //Does not have real primary ownership, but allows the device to set gamma on its owned sources
3840} D3DKMT_VIDPNSOURCEOWNER_TYPE;
3841
3842#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3843typedef struct _D3DKMT_VIDPNSOURCEOWNER_FLAGS
3844{
3845 union
3846 {
3847 struct
3848 {
3849 UINT AllowOutputDuplication : 1;
3850 UINT DisableDWMVirtualMode : 1;
3851 UINT UseNtHandles : 1;
3852 UINT Reserved : 29;
3853 };
3854 UINT Value;
3855 };
3856} D3DKMT_VIDPNSOURCEOWNER_FLAGS;
3857#endif
3858
3859typedef struct _D3DKMT_SETVIDPNSOURCEOWNER
3860{
3861 D3DKMT_HANDLE hDevice; // in: Device handle
3862 D3DKMT_PTR(CONST D3DKMT_VIDPNSOURCEOWNER_TYPE*, pType); // in: OwnerType array
3863 D3DKMT_PTR(CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID*, pVidPnSourceId); // in: VidPn source ID array
3864 UINT VidPnSourceCount; // in: Number of valid entries in above array
3865} D3DKMT_SETVIDPNSOURCEOWNER;
3866
3867#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
3868typedef struct _D3DKMT_SETVIDPNSOURCEOWNER1
3869{
3870 D3DKMT_SETVIDPNSOURCEOWNER Version0;
3871 D3DKMT_VIDPNSOURCEOWNER_FLAGS Flags;
3872} D3DKMT_SETVIDPNSOURCEOWNER1;
3873#endif
3874
3875#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
3876typedef struct _D3DKMT_SETVIDPNSOURCEOWNER2
3877{
3878 D3DKMT_SETVIDPNSOURCEOWNER1 Version1;
3879 D3DKMT_PTR(CONST D3DKMT_PTR_TYPE*, pVidPnSourceNtHandles); // in: VidPn source owner DispMgr NT handles
3880} D3DKMT_SETVIDPNSOURCEOWNER2;
3881#endif
3882
3883typedef struct _D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP
3884{
3885 D3DKMT_HANDLE hAdapter; // in: Adapter handle
3886 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn source ID array
3887} D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP;
3888
3889#define D3DKMT_GETPRESENTHISTORY_MAXTOKENS 2048
3890
3891typedef struct _D3DKMT_GETPRESENTHISTORY
3892{
3893 D3DKMT_HANDLE hAdapter; // in: Handle to adapter
3894 UINT ProvidedSize; // in: Size of provided buffer
3895 UINT WrittenSize; // out: Copied token size or required size for first token
3896 D3DKMT_PTR(_Field_size_bytes_(ProvidedSize) D3DKMT_PRESENTHISTORYTOKEN*, pTokens); // in: Pointer to buffer.
3897 UINT NumTokens; // out: Number of copied token
3898} D3DKMT_GETPRESENTHISTORY;
3899
3900typedef struct _D3DKMT_CREATEOVERLAY
3901{
3902 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in
3903 D3DKMT_HANDLE hDevice; // in: Indentifies the device
3904 D3DDDI_KERNELOVERLAYINFO OverlayInfo; // in
3905 D3DKMT_HANDLE hOverlay; // out: Kernel overlay handle
3906} D3DKMT_CREATEOVERLAY;
3907
3908typedef struct _D3DKMT_UPDATEOVERLAY
3909{
3910 D3DKMT_HANDLE hDevice; // in: Indentifies the device
3911 D3DKMT_HANDLE hOverlay; // in: Kernel overlay handle
3912 D3DDDI_KERNELOVERLAYINFO OverlayInfo; // in
3913} D3DKMT_UPDATEOVERLAY;
3914
3915typedef struct _D3DKMT_FLIPOVERLAY
3916{
3917 D3DKMT_HANDLE hDevice; // in: Indentifies the device
3918 D3DKMT_HANDLE hOverlay; // in: Kernel overlay handle
3919 D3DKMT_HANDLE hSource; // in: Allocation currently displayed
3920 D3DKMT_PTR(VOID*, pPrivateDriverData); // in: Private driver data
3921 UINT PrivateDriverDataSize; // in: Size of private driver data
3922} D3DKMT_FLIPOVERLAY;
3923
3924typedef struct _D3DKMT_GETOVERLAYSTATE
3925{
3926 D3DKMT_HANDLE hDevice; // in: Indentifies the device
3927 D3DKMT_HANDLE hOverlay; // in: Kernel overlay handle
3928 BOOLEAN OverlayEnabled;
3929} D3DKMT_GETOVERLAYSTATE;
3930
3931typedef struct _D3DKMT_DESTROYOVERLAY
3932{
3933 D3DKMT_HANDLE hDevice; // in: Indentifies the device
3934 D3DKMT_HANDLE hOverlay; // in: Kernel overlay handle
3935} D3DKMT_DESTROYOVERLAY;
3936
3937typedef struct _D3DKMT_WAITFORVERTICALBLANKEVENT
3938{
3939 D3DKMT_HANDLE hAdapter; // in: adapter handle
3940 D3DKMT_HANDLE hDevice; // in: device handle [Optional]
3941 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
3942} D3DKMT_WAITFORVERTICALBLANKEVENT;
3943
3944#define D3DKMT_MAX_WAITFORVERTICALBLANK_OBJECTS 8
3945
3946typedef struct _D3DKMT_WAITFORVERTICALBLANKEVENT2
3947{
3948 D3DKMT_HANDLE hAdapter; // in: adapter handle
3949 D3DKMT_HANDLE hDevice; // in: device handle [Optional]
3950 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
3951 UINT NumObjects;
3952 D3DKMT_PTR_TYPE ObjectHandleArray[D3DKMT_MAX_WAITFORVERTICALBLANK_OBJECTS]; // in: Specifies the objects to wait on.
3953} D3DKMT_WAITFORVERTICALBLANKEVENT2;
3954
3955typedef struct _D3DKMT_GETVERTICALBLANKEVENT
3956{
3957 D3DKMT_HANDLE hAdapter; // in: adapter handle
3958 D3DKMT_HANDLE hDevice; // in: device handle [Optional]
3959 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
3960 D3DKMT_PTR(D3DKMT_PTR_TYPE*, phEvent);
3961} D3DKMT_GETVERTICALBLANKEVENT;
3962
3963typedef struct _D3DKMT_SETSYNCREFRESHCOUNTWAITTARGET
3964{
3965 D3DKMT_HANDLE hAdapter; // in: adapter handle
3966 D3DKMT_HANDLE hDevice; // in: device handle [Optional]
3967 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
3968 UINT TargetSyncRefreshCount;
3969} D3DKMT_SETSYNCREFRESHCOUNTWAITTARGET;
3970
3971typedef struct _D3DKMT_SETGAMMARAMP
3972{
3973 D3DKMT_HANDLE hDevice; // in: device handle
3974 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
3975 D3DDDI_GAMMARAMP_TYPE Type; // in: Gamma ramp type
3976
3977 union
3978 {
3979 D3DDDI_GAMMA_RAMP_RGB256x3x16* pGammaRampRgb256x3x16;
3980 D3DDDI_GAMMA_RAMP_DXGI_1* pGammaRampDXGI1;
3981 D3DKMT_PTR_HELPER( AlignUnionTo64)
3982 };
3983 UINT Size;
3984} D3DKMT_SETGAMMARAMP;
3985
3986typedef struct _D3DKMT_ADJUSTFULLSCREENGAMMA
3987{
3988 D3DKMT_HANDLE hAdapter; // in: adapter handle
3989 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
3990 D3DDDI_DXGI_RGB Scale;
3991 D3DDDI_DXGI_RGB Offset;
3992} D3DKMT_ADJUSTFULLSCREENGAMMA;
3993
3994#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
3995
3996typedef struct _D3DKMT_SET_COLORSPACE_TRANSFORM
3997{
3998 _In_ LUID AdapterLuid;
3999 _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId;
4000 _In_ D3DDDI_GAMMARAMP_TYPE Type;
4001 _In_ UINT Size;
4002 union
4003 {
4004 _In_reads_bytes_opt_(Size) D3DKMDT_3x4_COLORSPACE_TRANSFORM* pColorSpaceTransform;
4005 D3DKMT_PTR_HELPER( AlignUnionTo64)
4006 };
4007} D3DKMT_SET_COLORSPACE_TRANSFORM;
4008
4009#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3
4010
4011typedef struct _D3DKMT_SETVIDPNSOURCEHWPROTECTION
4012{
4013 D3DKMT_HANDLE hAdapter; // in: adapter handle
4014 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN Source ID
4015 BOOL HwProtected; // in: HW protection status
4016} D3DKMT_SETVIDPNSOURCEHWPROTECTION;
4017
4018typedef struct _D3DKMT_SETHWPROTECTIONTEARDOWNRECOVERY
4019{
4020 D3DKMT_HANDLE hAdapter; // in: adapter handle
4021 BOOL Recovered; // in: HW protection teardown recovery
4022} D3DKMT_SETHWPROTECTIONTEARDOWNRECOVERY;
4023
4024typedef enum _D3DKMT_DEVICEEXECUTION_STATE
4025{
4026 D3DKMT_DEVICEEXECUTION_ACTIVE = 1,
4027 D3DKMT_DEVICEEXECUTION_RESET = 2,
4028 D3DKMT_DEVICEEXECUTION_HUNG = 3,
4029 D3DKMT_DEVICEEXECUTION_STOPPED = 4,
4030 D3DKMT_DEVICEEXECUTION_ERROR_OUTOFMEMORY = 5,
4031 D3DKMT_DEVICEEXECUTION_ERROR_DMAFAULT = 6,
4032#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4033 D3DKMT_DEVICEEXECUTION_ERROR_DMAPAGEFAULT = 7,
4034#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4035} D3DKMT_DEVICEEXECUTION_STATE;
4036
4037typedef struct _D3DKMT_DEVICERESET_STATE
4038{
4039 union
4040 {
4041 struct
4042 {
4043 UINT DesktopSwitched : 1; // 0x00000001
4044 UINT Reserved :31; // 0xFFFFFFFE
4045 };
4046 UINT Value;
4047 };
4048} D3DKMT_DEVICERESET_STATE;
4049
4050typedef struct _D3DKMT_PRESENT_STATS
4051{
4052 UINT PresentCount;
4053 UINT PresentRefreshCount;
4054 UINT SyncRefreshCount;
4055 D3DKMT_ALIGN64 LARGE_INTEGER SyncQPCTime;
4056 D3DKMT_ALIGN64 LARGE_INTEGER SyncGPUTime;
4057} D3DKMT_PRESENT_STATS;
4058
4059typedef struct _D3DKMT_DEVICEPRESENT_STATE
4060{
4061 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: present source id
4062 D3DKMT_PRESENT_STATS PresentStats; // out: present stats
4063} D3DKMT_DEVICEPRESENT_STATE;
4064
4065typedef struct _D3DKMT_PRESENT_STATS_DWM
4066{
4067 UINT PresentCount;
4068 UINT PresentRefreshCount;
4069 D3DKMT_ALIGN64 LARGE_INTEGER PresentQPCTime;
4070 UINT SyncRefreshCount;
4071 D3DKMT_ALIGN64 LARGE_INTEGER SyncQPCTime;
4072 UINT CustomPresentDuration;
4073} D3DKMT_PRESENT_STATS_DWM;
4074
4075#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4076
4077typedef struct _D3DKMT_DEVICEPAGEFAULT_STATE
4078{
4079 D3DKMT_ALIGN64 UINT64 FaultedPrimitiveAPISequenceNumber; // when per draw fence write is enabled, identifies the draw that caused the page fault, or DXGK_PRIMITIVE_API_SEQUENCE_NUMBER_UNKNOWN if such information is not available.
4080 DXGK_RENDER_PIPELINE_STAGE FaultedPipelineStage; // render pipeline stage during which the fault was generated, or DXGK_RENDER_PIPELINE_STAGE_UNKNOWN if such information is not available.
4081 UINT FaultedBindTableEntry; // a bind table index of a resource being accessed at the time of the fault, or DXGK_BIND_TABLE_ENTRY_UNKNOWN if such information is not available.
4082 DXGK_PAGE_FAULT_FLAGS PageFaultFlags; // flags specifying the nature of the fault
4083 DXGK_FAULT_ERROR_CODE FaultErrorCode; // Structure that contains error code describing the fault.
4084 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS FaultedVirtualAddress; // virtual address of faulting resource, or D3DGPU_NULL if such information is not available.
4085} D3DKMT_DEVICEPAGEFAULT_STATE;
4086
4087#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4088
4089typedef struct _D3DKMT_DEVICEPRESENT_STATE_DWM
4090{
4091 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: present source id
4092 D3DKMT_PRESENT_STATS_DWM PresentStatsDWM; // out: present stats rev 2
4093} D3DKMT_DEVICEPRESENT_STATE_DWM;
4094
4095#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
4096
4097typedef struct _D3DKMT_DEVICEPRESENT_QUEUE_STATE
4098{
4099 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: present source id
4100 BOOLEAN bQueuedPresentLimitReached; // out: whether the queued present limit has been reached
4101} D3DKMT_DEVICEPRESENT_QUEUE_STATE;
4102
4103#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
4104
4105typedef enum _D3DKMT_DEVICESTATE_TYPE
4106{
4107 D3DKMT_DEVICESTATE_EXECUTION = 1,
4108 D3DKMT_DEVICESTATE_PRESENT = 2,
4109 D3DKMT_DEVICESTATE_RESET = 3,
4110 D3DKMT_DEVICESTATE_PRESENT_DWM = 4,
4111
4112#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4113
4114 D3DKMT_DEVICESTATE_PAGE_FAULT = 5,
4115
4116#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4117
4118#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
4119
4120 D3DKMT_DEVICESTATE_PRESENT_QUEUE = 6,
4121
4122#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1
4123} D3DKMT_DEVICESTATE_TYPE;
4124
4125typedef struct _D3DKMT_GETDEVICESTATE
4126{
4127 D3DKMT_HANDLE hDevice; // in: device handle
4128 D3DKMT_DEVICESTATE_TYPE StateType; // in: device state type
4129 union
4130 {
4131 D3DKMT_DEVICEEXECUTION_STATE ExecutionState; // out: device state
4132 D3DKMT_DEVICEPRESENT_STATE PresentState; // in/out: present state
4133 D3DKMT_DEVICERESET_STATE ResetState; // out: reset state
4134 D3DKMT_DEVICEPRESENT_STATE_DWM PresentStateDWM; // in/out: present state
4135
4136#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4137
4138 D3DKMT_DEVICEPAGEFAULT_STATE PageFaultState; // out: page fault state
4139
4140#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4141
4142#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
4143
4144 D3DKMT_DEVICEPRESENT_QUEUE_STATE PresentQueueState; // in/out: present queue state
4145
4146#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1
4147 };
4148} D3DKMT_GETDEVICESTATE;
4149
4150typedef struct _D3DKMT_CREATEDCFROMMEMORY
4151{
4152 D3DKMT_PTR(VOID*, pMemory); // in: memory for DC
4153 D3DDDIFORMAT Format; // in: Memory pixel format
4154 UINT Width; // in: Memory Width
4155 UINT Height; // in: Memory Height
4156 UINT Pitch; // in: Memory pitch
4157 D3DKMT_PTR(HDC, hDeviceDc); // in: DC describing the device
4158 D3DKMT_PTR(PALETTEENTRY*, pColorTable); // in: Palette
4159 D3DKMT_PTR(HDC, hDc); // out: HDC
4160 D3DKMT_PTR(HANDLE, hBitmap); // out: Handle to bitmap
4161} D3DKMT_CREATEDCFROMMEMORY;
4162
4163typedef struct _D3DKMT_DESTROYDCFROMMEMORY
4164{
4165 D3DKMT_PTR(HDC, hDc); // in:
4166 D3DKMT_PTR(HANDLE, hBitmap); // in:
4167} D3DKMT_DESTROYDCFROMMEMORY;
4168
4169#define D3DKMT_SETCONTEXTSCHEDULINGPRIORITY_ABSOLUTE 0x40000000
4170
4171typedef struct _D3DKMT_SETCONTEXTSCHEDULINGPRIORITY
4172{
4173 D3DKMT_HANDLE hContext; // in: context handle
4174 INT Priority; // in: context priority
4175} D3DKMT_SETCONTEXTSCHEDULINGPRIORITY;
4176
4177typedef struct _D3DKMT_SETCONTEXTINPROCESSSCHEDULINGPRIORITY
4178{
4179 D3DKMT_HANDLE hContext; // in: context handle
4180 INT Priority; // in: context priority
4181} D3DKMT_SETCONTEXTINPROCESSSCHEDULINGPRIORITY;
4182
4183typedef struct _D3DKMT_CHANGESURFACEPOINTER
4184{
4185 D3DKMT_PTR(HDC, hDC); // in: dc handle
4186 D3DKMT_PTR(HANDLE, hBitmap); // in: bitmap handle
4187 D3DKMT_PTR(LPVOID, pSurfacePointer);// in: new surface pointer
4188 UINT Width; // in: Memory Width
4189 UINT Height; // in: Memory Height
4190 UINT Pitch; // in: Memory pitch
4191} D3DKMT_CHANGESURFACEPOINTER;
4192
4193typedef struct _D3DKMT_GETCONTEXTSCHEDULINGPRIORITY
4194{
4195 D3DKMT_HANDLE hContext; // in: context handle
4196 INT Priority; // out: context priority
4197} D3DKMT_GETCONTEXTSCHEDULINGPRIORITY;
4198
4199typedef struct _D3DKMT_GETCONTEXTINPROCESSSCHEDULINGPRIORITY
4200{
4201 D3DKMT_HANDLE hContext; // in: context handle
4202 INT Priority; // out: context priority
4203} D3DKMT_GETCONTEXTINPROCESSSCHEDULINGPRIORITY;
4204
4205typedef enum _D3DKMT_SCHEDULINGPRIORITYCLASS
4206{
4207 D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE = 0,
4208 D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL = 1,
4209 D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL = 2,
4210 D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL = 3,
4211 D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH = 4,
4212 D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME = 5,
4213} D3DKMT_SCHEDULINGPRIORITYCLASS;
4214
4215typedef struct _D3DKMT_GETSCANLINE
4216{
4217 D3DKMT_HANDLE hAdapter; // in: Adapter handle
4218 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Adapter's VidPN Source ID
4219 BOOLEAN InVerticalBlank; // out: Within vertical blank
4220 UINT ScanLine; // out: Current scan line
4221} D3DKMT_GETSCANLINE;
4222
4223typedef enum _D3DKMT_QUEUEDLIMIT_TYPE
4224{
4225 D3DKMT_SET_QUEUEDLIMIT_PRESENT = 1,
4226 D3DKMT_GET_QUEUEDLIMIT_PRESENT = 2,
4227} D3DKMT_QUEUEDLIMIT_TYPE;
4228
4229typedef struct _D3DKMT_SETQUEUEDLIMIT
4230{
4231 D3DKMT_HANDLE hDevice; // in: device handle
4232 D3DKMT_QUEUEDLIMIT_TYPE Type; // in: limit type
4233 union
4234 {
4235 UINT QueuedPresentLimit; // in (or out): queued present limit
4236 struct
4237 {
4238 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: adapter's VidPN source ID
4239 UINT QueuedPendingFlipLimit; // in (or out): flip pending limit
4240 };
4241 };
4242} D3DKMT_SETQUEUEDLIMIT;
4243
4244typedef struct _D3DKMT_POLLDISPLAYCHILDREN
4245{
4246 D3DKMT_HANDLE hAdapter; // in: Adapter handle
4247 UINT NonDestructiveOnly : 1; // in: 0x00000001 Destructive or not
4248 UINT SynchronousPolling : 1; // in: 0x00000002 Synchronous polling or not
4249 UINT DisableModeReset : 1; // in: 0x00000004 Disable DMM mode reset on monitor event
4250 UINT PollAllAdapters : 1; // in: 0x00000008 Poll all adapters
4251 UINT PollInterruptible : 1; // in: 0x00000010 Poll interruptible targets as well.
4252 UINT Reserved : 27; // in: 0xffffffc0
4253} D3DKMT_POLLDISPLAYCHILDREN;
4254
4255typedef struct _D3DKMT_INVALIDATEACTIVEVIDPN
4256{
4257 D3DKMT_HANDLE hAdapter; // in: Adapter handle
4258 D3DKMT_PTR(VOID*, pPrivateDriverData); // in: Private driver data
4259 UINT PrivateDriverDataSize; // in: Size of private driver data
4260} D3DKMT_INVALIDATEACTIVEVIDPN;
4261
4262typedef struct _D3DKMT_CHECKOCCLUSION
4263{
4264 D3DKMT_PTR(HWND, hWindow); // in: Destination window handle
4265} D3DKMT_CHECKOCCLUSION;
4266
4267typedef struct _D3DKMT_WAITFORIDLE
4268{
4269 D3DKMT_HANDLE hDevice; // in: Device to wait for idle
4270} D3DKMT_WAITFORIDLE;
4271
4272typedef struct _D3DKMT_CHECKMONITORPOWERSTATE
4273{
4274 D3DKMT_HANDLE hAdapter; // in: Adapter to check on
4275 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Adapter's VidPN Source ID
4276} D3DKMT_CHECKMONITORPOWERSTATE;
4277
4278typedef struct _D3DKMT_SETDISPLAYPRIVATEDRIVERFORMAT
4279{
4280 D3DKMT_HANDLE hDevice; // in: Identifies the device
4281 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies which VidPn we are changing the private driver format attribute for
4282 UINT PrivateDriverFormatAttribute; // In: Requested private format attribute for VidPn specified
4283} D3DKMT_SETDISPLAYPRIVATEDRIVERFORMAT;
4284
4285typedef struct _D3DKMT_CREATEKEYEDMUTEX
4286{
4287 D3DKMT_ALIGN64 UINT64 InitialValue; // in: Initial value to release to
4288 D3DKMT_HANDLE hSharedHandle; // out: Global handle to keyed mutex
4289 D3DKMT_HANDLE hKeyedMutex; // out: Handle to the keyed mutex in this process
4290} D3DKMT_CREATEKEYEDMUTEX;
4291
4292typedef struct _D3DKMT_OPENKEYEDMUTEX
4293{
4294 D3DKMT_HANDLE hSharedHandle; // in: Global handle to keyed mutex
4295 D3DKMT_HANDLE hKeyedMutex; // out: Handle to the keyed mutex in this process
4296} D3DKMT_OPENKEYEDMUTEX;
4297
4298typedef struct _D3DKMT_DESTROYKEYEDMUTEX
4299{
4300 D3DKMT_HANDLE hKeyedMutex; // in: Identifies the keyed mutex being destroyed.
4301} D3DKMT_DESTROYKEYEDMUTEX;
4302
4303typedef struct _D3DKMT_ACQUIREKEYEDMUTEX
4304{
4305 D3DKMT_HANDLE hKeyedMutex; // in: Handle to the keyed mutex
4306 D3DKMT_ALIGN64 UINT64 Key; // in: Key value to Acquire
4307 D3DKMT_PTR(PLARGE_INTEGER, pTimeout); // in: NT-style timeout value
4308 D3DKMT_ALIGN64 UINT64 FenceValue; // out: Current fence value of the GPU sync object
4309} D3DKMT_ACQUIREKEYEDMUTEX;
4310
4311typedef struct _D3DKMT_RELEASEKEYEDMUTEX
4312{
4313 D3DKMT_HANDLE hKeyedMutex; // in: Handle to the keyed mutex
4314 D3DKMT_ALIGN64 UINT64 Key; // in: Key value to Release to
4315 D3DKMT_ALIGN64 UINT64 FenceValue; // in: New fence value to use for GPU sync object
4316} D3DKMT_RELEASEKEYEDMUTEX;
4317
4318#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
4319
4320typedef struct _D3DKMT_CREATEKEYEDMUTEX2_FLAGS
4321{
4322 union
4323 {
4324 struct
4325 {
4326 UINT NtSecuritySharing : 1; // If set, the keyed mutex will be shared using DxgkShareObjects instead of D3DKMT_CREATEKEYEDMUTEX2::hSharedHandle
4327 UINT Reserved : 31;
4328 };
4329 UINT Value;
4330 };
4331} D3DKMT_CREATEKEYEDMUTEX2_FLAGS;
4332
4333typedef struct _D3DKMT_CREATEKEYEDMUTEX2
4334{
4335 D3DKMT_ALIGN64 UINT64 InitialValue; // in: Initial value to release to
4336 D3DKMT_HANDLE hSharedHandle; // out: Global handle to keyed mutex, NULL if NtSecuritySharing is set.
4337 D3DKMT_HANDLE hKeyedMutex; // out: Handle to the keyed mutex in this process
4338 D3DKMT_PTR(_In_reads_bytes_opt_(PrivateRuntimeDataSize)
4339 VOID*, pPrivateRuntimeData); // in: Buffer containing initial private data.
4340 // If NULL then PrivateRuntimeDataSize must be 0.
4341 UINT PrivateRuntimeDataSize; // in: Size in bytes of pPrivateRuntimeData.
4342 D3DKMT_CREATEKEYEDMUTEX2_FLAGS Flags; // in: Creation flags.
4343} D3DKMT_CREATEKEYEDMUTEX2;
4344
4345typedef struct _D3DKMT_OPENKEYEDMUTEX2
4346{
4347 D3DKMT_HANDLE hSharedHandle; // in: Global handle to keyed mutex
4348 D3DKMT_HANDLE hKeyedMutex; // out: Handle to the keyed mutex in this process
4349 D3DKMT_PTR(_In_reads_bytes_opt_(PrivateRuntimeDataSize)
4350 VOID*, pPrivateRuntimeData); // in: Buffer containing initial private data.
4351 // If NULL then PrivateRuntimeDataSize must be 0.
4352 // It will only be copied if the keyed mutex does not already have private data.
4353 UINT PrivateRuntimeDataSize; // in: Size in bytes of pPrivateRuntimeData.
4354} D3DKMT_OPENKEYEDMUTEX2;
4355
4356typedef struct _D3DKMT_OPENKEYEDMUTEXFROMNTHANDLE
4357{
4358 D3DKMT_PTR(HANDLE, hNtHandle); // in: NT handle to keyed mutex
4359 D3DKMT_HANDLE hKeyedMutex; // out: Handle to the keyed mutex in this process
4360 D3DKMT_PTR(_In_reads_bytes_opt_(PrivateRuntimeDataSize)
4361 VOID*, pPrivateRuntimeData); // in: Buffer containing initial private data.
4362 // If NULL then PrivateRuntimeDataSize must be 0.
4363 // It will only be copied if the keyed mutex does not already have private data.
4364 UINT PrivateRuntimeDataSize; // in: Size in bytes of pPrivateRuntimeData.
4365} D3DKMT_OPENKEYEDMUTEXFROMNTHANDLE;
4366
4367typedef struct _D3DKMT_ACQUIREKEYEDMUTEX2
4368{
4369 D3DKMT_HANDLE hKeyedMutex; // in: Handle to the keyed mutex
4370 D3DKMT_ALIGN64 UINT64 Key; // in: Key value to Acquire
4371 D3DKMT_PTR(PLARGE_INTEGER, pTimeout); // in: NT-style timeout value
4372 D3DKMT_ALIGN64 UINT64 FenceValue; // out: Current fence value of the GPU sync object
4373 D3DKMT_PTR(_Out_writes_bytes_all_opt_(PrivateRuntimeDataSize)
4374 VOID*, pPrivateRuntimeData); // out: Buffer to copy private data to.
4375 // If NULL then PrivateRuntimeDataSize must be 0.
4376 UINT PrivateRuntimeDataSize; // in: Size in bytes of pPrivateRuntimeData.
4377} D3DKMT_ACQUIREKEYEDMUTEX2;
4378
4379typedef struct _D3DKMT_RELEASEKEYEDMUTEX2
4380{
4381 D3DKMT_HANDLE hKeyedMutex; // in: Handle to the keyed mutex
4382 D3DKMT_ALIGN64 UINT64 Key; // in: Key value to Release to
4383 D3DKMT_ALIGN64 UINT64 FenceValue; // in: New fence value to use for GPU sync object
4384 D3DKMT_PTR(_In_reads_bytes_opt_(PrivateRuntimeDataSize)
4385 VOID*, pPrivateRuntimeData); // in: Buffer containing new private data.
4386 // If NULL then PrivateRuntimeDataSize must be 0.
4387 UINT PrivateRuntimeDataSize; // in: Size in bytes of pPrivateRuntimeData.
4388} D3DKMT_RELEASEKEYEDMUTEX2;
4389#endif
4390
4391
4392typedef struct _D3DKMT_CONFIGURESHAREDRESOURCE
4393{
4394 D3DKMT_HANDLE hDevice; // in: Device that created the resource
4395 D3DKMT_HANDLE hResource; // in: Handle for shared resource
4396 BOOLEAN IsDwm; // in: TRUE when the process is DWM
4397 D3DKMT_PTR(HANDLE, hProcess); // in: Process handle for the non-DWM case
4398 BOOLEAN AllowAccess; // in: Indicates whereh the process is allowed access
4399} D3DKMT_CONFIGURESHAREDRESOURCE;
4400
4401typedef struct _D3DKMT_CHECKSHAREDRESOURCEACCESS
4402{
4403 D3DKMT_HANDLE hResource; // in: Handle for the resource
4404 UINT ClientPid; // in: Client process PID
4405} D3DKMT_CHECKSHAREDRESOURCEACCESS;
4406
4407#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
4408typedef enum _D3DKMT_OFFER_PRIORITY
4409{
4410 D3DKMT_OFFER_PRIORITY_LOW=1, // Content is not useful
4411 D3DKMT_OFFER_PRIORITY_NORMAL, // Content is useful but easy to regenerate
4412 D3DKMT_OFFER_PRIORITY_HIGH, // Content is useful and difficult to regenerate
4413 D3DKMT_OFFER_PRIORITY_AUTO, // Let VidMm decide offer priority based on eviction priority
4414} D3DKMT_OFFER_PRIORITY;
4415
4416#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4417typedef struct _D3DKMT_OFFER_FLAGS
4418{
4419 union
4420 {
4421 struct
4422 {
4423 UINT OfferImmediately : 1; // 0x00000001
4424 UINT AllowDecommit : 1; // 0x00000002
4425 UINT Reserved : 30; // 0xFFFFFFFC
4426 };
4427 UINT Value;
4428 };
4429} D3DKMT_OFFER_FLAGS;
4430#endif // DXGKDDI_INTERFACE_VERSION
4431
4432typedef struct _D3DKMT_OFFERALLOCATIONS
4433{
4434 D3DKMT_HANDLE hDevice; // in: Device that created the allocations
4435 D3DKMT_PTR(D3DKMT_HANDLE*, pResources); // in: array of D3D runtime resource handles.
4436 D3DKMT_PTR(CONST D3DKMT_HANDLE*, HandleList); // in: array of allocation handles. If non-NULL, pResources must be NULL.
4437 UINT NumAllocations; // in: number of items in whichever of pResources or HandleList is non-NULL.
4438 D3DKMT_OFFER_PRIORITY Priority; // in: priority with which to offer the allocations
4439#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4440 D3DKMT_OFFER_FLAGS Flags; // in: various flags for determining offer behavior
4441#endif // DXGKDDI_INTERFACE_VERSION
4442} D3DKMT_OFFERALLOCATIONS;
4443
4444typedef struct _D3DKMT_RECLAIMALLOCATIONS
4445{
4446 D3DKMT_HANDLE hDevice; // in: Device that created the allocations
4447 D3DKMT_PTR(D3DKMT_HANDLE*, pResources); // in: array of D3D runtime resource handles.
4448 D3DKMT_PTR(CONST D3DKMT_HANDLE*, HandleList); // in: array of allocation handles. If non-NULL, pResources must be NULL.
4449 D3DKMT_PTR(BOOL*, pDiscarded); // out: optional array of booleans specifying whether each resource or allocation was discarded.
4450 UINT NumAllocations; // in: number of items in pDiscarded and whichever of pResources or HandleList is non-NULL.
4451} D3DKMT_RECLAIMALLOCATIONS;
4452
4453typedef struct _D3DKMT_RECLAIMALLOCATIONS2
4454{
4455 D3DKMT_HANDLE hPagingQueue; // in: Device that created the allocations
4456 UINT NumAllocations; // in: number of items in pDiscarded and whichever of pResources or HandleList is non-NULL.
4457 D3DKMT_PTR(D3DKMT_HANDLE*, pResources); // in: array of D3D runtime resource handles.
4458 D3DKMT_PTR(CONST D3DKMT_HANDLE*, HandleList); // in: array of allocation handles. If non-NULL, pResources must be NULL.
4459#if(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1 || \
4460 D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM2_1)
4461 union
4462 {
4463 BOOL* pDiscarded; // out: optional array of booleans specifying whether each resource or allocation was discarded.
4464 D3DDDI_RECLAIM_RESULT* pResults; // out: array of results specifying whether each resource or allocation is OK, discarded, or has no commitment.
4465 D3DKMT_PTR_HELPER(AlignUnionTo64)
4466 };
4467#else
4468 D3DKMT_PTR(BOOL*, pDiscarded); // out: optional array of booleans specifying whether each resource or allocation was discarded.
4469#endif // (DXGKDDI_INTERFACE_VERSION || D3D_UMD_INTERFACE_VERSION)
4470 D3DKMT_ALIGN64 UINT64 PagingFenceValue; // out: The paging fence to synchronize against before submitting work to the GPU which
4471 // references any of the resources or allocations in the provided arrays
4472} D3DKMT_RECLAIMALLOCATIONS2;
4473
4474typedef struct _D3DKMT_OUTPUTDUPLCREATIONFLAGS
4475{
4476 union
4477 {
4478 struct
4479 {
4480 UINT CompositionUiCaptureOnly : 1;
4481 UINT Reserved : 31;
4482 };
4483 UINT Value;
4484 };
4485} D3DKMT_OUTPUTDUPLCREATIONFLAGS;
4486
4487typedef struct _D3DKMT_OUTPUTDUPL_KEYEDMUTEX
4488{
4489 D3DKMT_PTR(HANDLE, hSharedSurfaceNt);
4490}D3DKMT_OUTPUTDUPL_KEYEDMUTEX;
4491
4492#define OUTPUTDUPL_CREATE_MAX_KEYEDMUTXES 3
4493typedef struct _D3DKMT_CREATE_OUTPUTDUPL
4494{
4495 D3DKMT_HANDLE hAdapter;
4496 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
4497 UINT KeyedMutexCount; // in : If zero then means is this the pre-create check
4498 UINT RequiredKeyedMutexCount; // out: The number of keyed mutexs needed
4499 D3DKMT_OUTPUTDUPL_KEYEDMUTEX KeyedMutexs[OUTPUTDUPL_CREATE_MAX_KEYEDMUTXES];
4500 D3DKMT_OUTPUTDUPLCREATIONFLAGS Flags;
4501} D3DKMT_CREATE_OUTPUTDUPL;
4502
4503typedef struct _D3DKMT_DESTROY_OUTPUTDUPL
4504{
4505 D3DKMT_HANDLE hAdapter;
4506 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
4507 BOOL bDestroyAllContexts;
4508} D3DKMT_DESTROY_OUTPUTDUPL;
4509
4510typedef struct _D3DKMT_OUTPUTDUPL_POINTER_POSITION
4511{
4513 BOOL Visible;
4514} D3DKMT_OUTPUTDUPL_POINTER_POSITION;
4515
4516typedef struct _D3DKMT_OUTPUTDUPL_FRAMEINFO
4517{
4518 D3DKMT_ALIGN64 LARGE_INTEGER LastPresentTime;
4519 D3DKMT_ALIGN64 LARGE_INTEGER LastMouseUpdateTime;
4520 UINT AccumulatedFrames;
4521 BOOL RectsCoalesced;
4522 BOOL ProtectedContentMaskedOut;
4523 D3DKMT_OUTPUTDUPL_POINTER_POSITION PointerPosition;
4524 UINT TotalMetadataBufferSize;
4525 UINT PointerShapeBufferSize;
4526} D3DKMT_OUTPUTDUPL_FRAMEINFO;
4527
4528typedef struct _D3DKMT_OUTPUTDUPL_GET_FRAMEINFO
4529{
4530 D3DKMT_HANDLE hAdapter;
4531 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
4532 D3DKMT_OUTPUTDUPL_FRAMEINFO FrameInfo;
4533} D3DKMT_OUTPUTDUPL_GET_FRAMEINFO;
4534
4535typedef enum _D3DKMT_OUTPUTDUPL_METADATATYPE
4536{
4537 D3DKMT_OUTPUTDUPL_METADATATYPE_DIRTY_RECTS = 0,
4538 D3DKMT_OUTPUTDUPL_METADATATYPE_MOVE_RECTS = 1
4539} D3DKMT_OUTPUTDUPL_METADATATYPE;
4540
4541typedef struct _D3DKMT_OUTPUTDUPL_METADATA
4542{
4543 D3DKMT_HANDLE hAdapter;
4544 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
4545 D3DKMT_OUTPUTDUPL_METADATATYPE Type;
4546 UINT BufferSizeSupplied;
4547 D3DKMT_PTR(_Field_size_bytes_part_(BufferSizeSupplied, BufferSizeRequired) PVOID, pBuffer);
4548 UINT BufferSizeRequired;
4549} D3DKMT_OUTPUTDUPL_METADATA;
4550
4551typedef enum _D3DKMT_OUTDUPL_POINTER_SHAPE_TYPE
4552{
4553 D3DKMT_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 0x00000001,
4554 D3DKMT_OUTDUPL_POINTER_SHAPE_TYPE_COLOR = 0x00000002,
4555 D3DKMT_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR = 0x00000004
4556} D3DKMT_OUTDUPL_POINTER_SHAPE_TYPE;
4557
4558typedef struct _D3DKMT_OUTDUPL_POINTER_SHAPE_INFO
4559{
4560 D3DKMT_OUTDUPL_POINTER_SHAPE_TYPE Type;
4561 UINT Width;
4562 UINT Height;
4563 UINT Pitch;
4564 POINT HotSpot;
4565} D3DKMT_OUTDUPL_POINTER_SHAPE_INFO;
4566
4567typedef struct _D3DKMT_OUTPUTDUPL_GET_POINTER_SHAPE_DATA
4568{
4569 D3DKMT_HANDLE hAdapter;
4570 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
4571 UINT BufferSizeSupplied;
4572 D3DKMT_PTR(_Field_size_bytes_part_(BufferSizeSupplied, BufferSizeRequired) PVOID, pShapeBuffer);
4573 UINT BufferSizeRequired;
4574 D3DKMT_OUTDUPL_POINTER_SHAPE_INFO ShapeInfo;
4575} D3DKMT_OUTPUTDUPL_GET_POINTER_SHAPE_DATA;
4576
4577typedef struct _D3DKMT_OUTPUTDUPL_RELEASE_FRAME
4578{
4579 D3DKMT_HANDLE hAdapter;
4580 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
4581 UINT NextKeyMutexIdx; // out : index of the next keyed mutex to use
4582} D3DKMT_OUTPUTDUPL_RELEASE_FRAME;
4583
4584
4585#define D3DKMT_MAX_OBJECTS_PER_HANDLE 3
4586
4587#define D3DKMT_MAX_BUNDLE_OBJECTS_PER_HANDLE 16
4588
4589#define D3DKMT_GDI_STYLE_HANDLE_DECORATION 0x2
4590
4591typedef struct _D3DKMT_GETSHAREDRESOURCEADAPTERLUID
4592{
4593 D3DKMT_HANDLE hGlobalShare; // in : Shared resource handle
4594 D3DKMT_PTR(HANDLE, hNtHandle); // in : Process's NT handle
4595 LUID AdapterLuid; // out: adapter LUID
4596} D3DKMT_GETSHAREDRESOURCEADAPTERLUID;
4597
4598typedef enum _D3DKMT_GPU_PREFERENCE_QUERY_STATE
4599{
4600 D3DKMT_GPU_PREFERENCE_STATE_UNINITIALIZED,
4601 D3DKMT_GPU_PREFERENCE_STATE_HIGH_PERFORMANCE,
4602 D3DKMT_GPU_PREFERENCE_STATE_MINIMUM_POWER,
4603 D3DKMT_GPU_PREFERENCE_STATE_UNSPECIFIED,
4604 D3DKMT_GPU_PREFERENCE_STATE_NOT_FOUND,
4605 D3DKMT_GPU_PREFERENCE_STATE_USER_SPECIFIED_GPU
4606} D3DKMT_GPU_PREFERENCE_QUERY_STATE;
4607
4608typedef enum _D3DKMT_GPU_PREFERENCE_QUERY_TYPE
4609{
4610 D3DKMT_GPU_PREFERENCE_TYPE_IHV_DLIST,
4611 D3DKMT_GPU_PREFERENCE_TYPE_DX_DATABASE,
4612 D3DKMT_GPU_PREFERENCE_TYPE_USER_PREFERENCE
4613} D3DKMT_GPU_PREFERENCE_QUERY_TYPE;
4614
4615typedef struct _D3DKMT_HYBRID_LIST
4616{
4617 D3DKMT_GPU_PREFERENCE_QUERY_STATE State; // Gpu preference query state
4618 LUID AdapterLuid; // in,opt: Adapter luid to per-adapter DList state. Optional if QueryType == D3DKMT_GPU_PREFERENCE_TYPE_IHV_DLIST
4619 BOOL bUserPreferenceQuery; // Whether referring to user gpu preference, or per-adapter DList query
4620#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6)
4621 D3DKMT_GPU_PREFERENCE_QUERY_TYPE QueryType; // Replaced bUserPreferenceQuery, for referring to which D3DKMT_GPU_PREFERENCE_QUERY_TYPE
4622#endif
4623} D3DKMT_HYBRID_LIST;
4624
4625#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
4626typedef struct
4627{
4628 DXGK_MIRACAST_CHUNK_INFO ChunkInfo;
4629 UINT PrivateDriverDataSize; // Size of private data
4630 BYTE PrivateDriverData[1]; // Private data buffer
4631} D3DKMT_MIRACAST_CHUNK_DATA;
4632
4633typedef enum
4634{
4635 MiracastStopped = 0,
4636 MiracastStartPending = 1,
4637 MiracastStarted = 2,
4638 MiracastStopPending = 3,
4639} D3DKMT_MIRACAST_DISPLAY_DEVICE_STATE;
4640
4641typedef enum
4642{
4643 D3DKMT_MIRACAST_DEVICE_STATUS_SUCCESS = 0,
4644 D3DKMT_MIRACAST_DEVICE_STATUS_SUCCESS_NO_MONITOR = 1,
4645 D3DKMT_MIRACAST_DEVICE_STATUS_PENDING = 2,
4646 D3DKMT_MIRACAST_DEVICE_STATUS_UNKOWN_ERROR = 0x80000001,
4647 D3DKMT_MIRACAST_DEVICE_STATUS_GPU_RESOURCE_IN_USE = 0x80000002,
4648 D3DKMT_MIRACAST_DEVICE_STATUS_DEVICE_ERROR = 0x80000003,
4649 D3DKMT_MIRACAST_DEVICE_STATUS_UNKOWN_PAIRING = 0x80000004,
4650 D3DKMT_MIRACAST_DEVICE_STATUS_REMOTE_SESSION = 0x80000005,
4651 D3DKMT_MIRACAST_DEVICE_STATUS_DEVICE_NOT_FOUND = 0x80000006,
4652 D3DKMT_MIRACAST_DEVICE_STATUS_DEVICE_NOT_STARTED = 0x80000007,
4653 D3DKMT_MIRACAST_DEVICE_STATUS_INVALID_PARAMETER = 0x80000008,
4654 D3DKMT_MIRACAST_DEVICE_STATUS_INSUFFICIENT_BANDWIDTH = 0x80000009,
4655 D3DKMT_MIRACAST_DEVICE_STATUS_INSUFFICIENT_MEMORY = 0x8000000A,
4656 D3DKMT_MIRACAST_DEVICE_STATUS_CANCELLED = 0x8000000B,
4657} D3DKMT_MIRACAST_DEVICE_STATUS;
4658
4659typedef struct _D3DKMT_MIRACAST_DISPLAY_DEVICE_STATUS
4660{
4661 //
4662 // Miracast display device state.
4663 //
4664 D3DKMT_MIRACAST_DISPLAY_DEVICE_STATE State;
4665} D3DKMT_MIRACAST_DISPLAY_DEVICE_STATUS, *PD3DKMT_MIRACAST_DISPLAY_DEVICE_STATUS;
4666
4667typedef struct _D3DKMT_MIRACAST_DISPLAY_DEVICE_CAPS
4668{
4669 BOOLEAN HdcpSupported;
4670 ULONG DefaultControlPort;
4671 BOOLEAN UsesIhvSolution;
4672} D3DKMT_MIRACAST_DISPLAY_DEVICE_CAPS, *PD3DKMT_MIRACAST_DISPLAY_DEVICE_CAPS;
4673
4674#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4675typedef struct _D3DKMT_MIRACAST_DISPLAY_STOP_SESSIONS
4676{
4677 LUID AdapterLuid;
4678 D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId;
4679 UINT StopReason;
4680} D3DKMT_MIRACAST_DISPLAY_STOP_SESSIONS, *PD3DKMT_MIRACAST_DISPLAY_STOP_SESSIONS;
4681#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4682
4683
4684#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3)
4685
4686#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
4687
4688typedef struct _D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU
4689{
4690 D3DKMT_HANDLE hDevice; // in: Handle to the device.
4691 UINT ObjectCount; // in: Number of objects to wait on.
4692
4693 D3DKMT_PTR(_Field_size_(ObjectCount)
4694 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Handle to monitored fence synchronization objects to wait on.
4695
4696 D3DKMT_PTR(_Field_size_(ObjectCount)
4697 const UINT64*, FenceValueArray); // in: Fence values to be waited on.
4698
4699 D3DKMT_PTR(HANDLE, hAsyncEvent); // in: Event to be signaled when the wait condition is satisfied.
4700 // When set to NULL, the call will not return until the wait condition is satisfied.
4701
4702 D3DDDI_WAITFORSYNCHRONIZATIONOBJECTFROMCPU_FLAGS Flags; // in: Flags that specify the wait mode.
4703} D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU;
4704
4705typedef struct _D3DKMT_SIGNALSYNCHRONIZATIONOBJECTFROMCPU
4706{
4707 D3DKMT_HANDLE hDevice; // in: Handle to the device.
4708 UINT ObjectCount; // in: Number of objects to signal.
4709
4710 D3DKMT_PTR(_Field_size_(ObjectCount)
4711 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Handle to monitored fence synchronization objects to signal.
4712
4713 D3DKMT_PTR(_Field_size_(ObjectCount)
4714 const UINT64*, FenceValueArray); // in: Fence values to be signaled.
4715
4716 D3DDDICB_SIGNALFLAGS Flags; // in: Specifies signal behavior.
4717} D3DKMT_SIGNALSYNCHRONIZATIONOBJECTFROMCPU;
4718
4719typedef struct _D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMGPU
4720{
4721 D3DKMT_HANDLE hContext; // in: Specify the context that should be waiting.
4722 UINT ObjectCount; // in: Number of object to wait on.
4723
4724 D3DKMT_PTR(_Field_size_(ObjectCount)
4725 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Handles to synchronization objects to wait on.
4726
4727 union
4728 {
4730 const UINT64* MonitoredFenceValueArray; // in: monitored fence values to be waited.
4731
4732 D3DKMT_ALIGN64 UINT64 FenceValue; // in: fence value to be waited.
4733
4734 D3DKMT_ALIGN64 UINT64 Reserved[8];
4735 };
4736} D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMGPU;
4737
4738typedef struct _D3DKMT_SIGNALSYNCHRONIZATIONOBJECTFROMGPU
4739{
4740 D3DKMT_HANDLE hContext; // in: Identifies the context that the signal is being submitted to.
4741 UINT ObjectCount; // in: Specifies the number of objects to signal.
4742
4743 D3DKMT_PTR(_Field_size_(ObjectCount)
4744 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Specifies the objects to signal.
4745
4746 union
4747 {
4749 const UINT64* MonitoredFenceValueArray; // in: monitored fence values to be signaled
4750
4751 D3DKMT_ALIGN64 UINT64 Reserved[8];
4752 };
4753} D3DKMT_SIGNALSYNCHRONIZATIONOBJECTFROMGPU;
4754
4755typedef struct _D3DKMT_SIGNALSYNCHRONIZATIONOBJECTFROMGPU2
4756{
4757 UINT ObjectCount; // in: Specifies the number of objects to signal.
4758
4759 D3DKMT_PTR(_Field_size_(ObjectCount)
4760 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Specifies the objects to signal.
4761
4762 D3DDDICB_SIGNALFLAGS Flags; // in: Specifies signal behavior.
4763
4764 ULONG BroadcastContextCount; // in: Specifies the number of contexts to broadcast this signal to.
4765
4766 D3DKMT_PTR(_Field_size_(BroadcastContextCount)
4767 const D3DKMT_HANDLE*, BroadcastContextArray); // in: Specifies context handles to broadcast to.
4768
4769 union
4770 {
4771 D3DKMT_ALIGN64 UINT64 FenceValue; // in: fence value to be signaled;
4772
4773 HANDLE CpuEventHandle; // in: handle of a CPU event to be signaled if Flags.EnqueueCpuEvent flag is set.
4774
4776 const UINT64* MonitoredFenceValueArray; // in: monitored fence values to be signaled
4777
4778 D3DKMT_ALIGN64 UINT64 Reserved[8];
4779 };
4780} D3DKMT_SIGNALSYNCHRONIZATIONOBJECTFROMGPU2;
4781
4782typedef struct _D3DKMT_CREATEPAGINGQUEUE
4783{
4784 D3DKMT_HANDLE hDevice; // in: Handle to the device.
4785 D3DDDI_PAGINGQUEUE_PRIORITY Priority; // in: scheduling priority relative to other paging queues on this device
4786 D3DKMT_HANDLE hPagingQueue; // out: handle to the paging queue used to synchronize paging operations for this device.
4787 D3DKMT_HANDLE hSyncObject; // out: handle to the monitored fence object used to synchronize paging operations for this paging queue.
4788 D3DKMT_PTR(VOID*, FenceValueCPUVirtualAddress); // out: Read-only mapping of the fence value for the CPU
4789 UINT PhysicalAdapterIndex; // in: Physical adapter index (engine ordinal)
4790} D3DKMT_CREATEPAGINGQUEUE;
4791
4792typedef struct _D3DKMT_EVICT
4793{
4794 D3DKMT_HANDLE hDevice; // in: Device that created the allocations
4795 UINT NumAllocations; // in: number of allocation handles
4796 D3DKMT_PTR(CONST D3DKMT_HANDLE*, AllocationList); // in: an array of NumAllocations allocation handles
4797 D3DDDI_EVICT_FLAGS Flags; // in: eviction flags
4798 D3DKMT_ALIGN64 UINT64 NumBytesToTrim; // out: This value indicates how much to trim in order to satisfy the new budget.
4799} D3DKMT_EVICT;
4800
4801typedef struct _D3DKMT_LOCK2
4802{
4803 D3DKMT_HANDLE hDevice; // in: Handle to the device.
4804 D3DKMT_HANDLE hAllocation; // in: allocation to lock
4805 D3DDDICB_LOCK2FLAGS Flags; // in: Bit field defined by D3DDDI_LOCK2FLAGS
4806 D3DKMT_PTR(PVOID, pData); // out: Virtual address of the locked allocation
4807} D3DKMT_LOCK2;
4808
4809typedef struct _D3DKMT_UNLOCK2
4810{
4811 D3DKMT_HANDLE hDevice; // in: Handle to the device.
4812 D3DKMT_HANDLE hAllocation; // in: allocation to unlock
4813} D3DKMT_UNLOCK2;
4814
4815typedef struct _D3DKMT_INVALIDATECACHE
4816{
4817 D3DKMT_HANDLE hDevice;
4818 D3DKMT_HANDLE hAllocation;
4819 D3DKMT_ALIGN64 D3DKMT_SIZE_T Offset;
4820 D3DKMT_ALIGN64 D3DKMT_SIZE_T Length;
4821} D3DKMT_INVALIDATECACHE;
4822
4823typedef struct _D3DKMT_FREEGPUVIRTUALADDRESS
4824{
4825 D3DKMT_HANDLE hAdapter; // in: Handle to an adapter.
4826 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS BaseAddress; // in: Start of a virtual address range in bytes
4827 D3DKMT_ALIGN64 D3DGPU_SIZE_T Size; // in: Size of the virtual address range in bytes
4828} D3DKMT_FREEGPUVIRTUALADDRESS;
4829
4830typedef struct _D3DKMT_UPDATEGPUVIRTUALADDRESS
4831{
4832 D3DKMT_HANDLE hDevice;
4833 D3DKMT_HANDLE hContext;
4834 D3DKMT_HANDLE hFenceObject;
4835 UINT NumOperations;
4836 D3DKMT_PTR(D3DDDI_UPDATEGPUVIRTUALADDRESS_OPERATION*, Operations);
4837 D3DKMT_ALIGN64 D3DKMT_SIZE_T Reserved0;
4838 D3DKMT_ALIGN64 UINT64 Reserved1;
4839 D3DKMT_ALIGN64 UINT64 FenceValue;
4840 union
4841 {
4842 struct
4843 {
4844 UINT DoNotWait : 1;
4845 UINT Reserved : 31;
4846 };
4847 UINT Value;
4848 } Flags;
4849} D3DKMT_UPDATEGPUVIRTUALADDRESS;
4850
4851typedef struct _D3DKMT_CREATECONTEXTVIRTUAL
4852{
4853 D3DKMT_HANDLE hDevice; // in:
4854 UINT NodeOrdinal; // in:
4855 UINT EngineAffinity; // in:
4856 D3DDDI_CREATECONTEXTFLAGS Flags; // in:
4857 D3DKMT_PTR(VOID*, pPrivateDriverData); // in:
4858 UINT PrivateDriverDataSize; // in:
4859 D3DKMT_CLIENTHINT ClientHint; // in: Hints which client is creating the context
4860 D3DKMT_HANDLE hContext; // out:
4861} D3DKMT_CREATECONTEXTVIRTUAL;
4862
4863typedef struct _D3DKMT_SUBMITCOMMANDFLAGS
4864{
4865 UINT NullRendering : 1; // 0x00000001
4866 UINT PresentRedirected : 1; // 0x00000002
4867 UINT NoKmdAccess : 1; // 0x00000004
4868 UINT Reserved : 29; // 0xFFFFFFF8
4869} D3DKMT_SUBMITCOMMANDFLAGS;
4870
4871typedef struct _D3DKMT_SUBMITCOMMAND
4872{
4873 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS Commands;
4874 UINT CommandLength;
4875 D3DKMT_SUBMITCOMMANDFLAGS Flags;
4876 D3DKMT_ALIGN64 ULONGLONG PresentHistoryToken; // in: Present history token for redirected present calls
4877 UINT BroadcastContextCount;
4878 D3DKMT_HANDLE BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT];
4879 D3DKMT_PTR(VOID*, pPrivateDriverData);
4880 UINT PrivateDriverDataSize;
4881 UINT NumPrimaries;
4882 D3DKMT_HANDLE WrittenPrimaries[D3DDDI_MAX_WRITTEN_PRIMARIES];
4883 UINT NumHistoryBuffers;
4884 D3DKMT_PTR(D3DKMT_HANDLE*, HistoryBufferArray);
4885} D3DKMT_SUBMITCOMMAND;
4886
4887#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
4888
4889typedef struct _D3DKMT_SUBMITCOMMANDTOHWQUEUE
4890{
4891 D3DKMT_HANDLE hHwQueue; // in: Context queue to submit the command to.
4892
4893 D3DKMT_ALIGN64 UINT64 HwQueueProgressFenceId; // in: Hardware queue progress fence value that will be signaled once the command is finished.
4894
4895 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS CommandBuffer;// in: GPU VA of the command buffer to be executed on the GPU.
4896 UINT CommandLength; // in: Length in bytes of the command buffer.
4897
4898 UINT PrivateDriverDataSize; // in: Size of private driver data in bytes.
4899
4900 D3DKMT_PTR(_Field_size_bytes_(PrivateDriverDataSize)
4901 VOID*, pPrivateDriverData); // in: Pointer to the private driver data.
4902
4903 UINT NumPrimaries; // in: The number of primaries written by this command buffer.
4904
4905 D3DKMT_PTR(_Field_size_ (NumPrimaries)
4906 D3DKMT_HANDLE CONST*, WrittenPrimaries); // in: The array of primaries written by this command buffer.
4907} D3DKMT_SUBMITCOMMANDTOHWQUEUE;
4908
4909typedef struct _D3DKMT_SUBMITWAITFORSYNCOBJECTSTOHWQUEUE
4910{
4911 D3DKMT_HANDLE hHwQueue; // in: Context queue to submit the command to.
4912
4913 UINT ObjectCount; // in: Number of objects to wait on.
4914
4915 D3DKMT_PTR(_Field_size_(ObjectCount)
4916 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Handles to monitored fence synchronization objects to wait on.
4917
4918 D3DKMT_PTR(_Field_size_(ObjectCount)
4919 const UINT64*, FenceValueArray); // in: monitored fence values to be waited.
4920} D3DKMT_SUBMITWAITFORSYNCOBJECTSTOHWQUEUE;
4921
4922typedef struct _D3DKMT_SUBMITSIGNALSYNCOBJECTSTOHWQUEUE
4923{
4924 D3DDDICB_SIGNALFLAGS Flags; // in: Specifies signal behavior.
4925
4926 ULONG BroadcastHwQueueCount; // in: Specifies the number of hardware queues to broadcast this signal to.
4927
4928 D3DKMT_PTR(_Field_size_(BroadcastHwQueueCount)
4929 const D3DKMT_HANDLE*, BroadcastHwQueueArray); // in: Specifies hardware queue handles to broadcast to.
4930
4931 UINT ObjectCount; // in: Number of objects to signal.
4932
4933 D3DKMT_PTR(_Field_size_(ObjectCount)
4934 const D3DKMT_HANDLE*, ObjectHandleArray); // in: Handles to monitored fence synchronization objects to signal.
4935
4936 D3DKMT_PTR(_Field_size_(ObjectCount)
4937 const UINT64*, FenceValueArray); // in: monitored fence values to signal.
4938} D3DKMT_SUBMITSIGNALSYNCOBJECTSTOHWQUEUE;
4939
4940#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
4941
4942typedef struct _D3DKMT_QUERYVIDEOMEMORYINFO
4943{
4944 D3DKMT_PTR(HANDLE, hProcess); // in,opt: A handle to a process. If NULL, the current process is used.
4945 // The process handle must be opened with PROCESS_QUERY_INFORMATION privileges
4946 D3DKMT_HANDLE hAdapter; // in : The adapter to query for this process
4947 D3DKMT_MEMORY_SEGMENT_GROUP MemorySegmentGroup; // in : The memory segment group to query.
4948 D3DKMT_ALIGN64 UINT64 Budget; // out: Total memory the application may use
4949 D3DKMT_ALIGN64 UINT64 CurrentUsage; // out: Current memory usage of the device
4950 D3DKMT_ALIGN64 UINT64 CurrentReservation; // out: Current reservation of the device
4951 D3DKMT_ALIGN64 UINT64 AvailableForReservation; // out: Total that the device may reserve
4952 UINT PhysicalAdapterIndex; // in : Zero based physical adapter index in the LDA configuration.
4953} D3DKMT_QUERYVIDEOMEMORYINFO;
4954
4955typedef struct _D3DKMT_CHANGEVIDEOMMEMORYRESERVATION
4956{
4957 D3DKMT_PTR(HANDLE, hProcess); // in,opt: A handle to a process. If NULL, the current process is used.
4958 // The process handle must be opened with PROCESS_SET_INFORMATION privileges
4959 D3DKMT_HANDLE hAdapter; // in : The adapter to change reservation for.
4960 D3DKMT_MEMORY_SEGMENT_GROUP MemorySegmentGroup; // in : The memory segment group to change reservation for.
4961 D3DKMT_ALIGN64 UINT64 Reservation; // in : Desired reservation in the range between 0 and AvailableForReservation returned by QueryVideoMemoryInfo.
4962 UINT PhysicalAdapterIndex; // in : Zero based physical adapter index in the LDA configuration.
4963} D3DKMT_CHANGEVIDEOMEMORYRESERVATION;
4964
4965typedef struct _D3DKMT_SETSTABLEPOWERSTATE
4966{
4967 D3DKMT_HANDLE hAdapter; // in: The adapter to enable or disable stable power for
4968 BOOL Enabled; // in: Whether or not stable power is being requested on or off.
4969} D3DKMT_SETSTABLEPOWERSTATE;
4970
4971// Used by Linux ioctl
4972typedef struct _D3DKMT_SHAREOBJECTS {
4973 UINT ObjectCount; // in
4974 D3DKMT_PTR(_Field_size_(ObjectCount)
4975 CONST D3DKMT_HANDLE*, ObjectHandleArray); // in
4976 D3DKMT_PTR(PVOID, pObjectAttributes); // in
4977 DWORD DesiredAccess; // in
4978 D3DKMT_PTR(HANDLE*, pSharedNtHandle); // out
4979} D3DKMT_SHAREOBJECTS;
4980
4981typedef struct _D3DKMT_SHAREOBJECTWITHHOST
4982{
4983 D3DKMT_HANDLE hDevice; // in
4984 D3DKMT_HANDLE hObject; // in
4985 D3DKMT_ALIGN64 UINT64 Reserved; // in Must be zero. Reserved for future use
4986 D3DKMT_ALIGN64 UINT64 hVailProcessNtHandle; // out
4987} D3DKMT_SHAREOBJECTWITHHOST;
4988
4989//
4990// This API is used to support sync_file in Android.
4991// A sync_file is a wrapper around the given monitored fence and the fence value.
4992// When a sync_file is created, a wait for sync object on CPU is issued
4993// and a file descriptor (FD) it returned to the app. The app can wait on the FD,
4994// which will be unblocked when the sync object with this fence value is signaled.
4995//
4996typedef struct _D3DKMT_CREATESYNCFILE
4997{
4998 D3DKMT_HANDLE hDevice; // in: Device owner of the monitored fence.
4999 D3DKMT_HANDLE hMonitoredFence; // in: Monitored fence object
5000 D3DKMT_ALIGN64 UINT64 FenceValue; // in: Fence value to wait for
5001 D3DKMT_ALIGN64 UINT64 hSyncFile; // out: File descriptor on Android or a NT handle on Windows (when implemented)
5002} D3DKMT_CREATESYNCFILE;
5003
5004typedef struct _D3DKMT_TRIMNOTIFICATION
5005{
5006 D3DKMT_PTR(VOID*, Context); // In: context at Register
5007 D3DDDI_TRIMRESIDENCYSET_FLAGS Flags; // In: trim flags
5008 D3DKMT_ALIGN64 UINT64 NumBytesToTrim; // In: When TrimToBudget flag is set, this value indicates how much VidMm
5009 // requests the app to trim to fit in the new budget.
5010} D3DKMT_TRIMNOTIFICATION;
5011
5012typedef VOID (APIENTRY *PFND3DKMT_TRIMNOTIFICATIONCALLBACK)(_Inout_ D3DKMT_TRIMNOTIFICATION*);
5013
5014typedef struct _D3DKMT_REGISTERTRIMNOTIFICATION
5015{
5016 LUID AdapterLuid;
5017 D3DKMT_HANDLE hDevice;
5018 PFND3DKMT_TRIMNOTIFICATIONCALLBACK Callback;
5019 D3DKMT_PTR(VOID*, Context); // In: callback context
5020 D3DKMT_PTR(VOID*, Handle); // Out: for Unregister
5021} D3DKMT_REGISTERTRIMNOTIFICATION;
5022
5023typedef struct _D3DKMT_UNREGISTERTRIMNOTIFICATION
5024{
5025 D3DKMT_PTR(VOID*, Handle); // In: Handle returned from RegisterTrimNotification,
5026 // or NULL to unregister all Callback instances.
5027 D3DKMT_PTR(PFND3DKMT_TRIMNOTIFICATIONCALLBACK, Callback); // In: When Handle is NULL, this parameter specifies that all registered instances of Callback
5028 // should be unregistered. This unregistration method should only be used
5029 // in DLL unload scenarios when the DLL being unloaded cannot guarantee that
5030 // all trim callbacks are unregistered through their handles.
5031} D3DKMT_UNREGISTERTRIMNOTIFICATION;
5032
5033typedef struct _D3DKMT_BUDGETCHANGENOTIFICATION
5034{
5035 D3DKMT_PTR(VOID*, Context); // In: context at Register
5036 D3DKMT_ALIGN64 UINT64 Budget; // In: new budget
5037} D3DKMT_BUDGETCHANGENOTIFICATION;
5038
5039typedef VOID (APIENTRY *PFND3DKMT_BUDGETCHANGENOTIFICATIONCALLBACK)(_In_ D3DKMT_BUDGETCHANGENOTIFICATION*);
5040
5041typedef struct _D3DKMT_REGISTERBUDGETCHANGENOTIFICATION
5042{
5043 D3DKMT_HANDLE hDevice;
5044 D3DKMT_PTR(PFND3DKMT_BUDGETCHANGENOTIFICATIONCALLBACK, Callback);
5045 D3DKMT_PTR(VOID*, Context); // In: callback context
5046 D3DKMT_PTR(VOID*, Handle); // Out: for Unregister
5047} D3DKMT_REGISTERBUDGETCHANGENOTIFICATION;
5048
5049typedef struct _D3DKMT_UNREGISTERBUDGETCHANGENOTIFICATION
5050{
5051 D3DKMT_PTR(VOID*, Handle); // In: from register
5052} D3DKMT_UNREGISTERBUDGETCHANGENOTIFICATION;
5053
5054typedef struct _D3DKMT_QUERYVIDPNEXCLUSIVEOWNERSHIP
5055{
5056 D3DKMT_PTR(HANDLE, hProcess); // In: Process handle
5057 D3DKMT_PTR(HWND, hWindow); // In: Window handle
5058 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // Out: VidPn source ID
5059 LUID AdapterLuid; // Out: Adapter LUID
5060 D3DKMT_VIDPNSOURCEOWNER_TYPE OwnerType; // Out: Owner Type
5061} D3DKMT_QUERYVIDPNEXCLUSIVEOWNERSHIP;
5062
5063
5064typedef enum _D3DKMT_DEVICE_ERROR_REASON {
5065 D3DKMT_DEVICE_ERROR_REASON_GENERIC = 0x80000000,
5066 D3DKMT_DEVICE_ERROR_REASON_DRIVER_ERROR = 0x80000006,
5067} D3DKMT_DEVICE_ERROR_REASON;
5068
5069typedef struct _D3DKMT_MARKDEVICEASERROR
5070{
5071 D3DKMT_HANDLE hDevice; // in: Device handle
5072 D3DKMT_DEVICE_ERROR_REASON Reason; // in: Status code
5073} D3DKMT_MARKDEVICEASERROR;
5074
5075typedef struct _D3DKMT_FLUSHHEAPTRANSITIONS
5076{
5077 D3DKMT_HANDLE hAdapter;
5078} D3DKMT_FLUSHHEAPTRANSITIONS;
5079
5080typedef struct _D3DKMT_QUERYPROCESSOFFERINFO
5081{
5082 _In_ ULONG cbSize;
5083 D3DKMT_PTR(_In_ HANDLE, hProcess);
5084 _Out_ D3DKMT_ALIGN64 UINT64 DecommitUniqueness;
5085 _Out_ D3DKMT_ALIGN64 UINT64 DecommittableBytes;
5086} D3DKMT_QUERYPROCESSOFFERINFO;
5087
5088typedef union _D3DKMT_TRIMPROCESSCOMMITMENT_FLAGS
5089{
5090 struct
5091 {
5092 UINT Lazy : 1;
5093 UINT OnlyRepurposed : 1;
5094 UINT Reserved : 30;
5095 };
5096 UINT Value;
5097} D3DKMT_TRIMPROCESSCOMMITMENT_FLAGS;
5098
5099typedef struct _D3DKMT_TRIMPROCESSCOMMITMENT
5100{
5101 _In_ ULONG cbSize;
5102 D3DKMT_PTR(_In_ HANDLE, hProcess);
5103 _In_ D3DKMT_TRIMPROCESSCOMMITMENT_FLAGS Flags;
5104 _In_ D3DKMT_ALIGN64 UINT64 DecommitRequested;
5105 _Out_ D3DKMT_ALIGN64 UINT64 NumBytesDecommitted;
5106} D3DKMT_TRIMPROCESSCOMMITMENT;
5107
5108#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
5109
5110typedef struct _D3DKMT_CREATEHWCONTEXT
5111{
5112 D3DKMT_HANDLE hDevice; // in: Handle to the device owning this context.
5113 UINT NodeOrdinal; // in: Identifier for the node targetted by this context.
5114 UINT EngineAffinity; // in: Engine affinity within the specified node.
5115 D3DDDI_CREATEHWCONTEXTFLAGS Flags; // in: Context creation flags.
5116 UINT PrivateDriverDataSize; // in: Size of private driver data
5117 D3DKMT_PTR(_Inout_
5118 _Field_size_bytes_ (PrivateDriverDataSize)
5119 VOID*, pPrivateDriverData); // in/out: Private driver data
5120 D3DKMT_HANDLE hHwContext; // out: Handle of the created context.
5121} D3DKMT_CREATEHWCONTEXT;
5122
5123typedef struct _D3DKMT_DESTROYHWCONTEXT
5124{
5125 D3DKMT_HANDLE hHwContext; // in: Identifies the context being destroyed.
5126} D3DKMT_DESTROYHWCONTEXT;
5127
5128typedef struct _D3DKMT_CREATEHWQUEUE
5129{
5130 D3DKMT_HANDLE hHwContext; // in: Handle to the hardware context the queue is associated with.
5131 D3DDDI_CREATEHWQUEUEFLAGS Flags; // in: Hardware queue creation flags.
5132 UINT PrivateDriverDataSize; // in: Size of private driver data
5133 D3DKMT_PTR(_Inout_
5134 _Field_size_bytes_ (PrivateDriverDataSize)
5135 VOID*, pPrivateDriverData); // in/out: Private driver data
5136 D3DKMT_HANDLE hHwQueue; // out: handle to the hardware queue object to submit work to.
5137 D3DKMT_HANDLE hHwQueueProgressFence; // out: handle to the monitored fence object used to monitor the queue progress.
5138 D3DKMT_PTR(VOID*, HwQueueProgressFenceCPUVirtualAddress); // out: Read-only mapping of the queue progress fence value for the CPU
5139 D3DKMT_ALIGN64 D3DGPU_VIRTUAL_ADDRESS HwQueueProgressFenceGPUVirtualAddress; // out: Read/write mapping of the queue progress fence value for the GPU
5140} D3DKMT_CREATEHWQUEUE;
5141
5142typedef struct _D3DKMT_DESTROYHWQUEUE
5143{
5144 D3DKMT_HANDLE hHwQueue; // in: handle to the hardware queue to be destroyed.
5145} D3DKMT_DESTROYHWQUEUE;
5146
5147typedef struct _D3DKMT_GETALLOCATIONPRIORITY
5148{
5149 D3DKMT_HANDLE hDevice; // in: Indentifies the device
5150 D3DKMT_HANDLE hResource; // in: Specify the resource to get priority of.
5151 D3DKMT_PTR(CONST D3DKMT_HANDLE*, phAllocationList); // in: pointer to an array allocation to get priorities of.
5152 UINT AllocationCount; // in: Number of allocations in phAllocationList
5153 D3DKMT_PTR(UINT*, pPriorities); // out: Priority for each of the allocation in the array.
5154} D3DKMT_GETALLOCATIONPRIORITY;
5155
5156#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
5157
5158
5159
5160#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
5161
5162#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
5163
5164#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
5165typedef union _D3DKMT_SETFSEBLOCKFLAGS
5166{
5167 struct
5168 {
5169 UINT Block : 1;
5170 UINT Reserved : 31;
5171 };
5172 UINT Value;
5173} D3DKMT_SETFSEBLOCKFLAGS;
5174
5175typedef struct _D3DKMT_SETFSEBLOCK
5176{
5177 LUID AdapterLuid;
5178 D3DKMT_HANDLE hAdapter;
5179 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
5180 D3DKMT_SETFSEBLOCKFLAGS Flags;
5181} D3DKMT_SETFSEBLOCK;
5182
5183typedef union _D3DKMT_QUERYFSEFLAGS
5184{
5185 struct
5186 {
5187 UINT Blocked : 1;
5188 UINT Reserved : 31;
5189 };
5190 UINT Value;
5191} D3DKMT_QUERYFSEBLOCKFLAGS;
5192
5193typedef struct _D3DKMT_QUERYFSEBLOCK
5194{
5195 LUID AdapterLuid;
5196 D3DKMT_HANDLE hAdapter;
5197 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
5198 D3DKMT_QUERYFSEBLOCKFLAGS Flags;
5199} D3DKMT_QUERYFSEBLOCK;
5200#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1)
5201
5202#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
5203#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2)
5204
5205#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
5206
5207typedef struct _D3DKMT_CREATEPROTECTEDSESSION
5208{
5209 D3DKMT_HANDLE hDevice; // in: device handle
5210 D3DKMT_HANDLE hSyncObject; // in: monitored fence handle associated to this session (kernel handle)
5211 D3DKMT_PTR(_Field_size_bytes_(PrivateDriverDataSize)
5212 CONST VOID*, pPrivateDriverData); // in: Private driver data
5213 UINT PrivateDriverDataSize; // in: Size of private runtime data
5214 D3DKMT_PTR(_Field_size_bytes_(PrivateRuntimeDataSize)
5215 CONST VOID*, pPrivateRuntimeData); // in: Private runtime data
5216 UINT PrivateRuntimeDataSize; // in: Size of private runtime data
5217
5218 D3DKMT_HANDLE hHandle; // out: protected session handle (kernel handle)
5219
5220} D3DKMT_CREATEPROTECTEDSESSION;
5221
5222typedef struct _D3DKMT_DESTROYPROTECTEDSESSION
5223{
5224 D3DKMT_HANDLE hHandle; // in: protected session handle (kernel handle)
5225
5226} D3DKMT_DESTROYPROTECTEDSESSION;
5227
5228typedef enum _D3DKMT_PROTECTED_SESSION_STATUS
5229{
5230 D3DKMT_PROTECTED_SESSION_STATUS_OK = 0,
5231 D3DKMT_PROTECTED_SESSION_STATUS_INVALID = 1,
5232} D3DKMT_PROTECTED_SESSION_STATUS;
5233
5234typedef struct _D3DKMT_QUERYPROTECTEDSESSIONSTATUS
5235{
5236 D3DKMT_HANDLE hHandle; // in: protected session handle (kernel handle)
5237 D3DKMT_PROTECTED_SESSION_STATUS Status; // out: protected session status
5238
5239} D3DKMT_QUERYPROTECTEDSESSIONSTATUS;
5240
5241typedef struct _D3DKMT_QUERYPROTECTEDSESSIONINFOFROMNTHANDLE
5242{
5243 D3DKMT_PTR(HANDLE, hNtHandle); // in: protected session handle (NT handle)
5244 D3DKMT_PTR(_Field_size_bytes_(PrivateDriverDataSize)
5245 CONST VOID*, pPrivateDriverData); // in: Private driver data
5246 UINT PrivateDriverDataSize; // in/out: Size of private runtime data
5247 D3DKMT_PTR(_Field_size_bytes_(PrivateRuntimeDataSize)
5248 CONST VOID*, pPrivateRuntimeData); // in: Private runtime data
5249 UINT PrivateRuntimeDataSize; // in/out: Size of private runtime data
5250
5251} D3DKMT_QUERYPROTECTEDSESSIONINFOFROMNTHANDLE;
5252
5253typedef struct _D3DKMT_OPENPROTECTEDSESSIONFROMNTHANDLE
5254{
5255 D3DKMT_PTR(HANDLE, hNtHandle);// in: protected session handle (NT handle)
5256 D3DKMT_HANDLE hHandle; // out: protected session handle (kernel handle)
5257
5258} D3DKMT_OPENPROTECTEDSESSIONFROMNTHANDLE;
5259
5260
5261typedef struct _D3DKMT_GETPROCESSDEVICEREMOVALSUPPORT
5262{
5263 D3DKMT_PTR(HANDLE, hProcess); // in: Process handle
5264 LUID AdapterLuid; // in: Luid of Adapter that is potentially being detached
5265 BOOLEAN Support; // out: Whether or not the process using the adapter can recover from graphics device removal
5266
5267} D3DKMT_GETPROCESSDEVICEREMOVALSUPPORT;
5268
5269#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3)
5270
5271
5272// All tracked workload functionality is accessible just by the D3D11 and D3D12 runtimes
5273typedef enum _D3DKMT_TRACKEDWORKLOADPOLICY
5274{
5275 D3DKMT_TRACKEDWORKLOADPOLICY_NORMAL = 0,
5276 D3DKMT_TRACKEDWORKLOADPOLICY_ENERGY_EFFICIENT = 1,
5277 D3DKMT_TRACKEDWORKLOADPOLICY_HIGH_SPEED = 2
5278} D3DKMT_TRACKEDWORKLOADPOLICY;
5279
5280typedef enum _D3DKMT_TRACKEDWORKLOADDEADLINETYPE
5281{
5282 D3DKMT_TRACKEDWORKLOADDEADLINETYPE_ABSOLUTE = 0,
5283 D3DKMT_TRACKEDWORKLOADDEADLINETYPE_VBLANK = 1,
5284} D3DKMT_TRACKEDWORKLOADDEADLINETYPE;
5285
5286typedef struct _D3DKMT_TRACKEDWORKLOADDEADLINE {
5287 union {
5288 D3DKMT_ALIGN64 UINT64 VBlankOffsetHundredsNS;
5289 D3DKMT_ALIGN64 UINT64 AbsoluteQPC;
5290 };
5291} D3DKMT_TRACKEDWORKLOADDEADLINE;
5292
5293typedef struct _D3DKMT_TRACKEDWORKLOADFLAGS
5294{
5295 union
5296 {
5297 struct
5298 {
5299 UINT Periodic : 1; // 0x00000001 - workload instances occur at a periodic rate
5300 UINT SimilarLoad : 1; // 0x00000002 - workload instances have a similar load
5301 UINT Reserved : 30;
5302 };
5303 UINT Value;
5304 };
5305} D3DKMT_TRACKEDWORKLOADFLAGS;
5306
5307#define D3DKMT_MAX_TRACKED_WORKLOAD_INSTANCE_PAIRS 32
5308
5309typedef struct _D3DKMT_CREATETRACKEDWORKLOAD
5310{
5311 ULONG cbSize; // in: size of structure for versioning
5312 ULONG ContextCount; // in: Specifies the number of contexts to create the workload
5313 D3DKMT_PTR(_Field_size_(ContextCount)
5314 const D3DKMT_HANDLE*, ContextArray); // in: Specifies context handles in which to create the workload
5315 D3DKMT_TRACKEDWORKLOADDEADLINETYPE DeadlineType; // in: Specifies the deadline type of the tracked workload
5316 UINT32 VidPnTargetId; // in: Specifies the target ID. Needed for VBLANK DEADLINETYPE
5317 D3DKMT_TRACKEDWORKLOADFLAGS Flags; // in: Flags to create the workload with
5318 D3DKMT_TRACKEDWORKLOADPOLICY Policy; // in: Which policy to use
5319 UINT MaxInstances; // in: maximum number of instances this workload can have
5320 UINT MaxInstancePairs; // in: maximum number of instance pairs this workload can have (includes suspend/resume)
5321 D3DKMT_HANDLE hResourceQueryTimestamps; // in: buffer which will contain the resolved query timestamps for the tracked workloads
5322 D3DKMT_HANDLE hTrackedWorkload; // out: the tracked workload handle
5323} D3DKMT_CREATETRACKEDWORKLOAD;
5324
5325typedef struct _D3DKMT_DESTROYTRACKEDWORKLOAD
5326{
5327 ULONG cbSize; // in: size of structure for versioning
5328 D3DKMT_HANDLE hTrackedWorkload; // in: tracked workload handle
5329} D3DKMT_DESTROYTRACKEDWORKLOAD;
5330
5331typedef struct _D3DKMT_UPDATETRACKEDWORKLOAD
5332{
5333 ULONG cbSize; // in: size of structure for versioning
5334 D3DKMT_HANDLE hTrackedWorkload; // in: tracked workload handle
5335 D3DKMT_TRACKEDWORKLOADDEADLINE FinishDeadline; // in: specifies the deadline by which this workload should be finished
5336 UINT BeginTrackedWorkloadIndex;// in: slot for the timestamp for the start of this workload pair (index in buffer pointed to by hResourceQueryTimestamps)
5337 UINT EndTrackedWorkloadIndex; // in: slot for the timestamp for the end of this workload pair (index in buffer pointed to by hResourceQueryTimestamps)
5338 BOOL Resume; // in: TRUE if the start of this workload pair is a Resume instead of a Begin
5339 BOOL Suspend; // in: TRUE if the end of this workload pair is a Suspend instead of an End
5340 D3DKMT_ALIGN64 UINT64 PairID; // in: identifier for the Begin/End tracked workload pair (should include any suspend/resume in the pair)
5341 D3DKMT_ALIGN64 UINT64 FenceSubmissionValue; // in: fence value for the submission of this workload
5342 D3DKMT_ALIGN64 UINT64 FenceCompletedValue; // in: fence value for the completed workloads
5343 D3DKMT_ALIGN64 UINT64 GPUTimestampFrequency; // in: GPU timestamp frequency for resolving query timestamps
5344 D3DKMT_ALIGN64 UINT64 GPUCalibrationTimestamp; // in: value of the GPU calibration timestamp counter
5345 D3DKMT_ALIGN64 UINT64 CPUCalibrationTimestamp; // in: value of the CPU calibration timestamp counter
5346 D3DKMT_ALIGN64 UINT64 TimestampArray[D3DKMT_MAX_TRACKED_WORKLOAD_INSTANCE_PAIRS * 2]; // in: specifies the already read timestamp data (D3D11 only)
5347 BOOL TimestampArrayProcessed; // out: TRUE if the timestamp array entries were processed (D3D11 only)
5348} D3DKMT_UPDATETRACKEDWORKLOAD;
5349
5350typedef struct _D3DKMT_GETAVAILABLETRACKEDWORKLOADINDEX
5351{
5352 ULONG cbSize; // in: size of structure for versioning
5353 D3DKMT_HANDLE hTrackedWorkload; // in: tracked workload handle
5354 D3DKMT_ALIGN64 UINT64 FenceCompletedValue; // in: fence value for the completed workloads
5355 D3DKMT_ALIGN64 UINT64 TimestampArray[D3DKMT_MAX_TRACKED_WORKLOAD_INSTANCE_PAIRS * 2]; // in: specifies the already read timestamp data (D3D11 only)
5356 UINT AvailableTrackedWorkloadIndex; // out: first available tracked workload slot
5357 BOOL TimestampArrayProcessed; // out: TRUE if the timestamp array entries were processed (D3D11 only)
5358} D3DKMT_GETAVAILABLETRACKEDWORKLOADINDEX;
5359
5360typedef struct _D3DKMT_TRACKEDWORKLOADSTATEFLAGS
5361{
5362 union
5363 {
5364 struct
5365 {
5366 UINT Saturated : 1; // 0x00000001 - in the current state of execution, tracked workload cannot meet its deadline.
5367 UINT NotEnoughSamples: 1; // 0x00000002 - we don't have enough samples to produce stats yet
5368 UINT Reserved : 30;
5369 };
5370 UINT Value;
5371 };
5372} D3DKMT_TRACKEDWORKLOADSTATEFLAGS;
5373
5374typedef struct _D3DKMT_TRACKEDWORKLOAD_STATISTICS
5375{
5376 D3DKMT_ALIGN64 INT64 Mean;
5377 D3DKMT_ALIGN64 INT64 Minimum;
5378 D3DKMT_ALIGN64 INT64 Maximum;
5379 D3DKMT_ALIGN64 INT64 Variance;
5380 D3DKMT_ALIGN64 UINT64 Count;
5381} D3DKMT_TRACKEDWORKLOAD_STATISTICS;
5382
5383typedef struct _D3DKMT_GETTRACKEDWORKLOADSTATISTICS
5384{
5385 ULONG cbSize; // in: size of structure for versioning
5386 D3DKMT_HANDLE hTrackedWorkload; // in: tracked workload handle
5387 D3DKMT_ALIGN64 UINT64 FenceCompletedValue; // in: fence value for the completed workloads
5388 D3DKMT_ALIGN64 UINT64 TimestampArray[D3DKMT_MAX_TRACKED_WORKLOAD_INSTANCE_PAIRS * 2]; // in: specifies the already read timestamp data (D3D11 only)
5389 BOOL TimestampArrayProcessed; // out: TRUE if the timestamp array entries were processed (D3D11 only)
5390 D3DKMT_TRACKEDWORKLOAD_STATISTICS DeadlineOffsetHundredsNS; // out: statistics for the offset of the deadline achieved of the tracked workload in hundreds of nanosecs
5391 D3DKMT_ALIGN64 UINT64 MissedDeadlines; // out: count of missed deadlines
5392 D3DKMT_TRACKEDWORKLOADSTATEFLAGS Flags; // out: current state flags
5393} D3DKMT_GETTRACKEDWORKLOADSTATISTICS;
5394
5395typedef struct _D3DKMT_RESETTRACKEDWORKLOADSTATISTICS
5396{
5397 ULONG cbSize; // in: size of structure for versioning
5398 D3DKMT_HANDLE hTrackedWorkload; // in: tracked workload handle
5399} D3DKMT_RESETTRACKEDWORKLOADSTATISTICS;
5400
5401#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7)
5402
5403
5404#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_7
5405
5406
5407typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATEALLOCATION)(_Inout_ D3DKMT_CREATEALLOCATION*);
5408typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATEALLOCATION2)(_Inout_ D3DKMT_CREATEALLOCATION*); // _ADVSCH_
5409typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_QUERYRESOURCEINFO)(_Inout_ D3DKMT_QUERYRESOURCEINFO*);
5410#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8)
5411typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_QUERYRESOURCEINFOFROMNTHANDLE)(_Inout_ D3DKMT_QUERYRESOURCEINFOFROMNTHANDLE*);
5412
5413typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SHAREOBJECTS)(
5414 _In_range_(1, D3DKMT_MAX_OBJECTS_PER_HANDLE) UINT cObjects,
5415 _In_reads_(cObjects) CONST D3DKMT_HANDLE * hObjects,
5416 _In_ POBJECT_ATTRIBUTES pObjectAttributes,
5417 _In_ DWORD dwDesiredAccess,
5418 _Out_ HANDLE * phSharedNtHandle
5419 );
5420typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENNTHANDLEFROMNAME)(_Inout_ D3DKMT_OPENNTHANDLEFROMNAME*);
5421typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENRESOURCEFROMNTHANDLE)(_Inout_ D3DKMT_OPENRESOURCEFROMNTHANDLE*);
5422typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENSYNCOBJECTFROMNTHANDLE)(_Inout_ D3DKMT_OPENSYNCOBJECTFROMNTHANDLE*);
5423#endif
5424typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENRESOURCE)(_Inout_ D3DKMT_OPENRESOURCE*);
5425typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENRESOURCE2)(_Inout_ D3DKMT_OPENRESOURCE*); // _ADVSCH_
5426typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYALLOCATION)(_In_ CONST D3DKMT_DESTROYALLOCATION*);
5427
5428#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0)
5429typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYALLOCATION2)(_In_ CONST D3DKMT_DESTROYALLOCATION2*);
5430#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0
5431
5432typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SETALLOCATIONPRIORITY)(_In_ CONST D3DKMT_SETALLOCATIONPRIORITY*);
5433typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_QUERYALLOCATIONRESIDENCY)(_In_ CONST D3DKMT_QUERYALLOCATIONRESIDENCY*);
5434typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATEDEVICE)(_Inout_ D3DKMT_CREATEDEVICE*);
5435typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYDEVICE)(_In_ CONST D3DKMT_DESTROYDEVICE*);
5436typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATECONTEXT)(_Inout_ D3DKMT_CREATECONTEXT*);
5437typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYCONTEXT)(_In_ CONST D3DKMT_DESTROYCONTEXT*);
5438typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATESYNCHRONIZATIONOBJECT)(_Inout_ D3DKMT_CREATESYNCHRONIZATIONOBJECT*);
5439typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATESYNCHRONIZATIONOBJECT2)(_Inout_ D3DKMT_CREATESYNCHRONIZATIONOBJECT2*);
5440typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENSYNCHRONIZATIONOBJECT)(_Inout_ D3DKMT_OPENSYNCHRONIZATIONOBJECT*);
5441typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYSYNCHRONIZATIONOBJECT)(_In_ CONST D3DKMT_DESTROYSYNCHRONIZATIONOBJECT*);
5442typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_WAITFORSYNCHRONIZATIONOBJECT)(_In_ CONST D3DKMT_WAITFORSYNCHRONIZATIONOBJECT*);
5443typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_WAITFORSYNCHRONIZATIONOBJECT2)(_In_ CONST D3DKMT_WAITFORSYNCHRONIZATIONOBJECT2*);
5444typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SIGNALSYNCHRONIZATIONOBJECT)(_In_ CONST D3DKMT_SIGNALSYNCHRONIZATIONOBJECT*);
5445typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SIGNALSYNCHRONIZATIONOBJECT2)(_In_ CONST D3DKMT_SIGNALSYNCHRONIZATIONOBJECT2*);
5446typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_LOCK)(_Inout_ D3DKMT_LOCK*);
5447typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_UNLOCK)(_In_ CONST D3DKMT_UNLOCK*);
5448typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETDISPLAYMODELIST)(_Inout_ D3DKMT_GETDISPLAYMODELIST*);
5449typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SETDISPLAYMODE)(_Inout_ CONST D3DKMT_SETDISPLAYMODE*);
5450typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETMULTISAMPLEMETHODLIST)(_Inout_ D3DKMT_GETMULTISAMPLEMETHODLIST*);
5451typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_PRESENT)(_Inout_ D3DKMT_PRESENT*);
5452typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_RENDER)(_Inout_ D3DKMT_RENDER*);
5453typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETRUNTIMEDATA)(_Inout_ CONST D3DKMT_GETRUNTIMEDATA*);
5454typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_QUERYADAPTERINFO)(_Inout_ CONST D3DKMT_QUERYADAPTERINFO*);
5455typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENADAPTERFROMHDC)(_Inout_ D3DKMT_OPENADAPTERFROMHDC*);
5456typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME)(_Inout_ D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME*);
5457typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_OPENADAPTERFROMDEVICENAME)(_Inout_ D3DKMT_OPENADAPTERFROMDEVICENAME*);
5458typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CLOSEADAPTER)(_In_ CONST D3DKMT_CLOSEADAPTER*);
5459typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETSHAREDPRIMARYHANDLE)(_Inout_ D3DKMT_GETSHAREDPRIMARYHANDLE*);
5460typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_ESCAPE)(_In_ CONST D3DKMT_ESCAPE*);
5461typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_QUERYSTATISTICS)(_In_ CONST D3DKMT_QUERYSTATISTICS*);
5462typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SETVIDPNSOURCEOWNER)(_In_ CONST D3DKMT_SETVIDPNSOURCEOWNER*);
5463typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETPRESENTHISTORY)(_Inout_ D3DKMT_GETPRESENTHISTORY*);
5464typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATEOVERLAY)(_Inout_ D3DKMT_CREATEOVERLAY*);
5465typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_UPDATEOVERLAY)(_In_ CONST D3DKMT_UPDATEOVERLAY*);
5466typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_FLIPOVERLAY)(_In_ CONST D3DKMT_FLIPOVERLAY*);
5467typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYOVERLAY)(_In_ CONST D3DKMT_DESTROYOVERLAY*);
5468typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_WAITFORVERTICALBLANKEVENT)(_In_ CONST D3DKMT_WAITFORVERTICALBLANKEVENT*);
5469typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SETGAMMARAMP)(_In_ CONST D3DKMT_SETGAMMARAMP*);
5470typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETDEVICESTATE)(_Inout_ D3DKMT_GETDEVICESTATE*);
5471typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_CREATEDCFROMMEMORY)(_Inout_ D3DKMT_CREATEDCFROMMEMORY*);
5472typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_DESTROYDCFROMMEMORY)(_In_ CONST D3DKMT_DESTROYDCFROMMEMORY*);
5473typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SETCONTEXTSCHEDULINGPRIORITY)(_In_ CONST D3DKMT_SETCONTEXTSCHEDULINGPRIORITY*);
5474typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETCONTEXTSCHEDULINGPRIORITY)(_Inout_ D3DKMT_GETCONTEXTSCHEDULINGPRIORITY*);
5475typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_SETPROCESSSCHEDULINGPRIORITYCLASS)(_In_ HANDLE, _In_ D3DKMT_SCHEDULINGPRIORITYCLASS);
5476typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETPROCESSSCHEDULINGPRIORITYCLASS)(_In_ HANDLE, _Out_ D3DKMT_SCHEDULINGPRIORITYCLASS*);
5477typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_RELEASEPROCESSVIDPNSOURCEOWNERS)(_In_ HANDLE);
5478typedef _Check_return_ NTSTATUS (APIENTRY *PFND3DKMT_GETSCANLINE)(_Inout_ D3DKMT_GETSCANLINE*);
5479typedef