diff --git a/drivers/bus/acpi/eval.c b/drivers/bus/acpi/eval.c index d2b94dd7c04ed..92a1bcbf999a8 100644 --- a/drivers/bus/acpi/eval.c +++ b/drivers/bus/acpi/eval.c @@ -162,7 +162,13 @@ EvalGetElementSize( return STATUS_SUCCESS; } - +#undef ACPI_METHOD_SET_ARGUMENT_STRING +#define ACPI_METHOD_SET_ARGUMENT_STRING( Argument, StrData ) \ + { Argument->Type = ACPI_METHOD_ARGUMENT_STRING; \ + Argument->DataLength = strlen(StrData) + sizeof(UCHAR); \ + memcpy(&Argument->Data[0], \ + (PUCHAR)StrData, \ + Argument->DataLength); } /** * @brief Performs translation from the supplied ACPI_OBJECT structure into a method argument. */ diff --git a/modules/rostests/apitests/acpi/Bus_PDO_EvalMethod.c b/modules/rostests/apitests/acpi/Bus_PDO_EvalMethod.c index e191a9ad25281..3f70781a510d8 100644 --- a/modules/rostests/apitests/acpi/Bus_PDO_EvalMethod.c +++ b/modules/rostests/apitests/acpi/Bus_PDO_EvalMethod.c @@ -747,6 +747,14 @@ DrvCallAcpiDriver( return Bus_PDO_EvalMethod(&DeviceData, &Irp); } +#undef ACPI_METHOD_SET_ARGUMENT_STRING +#define ACPI_METHOD_SET_ARGUMENT_STRING( Argument, StrData ) \ + { Argument->Type = ACPI_METHOD_ARGUMENT_STRING; \ + Argument->DataLength = strlen((PUCHAR)StrData) + sizeof(UCHAR); \ + memcpy(&Argument->Data[0], \ + (PUCHAR)StrData, \ + Argument->DataLength); } + static VOID DrvEvaluateStmObject( diff --git a/sdk/include/ddk/acpiioct.h b/sdk/include/ddk/acpiioct.h index cb10a4dbf2092..64c7256f63dac 100644 --- a/sdk/include/ddk/acpiioct.h +++ b/sdk/include/ddk/acpiioct.h @@ -1,21 +1,475 @@ + +#ifndef _ACPIIOCT_H_ +#define _ACPIIOCT_H_ + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) #pragma once +#pragma warning(push) +#endif -#ifdef __cplusplus -extern "C" { +#if defined (_MSC_VER) +#pragma warning(disable:4201) // named type definition in parentheses #endif -#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE 'BieA' -#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE 'IieA' -#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE 'SieA' -#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE 'CieA' -#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE 'BoeA' +// +// IRP_MJ_INTERNAL_DEVICE_CONTROL CODES +// + +#define IOCTL_ACPI_ASYNC_EVAL_METHOD_V1 CTL_CODE(FILE_DEVICE_ACPI, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_EVAL_METHOD_V1 CTL_CODE(FILE_DEVICE_ACPI, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_ACQUIRE_GLOBAL_LOCK CTL_CODE(FILE_DEVICE_ACPI, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_RELEASE_GLOBAL_LOCK CTL_CODE(FILE_DEVICE_ACPI, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_EVAL_METHOD IOCTL_ACPI_EVAL_METHOD_V1 +#define IOCTL_ACPI_ASYNC_EVAL_METHOD IOCTL_ACPI_ASYNC_EVAL_METHOD_V1 + #if (NTDDI_VERSION >= NTDDI_VISTA) -#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_EX 'AieA' -#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_EX 'DieA' -#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_EX 'EieA' -#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_EX 'FieA' -#define ACPI_ENUM_CHILDREN_OUTPUT_BUFFER_SIGNATURE 'GieA' -#define ACPI_ENUM_CHILDREN_INPUT_BUFFER_SIGNATURE 'HieA' +#define IOCTL_ACPI_EVAL_METHOD_V1_EX CTL_CODE(FILE_DEVICE_ACPI, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_ASYNC_EVAL_METHOD_V1_EX CTL_CODE(FILE_DEVICE_ACPI, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_ENUM_CHILDREN CTL_CODE(FILE_DEVICE_ACPI, 8, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_EVAL_METHOD_EX IOCTL_ACPI_EVAL_METHOD_V1_EX +#define IOCTL_ACPI_ASYNC_EVAL_METHOD_EX IOCTL_ACPI_ASYNC_EVAL_METHOD_V1_EX +#endif + +// +// Windows8+ only IOCTLs. +// + +#if (NTDDI_VERSION >= NTDDI_WIN8) + +#define IOCTL_ACPI_GET_DEVICE_INFORMATION CTL_CODE(FILE_DEVICE_ACPI, 10, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + + +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) +#define IOCTL_ACPI_GET_DEVICE_SPECIFIC_DATA CTL_CODE(FILE_DEVICE_ACPI, 14, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#endif + +// +// V2 ACPI IOCTLs. +// + +#if (NTDDI_VERSION >= NTDDI_WIN10_RS2) +#define IOCTL_ACPI_EVAL_METHOD_V2 CTL_CODE(FILE_DEVICE_ACPI, 15, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_ASYNC_EVAL_METHOD_V2 CTL_CODE(FILE_DEVICE_ACPI, 16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_EVAL_METHOD_V2_EX CTL_CODE(FILE_DEVICE_ACPI, 17, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_ACPI_ASYNC_EVAL_METHOD_V2_EX CTL_CODE(FILE_DEVICE_ACPI, 18, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#endif + +// +// Manganese IOCTLs +// + +#if (NTDDI_VERSION >= NTDDI_WIN10_MN) + + +#endif + +// +// -----------------------------V1 Data Structures------------------------------ +// + +// +// Data structures used for IOCTL_ACPI_ASYNC_EVAL_METHOD_V1 and +// IOCTL_ACPI_EVAL_METHOD_V1 +// + +typedef struct _ACPI_EVAL_INPUT_BUFFER_V1 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; +} ACPI_EVAL_INPUT_BUFFER_V1, *PACPI_EVAL_INPUT_BUFFER_V1; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; + ULONG IntegerArgument; +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; + ULONG StringLength; + _Field_size_bytes_(StringLength) + _Null_terminated_ + UCHAR String[ANYSIZE_ARRAY]; +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1; + +typedef struct _ACPI_METHOD_ARGUMENT_V1 { + USHORT Type; + USHORT DataLength; + union { + ULONG Argument; + _Field_size_bytes_(DataLength) + UCHAR Data[ANYSIZE_ARRAY]; + } DUMMYUNIONNAME; +} ACPI_METHOD_ARGUMENT_V1; + +typedef ACPI_METHOD_ARGUMENT_V1 UNALIGNED *PACPI_METHOD_ARGUMENT_V1; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_V1 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; + ULONG Size; + ULONG ArgumentCount; + ACPI_METHOD_ARGUMENT_V1 Argument[ANYSIZE_ARRAY]; +} ACPI_EVAL_INPUT_BUFFER_COMPLEX_V1, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_V1; + +typedef struct _ACPI_EVAL_OUTPUT_BUFFER_V1 { + ULONG Signature; + ULONG Length; + ULONG Count; + _Field_size_bytes_(Length - FIELD_OFFSET(struct _ACPI_EVAL_OUTPUT_BUFFER_V1, Argument)) + ACPI_METHOD_ARGUMENT_V1 Argument[ANYSIZE_ARRAY]; +} ACPI_EVAL_OUTPUT_BUFFER_V1; + +typedef ACPI_EVAL_OUTPUT_BUFFER_V1 UNALIGNED *PACPI_EVAL_OUTPUT_BUFFER_V1; + +// +// Data structure used for IOCTL_ACPI_ASYNC_EVAL_METHOD_V1_EX, +// IOCTL_ACPI_EVAL_METHOD_V1_EX and +// + + +typedef struct _ACPI_EVAL_INPUT_BUFFER_V1_EX { + ULONG Signature; + _Null_terminated_ + CHAR MethodName[256]; //NULL terminated name string +} ACPI_EVAL_INPUT_BUFFER_V1_EX, *PACPI_EVAL_INPUT_BUFFER_V1_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1_EX { + ULONG Signature; + _Null_terminated_ + CHAR MethodName[256];//NULL terminated name string + ULONG64 IntegerArgument; +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1_EX { + ULONG Signature; + CHAR MethodName[256];//NULL terminated name string + ULONG StringLength; + _Field_size_(StringLength) + _Null_terminated_ + UCHAR String[ANYSIZE_ARRAY]; + +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_V1_EX { + ULONG Signature; + CHAR MethodName[256];//NULL terminated name string + ULONG Size; + ULONG ArgumentCount; + _Field_size_(ArgumentCount) + ACPI_METHOD_ARGUMENT_V1 Argument[ANYSIZE_ARRAY]; +} ACPI_EVAL_INPUT_BUFFER_COMPLEX_V1_EX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_V1_EX; + +// +// Define ACPI_METHOD_ARGUMENT structure as V1 for DDKVERSION < NTDDI_WIN10_RS2 +// + +typedef struct _ACPI_METHOD_ARGUMENT_V1 ACPI_METHOD_ARGUMENT; +typedef ACPI_METHOD_ARGUMENT_V1 UNALIGNED *PACPI_METHOD_ARGUMENT; + +// +// Define ACPI_EVAL_INPUT_BUFFER structure as V1 for DDKVERSION < NTDDI_WIN10_RS2 +// + +typedef struct _ACPI_EVAL_INPUT_BUFFER_V1 ACPI_EVAL_INPUT_BUFFER, *PACPI_EVAL_INPUT_BUFFER; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1 + ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1 + ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_V1 + ACPI_EVAL_INPUT_BUFFER_COMPLEX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX; + +// +// Define ACPI_EVAL_INPUT_BUFFER_EX structure as V1 for DDKVERSION < NTDDI_WIN10_RS2 +// + +typedef struct _ACPI_EVAL_INPUT_BUFFER_V1_EX ACPI_EVAL_INPUT_BUFFER_EX, *PACPI_EVAL_INPUT_BUFFER_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V1_EX + ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V1_EX + ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_V1_EX + ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_EX; + +// +// Define ACPI_EVAL_OUTPUT_BUFFER structure as V1 for DDKVERSION < NTDDI_WIN10_RS2 +// + +typedef struct _ACPI_EVAL_OUTPUT_BUFFER_V1 ACPI_EVAL_OUTPUT_BUFFER; +typedef struct _ACPI_EVAL_OUTPUT_BUFFER_V1 UNALIGNED *PACPI_EVAL_OUTPUT_BUFFER; + +// +// -------------------------------V1 Macros------------------------------------- +// + +#define ACPI_METHOD_ARGUMENT_LENGTH( DataLength ) \ + (FIELD_OFFSET(ACPI_METHOD_ARGUMENT, Data) + max(sizeof(ULONG), DataLength)) + +#define ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) \ + (ACPI_METHOD_ARGUMENT_LENGTH(((PACPI_METHOD_ARGUMENT)Argument)->DataLength)) + +#define ACPI_METHOD_NEXT_ARGUMENT( Argument ) \ + (PACPI_METHOD_ARGUMENT) ( (PUCHAR) Argument + \ + ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) ) + + +#define ACPI_METHOD_SET_ARGUMENT_INTEGER( MethodArgument, IntData ) \ + { MethodArgument->Type = ACPI_METHOD_ARGUMENT_INTEGER; \ + MethodArgument->DataLength = sizeof(ULONG); \ + MethodArgument->Argument = IntData; } + +#define ACPI_METHOD_SET_ARGUMENT_STRING( Argument, StrData ) \ + { Argument->Type = ACPI_METHOD_ARGUMENT_STRING; \ + Argument->DataLength = strlen((PUCHAR)StrData) + sizeof(UCHAR); \ + memcpy(&Argument->Data[0], \ + (PUCHAR)StrData, \ + Argument->DataLength); } + +#define ACPI_METHOD_SET_ARGUMENT_BUFFER( Argument, BuffData, BuffLength ) \ + { Argument->Type = ACPI_METHOD_ARGUMENT_BUFFER; \ + Argument->DataLength = BuffLength; \ + memcpy(&Argument->Data[0], \ + (PUCHAR)BuffData, \ + BuffLength); } + +#define ACPI_EVAL_OUTPUT_BUFFER_ARGUMENT_LENGTH( EvalOutputBuffer ) \ + (EvalOutputBuffer->Length - FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument)) + +#define ACPI_EVAL_OUTPUT_BUFFER_ARGUMENTS_BEGIN( EvalOutputBuffer ) \ + ((PACPI_METHOD_ARGUMENT)EvalOutputBuffer->Argument) + +#define ACPI_EVAL_OUTPUT_BUFFER_ARGUMENTS_END( EvalOutputBuffer ) \ + (PACPI_METHOD_ARGUMENT)((PUCHAR)EvalOutputBuffer->Argument + \ + ACPI_EVAL_OUTPUT_BUFFER_ARGUMENT_LENGTH(EvalOutputBuffer)) + +#define FOR_EACH_ACPI_METHOD_ARGUMENT( MethodArgument, \ + MethodArgumentsBegin, \ + MethodArgumentsEnd ) \ + for (PACPI_METHOD_ARGUMENT MethodArgument = (MethodArgumentsBegin); \ + MethodArgument < (MethodArgumentsEnd); \ + MethodArgument = ACPI_METHOD_NEXT_ARGUMENT(MethodArgument)) + +// +// ----------------------------V2 Data Structures------------------------------- +// + +// +// Data structures used for IOCTL_ACPI_ASYNC_EVAL_METHOD_V2 and +// IOCTL_ACPI_EVAL_METHOD_V2 +// + +typedef struct _ACPI_EVAL_INPUT_BUFFER_V2 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; +} ACPI_EVAL_INPUT_BUFFER_V2, *PACPI_EVAL_INPUT_BUFFER_V2; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V2 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; + ULONG IntegerArgument; +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V2, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V2; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V2 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; + ULONG StringLength; + _Field_size_bytes_(StringLength) + _Null_terminated_ + UCHAR String[ANYSIZE_ARRAY]; +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V2, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V2; + +typedef struct _ACPI_METHOD_ARGUMENT_V2 { + USHORT Type; + ULONG DataLength; + union { + ULONG Argument; + _Field_size_bytes_(DataLength) + UCHAR Data[ANYSIZE_ARRAY]; + } DUMMYUNIONNAME; +} ACPI_METHOD_ARGUMENT_V2; + +typedef ACPI_METHOD_ARGUMENT_V2 UNALIGNED *PACPI_METHOD_ARGUMENT_V2; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_V2 { + ULONG Signature; + union { + UCHAR MethodName[4]; + ULONG MethodNameAsUlong; + } DUMMYUNIONNAME; + ULONG Size; + ULONG ArgumentCount; + ACPI_METHOD_ARGUMENT_V2 Argument[ANYSIZE_ARRAY]; +} ACPI_EVAL_INPUT_BUFFER_COMPLEX_V2, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_V2; + +typedef struct _ACPI_EVAL_OUTPUT_BUFFER_V2 { + ULONG Signature; + ULONG Length; + ULONG Count; + _Field_size_bytes_(Length - FIELD_OFFSET(struct _ACPI_EVAL_OUTPUT_BUFFER_V2, Argument)) + ACPI_METHOD_ARGUMENT_V2 Argument[ANYSIZE_ARRAY]; +} ACPI_EVAL_OUTPUT_BUFFER_V2; + +typedef ACPI_EVAL_OUTPUT_BUFFER_V2 UNALIGNED *PACPI_EVAL_OUTPUT_BUFFER_V2; + +// +// Data structure used for IOCTL_ACPI_ASYNC_EVAL_METHOD_V2_EX, +// IOCTL_ACPI_EVAL_METHOD_V2_EX and +// + + +typedef struct _ACPI_EVAL_INPUT_BUFFER_V2_EX { + ULONG Signature; + _Null_terminated_ + CHAR MethodName[256]; //NULL terminated name string +} ACPI_EVAL_INPUT_BUFFER_V2_EX, *PACPI_EVAL_INPUT_BUFFER_V2_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V2_EX { + ULONG Signature; + _Null_terminated_ + CHAR MethodName[256];//NULL terminated name string + ULONG64 IntegerArgument; +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V2_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_V2_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V2_EX { + ULONG Signature; + CHAR MethodName[256];//NULL terminated name string + ULONG StringLength; + _Field_size_(StringLength) + _Null_terminated_ + UCHAR String[ANYSIZE_ARRAY]; + +} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V2_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_V2_EX; + +typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_V2_EX { + ULONG Signature; + CHAR MethodName[256];//NULL terminated name string + ULONG Size; + ULONG ArgumentCount; + _Field_size_(ArgumentCount) + ACPI_METHOD_ARGUMENT_V2 Argument[ANYSIZE_ARRAY]; +} ACPI_EVAL_INPUT_BUFFER_COMPLEX_V2_EX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_V2_EX; + +// +// -------------------------------V2 Macros------------------------------------- +// + +#define ACPI_METHOD_ARGUMENT_V2_LENGTH( DataLength ) \ + (FIELD_OFFSET(ACPI_METHOD_ARGUMENT_V2, Data) + max(sizeof(ULONG), DataLength)) + +#define ACPI_METHOD_ARGUMENT_V2_LENGTH_FROM_ARGUMENT( Argument ) \ + (ACPI_METHOD_ARGUMENT_V2_LENGTH(((PACPI_METHOD_ARGUMENT_V2)Argument)->DataLength)) + +#define ACPI_METHOD_NEXT_ARGUMENT_V2( Argument ) \ + (PACPI_METHOD_ARGUMENT_V2) ( (PUCHAR) Argument + \ + ACPI_METHOD_ARGUMENT_V2_LENGTH_FROM_ARGUMENT( Argument ) ) + +#define ACPI_METHOD_SET_ARGUMENT_INTEGER_V2( MethodArgument, IntData ) \ + { MethodArgument->Type = ACPI_METHOD_ARGUMENT_INTEGER; \ + MethodArgument->DataLength = sizeof(ULONG); \ + MethodArgument->Argument = IntData; } + +#define ACPI_METHOD_SET_ARGUMENT_STRING_V2( Argument, StrData ) \ + { Argument->Type = ACPI_METHOD_ARGUMENT_STRING; \ + Argument->DataLength = strlen((PUCHAR)StrData) + sizeof(UCHAR); \ + memcpy(&Argument->Data[0], \ + (PUCHAR)StrData, \ + Argument->DataLength); } + +#define ACPI_METHOD_SET_ARGUMENT_BUFFER_V2( Argument, BuffData, BuffLength ) \ + { Argument->Type = ACPI_METHOD_ARGUMENT_BUFFER; \ + Argument->DataLength = BuffLength; \ + memcpy(&Argument->Data[0], \ + (PUCHAR)BuffData, \ + BuffLength); } + +#define ACPI_EVAL_OUTPUT_BUFFER_V2_ARGUMENT_LENGTH( EvalOutputBuffer ) \ + (EvalOutputBuffer->Length - FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER_V2, Argument)) + +#define ACPI_EVAL_OUTPUT_BUFFER_V2_ARGUMENTS_BEGIN( EvalOutputBuffer ) \ + ((PACPI_METHOD_ARGUMENT_V2)EvalOutputBuffer->Argument) + +#define ACPI_EVAL_OUTPUT_BUFFER_V2_ARGUMENTS_END( EvalOutputBuffer ) \ + (PACPI_METHOD_ARGUMENT_V2)((PUCHAR)EvalOutputBuffer->Argument + \ + ACPI_EVAL_OUTPUT_BUFFER_V2_ARGUMENT_LENGTH(EvalOutputBuffer)) + +#define FOR_EACH_ACPI_METHOD_ARGUMENT_V2( MethodArgument, \ + MethodArgumentsBegin, \ + MethodArgumentsEnd ) \ + for (PACPI_METHOD_ARGUMENT_V2 MethodArgument = (MethodArgumentsBegin); \ + MethodArgument < (MethodArgumentsEnd); \ + MethodArgument = ACPI_METHOD_NEXT_ARGUMENT_V2(MethodArgument)) + +#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_V1 'BieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_V1 'IieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_V1 'SieA' +#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_V1 'CieA' +#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE_V1 'BoeA' +#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE ACPI_EVAL_INPUT_BUFFER_SIGNATURE_V1 +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_V1 +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_V1 +#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_V1 +#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE_V1 + +#if (NTDDI_VERSION >= NTDDI_VISTA) +#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_V1_EX 'AieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_V1_EX 'DieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_V1_EX 'EieA' +#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_V1_EX 'FieA' +#define ACPI_ENUM_CHILDREN_OUTPUT_BUFFER_SIGNATURE 'GieA' +#define ACPI_ENUM_CHILDREN_INPUT_BUFFER_SIGNATURE 'HieA' +#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_EX ACPI_EVAL_INPUT_BUFFER_SIGNATURE_V1_EX +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_EX ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_V1_EX +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_EX ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_V1_EX +#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_EX ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_V1_EX +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) +#define IOCTL_ACPI_GET_DEVICE_INFORMATION_SIGNATURE 'JieA' +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) +#define IOCTL_ACPI_GET_DEVICE_SPECIFIC_DATA_SIGNATURE 'HieA' +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN10_RS2) +#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_V2 'KieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_V2 'LieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_V2 'MieA' +#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_V2 'NieA' +#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE_V2_EX 'OieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE_V2_EX 'PieA' +#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE_V2_EX 'QieA' +#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE_V2_EX 'RieA' +#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE_V2 'KoeA' #endif #define ACPI_METHOD_ARGUMENT_INTEGER 0x0 @@ -24,167 +478,147 @@ extern "C" { #define ACPI_METHOD_ARGUMENT_PACKAGE 0x3 #define ACPI_METHOD_ARGUMENT_PACKAGE_EX 0x4 -#define ACPI_ACQUIRE_GLOBAL_LOCK_SIGNATURE 'LgaA' -#define ACPI_RELEASE_GLOBAL_LOCK_SIGNATURE 'LgrA' - -#define ACPI_OBJECT_HAS_CHILDREN 0x1 - -#define ENUM_CHILDREN_IMMEDIATE_ONLY 0x1 -#define ENUM_CHILDREN_MULTILEVEL 0x2 -#define ENUM_CHILDREN_NAME_IS_FILTER 0x4 - -typedef struct _ACPI_EVAL_INPUT_BUFFER { - ULONG Signature; - _ANONYMOUS_UNION union { - UCHAR MethodName[4]; - ULONG MethodNameAsUlong; - } DUMMYUNIONNAME; -} ACPI_EVAL_INPUT_BUFFER, *PACPI_EVAL_INPUT_BUFFER; - -typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER { - ULONG Signature; - _ANONYMOUS_UNION union { - UCHAR MethodName[4]; - ULONG MethodNameAsUlong; - } DUMMYUNIONNAME; - ULONG IntegerArgument; -} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER; - -typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING { - ULONG Signature; - _ANONYMOUS_UNION union { - UCHAR MethodName[4]; - ULONG MethodNameAsUlong; - } DUMMYUNIONNAME; - ULONG StringLength; - _Field_size_bytes_(StringLength) _Null_terminated_ UCHAR String[ANYSIZE_ARRAY]; -} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING; - -typedef struct _ACPI_METHOD_ARGUMENT { - USHORT Type; - USHORT DataLength; - _ANONYMOUS_UNION union { - ULONG Argument; - _Field_size_bytes_(DataLength) UCHAR Data[ANYSIZE_ARRAY]; - } DUMMYUNIONNAME; -} ACPI_METHOD_ARGUMENT; -typedef ACPI_METHOD_ARGUMENT UNALIGNED *PACPI_METHOD_ARGUMENT; - -typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX { - ULONG Signature; - _ANONYMOUS_UNION union { - UCHAR MethodName[4]; - ULONG MethodNameAsUlong; - } DUMMYUNIONNAME; - ULONG Size; - ULONG ArgumentCount; - ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY]; -} ACPI_EVAL_INPUT_BUFFER_COMPLEX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX; - -typedef struct _ACPI_EVAL_OUTPUT_BUFFER { - ULONG Signature; - ULONG Length; - ULONG Count; - _Field_size_bytes_(Length) ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY]; -} ACPI_EVAL_OUTPUT_BUFFER; -typedef ACPI_EVAL_OUTPUT_BUFFER UNALIGNED *PACPI_EVAL_OUTPUT_BUFFER; +// +// Data structures used for IOCTL_ACPI_ACQUIRE_GLOBAL_LOCK +// IOCTL_ACPI_RELEASE_GLOBAL_LOCK +// typedef struct _ACPI_MANIPULATE_GLOBAL_LOCK_BUFFER { - ULONG Signature; - PVOID LockObject; + ULONG Signature; + PVOID LockObject; } ACPI_MANIPULATE_GLOBAL_LOCK_BUFFER, *PACPI_MANIPULATE_GLOBAL_LOCK_BUFFER; -typedef struct _ACPI_EVAL_INPUT_BUFFER_EX { - ULONG Signature; - _Null_terminated_ CHAR MethodName[256]; -} ACPI_EVAL_INPUT_BUFFER_EX, *PACPI_EVAL_INPUT_BUFFER_EX; - -typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX { - ULONG Signature; - _Null_terminated_ CHAR MethodName[256]; - ULONG64 IntegerArgument; -} ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_EX; - -typedef struct _ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX { - ULONG Signature; - CHAR MethodName[256]; - ULONG StringLength; - _Field_size_(StringLength) _Null_terminated_ UCHAR String[ANYSIZE_ARRAY]; -} ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX, *PACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_EX; - -typedef struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX { - ULONG Signature; - CHAR MethodName[256]; - ULONG Size; - ULONG ArgumentCount; - _Field_size_(ArgumentCount) ACPI_METHOD_ARGUMENT Argument[ANYSIZE_ARRAY]; -} ACPI_EVAL_INPUT_BUFFER_COMPLEX_EX, *PACPI_EVAL_INPUT_BUFFER_COMPLEX_EX; +#define ACPI_ACQUIRE_GLOBAL_LOCK_SIGNATURE 'LgaA' +#define ACPI_RELEASE_GLOBAL_LOCK_SIGNATURE 'LgrA' + +// +// IOCTL_ACPI_ENUM_CHILDREN +// typedef struct _ACPI_ENUM_CHILDREN_INPUT_BUFFER { - ULONG Signature; - ULONG Flags; - ULONG NameLength; - _Field_size_bytes_(NameLength) _Null_terminated_ CHAR Name[ANYSIZE_ARRAY]; + ULONG Signature; + ULONG Flags; + ULONG NameLength; + _Field_size_bytes_(NameLength) + _Null_terminated_ + CHAR Name[ANYSIZE_ARRAY]; } ACPI_ENUM_CHILDREN_INPUT_BUFFER, *PACPI_ENUM_CHILDREN_INPUT_BUFFER; +// +// Enum child structures. +// + typedef struct _ACPI_ENUM_CHILD { - ULONG Flags; - ULONG NameLength; - _Field_size_bytes_(NameLength) _Null_terminated_ CHAR Name[ANYSIZE_ARRAY]; + ULONG Flags; + ULONG NameLength; // length including null terminator + _Field_size_bytes_(NameLength) + _Null_terminated_ + CHAR Name[ANYSIZE_ARRAY]; } ACPI_ENUM_CHILD; + typedef ACPI_ENUM_CHILD UNALIGNED *PACPI_ENUM_CHILD; typedef struct _ACPI_ENUM_CHILDREN_OUTPUT_BUFFER { - ULONG Signature; - ULONG NumberOfChildren; - ACPI_ENUM_CHILD Children[ANYSIZE_ARRAY]; + ULONG Signature; + ULONG NumberOfChildren; + ACPI_ENUM_CHILD Children[ANYSIZE_ARRAY]; } ACPI_ENUM_CHILDREN_OUTPUT_BUFFER; + typedef ACPI_ENUM_CHILDREN_OUTPUT_BUFFER UNALIGNED *PACPI_ENUM_CHILDREN_OUTPUT_BUFFER; -#define ACPI_METHOD_ARGUMENT_LENGTH( DataLength ) \ - (FIELD_OFFSET(ACPI_METHOD_ARGUMENT, Data) + max(sizeof(ULONG), DataLength)) +#define ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) \ + ( (2* sizeof (ULONG)) + Child->NameLength ) -#define ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) \ - (ACPI_METHOD_ARGUMENT_LENGTH(((PACPI_METHOD_ARGUMENT)Argument)->DataLength)) +#define ACPI_ENUM_CHILD_NEXT( Child ) \ + (PACPI_ENUM_CHILD) ( (PUCHAR) Child + \ + ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) ) -#define ACPI_METHOD_NEXT_ARGUMENT( Argument ) \ - (PACPI_METHOD_ARGUMENT) ( (PUCHAR) Argument + \ - ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT( Argument ) ) +typedef struct _ACPI_DEVICE_INFORMATION_OUTPUT_BUFFER { + ULONG Signature; + USHORT Size; + UCHAR Revision; + UCHAR Reserved0; + // + // Vendor and device strings. + // -#define ACPI_METHOD_SET_ARGUMENT_INTEGER( MethodArgument, IntData ) \ - { MethodArgument->Type = ACPI_METHOD_ARGUMENT_INTEGER; \ - MethodArgument->DataLength = sizeof(ULONG); \ - MethodArgument->Argument = IntData; } + USHORT VendorIdStringOffset; + USHORT VendorStringLength; + USHORT DeviceIdStringOffset; -#define ACPI_METHOD_SET_ARGUMENT_STRING( Argument, StrData ) \ - { Argument->Type = ACPI_METHOD_ARGUMENT_STRING; \ - Argument->DataLength = (USHORT)strlen((PCHAR)StrData) + sizeof(UCHAR); \ - RtlCopyMemory(&Argument->Data[0],(PUCHAR)StrData,Argument->DataLength); } + // + // Sub system and sub device strings. + // -#define ACPI_METHOD_SET_ARGUMENT_BUFFER( Argument, BuffData, BuffLength ) \ - { Argument->Type = ACPI_METHOD_ARGUMENT_BUFFER; \ - Argument->DataLength = BuffLength; \ - RtlCopyMemory(&Argument->Data[0],(PUCHAR)BuffData,Argument->DataLength); } + USHORT SubSystemIdStringOffset; + USHORT SubSystemStringLength; + USHORT SubDeviceIdStringOffset; -#define ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) \ - ( (2* sizeof (ULONG)) + Child->NameLength ) + // + // Instance string. + // -#define ACPI_ENUM_CHILD_NEXT( Child ) \ - (PACPI_ENUM_CHILD) ( (PUCHAR) Child + \ - ACPI_ENUM_CHILD_LENGTH_FROM_CHILD( Child ) ) + USHORT InstanceIdLength; + USHORT InstanceIdOffset; -#define IOCTL_ACPI_ASYNC_EVAL_METHOD CTL_CODE(FILE_DEVICE_ACPI, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_ACPI_EVAL_METHOD CTL_CODE(FILE_DEVICE_ACPI, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_ACPI_ACQUIRE_GLOBAL_LOCK CTL_CODE(FILE_DEVICE_ACPI, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_ACPI_RELEASE_GLOBAL_LOCK CTL_CODE(FILE_DEVICE_ACPI, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + // + // Classcodes hardware revision and programming interface. + // -#if (NTDDI_VERSION >= NTDDI_VISTA) -#define IOCTL_ACPI_EVAL_METHOD_EX CTL_CODE(FILE_DEVICE_ACPI, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_ACPI_ASYNC_EVAL_METHOD_EX CTL_CODE(FILE_DEVICE_ACPI, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_ACPI_ENUM_CHILDREN CTL_CODE(FILE_DEVICE_ACPI, 8, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + USHORT BaseClassCode; + USHORT HardwareRevision; + UCHAR ProgrammingInterface; + UCHAR Reserved1; + USHORT SubClassCode; + + // + // Strings are appended after the structure. e.g.: + // + // BYTE[SubVendorStringLength+1] SubSystemIdString; + // BYTE[VendorIdStringOffset+1] VendorIdString; + // BYTE[InstanceIdOffset+1] InstanceIdString; + // + +} ACPI_DEVICE_INFORMATION_OUTPUT_BUFFER, *PACPI_DEVICE_INFORMATION_OUTPUT_BUFFER; + +// +// valid flags for ACPI_ENUM_CHILDREN_INPUT_BUFFER.Flags +// + +#define ENUM_CHILDREN_IMMEDIATE_ONLY 0x1 +#define ENUM_CHILDREN_MULTILEVEL 0x2 +#define ENUM_CHILDREN_NAME_IS_FILTER 0x4 + +// +// valid flags for ACPI_ENUM_CHILD +// + +#define ACPI_OBJECT_HAS_CHILDREN 0x1 + + +// +// INTERNAL-ONLY DEFINITION SECTION. +// + + +// +// Input buffer for the IOCTL_ACPI_GET_DEVICE_SPECIFIC_DATA. +// + +typedef struct _ACPI_GET_DEVICE_SPECIFIC_DATA { + ULONG Signature; + GUID Section; + ULONG PropertyNameLength; + _Field_size_bytes_(PropertyNameLength) + _Null_terminated_ + UCHAR PropertyName[ANYSIZE_ARRAY]; +} ACPI_GET_DEVICE_SPECIFIC_DATA, *PACPI_GET_DEVICE_SPECIFIC_DATA; + +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +#pragma warning(pop) #endif -#ifdef __cplusplus -} #endif + + diff --git a/sdk/include/ddk/d3dkmddi.h b/sdk/include/ddk/d3dkmddi.h new file mode 100644 index 0000000000000..d0e2ecfc3957b --- /dev/null +++ b/sdk/include/ddk/d3dkmddi.h @@ -0,0 +1,10258 @@ + +#pragma once + +#include "d3dkmdt.h" + +#ifndef DXGK_ALLOCATIONINFOFLAGS_EXT +#define DXGK_ALLOCATIONINFOFLAGS_EXT +#define DXGK_ALLOC_RESERVED0 Reserved0 +#define DXGK_ALLOC_RESERVED1 Reserved1 +#define DXGK_ALLOC_RESERVED2 Reserved2 +#define DXGK_ALLOC_RESERVED3 Reserved3 +#define DXGK_ALLOC_RESERVED4 Reserved4 +#define DXGK_ALLOC_RESERVED5 Reserved5 +#define DXGK_ALLOC_RESERVED6 Reserved6 +#define DXGK_ALLOC_RESERVED7 Reserved7 +#define DXGK_ALLOC_RESERVED8 Reserved8 +#define DXGK_ALLOC_RESERVED9 Reserved9 +#define DXGK_ALLOC_RESERVED10 Reserved10 +#define DXGK_ALLOC_RESERVED11 Reserved11 +#define DXGK_ALLOC_RESERVED12 Reserved12 +#define DXGK_ALLOC_RESERVED13 Reserved13 +#define DXGK_ALLOC_RESERVED14 Reserved14 +#define DXGK_ALLOC_RESERVED15 Reserved15 +#endif + +#ifndef DXGK_DEVICEFLAGS_EXT +#define DXGK_DEVICEFLAGS_EXT +#define DXGK_DEVICE_RESERVED0 Reserved0 +#endif + +// +// Stable power states ETW defines +// +#define DXGK_KEYWORD_LOG_FLAGS_STABLE_POWER 0x1000 +#define DXGK_KEYWORD_LOG_FLAGS_STABLE_POWER2 0x2000 + +#if defined (_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4200) /* nonstandard extension used : zero-sized array in struct/union */ +#pragma warning(disable:4201) // anonymous unions warning +#pragma warning(disable:4510 4512 4610 ) // cannot generate default constructor +#endif + +typedef D3DDDI_SEGMENTPREFERENCE DXGK_SEGMENTPREFERENCE; + +typedef struct _DXGK_SEGMENTBANKPREFERENCE +{ + union + { + struct + { + UINT Bank0 : 7; // 0x0000007F + UINT Direction0 : 1; // 0x00000080 + UINT Bank1 : 7; // 0x00007F00 + UINT Direction1 : 1; // 0x00008000 + UINT Bank2 : 7; // 0x007F0000 + UINT Direction2 : 1; // 0x00800000 + UINT Bank3 : 7; // 0x7F000000 + UINT Direction3 : 1; // 0x80000000 + }; + UINT Value; + }; +} DXGK_SEGMENTBANKPREFERENCE; + +typedef struct _DXGK_ALLOCATIONLIST +{ + HANDLE hDeviceSpecificAllocation; + struct + { + UINT WriteOperation : 1; // 0x00000001 + UINT SegmentId : 5; // 0x0000002E + UINT Reserved : 26; // 0xFFFFFFC0 + }; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + union + { + PHYSICAL_ADDRESS PhysicalAddress; + D3DGPU_VIRTUAL_ADDRESS VirtualAddress; + }; +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + PHYSICAL_ADDRESS PhysicalAddress; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +} DXGK_ALLOCATIONLIST; + +// +// The below is to allow drivers to use the updated annotations if they wish, +// but not yet require all drivers to update their annotations. +// + +#ifdef ENABLE_DXGK_SAL +#define _Function_class_DXGK_(param) _Function_class_(param) +#else +#define _Function_class_DXGK_(param) +#endif + + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Purpose: Define parameter types for SAL-annotated DDI parameters. These are used by DDI function +// name typedefs in dispmprt.h and d3dkmddi.h. They are not needed in a driver's DDI function +// definitions, and should not be used in driver code. +// +// Naming convention: Concatenate all SAL annotations, an underscore, other modifiers +// such as CONST, and the type of the parameter, and use uppercase +// only. +// +typedef _In_ BOOLEAN IN_BOOLEAN; +typedef _In_ UCHAR IN_UCHAR; +typedef _In_ DEVICE_POWER_STATE IN_DEVICE_POWER_STATE; +typedef _In_ CONST HANDLE IN_CONST_HANDLE; +typedef _Inout_ UINT* INOUT_PUINT; +typedef _Out_ UINT* OUT_PUINT; +typedef _In_ ULONG IN_ULONG; +typedef _Out_ PULONG OUT_PULONG; +typedef _In_ POWER_ACTION IN_POWER_ACTION; +typedef _In_ PVOID IN_PVOID; +typedef _In_ CONST PVOID IN_CONST_PVOID; +typedef _Outptr_ PVOID* OUT_PPVOID; +typedef _In_ CONST SIZE_T IN_CONST_SIZE_T; +typedef _Out_ SIZE_T* OUT_PSIZE_T; +typedef _Out_ SIZE_T* CONST OUT_PSIZE_T_CONST; + + +typedef struct _DXGKARG_RENDER +{ + CONST VOID* pCommand; + UINT CommandLength; + VOID* pDmaBuffer; + UINT DmaSize; + VOID* pDmaBufferPrivateData; + UINT DmaBufferPrivateDataSize; + DXGK_ALLOCATIONLIST* pAllocationList; + UINT AllocationListSize; + D3DDDI_PATCHLOCATIONLIST* pPatchLocationListIn; + UINT PatchLocationListInSize; + D3DDDI_PATCHLOCATIONLIST* pPatchLocationListOut; + UINT PatchLocationListOutSize; + UINT MultipassOffset; + UINT DmaBufferSegmentId; + PHYSICAL_ADDRESS DmaBufferPhysicalAddress; +} DXGKARG_RENDER; + +typedef _Inout_ DXGKARG_RENDER* INOUT_PDXGKARG_RENDER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RENDER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RENDER( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_RENDER pRender + ); + + +#define DXGK_PRESENT_SOURCE_INDEX 1 +#define DXGK_PRESENT_DESTINATION_INDEX 2 +#define DXGK_PRESENT_MAX_INDEX DXGK_PRESENT_DESTINATION_INDEX + +typedef struct _DXGK_PRESENTFLAGS +{ + union + { + struct + { + UINT Blt : 1; // 0x00000001 + UINT ColorFill : 1; // 0x00000002 + UINT Flip : 1; // 0x00000004 + UINT FlipWithNoWait : 1; // 0x00000008 + UINT SrcColorKey : 1; // 0x00000010 + UINT DstColorKey : 1; // 0x00000020 + UINT LinearToSrgb : 1; // 0x00000040 + UINT Rotate : 1; // 0x00000080 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + UINT FlipStereo : 1; // 0x00000100 + UINT FlipStereoTemporaryMono : 1; // 0x00000200 // Use the left image only when making a stereo frame + UINT FlipStereoPreferRight : 1; // 0x00000400 // Used when a stereo primary is cloned to a mono monitor. Cannot be used with FlipStereoTemporaryMono + UINT BltStereoUseRight : 1; // 0x00000800 // Used when presenting from a stereo back buffer to a mono surface. The right image must be used. + UINT FlipWithMultiPlaneOverlay : 1; // 0x00001000 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT RedirectedFlip : 1; // 0x00002000 + UINT Reserved :18; // 0xFFFFC000 +#else + UINT Reserved :19; // 0xFFFFE000 +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0 +#else + UINT Reserved :24; // 0xFFFFFF00 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + }; + UINT Value; + }; +} DXGK_PRESENTFLAGS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + +typedef struct _DXGK_PRESENTALLOCATIONINFO +{ + HANDLE hDeviceSpecificAllocation; + D3DGPU_VIRTUAL_ADDRESS AllocationVirtualAddress; + PHYSICAL_ADDRESS PhysicalAddress; + WORD SegmentId; + WORD PhysicalAdapterIndex; +} DXGK_PRESENTALLOCATIONINFO; +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef struct _DXGK_PRESENTMULTIPLANEOVERLAYLIST +{ + UINT LayerIndex; + BOOL Enabled; + + HANDLE hDeviceSpecificAllocation; + struct + { + UINT SegmentId : 5; // in: 0x0000001F + UINT Reserved : 27; + }; + PHYSICAL_ADDRESS PhysicalAddress; +} DXGK_PRESENTMULTIPLANEOVERLAYLIST; + +typedef struct _DXGK_PRESENTMULTIPLANEOVERLAYINFO +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + UINT PlaneListCount; + DXGK_PRESENTMULTIPLANEOVERLAYLIST* pPlaneList; +} DXGK_PRESENTMULTIPLANEOVERLAYINFO; +#endif // DXGKDDI_INTERFACE_VERSION + +typedef struct _DXGKARG_PRESENT +{ + VOID* pDmaBuffer; + UINT DmaSize; + VOID* pDmaBufferPrivateData; + UINT DmaBufferPrivateDataSize; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + union + { + DXGK_ALLOCATIONLIST* pAllocationList; + DXGK_PRESENTALLOCATIONINFO* pAllocationInfo; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + DXGK_PRESENTMULTIPLANEOVERLAYINFO* pPresentMultiPlaneOverlayInfo; +#endif // DXGKDDI_INTERFACE_VERSION + }; + D3DDDI_PATCHLOCATIONLIST* pPatchLocationListOut; // Not used + UINT PatchLocationListOutSize; // Not used +#else + DXGK_ALLOCATIONLIST* pAllocationList; + D3DDDI_PATCHLOCATIONLIST* pPatchLocationListOut; + UINT PatchLocationListOutSize; +#endif // DXGKDDI_INTERFACE_VERSION + UINT MultipassOffset; + UINT Color; + RECT DstRect; + RECT SrcRect; + UINT SubRectCnt; + CONST RECT* pDstSubRects; + D3DDDI_FLIPINTERVAL_TYPE FlipInterval; + DXGK_PRESENTFLAGS Flags; + UINT DmaBufferSegmentId; + PHYSICAL_ADDRESS DmaBufferPhysicalAddress; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT Reserved; +#endif +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + D3DGPU_VIRTUAL_ADDRESS DmaBufferGpuVirtualAddress; + UINT NumSrcAllocations; + UINT NumDstAllocations; + UINT PrivateDriverDataSize; + _Field_size_bytes_(PrivateDriverDataSize) + PVOID pPrivateDriverData; +#endif // DXGKDDI_INTERFACE_VERSION +} DXGKARG_PRESENT; + +typedef _Inout_ DXGKARG_PRESENT* INOUT_PDXGKARG_PRESENT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_PRESENT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_PRESENT( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_PRESENT pPresent + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef struct _DXGK_MULTIPLANE_OVERLAY_FLAGS +{ + union + { + struct + { + UINT VerticalFlip : 1; // 0x00000001 + UINT HorizontalFlip : 1; // 0x00000002 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + UINT StaticCheck : 1; // 0x00000004 + UINT Reserved :29; // 0xFFFFFFF8 +#else + UINT Reserved :30; // 0xFFFFFFFC +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + }; + UINT Value; + }; +} DXGK_MULTIPLANE_OVERLAY_FLAGS; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_BLEND +{ + union + { + struct + { + UINT AlphaBlend : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_MULTIPLANE_OVERLAY_BLEND; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_YCbCr_FLAGS +{ + union + { + struct + { + UINT NominalRange : 1; // 0x00000001 + UINT Bt709 : 1; // 0x00000002 + UINT xvYCC : 1; // 0x00000004 + UINT Reserved : 29; // 0xFFFFFFF8 + }; + UINT Value; + }; +} DXGK_MULTIPLANE_OVERLAY_YCbCr_FLAGS; + +typedef enum _DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT +{ + DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, + DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, + DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2, +} DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT; + +typedef enum _DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT +{ + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_MONO = 0, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_HORIZONTAL = 1, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_VERTICAL = 2, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_SEPARATE = 3, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_MONO_OFFSET = 4, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_ROW_INTERLEAVED = 5, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT_CHECKERBOARD = 7, +} DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT; + +typedef enum _DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE +{ + DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_NONE = 0, + DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_FRAME0 = 1, + DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_FRAME1 = 2, +} DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE; + +typedef enum _DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY +{ + DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY_BILINEAR = 0x1, // Bilinear + DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY_HIGH = 0x2, // Maximum +} DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES +{ + DXGK_MULTIPLANE_OVERLAY_FLAGS Flags; + RECT SrcRect; + RECT DstRect; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + RECT ClipRect; +#endif + D3DDDI_ROTATION Rotation; + DXGK_MULTIPLANE_OVERLAY_BLEND Blend; +#if (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT NumFilters; + void* pFilters; +#endif + DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT VideoFrameFormat; + DXGK_MULTIPLANE_OVERLAY_YCbCr_FLAGS YCbCrFlags; + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT StereoFormat; + BOOL StereoLeftViewFrame0; + BOOL StereoBaseViewFrame0; + DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE StereoFlipMode; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; +#endif +} DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES; + +typedef struct _DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_PLANE +{ + HANDLE hAllocation; + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes; +} DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_PLANE; + +typedef struct DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO +{ + union + { + struct + { + UINT FailingPlane : 4; // The 0 based index of the first plane that could not be supported + UINT TryAgain : 1; // The configuration is not supported due to a transition condition, which should shortly go away + UINT Reserved : 27; + }; + UINT Value; + }; +} DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_PLANE +{ + UINT LayerIndex; + BOOL Enabled; + + UINT AllocationSegment; + PHYSICAL_ADDRESS AllocationAddress; + HANDLE hAllocation; + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes; +} DXGK_MULTIPLANE_OVERLAY_PLANE; +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +typedef struct _DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES2 +{ + DXGK_MULTIPLANE_OVERLAY_FLAGS Flags; // Specifies a combination of flip operations by Oring values in the DXGK_MULTIPLANE_OVERLAY_FLAGS enumeration. + RECT SrcRect; // Specifies the source rectangle, of type RECT, relative to the source resource. + RECT DstRect; // Specifies the destination rectangle, of type RECT, relative to the monitor resolution. + RECT ClipRect; // Specifies any additional clipping, of type RECT, relative to the DstRect rectangle, + // after the data has been stretched according to the values of SrcRect and DstRect. + + // The driver and hardware can use the ClipRect member to apply a common stretch factor + // as the clipping changes when an app occludes part of the DstRect destination rectangle. + D3DDDI_ROTATION Rotation; // Specifies the clockwise rotation of the overlay plane, given as a value from the D3DDDI_ROTATION enumeration. + DXGK_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. + DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT VideoFrameFormat; // Specifies the overlay plane's video frame format, given as a value from the DXGK_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT enumeration. + D3DDDI_COLOR_SPACE_TYPE ColorSpaceType; // Specifies the colorspace configuration, given as a value from the D3DDDI_COLOR_SPACE_TYPE enumeration. + DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT StereoFormat; // Specifies the overlay plane's video frame format, given as a value from the DXGK_MULTIPLANE_OVERLAY_STEREO_FORMAT enumeration. + BOOL StereoLeftViewFrame0; // Reserved for system use. Must always be FALSE. + BOOL StereoBaseViewFrame0; // Reserved for system use. Must always be FALSE. + DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE StereoFlipMode; // Specifies the overlay plane's stereo flip mode, given as a value from the DXGK_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE enumeration. + DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; // Specifies the overlay plane's stretch quality, given as a value from the DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY enumeration. + UINT Reserved1; +} DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES2; + +// Describes the multi-plane overlay plane attributes, allocation, and VidPnSourceId. +typedef struct _DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE +{ + HANDLE hAllocation; // A handle to the allocation. + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // The zero-based video present network (VidPN) source identification number + // of the input for which the support levels are queried. + UINT LayerIndex; + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES2 PlaneAttributes; // A DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES1 structure that specifies overlay plane attributes. +} DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE; + +typedef struct _DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT2 +{ + UINT PlaneCount; // The number of planes to be enabled. + DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE* pPlanes; // A pointer to a DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE + // structure that specifies support attributes that the hardware + // provides for multi-plane overlays. + BOOL Supported; // TRUE if the multi-plane overlay configuration can be supported, otherwise FALSE. + DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO ReturnInfo; // Specifies additional information. +} DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT2; + +typedef _Inout_ DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT2* IN_OUT_PDXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT2; +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + +typedef enum _DXGK_GDIROP_BITBLT +{ + DXGK_GDIROP_INVALID = 0, + DXGK_GDIROP_SRCCOPY = 1, // Dst = Src + DXGK_GDIROP_SRCINVERT = 2, // Dst = Dst ^ Src + DXGK_GDIROP_SRCAND = 3, // Dst = Dst & Src + DXGK_GDIROP_SRCOR = 4, // Dst = Dst | Src + DXGK_GDIROP_ROP3 = 5, // The high word contains the GDI Rop3 code +} DXGK_GDIROP_BITBLT; + +typedef struct _DXGK_GDIARG_BITBLT +{ + RECT SrcRect; // Source rectangle + RECT DstRect; // Destination rectangle + UINT SrcAllocationIndex; // Index in the allocation list + UINT DstAllocationIndex; // Index in the allocation list + UINT NumSubRects; // Number of sub-rects in the destination space. + RECT* pSubRects; // Pointer to sub-rects in the destination space + WORD Rop; // DXGK_GDIROP_BITBLT + WORD Rop3; // GDI Rop3 code when Rop == DXGK_GDIROP_ROP3 + UINT SrcPitch; // Source surface pitch (in bytes) + UINT DstPitch; // Destination surface pitch (in bytes) +} DXGK_GDIARG_BITBLT; + +typedef enum _DXGK_GDIROP_COLORFILL +{ + DXGK_GDIROPCF_INVALID = 0, + DXGK_GDIROPCF_PATCOPY = 1, // Dst = Color + DXGK_GDIROPCF_PATINVERT = 2, // Dst = Dst ^ Color + DXGK_GDIROPCF_PDXN = 3, // Dst = ~(Color ^ Dst) + DXGK_GDIROPCF_DSTINVERT = 4, // Dst = ~Dst + DXGK_GDIROPCF_PATAND = 5, // Dst = Dst & Color + DXGK_GDIROPCF_PATOR = 6, // Dst = Dst | Color + DXGK_GDIROPCF_ROP3 = 7, // The high word contains the GDI Rop3 code +} DXGK_GDIROP_COLORFILL; + +typedef struct _DXGK_GDIARG_STRETCHBLT +{ + RECT SrcRect; // Source rectangle + RECT DstRect; // Destination rectangle + UINT DstAllocationIndex; // Index in the allocation list + UINT SrcAllocationIndex; // Index in the allocation list + UINT NumSubRects; // Number of sub-rects in the destination space. + RECT* pSubRects; // Pointer to sub-rects in the destination space + union + { + struct + { + UINT Mode : 16; // Stretch BLT mode (See MSDN DrvStrechBlt) + UINT MirrorX : 1; // Do mirroring along X axes + UINT MirrorY : 1; // Do mirroring along Y axes + }; + UINT Flags; + }; + UINT SrcPitch; // Source surface pitch (in bytes) +} DXGK_GDIARG_STRETCHBLT; + +typedef struct _DXGK_GDIARG_COLORFILL +{ + RECT DstRect; // Destination rectangle + UINT DstAllocationIndex; // Index in the allocation list + UINT NumSubRects; // Number of sub-rects in the destination space + RECT* pSubRects; // Pointer to sub-rects in the destination space + UINT Color; // Color in the format of the destination surface + WORD Rop; // DXGK_GDIROP_COLORFILL + WORD Rop3; // GDI Rop3 code when Rop == DXGK_GDIROP_ROP3 +} DXGK_GDIARG_COLORFILL; + +typedef struct _DXGK_GDIARG_ALPHABLEND +{ + RECT SrcRect; // Source rectangle + RECT DstRect; // Destination rectangle + UINT SrcAllocationIndex; // Index in the allocation list + UINT DstAllocationIndex; // Index in the allocation list + UINT NumSubRects; // Number of sub-rects in the destination space. + RECT* pSubRects; // Pointer to sub-rects in the destination space + BYTE SourceConstantAlpha; + BOOLEAN SourceHasAlpha; + UINT SrcPitch; // Source surface pitch (in bytes) +} DXGK_GDIARG_ALPHABLEND; + +typedef struct _D3DKM_TRANSPARENTBLTFLAGS +{ + union + { + struct + { + UINT HonorAlpha : 1; + }; + UINT Value; + }; +} D3DKM_TRANSPARENTBLTFLAGS; + +typedef struct _DXGK_GDIARG_TRANSPARENTBLT +{ + RECT SrcRect; // Source rectangle + RECT DstRect; // Destination rectangle + UINT SrcAllocationIndex; // Index in the allocation list + UINT DstAllocationIndex; // Index in the allocation list + UINT Color; // Pixels with this color should not be copied to the destination. + UINT NumSubRects; // Number of sub-rects in the destination space. + RECT* pSubRects; // Pointer to sub-rects in the destination space + D3DKM_TRANSPARENTBLTFLAGS Flags; + UINT SrcPitch; // Source surface pitch (in bytes) +} DXGK_GDIARG_TRANSPARENTBLT; + +#define D3DKM_INVALID_GAMMA_INDEX 0xFFFFFFFF + +typedef struct _DXGK_GDIARG_CLEARTYPEBLEND +{ + RECT DstRect; // Destination rectangle + UINT TmpSurfAllocationIndex; + UINT GammaSurfAllocationIndex; + UINT AlphaSurfAllocationIndex; + UINT DstAllocationIndex; + INT DstToAlphaOffsetX; // Used to transforms rectangles from the destination surface space to the alpha surface space. + INT DstToAlphaOffsetY; // Used to transforms rectangles from the destination surface space to the alpha surface space. + UINT Color; // Foreground color in a 32-bit surface format (gamma corrected) + UINT Gamma; // Value to pick the gamma and inverse gamma tables + UINT NumSubRects; // Number of sub-rects in the destination space. + RECT* pSubRects; // Pointer to sub-rects in the destination space + UINT AlphaSurfPitch; // Alpha surface pitch (in bytes) + UINT Color2; // Foreground color in a 32-bit surface format (not gamma corrected) +} DXGK_GDIARG_CLEARTYPEBLEND; + +typedef enum _DXGK_RENDERKM_OPERATION +{ + DXGK_GDIOP_BITBLT = 1, + DXGK_GDIOP_COLORFILL = 2, + DXGK_GDIOP_ALPHABLEND = 3, + DXGK_GDIOP_STRETCHBLT = 4, + DXGK_GDIOP_ESCAPE = 5, // Driver ignores this command + DXGK_GDIOP_TRANSPARENTBLT = 6, + DXGK_GDIOP_CLEARTYPEBLEND = 7, +} DXGK_RENDERKM_OPERATION; + +typedef struct _DXGK_RENDERKM_COMMAND +{ + DXGK_RENDERKM_OPERATION OpCode; // Command OpCode + UINT CommandSize; // Number of bytes to the next command from the start of DXGK_RENDERKM_COMMAND + union + { + DXGK_GDIARG_BITBLT BitBlt; + DXGK_GDIARG_COLORFILL ColorFill; + DXGK_GDIARG_ALPHABLEND AlphaBlend; + DXGK_GDIARG_STRETCHBLT StretchBlt; + DXGK_GDIARG_TRANSPARENTBLT TransparentBlt; + DXGK_GDIARG_CLEARTYPEBLEND ClearTypeBlend; + } Command; +} DXGK_RENDERKM_COMMAND; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RENDER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RENDERKM( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_RENDER pRenderKmArgs + ); + +#endif // DXGKDDI_INTERFACE_VERSION + +typedef struct _DXGKARG_STOPCAPTURE +{ + HANDLE hAllocation; +} DXGKARG_STOPCAPTURE; + +typedef _In_ CONST DXGKARG_STOPCAPTURE* IN_CONST_PDXGKARG_STOPCAPTURE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_STOPCAPTURE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_STOPCAPTURE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_STOPCAPTURE pStopCapture + ); + +// +// Definitions for reporting the progress in the kernel mode display +// only device present. +// +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +typedef enum _DXGK_PRESENT_DISPLAY_ONLY_PROGRESS_ID +{ + DXGK_PRESENT_DISPLAYONLY_PROGRESS_ID_COMPLETE = 0, + DXGK_PRESENT_DISPLAYONLY_PROGRESS_ID_FAILED = 1, +} DXGK_PRESENT_DISPLAY_ONLY_PROGRESS_ID; + +typedef struct _DXGKARGCB_PRESENT_DISPLAYONLY_PROGRESS +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + DXGK_PRESENT_DISPLAY_ONLY_PROGRESS_ID ProgressId; +} DXGKARGCB_PRESENT_DISPLAYONLY_PROGRESS; + +typedef _In_ CONST DXGKARGCB_PRESENT_DISPLAYONLY_PROGRESS* IN_CONST_PDXGKARGCB_PRESENT_DISPLAYONLY_PROGRESS; + +#endif // DXGKDDI_INTERFACE_VERSION + +// +// Definition for Scheduler Interrupt Event Type. +// +typedef enum _DXGK_INTERRUPT_TYPE +{ + DXGK_INTERRUPT_DMA_COMPLETED = 1, + DXGK_INTERRUPT_DMA_PREEMPTED = 2, + DXGK_INTERRUPT_CRTC_VSYNC = 3, + DXGK_INTERRUPT_DMA_FAULTED = 4, + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + DXGK_INTERRUPT_DISPLAYONLY_VSYNC = 5, + DXGK_INTERRUPT_DISPLAYONLY_PRESENT_PROGRESS = 6, + DXGK_INTERRUPT_CRTC_VSYNC_WITH_MULTIPLANE_OVERLAY = 7, +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGK_INTERRUPT_MICACAST_CHUNK_PROCESSING_COMPLETE = 8, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + DXGK_INTERRUPT_DMA_PAGE_FAULTED = 9, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + DXGK_INTERRUPT_CRTC_VSYNC_WITH_MULTIPLANE_OVERLAY2 = 10, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGK_INTERRUPT_MONITORED_FENCE_SIGNALED = 11, + DXGK_INTERRUPT_HWQUEUE_PAGE_FAULTED = 12, + DXGK_INTERRUPT_HWCONTEXTLIST_SWITCH_COMPLETED = 13, + DXGK_INTERRUPT_PERIODIC_MONITORED_FENCE_SIGNALED = 14, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + DXGK_INTERRUPT_SCHEDULING_LOG_INTERRUPT = 15, + DXGK_INTERRUPT_GPU_ENGINE_TIMEOUT = 16, + DXGK_INTERRUPT_SUSPEND_CONTEXT_COMPLETED = 17, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + DXGK_INTERRUPT_CRTC_VSYNC_WITH_MULTIPLANE_OVERLAY3 = 18, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + DXGK_INTERRUPT_NATIVE_FENCE_SIGNALED = 19, + DXGK_INTERRUPT_GPU_ENGINE_STATE_CHANGE = 20 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +} DXGK_INTERRUPT_TYPE; + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef struct _DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO +{ + DWORD LayerIndex; + BOOL Enabled; + PHYSICAL_ADDRESS PhysicalAddress; + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes; +} DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO; +#endif // DXGKDDI_INTERFACE_VERSION + +typedef struct _DXGKCB_NOTIFY_INTERRUPT_DATA_FLAGS +{ + union + { + struct + { + UINT ValidPhysicalAdapterMask : 1; // 0x00000001 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT HsyncFlipCompletion : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC +#else + UINT Reserved :31; // 0xFFFFFFFE +#endif + }; + UINT Value; + }; +} DXGKCB_NOTIFY_INTERRUPT_DATA_FLAGS; + +typedef struct _DXGKCB_NOTIFY_MPO_VSYNC_FLAGS +{ + union + { + struct + { + UINT PostPresentNeeded : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGKCB_NOTIFY_MPO_VSYNC_FLAGS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) +typedef struct _DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO2 +{ + DWORD LayerIndex; + ULONGLONG PresentId; + DXGKCB_NOTIFY_MPO_VSYNC_FLAGS Flags; +} DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO2; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +typedef struct _DXGK_FLIPQUEUE_LOG_ENTRY +{ + ULONGLONG PresentId; + ULONGLONG PresentTimestamp; +} DXGK_FLIPQUEUE_LOG_ENTRY; + + +typedef struct _DXGKARG_SETFLIPQUEUELOGBUFFER +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies the VidPn Source ID the flip queue log buffer is provided for. + UINT LayerIndex; // in: Identifies the MPO plane index the flip queue log buffer is provided for. + UINT NumberOfEntries; // in: number of DXGK_FLIPQUEUE_LOG_ENTRY entries in the flip queue log buffer array + + _Field_size_(NumberOfEntries) + _Maybenull_ + DXGK_FLIPQUEUE_LOG_ENTRY* LogBufferAddress; // in: kernel mode CPU VA of the flip queue log buffer in non-paged memory + // Can be NULL if the OS is about to destroy the current flip queue log buffer. +} DXGKARG_SETFLIPQUEUELOGBUFFER; + +typedef _In_ CONST DXGKARG_SETFLIPQUEUELOGBUFFER* IN_CONST_PDXGKARG_SETFLIPQUEUELOGBUFFER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETFLIPQUEUELOGBUFFER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETFLIPQUEUELOGBUFFER( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETFLIPQUEUELOGBUFFER pSetFlipQueueLogBuffer + ); + +typedef struct _DXGKARG_UPDATEFLIPQUEUELOG +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies the VidPn Source ID of the flip queue. + UINT LayerIndex; // in: Identifies the MPO plane index the flip queue. + ULONG FirstFreeFlipQueueLogEntryIndex; // out: Returns the index after the last written entry in the flip queue log buffer. +} DXGKARG_UPDATEFLIPQUEUELOG; + +typedef _Inout_ DXGKARG_UPDATEFLIPQUEUELOG* INOUT_PDXGKARG_UPDATEFLIPQUEUELOG; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UPDATEFLIPQUEUELOG) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_UPDATEFLIPQUEUELOG( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_UPDATEFLIPQUEUELOG pUpdateFlipQueueLog + ); + +typedef struct _DXGKARG_CANCELQUEUEDFLIPS +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies the VidPn Source ID of the flip queue. + UINT LayerIndex; // in: Identifies the MPO plane index the flip queue. + ULONGLONG PresentIdCancelRequested; // in: Identifies the range of PresentIds to cancel: [PresentIdCancelRequested, LastSubmittedPresentIdToDriver] + ULONGLONG PresentIdCancelled; // out: Specifies the range of PresentId that was synchronously cancelled: [PresentIdCancelled, LastSubmittedPresentIdToDriver] + // PresentIdCancelled may be greater or equal to PresentIdCancelRequested + // PresentIdCancelled may be set to zero if none of the pending presents were synchronously cancelled. + // Asynchronously cancelled PresentIds will be reported via VSync interrupt mechanism. +} DXGKARG_CANCELQUEUEDFLIPS; + +typedef _Inout_ DXGKARG_CANCELQUEUEDFLIPS* INOUT_PDXGKARG_CANCELQUEUEDFLIPS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CANCELQUEUEDFLIPS) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_CANCELQUEUEDFLIPS( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CANCELQUEUEDFLIPS pCancelQueuedFlips + ); + + +typedef struct _DXGK_CANCELFLIPS_PLANE +{ + ULONGLONG PresentIdCancelRequested; // in: Identifies the range of PresentIds to cancel: [PresentIdCancelRequested, LastSubmittedPresentIdToDriver] + ULONGLONG PresentIdCancelled; // out: Specifies the range of PresentId that was synchronously cancelled: [PresentIdCancelled, LastSubmittedPresentIdToDriver] + // PresentIdCancelled may be greater or equal to PresentIdCancelRequested + // PresentIdCancelled may be set to zero if none of the pending presents were synchronously cancelled. + // Asynchronously cancelled PresentIds will be reported via VSync interrupt mechanism. + UINT LayerIndex; // in: Identifies the MPO plane index the flip queue. +} DXGK_CANCELFLIPS_PLANE; + +typedef struct _DXGKARG_CANCELFLIPS +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies the VidPn Source ID of the flip queue. + UINT PlaneCount; // in: number of planes with pending Presents to cancel + _Field_size_(PlaneCount) + DXGK_CANCELFLIPS_PLANE** ppPlanes; // inout: per plane cancel request +} DXGKARG_CANCELFLIPS; + +typedef _Inout_ DXGKARG_CANCELFLIPS* INOUT_PDXGKARG_CANCELFLIPS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CANCELFLIPS) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_CANCELFLIPS( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CANCELFLIPS pCancelFlips + ); + +typedef struct _DXGKARG_SETINTERRUPTTARGETPRESENTID +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies the VidPn Source ID of the flip queue. + UINT LayerIndex; // in: Identifies the MPO plane index the flip queue. + ULONGLONG InterruptTargetPresentId; // in: Identifies PresentId that is required to raise a corresponding VSync or HSync interrupt when it's completed. + // When it is set to UINT64_MAX, no VSync interrupt is required going forward until it's changed again. + // When it is set to 0, VSync interrupts are required for every interval regardless of whether any new flips are completed. +} DXGKARG_SETINTERRUPTTARGETPRESENTID; + +typedef _In_ CONST DXGKARG_SETINTERRUPTTARGETPRESENTID* IN_CONST_PDXGKARG_SETINTERRUPTTARGETPRESENTID; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETINTERRUPTTARGETPRESENTID) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_SETINTERRUPTTARGETPRESENTID( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETINTERRUPTTARGETPRESENTID pSetInterruptTargetPresentId + ); + +typedef struct _DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO3 +{ + DWORD LayerIndex; + ULONG FirstFreeFlipQueueLogEntryIndex; +} DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO3; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + +typedef struct _DXGKARG_SETALLOCATIONBACKINGSTORE +{ + HANDLE hDriverAllocation; // Returned by KMD from DxgkDdiCreateAllocation + VOID* pBackingStore; // Address in system space +} DXGKARG_SETALLOCATIONBACKINGSTORE; + +typedef _In_ CONST DXGKARG_SETALLOCATIONBACKINGSTORE* IN_CONST_PDXGKARG_SETALLOCATIONBACKINGSTORE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETALLOCATIONBACKINGSTORE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETALLOCATIONBACKINGSTORE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETALLOCATIONBACKINGSTORE pArgs + ); + +typedef struct _DXGK_CREATECPUEVENTFLAGS +{ + union + { + struct + { + UINT Reserved : 32; + }; + UINT Value; + }; +} DXGK_CREATECPUEVENTFLAGS; + +typedef struct _DXGKARG_CREATECPUEVENT +{ + HANDLE hKmdDevice; // in + HANDLE hDxgCpuEvent; // in + DXGK_CREATECPUEVENTFLAGS Flags; // in + HANDLE hKmdCpuEvent; // out +} DXGKARG_CREATECPUEVENT; + +typedef _Inout_ DXGKARG_CREATECPUEVENT * INOUT_PDXGKARG_CREATECPUEVENT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATECPUEVENT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATECPUEVENT ( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATECPUEVENT pArgs + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYCPUEVENT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYCPUEVENT ( + IN_CONST_HANDLE hAdapter, + IN_CONST_HANDLE hKmdCpuEvent + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) +typedef enum _DXGK_ENGINE_STATE +{ + DXGK_ENGINE_STATE_ACTIVE = 0, + DXGK_ENGINE_STATE_IDLE = 1, + DXGK_ENGINE_STATE_HUNG = 2 +}DXGK_ENGINE_STATE; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +typedef struct _DXGKARGCB_NOTIFY_INTERRUPT_DATA +{ + DXGK_INTERRUPT_TYPE InterruptType; // in: interrupt type + union + { + struct + { + UINT SubmissionFenceId; // in: submission id of completed command. + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + } DmaCompleted; + struct + { + UINT PreemptionFenceId; // in: submission id of preemption request. + UINT LastCompletedFenceId; // in: submission id of last completed command before preemption. + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + } DmaPreempted; + struct + { + UINT FaultedFenceId; // in: submission id of faulted command. + NTSTATUS Status; // in: status of fault + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + } DmaFaulted; + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; // in: VidPnTarget id (where vsync occurs). + PHYSICAL_ADDRESS PhysicalAddress; // in: Physical Address of displaying buffer. + UINT PhysicalAdapterMask; // in: Physical adapter mask (where vsync occurs). + // (Must set Flags.ValidPhysicalAdapterMask as well) + } CrtcVsync; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; // in: VidPnTarget id (where vsync occurs). + } DisplayOnlyVsync; + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; + UINT PhysicalAdapterMask; + UINT MultiPlaneOverlayVsyncInfoCount; + DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO *pMultiPlaneOverlayVsyncInfo; + } CrtcVsyncWithMultiPlaneOverlay; + + DXGKARGCB_PRESENT_DISPLAYONLY_PROGRESS DisplayOnlyPresentProgress; +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; + DXGK_MIRACAST_CHUNK_INFO ChunkInfo; + PVOID pPrivateDriverData; + UINT PrivateDataDriverSize; + NTSTATUS Status; + } MiracastEncodeChunkCompleted; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + struct + { + UINT FaultedFenceId; // in: submission id of faulted command. If the faulted fence could not be determined reliably, + // PageFaultFlags should have DXGK_PAGE_FAULT_FENCE_INVALID flag set. + UINT64 FaultedPrimitiveAPISequenceNumber; // in: 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. + DXGK_RENDER_PIPELINE_STAGE FaultedPipelineStage; // in: render pipeline stage during which the fault was generated, or DXGK_RENDER_PIPELINE_STAGE_UNKNOWN if such information is not available. + UINT FaultedBindTableEntry; // in: 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. + DXGK_PAGE_FAULT_FLAGS PageFaultFlags; // in: flags specifying the nature of the page fault and recovery policy + D3DGPU_VIRTUAL_ADDRESS FaultedVirtualAddress; // in: VA of fault, or 0 if the fault has another cause. In the latter case, FaultErrorCode field should be used to describe the GPU error. + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + UINT PageTableLevel; // in: Described page table level which the faulting operation was attempted on. + DXGK_FAULT_ERROR_CODE FaultErrorCode; // in: Structure that contains error code describing the fault. + HANDLE FaultedProcessHandle; // in: DXGK process handle of the process that generated page fault, or NULL if the faulted + // process could not be determined. + } DmaPageFaulted; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; + UINT PhysicalAdapterMask; + UINT MultiPlaneOverlayVsyncInfoCount; + _Field_size_(MultiPlaneOverlayVsyncInfoCount) DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO2 *pMultiPlaneOverlayVsyncInfo; + ULONGLONG GpuFrequency; + ULONGLONG GpuClockCounter; + } CrtcVsyncWithMultiPlaneOverlay2; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + struct + { + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + } MonitoredFenceSignaled; + + struct + { + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + UINT64 ContextSwitchFence; // in: Context switch fence used to perform this switch operation. + } HwContextListSwitchCompleted; + + struct + { + UINT64 FaultedFenceId; // in: HW queue progress fence ID of the faulted command. If the faulted fence could not be determined reliably, + // PageFaultFlags should have DXGK_PAGE_FAULT_FENCE_INVALID flag set. + D3DGPU_VIRTUAL_ADDRESS FaultedVirtualAddress; // in: VA of fault, or 0 if the fault has another cause. In the latter case, FaultErrorCode field should be used to describe the GPU error. + UINT64 FaultedPrimitiveAPISequenceNumber; // in: 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. + + union + { + HANDLE FaultedHwQueue; // in: when DXGK_PAGE_FAULT_FENCE_INVALID is not set, + // specifies the handle of the HW queue that generated the fault. + HANDLE FaultedHwContext; // in: when DXGK_PAGE_FAULT_FENCE_INVALID and DXGK_PAGE_FAULT_HW_CONTEXT_VALID are set, + // specifies the handle of the HW context that generated the fault. + HANDLE FaultedProcessHandle; // in: when DXGK_PAGE_FAULT_FENCE_INVALID and DXGK_PAGE_FAULT_PROCESS_HANDLE_VALID are set, + // specifies the handle of the process that generated the fault. + }; + + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + + DXGK_RENDER_PIPELINE_STAGE FaultedPipelineStage; // in: render pipeline stage during which the fault was generated, or DXGK_RENDER_PIPELINE_STAGE_UNKNOWN if such information is not available. + UINT FaultedBindTableEntry; // in: 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. + DXGK_PAGE_FAULT_FLAGS PageFaultFlags; // in: flags specifying the nature of the page fault and recovery policy + UINT PageTableLevel; // in: Described page table level which the faulting operation was attempted on. + DXGK_FAULT_ERROR_CODE FaultErrorCode; // in: Structure that contains error code describing the fault. + } HwQueuePageFaulted; + + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; // in: The display signaling the monitored fence. + UINT NotificationID; // in: The notification id as multiple can be attached to one VidPnSource. + } PeriodicMonitoredFenceSignaled; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + struct + { + UINT NodeOrdinal; // in: Node ordinal of engine that raised the scheduling log interrupt. + UINT EngineOrdinal; // in: Engine ordinal of engine that raised the scheduling log interrupt. + } SchedulingLogInterrupt; + + struct + { + UINT NodeOrdinal; // in: Node ordinal of engine that timed out and needs the reset. + UINT EngineOrdinal; // in: Engine ordinal of engine that timed out and needs the reset. + } GpuEngineTimeout; + + struct + { + HANDLE hContext; // in: Hardware context that the suspend acknowledgment is for. + UINT64 ContextSuspendFence; // in: Context suspend fence. + } SuspendContextCompleted; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + struct + { + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; + UINT PhysicalAdapterMask; + UINT MultiPlaneOverlayVsyncInfoCount; + _Field_size_(MultiPlaneOverlayVsyncInfoCount) DXGK_MULTIPLANE_OVERLAY_VSYNC_INFO3 *pMultiPlaneOverlayVsyncInfo; + ULONGLONG GpuFrequency; + ULONGLONG GpuClockCounter; + } CrtcVsyncWithMultiPlaneOverlay3; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + struct + { + UINT NodeOrdinal; // in: Node ordinal of engine generating the notification. + UINT EngineOrdinal; // in: Engine ordinal of engine generating the notification. + + // Signaled native fence array specifies all fences that were signaled and require waiters to be unblocked. + // If this array is empty, the OS will re-scan all pending native fence waiters instead of the subset specified by the signaled native fence array. + UINT SignaledNativeFenceCount; // in: size of the signaled native fence array. + _Field_size_(SignaledNativeFenceCount) + HANDLE* pSignaledNativeFenceArray; // in: OS kernel mode handles of objects in the signaled native fence array. + } NativeFenceSignaled; + + struct + { + UINT NodeOrdinal; // in: Node ordinal of engine whose state changed + UINT EngineOrdinal; // in: Engine ordinal of engine whose state changed + DXGK_ENGINE_STATE NewState; + } EngineStateChange; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + + struct + { + UINT Reserved[16]; + } Reserved; + }; + DXGKCB_NOTIFY_INTERRUPT_DATA_FLAGS Flags; // in: event flags +} DXGKARGCB_NOTIFY_INTERRUPT_DATA; + +typedef _Inout_ DXGKARGCB_NOTIFY_INTERRUPT_DATA* IN_CONST_PDXGKARGCB_NOTIFY_INTERRUPT_DATA; + +// Device Driver Interface fence update at ISR. +// +typedef + _Function_class_DXGK_(DXGKCB_NOTIFY_INTERRUPT) + _IRQL_requires_(HIGH_LEVEL) // HIGH_LEVEL is best approximation of DIRQL +VOID (APIENTRY CALLBACK *DXGKCB_NOTIFY_INTERRUPT)( + IN_CONST_HANDLE hAdapter, IN_CONST_PDXGKARGCB_NOTIFY_INTERRUPT_DATA + ); + +// Device Driver Interface fence update at DPC. +// +typedef + _Function_class_DXGK_(DXGKCB_NOTIFY_DPC) + _IRQL_requires_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_NOTIFY_DPC)( + IN_CONST_HANDLE hAdapter + ); + +typedef struct _DXGK_OPENALLOCATIONINFO +{ + D3DKMT_HANDLE hAllocation; // in: dxg assigned per Device handle + VOID* pPrivateDriverData; // in/out: Private data for each allocation allocated by the user mode driver + UINT PrivateDriverDataSize; // in: Size of the private data + HANDLE hDeviceSpecificAllocation; // out: driver set it +} DXGK_OPENALLOCATIONINFO; + +typedef struct _DXGK_OPENALLOCATIONFLAGS +{ + union + { + struct + { + UINT Create : 1; // 0x00000001 // Indicates that this allocation is being created, if not set then allocation is being opened + UINT ReadOnly : 1; // 0x00000002 // Indicates that this allocation is being opened read-only. + UINT Reserved :30; // 0xFFFFFFFC + }; + UINT Value; + }; +} DXGK_OPENALLOCATIONFLAGS; + +typedef struct _DXGKARG_OPENALLOCATION +{ + UINT NumAllocations; + DXGK_OPENALLOCATIONINFO* pOpenAllocation; + VOID* pPrivateDriverData; + UINT PrivateDriverSize; + DXGK_OPENALLOCATIONFLAGS Flags; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + UINT SubresourceIndex; + // The following data is set by the driver for allocations which have all the following properties: + // - shared; + // - GDI compatible + // - in the aperture segment + // - linear + // - the driver can texture from the allocation + // + SIZE_T SubresourceOffset; // Out. Offset in bytes from the start of the allocation. + UINT Pitch; // Out. Pitch for allocations. +#endif +} DXGKARG_OPENALLOCATION; + +typedef _In_ CONST DXGKARG_OPENALLOCATION* IN_CONST_PDXGKARG_OPENALLOCATION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_OPENALLOCATIONINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_OPENALLOCATIONINFO( + IN_CONST_HANDLE hDevice, + IN_CONST_PDXGKARG_OPENALLOCATION pOpenAllocation + ); + +typedef struct _DXGKARG_CLOSEALLOCATION +{ + UINT NumAllocations; + CONST HANDLE* pOpenHandleList; //in: hDeviceSpecificAllocation list +} DXGKARG_CLOSEALLOCATION; + +typedef _In_ CONST DXGKARG_CLOSEALLOCATION* IN_CONST_PDXGKARG_CLOSEALLOCATION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CLOSEALLOCATION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CLOSEALLOCATION( + IN_CONST_HANDLE hDevice, + IN_CONST_PDXGKARG_CLOSEALLOCATION pCloseAllocation + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYDEVICE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYDEVICE( + IN_CONST_HANDLE hDevice + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYCONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYCONTEXT( + IN_CONST_HANDLE hContext + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYHWCONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYHWCONTEXT( + IN_CONST_HANDLE hHwContext + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYHWQUEUE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYHWQUEUE( + IN_CONST_HANDLE hHwQueue + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef _In_ D3DKMT_HANDLE IN_D3DKMT_HANDLE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_GETHANDLEPARENT) + _IRQL_requires_(PASSIVE_LEVEL) +D3DKMT_HANDLE +(APIENTRY CALLBACK *DXGKCB_GETHANDLEPARENT)(IN_D3DKMT_HANDLE hAllocation); + +typedef enum _DXGK_HANDLE_TYPE +{ + DXGK_HANDLE_ALLOCATION = 1, + DXGK_HANDLE_RESOURCE = 2, +} DXGK_HANDLE_TYPE; + +typedef struct _DXGKCB_GETHANDLEDATAFLAGS +{ + union + { + struct + { + UINT DeviceSpecific : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGKCB_GETHANDLEDATAFLAGS; + +typedef struct _DXGKARGCB_GETHANDLEDATA +{ + D3DKMT_HANDLE hObject; + DXGK_HANDLE_TYPE Type; + DXGKCB_GETHANDLEDATAFLAGS Flags; +} DXGKARGCB_GETHANDLEDATA; + +typedef _In_ CONST DXGKARGCB_GETHANDLEDATA* IN_CONST_PDXGKARGCB_GETHANDLEDATA; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_GETHANDLEDATA) + _IRQL_requires_(PASSIVE_LEVEL) +VOID* +(APIENTRY CALLBACK *DXGKCB_GETHANDLEDATA)(IN_CONST_PDXGKARGCB_GETHANDLEDATA); + +typedef VOID * DXGKARG_RELEASE_HANDLE; +typedef DXGKARG_RELEASE_HANDLE * PDXGKARG_RELEASE_HANDLE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_ACQUIREHANDLEDATA) + _IRQL_requires_max_(APC_LEVEL) +VOID* +(APIENTRY CALLBACK *DXGKCB_ACQUIREHANDLEDATA)(IN_CONST_PDXGKARGCB_GETHANDLEDATA, _Out_ PDXGKARG_RELEASE_HANDLE); + +typedef struct _DXGKARGCB_RELEASEHANDLEDATA +{ + DXGKARG_RELEASE_HANDLE ReleaseHandle; + DXGK_HANDLE_TYPE Type; +} DXGKARGCB_RELEASEHANDLEDATA; + +typedef _In_ CONST DXGKARGCB_RELEASEHANDLEDATA IN_CONST_DXGKARGCB_RELEASEHANDLEDATA; + +typedef + _Function_class_DXGK_(DXGKCB_RELEASEHANDLEDATA) + _IRQL_requires_max_(APC_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_RELEASEHANDLEDATA)(IN_CONST_DXGKARGCB_RELEASEHANDLEDATA); + +typedef struct _DXGKARGCB_ENUMHANDLECHILDREN +{ + D3DKMT_HANDLE hObject; + UINT Index; +} DXGKARGCB_ENUMHANDLECHILDREN; + +typedef _In_ CONST DXGKARGCB_ENUMHANDLECHILDREN* IN_CONST_PDXGKARGCB_ENUMHANDLECHILDREN; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_ENUMHANDLECHILDREN) + _IRQL_requires_(PASSIVE_LEVEL) +D3DKMT_HANDLE +(APIENTRY CALLBACK *DXGKCB_ENUMHANDLECHILDREN)(IN_CONST_PDXGKARGCB_ENUMHANDLECHILDREN); + +typedef struct _DXGKARGCB_GETCAPTUREADDRESS +{ + D3DKMT_HANDLE hAllocation; // in: Allocation handle + UINT SegmentId; // out: Segment ID of capture buffer + PHYSICAL_ADDRESS PhysicalAddress; // out: Physical address of capture buffer +} DXGKARGCB_GETCAPTUREADDRESS; + +typedef _Inout_ DXGKARGCB_GETCAPTUREADDRESS* INOUT_PDXGKARGCB_GETCAPTUREADDRESS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_GETCAPTUREADDRESS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_GETCAPTUREADDRESS)(INOUT_PDXGKARGCB_GETCAPTUREADDRESS); + +typedef struct _DXGK_DEVICEINFOFLAGS +{ + union + { + struct + { + UINT GuaranteedDmaBufferContract : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; + } DXGK_DEVICEINFOFLAGS; + +typedef struct _DXGK_DEVICEINFO +{ + UINT DmaBufferSize; + UINT DmaBufferSegmentSet; + UINT DmaBufferPrivateDataSize; + UINT AllocationListSize; + UINT PatchLocationListSize; + DXGK_DEVICEINFOFLAGS Flags; +} DXGK_DEVICEINFO; + +typedef struct _DXGK_CREATEDEVICEFLAGS +{ + union + { + struct + { + UINT SystemDevice : 1; // 0x00000001 + UINT GdiDevice : 1; // 0x00000002 + UINT Reserved : 29; // 0x7FFFFFFC + UINT DXGK_DEVICE_RESERVED0 : 1; // 0x80000000 + }; + UINT Value; + }; +} DXGK_CREATEDEVICEFLAGS; + +typedef struct _DXGKARG_CREATEDEVICE +{ + HANDLE hDevice; // in: Runtime handle/out: Driver handle + union + { + DXGK_CREATEDEVICEFLAGS Flags; // in: device creation flags + DXGK_DEVICEINFO* pInfo; // out: device info from driver (obsolate: backward compatibility only) + }; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + ULONG Pasid; // in: the owner process PASID for SVM + HANDLE hKmdProcess; // in: KMD driver process handle +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +} DXGKARG_CREATEDEVICE; + +typedef _Inout_ DXGKARG_CREATEDEVICE* INOUT_PDXGKARG_CREATEDEVICE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEDEVICE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEDEVICE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATEDEVICE pCreateDevice + ); + +typedef struct _DXGK_CREATECONTEXTFLAGS +{ + union + { + struct + { + UINT SystemContext : 1; + UINT GdiContext : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT VirtualAddressing : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT SystemProtectedContext : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + UINT HwQueueSupported : 1; + UINT Reserved : 27; +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_3 + UINT Reserved : 28; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_1 + UINT Reserved : 29; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_0 + UINT Reserved : 30; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0 + }; + UINT Value; + }; +} DXGK_CREATECONTEXTFLAGS; + +#define DXGK_ALLOCATION_LIST_SIZE_GDICONTEXT 256 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef struct _DXGK_CONTEXTINFO_CAPS +{ + union + { + struct + { + UINT NoPatchingRequired : 1; + UINT DriverManagesResidency : 1; + UINT UseIoMmu : 1; + UINT Reserved : 29; + }; + UINT Value; + }; +} DXGK_CONTEXTINFO_CAPS; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef struct _DXGK_CONTEXTINFO +{ + UINT DmaBufferSize; + UINT DmaBufferSegmentSet; + UINT DmaBufferPrivateDataSize; + UINT AllocationListSize; + UINT PatchLocationListSize; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + UINT Reserved; +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + DXGK_CONTEXTINFO_CAPS Caps; // Describes optional features supported by the context + ULONG PagingCompanionNodeId; // Zero based node index to use with context paging operations +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +} DXGK_CONTEXTINFO; + +typedef struct _DXGKARG_CREATECONTEXT +{ + HANDLE hContext; // in: Runtime handle/out: Driver handle + UINT NodeOrdinal; // in: Node targetted for this context. + UINT EngineAffinity; // in: Engine affinity. + DXGK_CREATECONTEXTFLAGS Flags; // in: Context creation flags. + VOID* pPrivateDriverData; // in: Private driver data + UINT PrivateDriverDataSize; // in: Size of private driver data + DXGK_CONTEXTINFO ContextInfo; // out: context info from driver +} DXGKARG_CREATECONTEXT; + +typedef _Inout_ DXGKARG_CREATECONTEXT* INOUT_PDXGKARG_CREATECONTEXT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATECONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATECONTEXT( + IN_CONST_HANDLE hDevice, + INOUT_PDXGKARG_CREATECONTEXT pCreateContext + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGK_HWCONTEXT_CAPS +{ + union + { + struct + { + UINT UseIoMmu : 1; + UINT Reserved : 31; + }; + UINT Value; + }; +} DXGK_HWCONTEXT_CAPS; + +typedef struct _DXGKARG_CREATEHWCONTEXT +{ + HANDLE hHwContext; // in: Runtime handle/out: Driver handle + UINT NodeOrdinal; // in: Node targetted for this context. + UINT EngineAffinity; // in: Engine affinity. + D3DDDI_CREATEHWCONTEXTFLAGS Flags; // in: Context creation flags. + UINT PrivateDriverDataSize; // in: Size of private driver data + _Inout_ + _Field_size_bytes_ (PrivateDriverDataSize) + VOID* pPrivateDriverData; // in/out: Private driver data + DXGK_HWCONTEXT_CAPS ContextCaps; // out: context caps from driver +} DXGKARG_CREATEHWCONTEXT; + +typedef _Inout_ DXGKARG_CREATEHWCONTEXT* INOUT_PDXGKARG_CREATEHWCONTEXT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEHWCONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEHWCONTEXT( + IN_CONST_HANDLE hDevice, + INOUT_PDXGKARG_CREATEHWCONTEXT pCreateContext + ); + +typedef struct _DXGKARG_CREATEHWQUEUE +{ + HANDLE hHwQueue; // in: Runtime handle/out: Driver handle + D3DDDI_CREATEHWQUEUEFLAGS Flags; // in: Queue creation flags. + UINT PrivateDriverDataSize; // in: Size of private driver data + _Inout_ + _Field_size_bytes_ (PrivateDriverDataSize) + VOID* pPrivateDriverData; // in/out: Private driver data + D3DKMT_HANDLE hHwQueueProgressFence; // in: Handle to the hardware queue progress fence object. + VOID* HwQueueProgressFenceCPUVirtualAddress; // in: Read-only mapping of the fence value for the CPU + D3DGPU_VIRTUAL_ADDRESS HwQueueProgressFenceGPUVirtualAddress; // in: Read/write mapping of the fence value for the GPU +} DXGKARG_CREATEHWQUEUE; + +typedef _Inout_ DXGKARG_CREATEHWQUEUE* INOUT_PDXGKARG_CREATEHWQUEUE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEHWQUEUE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEHWQUEUE( + IN_CONST_HANDLE hHwContext, + INOUT_PDXGKARG_CREATEHWQUEUE pCreateHwQueue + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef _In_ CONST DXGKARG_SETPALETTE* IN_CONST_PDXGKARG_SETPALETTE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETPALETTE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETPALETTE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETPALETTE pSetPalette + ); + +typedef struct _DXGK_POINTERFLAGS +{ + union + { + struct + { + UINT Monochrome : 1; // 0x00000001 + UINT Color : 1; // 0x00000002 + UINT MaskedColor : 1; // 0x00000004 + UINT Reserved :29; // 0xFFFFFFF8 + }; + UINT Value; + }; +} DXGK_POINTERFLAGS; + +typedef struct _DXGKARG_SETPOINTERSHAPE +{ + DXGK_POINTERFLAGS Flags; + UINT Width; + UINT Height; + UINT Pitch; + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + CONST VOID* pPixels; + UINT XHot; + UINT YHot; +} DXGKARG_SETPOINTERSHAPE; + +// +//Flags specifies monochrome or color pointer or color pointer with alpha. +// +//Width is Width of the pointer in pixels. +// +//Height is Height of the pointer in scans. +// +//Pitch is Width of the pointer in bytes. +// +//VidPnSourceId is VidPN source ID of this adapter on which the pointer is being set. +// +//pPixels points to the start of color bitmap size of specified Width and Height +// in 32-bpp ARGB DIB format for non-monochrome pointers, or points to the start of +// monochrome bitmap size of specified Width and Height in 1-bpp DIB format AND mask +// followed by another 1-bpp DIB format XOR mask of the same size for monochrome pointers. +// +//XHot is column on which hot pixel is located from top left of pointer bitmap in pixels. +// +//YHot is row on which hot pixel is located from top left of pointer bitmap in pixels. +// + +typedef _In_ CONST DXGKARG_SETPOINTERSHAPE* IN_CONST_PDXGKARG_SETPOINTERSHAPE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETPOINTERSHAPE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETPOINTERSHAPE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETPOINTERSHAPE pSetPointerShape + ); + +typedef struct _DXGK_SETPOINTERPOSITIONFLAGS +{ + union + { + struct + { + UINT Visible : 1; // 0x00000001 + UINT Procedural : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC + }; + UINT Value; + }; +} DXGK_SETPOINTERPOSITIONFLAGS; + +typedef struct _DXGKARG_SETPOINTERPOSITION +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + INT X; + INT Y; + DXGK_SETPOINTERPOSITIONFLAGS Flags; +} DXGKARG_SETPOINTERPOSITION; + +// +//Visible indicates if the pointer should be visible or not. +//X and Y should be ignored by driver if FALSE. +// +//Output is output index of this adapter. +// +//X is Column on which the top left pixel of cursor image is located +//from the top left pixel of the VidPN source in pixels. +// +//Y is Row on which the top left pixel of cusor image is located from +//the top left pixel of the VidPN source in pixels. +// + +typedef _In_ CONST DXGKARG_SETPOINTERPOSITION* IN_CONST_PDXGKARG_SETPOINTERPOSITION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETPOINTERPOSITION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETPOINTERPOSITION( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETPOINTERPOSITION pSetPointerPosition + ); + +typedef enum _DXGK_QUERYADAPTERINFOTYPE +{ + DXGKQAITYPE_UMDRIVERPRIVATE = 0, + DXGKQAITYPE_DRIVERCAPS = 1, + DXGKQAITYPE_QUERYSEGMENT = 2, +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + DXGKQAITYPE_RESERVED = 3, // _ADVSCH_ + DXGKQAITYPE_QUERYSEGMENT2 = 4, // _ADVSCH_ +#endif // DXGKDDI_INTERFACE_VERSION_WIN7 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + DXGKQAITYPE_QUERYSEGMENT3 = 5, + DXGKQAITYPE_NUMPOWERCOMPONENTS = 6, + DXGKQAITYPE_POWERCOMPONENTINFO = 7, + DXGKQAITYPE_PREFERREDGPUNODE = 8, +#endif // DXGKDDI_INTERFACE_VERSION_WIN8 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGKQAITYPE_POWERCOMPONENTPSTATEINFO = 9, + DXGKQAITYPE_HISTORYBUFFERPRECISION = 10, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + DXGKQAITYPE_QUERYSEGMENT4 = 11, + DXGKQAITYPE_SEGMENTMEMORYSTATE = 12, + DXGKQAITYPE_GPUMMUCAPS = 13, + DXGKQAITYPE_PAGETABLELEVELDESC = 14, + DXGKQAITYPE_PHYSICALADAPTERCAPS = 15, + DXGKQAITYPE_DISPLAY_DRIVERCAPS_EXTENSION = 16, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGKQAITYPE_INTEGRATED_DISPLAY_DESCRIPTOR = 17, + DXGKQAITYPE_UEFIFRAMEBUFFERRANGES = 18, + DXGKQAITYPE_QUERYCOLORIMETRYOVERRIDES = 19, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + DXGKQAITYPE_DISPLAYID_DESCRIPTOR = 20, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + DXGKQAITYPE_FRAMEBUFFERSAVESIZE = 21, + DXGKQAITYPE_HARDWARERESERVEDRANGES = 22, + DXGKQAITYPE_INTEGRATED_DISPLAY_DESCRIPTOR2 = 23, + DXGKQAITYPE_NODEPERFDATA = 24, + DXGKQAITYPE_ADAPTERPERFDATA = 25, + DXGKQAITYPE_ADAPTERPERFDATA_CAPS = 26, + DXGKQAITYPE_GPUVERSION = 27, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + DXGKQAITYPE_DEVICE_TYPE_CAPS = 28, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_5 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + DXGKQAITYPE_WDDMDEVICECAPS = 29, + DXGKQAITYPE_GPUPCAPS = 30, + DXGKQAITYPE_QUERYTARGETGAMMACAPS = 31, + DXGKQAITYPE_SCANOUT_CAPS = 33, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + DXGKQAITYPE_PHYSICAL_MEMORY_CAPS = 34, + DXGKQAITYPE_IOMMU_CAPS = 35, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + DXGKQAITYPE_HARDWARERESERVEDRANGES2 = 36, + DXGKQAITYPE_NATIVE_FENCE_CAPS = 37, + DXGKQAITYPE_USERMODESUBMISSION_CAPS = 38, +#endif // DXGKDDI_INTERFACE_VERSION_WDDM3_1 + +} DXGK_QUERYADAPTERINFOTYPE; + +typedef struct _DXGK_GAMMARAMPCAPS +{ + union + { + struct + { + UINT Gamma_Rgb256x3x16 : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_GAMMARAMPCAPS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGK_COLORTRANSFORMCAPS +{ + union + { + struct + { + UINT Gamma_Rgb256x3x16 : 1; // 0x00000001 + UINT Gamma_Dxgi1 : 1; // 0x00000002 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + + UINT Transform_3x4Matrix : 1; // 0x00000004 + UINT Transform_3x4Matrix_WideColor : 1; // 0x00000008 + UINT Transform_3x4Matrix_HighColor : 1; // 0x00000010 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + UINT Transform_Matrix_V2 : 1; // 0x00000020 + UINT Reserved :26; // 0xFFFFFFC0 +#else //DXGKDDI_INTERFACE_VERSION_WDDM2_6 + UINT Reserved :27; // 0xFFFFFFE0 +#endif //DXGKDDI_INTERFACE_VERSION_WDDM2_6 +#else // DXGKDDI_INTERFACE_VERSION_WDDM2_3 + + UINT Reserved :30; // 0xFFFFFFFC + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3 + }; + UINT Value; + }; +} DXGK_COLORTRANSFORMCAPS; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2 + + +#define DXGK_TEXTURE_SIZE_SHIFT 11 + +typedef struct _DXGK_PRESENTATIONCAPS +{ + union + { + struct + { + UINT NoScreenToScreenBlt : 1; // Driver does not support kernel mode Present within the same allocation + UINT NoOverlapScreenBlt : 1; // Driver does not support kernel mode Present within the same allocation with overlapped SrcRect and DstRect + UINT SupportKernelModeCommandBuffer : 1; // Driver supports RenderKm DDI + UINT NoSameBitmapAlphaBlend : 1; // Driver cannot support AlphaBlend when source and destination allocations are the same. + UINT NoSameBitmapStretchBlt : 1; // Driver cannot support StretchBlt when source and destination allocations are the same. + UINT NoSameBitmapTransparentBlt : 1; // Driver cannot support TransparentBlt when source and destination allocations are the same. + UINT NoSameBitmapOverlappedAlphaBlend: 1; // Driver cannot support AlphaBlend when source and destination allocations are the same and + // source and destination rectangles overlap. + UINT NoSameBitmapOverlappedStretchBlt: 1; // Driver cannot support StretchBlt when source and destination allocations are the same and + // source and destination rectangles overlap. + UINT DriverSupportsCddDwmInterop : 1; // Driver does not support hardware GDI acceleration, but supports Cdd-Dwm interop. + UINT Reserved0 : 1; + UINT AlignmentShift : 4; // Driver requires Blt surface pitch alignment to be (1 << AlignmentShift) bytes. Must be >= 2. + UINT MaxTextureWidthShift : 3; // Max supported texture width is 2 ^ (MaxTextureWidth + DXGK_TEXTURE_SIZE_SHIFT) texels + UINT MaxTextureHeightShift : 3; // Max supported texture height is 2 ^ (MaxTextureHeight + DXGK_TEXTURE_SIZE_SHIFT) texels + UINT SupportAllBltRops : 1; // Driver supports all GDI ROP3 operations in BitBlt and ColorFill + UINT SupportMirrorStretchBlt : 1; // Driver supports StretchBlt in mirror mode + UINT SupportMonoStretchBltModes : 1; // Driver supports BLACKONWHITE and WHITEONBLACK StretchBlt modes + UINT StagingRectStartPitchAligned : 1; // Driver requires the staging rect top/left point in the cpu visible surface to be pitch aligned (left = 0). + UINT NoSameBitmapBitBlt : 1; // Driver cannot support BitBlt when source and destination allocations are the same. + UINT NoSameBitmapOverlappedBitBlt : 1; // Driver cannot support BitBlt when source and destination allocations are the same and + // source and destination rectangles overlap. + UINT Reserved1 : 1; + UINT NoTempSurfaceForClearTypeBlend : 1; // The driver does not need the temporary surface for ClearType blend +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + UINT SupportSoftwareDeviceBitmaps : 1; // Driver supports D3DKMDT_GDISURFACE_TEXTURE_CPUVISIBLE redirection bitmaps. + UINT NoCacheCoherentApertureMemory : 1; // Driver does not support cache coherent aperture memory. + UINT SupportLinearHeap : 1; // Driver supports linear heap allocation from staging surfaces. + UINT Reserved : 1; +#else + UINT Reserved : 4; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + }; + UINT Value; + }; +} DXGK_PRESENTATIONCAPS; + +typedef struct _DXGK_FLIPCAPS +{ + union + { + struct + { + UINT FlipOnVSyncWithNoWait : 1; // Support Flip on vsync via command buffer without wait. + UINT FlipOnVSyncMmIo : 1; // Support Flip as mmio at vsync interrupt. + UINT FlipInterval : 1; // Support FLIPINTERVAL_TWO, _THREE, _FOUR. + UINT FlipImmediateMmIo : 1; // Support Flip as mmio immediate. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT FlipIndependent : 1; // Support MMIO flip to redirected surfaces bypassing DMW Present. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT DdiPresentForIFlip : 1; // Call DxgkDdiPresent when independent flip Present might be issued. + UINT FlipImmediateOnHSync : 1; // Driver supports SetVidPnSourceAddress FlipImmediate flag with no tearing between HSync intervals. + UINT Reserved :25; +#else + UINT Reserved :27; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +#else + UINT Reserved :28; +#endif // DXGKDDI_INTERFACE_VERSION + }; + UINT Value; + }; +} DXGK_FLIPCAPS; + +typedef struct _DXGK_VIDSCHCAPS +{ + union + { + struct + { + UINT MultiEngineAware :1; + UINT VSyncPowerSaveAware :1; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + + UINT PreemptionAware :1; + UINT NoDmaPatching :1; + UINT CancelCommandAware :1; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + + UINT No64BitAtomics :1; + UINT LowIrqlPreemptCommand :1; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + + UINT HwQueuePacketCap :4; // maximum number of DMA packets allowed to be queued to a node + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + + UINT NativeGpuFence :1; // Specifies whether the GPU supports native GPU fence + UINT Reserved :20; + +#else + + UINT Reserved :21; + +#endif // !(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +#else + + UINT Reserved :25; + +#endif // !(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +#else + + UINT Reserved :27; + +#endif // !(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#else + + UINT Reserved :30; + +#endif // !(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + }; + UINT Value; + }; +} DXGK_VIDSCHCAPS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef enum _DXGK_PAGETABLEUPDATEMODE +{ + DXGK_PAGETABLEUPDATE_CPU_VIRTUAL, + DXGK_PAGETABLEUPDATE_GPU_VIRTUAL, + DXGK_PAGETABLEUPDATE_GPU_PHYSICAL, +} DXGK_PAGETABLEUPDATEMODE; + +typedef struct _DXGK_PAGETABLEUPDATEADDRESS +{ + union + { + PVOID CpuVirtual; + D3DGPU_PHYSICAL_ADDRESS GpuPhysical; + D3DGPU_VIRTUAL_ADDRESS GpuVirtual; + }; +} DXGK_PAGETABLEUPDATEADDRESS; + +typedef struct _DXGK_PAGE_TABLE_LEVEL_DESC +{ + UINT PageTableIndexBitCount; + UINT PageTableSegmentId; + UINT PagingProcessPageTableSegmentId; + UINT PageTableSizeInBytes; + UINT PageTableAlignmentInBytes; // 0 means the page size of the memory segment +} DXGK_PAGE_TABLE_LEVEL_DESC; + +typedef struct _DXGK_UPDATEPAGETABLEFLAGS +{ + UINT Repeat : 1; + UINT InitialUpdate : 1; + UINT NotifyEviction : 1; + UINT Use64KBPages : 1; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + UINT NativeFence : 1; // When set, specifies that DXGK_BUILDPAGINGBUFFER_UPDATEPAGETABLE::hAllocation is a native GPU fence handle. + UINT Reserved : 27; +#else + UINT Reserved : 28; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +} DXGK_UPDATEPAGETABLEFLAGS; + +typedef struct _DXGK_QUERYGPUMMUCAPSIN +{ + UINT PhysicalAdapterIndex; +} DXGK_QUERYGPUMMUCAPSIN; + +typedef struct _DXGK_QUERYPAGETABLELEVELDESCIN +{ + WORD LevelIndex; + WORD PhysicalAdapterIndex; +} DXGK_QUERYPAGETABLELEVELDESCIN; + +typedef struct _DXGK_QUERYHISTORYBUFFERPRECISIONIN +{ + UINT PhysicalAdapterIndex; +} DXGK_QUERYHISTORYBUFFERPRECISIONIN; + +typedef struct _DXGK_GPUMMUCAPS +{ + union + { + struct + { + UINT ReadOnlyMemorySupported : 1; + UINT NoExecuteMemorySupported : 1; + UINT ZeroInPteSupported : 1; + UINT ExplicitPageTableInvalidation : 1; + UINT CacheCoherentMemorySupported : 1; + UINT PageTableUpdateRequireAddressSpaceIdle : 1; + UINT LargePageSupported : 1; + UINT DualPteSupported : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT AllowNonAlignedLargePageAddress : 1; + UINT SysMem64KBPageSupported : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + UINT InvalidTlbEntriesNotCached : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT SysMemLargePageSupported : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + UINT CachedPageTables : 1; + UINT Reserved : 19; +#else + UINT Reserved : 20; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) +#else + UINT Reserved : 21; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) +#else + UINT Reserved : 22; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) +#else + UINT Reserved : 24; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + }; + UINT Value; + }; + DXGK_PAGETABLEUPDATEMODE PageTableUpdateMode; + UINT VirtualAddressBitCount; + UINT LeafPageTableSizeFor64KPagesInBytes; + UINT PageTableLevelCount; + struct + { + UINT SourcePageTableVaInTransfer : 1; + UINT Reserved : 31; + } LegacyBehaviors; +} DXGK_GPUMMUCAPS; + +typedef struct _DXGK_QUERYPHYSICALADAPTERCAPSIN +{ + UINT PhysicalAdapterIndex; +} DXGK_QUERYPHYSICALADAPTERCAPSIN; + +typedef struct _DXGK_PHYSICALADAPTERFLAGS +{ + union + { + struct + { + UINT IoMmuSupported : 1; + UINT GpuMmuSupported : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT MovePagingSupported : 1; + UINT VPRPagingContextRequired : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT AllowHardwareProtectedNoVpr : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + UINT VirtualCopyEngineSupported : 1; + UINT Reserved : 26; +#else + UINT Reserved : 27; +#endif +#else + UINT Reserved : 28; +#endif +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_1 + UINT Reserved : 30; +#endif + }; + UINT Value; + }; +} DXGK_PHYSICALADAPTERFLAGS; + +typedef struct _DXGK_PHYSICALADAPTERCAPS +{ + WORD NumExecutionNodes; + WORD PagingNodeIndex; + HANDLE DxgkPhysicalAdapterHandle; + DXGK_PHYSICALADAPTERFLAGS Flags; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT VPRPagingNode; +#endif +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + UINT VirtualCopyNodeIndex; +#endif + +// +// With each DDI update the code in GetPhysicalAdapterCapsSizeFromInterfaceVersion +// needs to be updated to correctly return the struct size in the vmbus. +// + +} DXGK_PHYSICALADAPTERCAPS; + +typedef struct _DXGK_CPUHOSTAPERTURE +{ + UINT64 PhysicalAddress; // CPU physical address + UINT32 SizeInPages; // Size in CPU host pages +} DXGK_CPUHOSTAPERTURE; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef struct _DXGK_FRAMEBUFFERSAVEAREA +{ + SIZE_T MaximumSize; +} DXGK_FRAMEBUFFERSAVEAREA; + +typedef struct _DXGK_PHYSICAL_MEMORY_RANGE +{ + PHYSICAL_ADDRESS BaseAddress; + LARGE_INTEGER NumberOfBytes; +} DXGK_PHYSICAL_MEMORY_RANGE; + +typedef struct _DXGK_HARDWARERESERVEDRANGES +{ + UINT32 NumRanges; + _Field_size_(NumRanges) + DXGK_PHYSICAL_MEMORY_RANGE *pPhysicalRanges; +} DXGK_HARDWARERESERVEDRANGES; + +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4 + +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0 + +typedef struct _DXGK_VIDMMCAPS +{ + union + { + struct + { + UINT OutOfOrderLock : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + UINT DedicatedPagingEngine : 1; // _ADVSCH_ + UINT PagingEngineCanSwizzle : 1; // _ADVSCH_ + UINT SectionBackedPrimary : 1; // Create primaries using section without need for IO range +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT CrossAdapterResource : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT VirtualAddressingSupported : 1; + UINT GpuMmuSupported : 1; + UINT IoMmuSupported : 1; + UINT ReplicateGdiContent : 1; + UINT NonCpuVisiblePrimary : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT ParavirtualizationSupported : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + UINT IoMmuSecureModeSupported : 1; + UINT DisableSelfRefreshVRAMInS3 : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + UINT IoMmuSecureModeRequired : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT MapAperture2Supported : 1; + UINT CrossAdapterResourceTexture : 1; + UINT CrossAdapterResourceScanout : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + UINT AlwaysPoweredVRAM : 1; + UINT Reserved : 14; +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_9 + UINT Reserved : 15; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_7 + UINT Reserved : 18; +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_4 + UINT Reserved : 19; +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_4 + UINT Reserved : 21; +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_2 + UINT Reserved : 22; +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM2_0 + UINT Reserved : 27; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0 +#else // ! DXGKDDI_INTERFACE_VERSION_WDDM1_3 + UINT Reserved : 28; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 +#else // ! DXGKDDI_INTERFACE_VERSION_WIN7 + UINT Reserved : 31; +#endif // DXGKDDI_INTERFACE_VERSION_WIN7 + }; + UINT Value; + }; + UINT PagingNode; +} DXGK_VIDMMCAPS; + +#define DXGK_MAX_ASYMETRICAL_PROCESSING_NODES 64 +typedef struct _DXGK_GPUENGINETOPOLOGY +{ + UINT NbAsymetricProcessingNodes; + UINT Reserved[DXGK_MAX_ASYMETRICAL_PROCESSING_NODES]; +} DXGK_GPUENGINETOPOLOGY; + +typedef struct _DXGK_HWQUEUEDFLIP_CAPS +{ + union + { + struct + { + UINT Reserved :32; + }; + UINT Value; + }; +} DXGK_HWQUEUEDFLIP_CAPS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) +typedef struct _DXGK_VIRTUALADDRESSCAPS_DEPRECATED // _ADVSCH_ +{ + union + { + struct + { + UINT PrivilegedMemorySupported : 1; + UINT ReadOnlyMemorySupported : 1; + UINT Reserved : 30; + }; + UINT Value; + }; + + UINT VirtualAddressBitCount; + UINT PageTableCoverageBitCount; + + UINT PageDirectoryEntrySize; + + UINT PageDirectorySegment; + UINT PageTableSegment; + + UINT IdealGPUPageSize; +} DXGK_VIRTUALADDRESSCAPS_DEPRECATED; + +typedef struct _DXGK_DMABUFFERCAPS_DEPRECATED // _ADVSCH_ +{ + struct + { + UINT Size; + UINT PrivateDriverDataSize; + UINT SegmentId; + UINT Reserved1; + UINT Reserved[16]; + } PresentDmaBuffer; + + struct + { + UINT Size; + UINT PrivateDriverDataSize; + UINT SegmentId; + UINT Reserved1; + UINT Reserved[16]; + } PagingDmaBuffer; +} DXGK_DMABUFFERCAPS_DEPRECATED; + +typedef enum _DXGK_WDDMVERSION // _ADVSCH_ +{ + DXGKDDI_WDDMv1 = 0x1000, + DXGKDDI_WDDMv1_2 = 0x1200, + DXGKDDI_WDDMv1_3 = 0x1300, + DXGKDDI_WDDMv2 = 0x2000, + DXGKDDI_WDDMv2_1 = 0x2100, + DXGKDDI_WDDMv2_1_5 = 0x2105, // The WDDM version is added so the latest DDK can be used for drivers, which support GPU-P in RS1.7 and need to return this value. + DXGKDDI_WDDMv2_1_6 = 0x2106, // The WDDM version is added so the latest DDK can be used for drivers, which support GPU-P in RS1.8 and need to return this value. + DXGKDDI_WDDMv2_2 = 0x2200, + DXGKDDI_WDDMv2_3 = 0x2300, + DXGKDDI_WDDMv2_4 = 0x2400, + DXGKDDI_WDDMv2_5 = 0x2500, + DXGKDDI_WDDMv2_6 = 0x2600, + DXGKDDI_WDDMv2_7 = 0x2700, + DXGKDDI_WDDMv2_8 = 0x2800, + DXGKDDI_WDDMv2_9 = 0x2900, + DXGKDDI_WDDMv3_0 = 0x3000, + DXGKDDI_WDDMv3_1 = 0x3100, + DXGKDDI_WDDM_LATEST = DXGKDDI_WDDMv3_1 +} DXGK_WDDMVERSION; +#endif // DXGKDDI_INTERFACE_VERSION + +typedef struct _DXGK_DRIVERCAPS +{ + PHYSICAL_ADDRESS HighestAcceptableAddress; + UINT MaxAllocationListSlotId; + SIZE_T ApertureSegmentCommitLimit; + UINT MaxPointerWidth; + UINT MaxPointerHeight; + DXGK_POINTERFLAGS PointerCaps; + UINT InterruptMessageNumber; + UINT NumberOfSwizzlingRanges; + UINT MaxOverlays; + union + { + DXGK_GAMMARAMPCAPS GammaRampCaps; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGK_COLORTRANSFORMCAPS ColorTransformCaps; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2 + }; + DXGK_PRESENTATIONCAPS PresentationCaps; + UINT MaxQueuedFlipOnVSync; + DXGK_FLIPCAPS FlipCaps; + DXGK_VIDSCHCAPS SchedulingCaps; + DXGK_VIDMMCAPS MemoryManagementCaps; + DXGK_GPUENGINETOPOLOGY GpuEngineTopology; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + DXGK_WDDMVERSION WDDMVersion; // _ADVSCH_ + DXGK_VIRTUALADDRESSCAPS_DEPRECATED Reserved; // _ADVSCH_ + DXGK_DMABUFFERCAPS_DEPRECATED Reserved1; // _ADVSCH_ +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + D3DKMDT_PREEMPTION_CAPS PreemptionCaps; + BOOLEAN SupportNonVGA; + BOOLEAN SupportSmoothRotation; + BOOLEAN SupportPerEngineTDR; + BOOLEAN SupportDirectFlip; + BOOLEAN SupportMultiPlaneOverlay; + BOOLEAN SupportRuntimePowerManagement; + BOOLEAN SupportSurpriseRemovalInHibernation; +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + BOOLEAN HybridDiscrete; + UINT MaxOverlayPlanes; +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + BOOLEAN HybridIntegrated; + D3DGPU_VIRTUAL_ADDRESS InternalGpuVirtualAddressRangeStart; + D3DGPU_VIRTUAL_ADDRESS InternalGpuVirtualAddressRangeEnd; + BOOLEAN SupportSurpriseRemoval; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_0 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + BOOLEAN SupportMultiPlaneOverlayImmediateFlip; + BOOLEAN CursorScaledWithMultiPlaneOverlayPlane0; + BOOLEAN HybridAcpiChainingRequired; + UINT MaxQueuedMultiPlaneOverlayFlipVSync; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_1 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + union + { + struct + { + UINT SupportContextlessPresent : 1; + UINT Detachable : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT VirtualGpuOnly : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + UINT ComputeOnly : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + UINT IndependentVidPnVSyncControl : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8) + UINT NoHybridDiscreteDListDllSupport : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + UINT DisplayableSupport : 1; + UINT Reserved : 25; +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + UINT Reserved : 26; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8) + UINT Reserved : 27; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8) +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + UINT Reserved : 28; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + UINT Reserved : 29; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT Reserved : 30; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + }; + UINT Value; + } MiscCaps; +#endif + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT MaxHwQueuedFlips; + DXGK_HWQUEUEDFLIP_CAPS HwQueuedFlipCaps; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9 + + +} DXGK_DRIVERCAPS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +typedef struct _DXGK_WDDMDEVICECAPSIN +{ + ULONG DxgkrnlInterfaceVersion; // Same value as DXGKRNL_INTERFACE::Version passed to DxgkDdiStartDevice +} DXGK_WDDMDEVICECAPSIN; + +// +// These caps must be filled out by the KMD in reponse to DXGKQAITYPE_WDDMDEVICECAPS QueryAdapterInfo request. +// These are queried by the OS during device initialization +// after DxgkDdiAddDevice returns and before DxgkDdiStartDevice is called. +// +typedef struct _DXGK_WDDMDEVICECAPS +{ + DXGK_WDDMVERSION WDDMVersion; // Same value as DXGK_DRIVERCAPS::WDDMVersion +} DXGK_WDDMDEVICECAPS; + +// +// These caps must be filled out by the KMD in reponse to DXGKQAITYPE_GPUPCAPS QueryAdapterInfo request. +// These are queried by the OS during device initialization after DxgkDdiStartDevice is called and +// when the adapter supports GPU partitioning. +// +typedef struct _DXGK_GPUPCAPS +{ + union + { + struct + { + UINT VirtualMachineHibernation : 1; + UINT HotDriverUpdate : 1; + UINT Reserved : 30; + }; + UINT Value; + } Caps; +} DXGK_GPUPCAPS; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +// Segment Caps +typedef struct _DXGK_SEGMENTFLAGS +{ + union + { + struct + { + UINT Aperture : 1; // 0x00000001 + UINT Agp : 1; // 0x00000002 + UINT CpuVisible : 1; // 0x00000004 + UINT UseBanking : 1; // 0x00000008 + UINT CacheCoherent : 1; // 0x00000010 + UINT PitchAlignment : 1; // 0x00000020 + UINT PopulatedFromSystemMemory : 1; // 0x00000040 + UINT PreservedDuringStandby : 1; // 0x00000080 + UINT PreservedDuringHibernate : 1; // 0x00000100 + UINT PartiallyPreservedDuringHibernate : 1; // 0x00000200 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + UINT DirectFlip : 1; // 0x00000400 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT Use64KBPages : 1; // 0x00000800 // Defines if the segment is using 4GB or 64 KB pages + UINT ReservedSysMem : 1; // 0x00001000 // Reserved for system use + UINT SupportsCpuHostAperture : 1; // 0x00002000 // True if segment supports a CpuHostAperture + UINT SupportsCachedCpuHostAperture : 1; // 0x00004000 // True if segment supports cache coherent CpuHostAperture + UINT ApplicationTarget : 1; // 0x00008000 // Deprecated, replaced by LocalBudgetGroup and NonLocalBudgetGroup flags. + UINT VprSupported : 1; // 0x00010000 // Video Protected Region supported + UINT VprPreservedDuringStandby : 1; // 0x00020000 // Content of Video Protected Regions preserved during standby + UINT EncryptedPagingSupported : 1; // 0x00040000 // Hardware protected allocation are encripted during paging + UINT LocalBudgetGroup : 1; // 0x00080000 // This segment counts against local memory segment budget group. + UINT NonLocalBudgetGroup : 1; // 0x00100000 // This segment counts against non-local memory segment budget group. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT PopulatedByReservedDDRByFirmware : 1; // 0x00200000 // This segment is populated from reserved system memory by the firmware. + UINT Reserved :10; // 0xFFC00000 +#else + UINT Reserved :11; // 0xFFE00000 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) +#else + UINT Reserved :21; // 0xFFFFF800 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +#else + UINT Reserved :22; // 0xFFFFFC00 +#endif + }; + UINT Value; + }; +} DXGK_SEGMENTFLAGS; + +typedef struct _DXGK_SEGMENTDESCRIPTOR +{ + PHYSICAL_ADDRESS BaseAddress; // GPU logical base address for + // the segment. + PHYSICAL_ADDRESS CpuTranslatedAddress; // CPU translated base address + // for the segment if CPU visible. + SIZE_T Size; // Size of the segment. + UINT NbOfBanks; // Number of bank in the segment. + SIZE_T* pBankRangeTable; // Range delimiting each bank. + SIZE_T CommitLimit; // Maximum number of bytes that can be + // commited to this segment, apply to + // aperture segment only. + DXGK_SEGMENTFLAGS Flags; // Segment bit field flags +} DXGK_SEGMENTDESCRIPTOR; + +typedef struct _DXGK_QUERYSEGMENTIN +{ + PHYSICAL_ADDRESS AgpApertureBase; // AGP aperture base address. + LARGE_INTEGER AgpApertureSize; // Size of the available AGP aperture. + DXGK_SEGMENTFLAGS AgpFlags; // Segment bit field flags +} DXGK_QUERYSEGMENTIN; + +typedef struct _DXGK_QUERYSEGMENTOUT +{ + UINT NbSegment; // Number of segment described. + DXGK_SEGMENTDESCRIPTOR* pSegmentDescriptor; // Buffer describing the segment. + UINT PagingBufferSegmentId; // SegmentId the paging buffer + // should be allocated from. + UINT PagingBufferSize; // Paging buffer size. + UINT PagingBufferPrivateDataSize; +} DXGK_QUERYSEGMENTOUT; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + +// +// System Memory SegmentId define for WDDM v2 +// +#define DXGK_SEGMENT_ID_INVALID 0 +#define DXGK_SEGMENT_ID_SYSTEMMEMORY 31 + +// +// System Memory SegmentSet mask define for WDDM v2 +// +#define DXGK_SEGMENT_SET_SYSTEMMEMORY 0x80000000 + +typedef struct _DXGK_SEGMENTFLAGS2 +{ + union + { + struct + { + UINT Aperture : 1; // 0x00000001 + UINT PopulatedFromSystemMemory : 1; // 0x00000002 + UINT SystemMemoryReservedByBios : 1; // 0x00000004 + UINT CpuVisible : 1; // 0x00000008 // ADVSCH_M2 TEMPORARY + UINT Reserved :28; // 0xFFFFFFF0 + }; + UINT Value; + }; +} DXGK_SEGMENTFLAGS2; + +typedef struct _DXGK_SEGMENTDESCRIPTOR2 +{ + DXGK_SEGMENTFLAGS2 Flags; // Segment bit field flags + SIZE_T Size; // Size of the segment. + PMDL pMdl; // Mdl for PopulatedFromSystemMemory segment + PHYSICAL_ADDRESS BaseAddress; // ADVSCH_M2 TEMPORARY + PHYSICAL_ADDRESS CpuTranslatedAddress; // ADVSCH_M2 TEMPORARY +} DXGK_SEGMENTDESCRIPTOR2; + +typedef struct _DXGK_QUERYSEGMENTOUT2 +{ + UINT SegmentCount; // Number of segment described. + DXGK_SEGMENTDESCRIPTOR2* pSegmentDescriptor; // Buffer describing the segment. +} DXGK_QUERYSEGMENTOUT2; + +#endif // DXGKDDI_INTERFACE_VERSION_WIN7 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef struct _DXGK_SEGMENTDESCRIPTOR3 +{ + DXGK_SEGMENTFLAGS Flags; // Segment bit field flags + PHYSICAL_ADDRESS BaseAddress; // GPU logical base address for + // the segment. + PHYSICAL_ADDRESS CpuTranslatedAddress; // CPU translated base address + // for the segment if CPU visible. + SIZE_T Size; // Size of the segment. + UINT NbOfBanks; // Number of bank in the segment. + SIZE_T* pBankRangeTable; // Range delimiting each bank. + SIZE_T CommitLimit; // Maximum number of bytes that can be + // commited to this segment, apply to + // aperture segment only. + SIZE_T SystemMemoryEndAddress; // For segments that are partially composed + // of system memory, all allocations ending after + // this address are purged during hibernate. + SIZE_T Reserved; +} DXGK_SEGMENTDESCRIPTOR3; + +typedef struct _DXGK_QUERYSEGMENTOUT3 +{ + UINT NbSegment; // Number of segment described. + DXGK_SEGMENTDESCRIPTOR3* pSegmentDescriptor; // Buffer describing the segment. + UINT PagingBufferSegmentId; // SegmentId the paging buffer + // should be allocated from. + UINT PagingBufferSize; // Paging buffer size. + UINT PagingBufferPrivateDataSize; +} DXGK_QUERYSEGMENTOUT3; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef struct _DXGK_QUERYSEGMENTIN4 +{ + UINT PhysicalAdapterIndex; // Index of the physical adapter to query (engine ordinal index) +} DXGK_QUERYSEGMENTIN4; + +typedef struct _DXGK_SEGMENTDESCRIPTOR4 +{ + DXGK_SEGMENTFLAGS Flags; // Segment bit field flags + PHYSICAL_ADDRESS BaseAddress; // GPU logical base address for the segment. + SIZE_T Size; // Size of the segment. + SIZE_T CommitLimit; // Maximum number of bytes that can be + // commited to this segment, apply to + // aperture segment only. + SIZE_T SystemMemoryEndAddress; // For segments that are partially composed + // of system memory, all allocations ending after + // this address are purged during hibernate. + union + { + PHYSICAL_ADDRESS CpuTranslatedAddress; // If Flags.SupportsCpuHostAperture==FALSE and the + // segment is CPUVisible, this will be the + // CPU physical base address of the segment + DXGK_CPUHOSTAPERTURE CpuHostAperture; // If Flags.SupportsCpuHostAperture==TRUE this will + // have the CPU address and size of the + // CPUHostAperture + }; + UINT NumInvalidMemoryRanges; // Number of invalid memory ranges in the segment + SIZE_T VprRangeStartOffset; // Start offset of video protected region range in bytes + SIZE_T VprRangeSize; // Size of the video protected region range + UINT VprAlignment; // Alignment of video protected regions in bytes. Applies to size and start offset. + UINT NumVprSupported; // Number of supported video protected regions in the VPR range. Zero for infinite number. + UINT VprReserveSize; // Size of area in VPR to reserve for driver/hardware use. Zero for no reserve. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT NumUEFIFrameBufferRanges;// Number of UEFI frame buffer memory ranges in the segment. +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +} DXGK_SEGMENTDESCRIPTOR4; + +typedef struct _DXGK_QUERYSEGMENTOUT4 +{ + UINT NbSegment; // Number of segment described. + BYTE* pSegmentDescriptor; // An array of segment descriptors, where each element + // is of 'SegmentDescriptorStride' in size. + UINT PagingBufferSegmentId; // SegmentId the paging buffer + // should be allocated from. + UINT PagingBufferSize; // Paging buffer size. + UINT PagingBufferPrivateDataSize; + SIZE_T SegmentDescriptorStride; // Size of each element in the + // pSegmentDescriptor array +} DXGK_QUERYSEGMENTOUT4; + + +typedef struct _DXGK_MEMORYRANGE +{ + UINT64 SegmentOffset; // Offset in bytes from the start of segment + UINT64 SizeInBytes; // Size in bytes +} DXGK_MEMORYRANGE; + +typedef struct _DXGK_QUERYSEGMENTMEMORYSTATE +{ + WORD DriverSegmentId; // [in] Driver segment Id. + WORD PhysicalAdapterIndex; // [in] Physical adapter index in an LDA link +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + union + { + UINT NumInvalidMemoryRanges; // [in] Number of elements in the pMemoryRanges array used with DXGKQAITYPE_SEGMENTMEMORYSTATE. + UINT NumUEFIFrameBufferRanges;// [in] Number of elements in the pMemoryRanges array used with DXGKQAITYPE_UEFIFRAMEBUFFERRANGES. + }; +#else + UINT NumInvalidMemoryRanges; // [in] Number of elements in the pMemoryRanges array used with DXGKQAITYPE_SEGMENTMEMORYSTATE. +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGK_MEMORYRANGE* pMemoryRanges; // [out] Invalid memory ranges +} DXGK_QUERYSEGMENTMEMORYSTATE, DXGK_SEGMENTMEMORYSTATE; + +typedef _In_ CONST DXGK_SEGMENTMEMORYSTATE* IN_CONST_PDXGK_SEGMENTMEMORYSTATE; + +// +// Driver caps extension for WDDM2.0 or above drivers +// +typedef struct _DXGK_DISPLAY_DRIVERCAPS_EXTENSION +{ + union + { + struct + { + UINT SecureDisplaySupport : 1; // 0x00000001 + UINT VirtualModeSupport : 1; // 0x00000002 +#if (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT Reserved :29; // 0x7FFFFFFC + UINT NonSpecificPrimarySupport : 1; // 0x80000000 Do not use! +#elif (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT HdrFP16ScanoutSupport : 1; // 0x00000004 + UINT HdrARGB10ScanoutSupport : 1; // 0x00000008 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + UINT Hdr10MetadataSupport : 1; // 0x00000010 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT VirtualRefreshRateSupport : 1; // 0x00000020 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + UINT SupportUsb4Targets : 1; // 0x00000040 + UINT Reserved :25; // 0xFFFFFF80 +#else + UINT Reserved :26; // 0xFFFFFFC0 +#endif +#else + UINT Reserved :27; // 0xFFFFFFE0 +#endif +#else + UINT Reserved :28; // 0xFFFFFFF0 +#endif +#else + UINT Reserved :30; // 0xFFFFFFFC +#endif + }; + UINT Value; + }; +} DXGK_DISPLAY_DRIVERCAPS_EXTENSION; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if defined(__cplusplus) && !defined(SORTPP_PASS) +typedef enum _DXGK_DISPLAYPANELORIENTATION : UINT +{ + DXGK_DPO_0 = 0, + DXGK_DPO_90 = 1, + DXGK_DPO_180 = 2, + DXGK_DPO_270 = 3 +} DXGK_DISPLAYPANELORIENTATION; +#else +typedef UINT DXGK_DISPLAYPANELORIENTATION; +#endif // defined(__cplusplus) && !defined(SORTPP_PASS) + + +#define DXGK_MAX_INTEGRATED_DISPLAYS 16 + +typedef union _DXGK_INTEGRATEDDISPLAYFLAGS +{ + struct + { + DXGK_DISPLAYPANELORIENTATION UndockedOrientation : 2; + DXGK_DISPLAYPANELORIENTATION DockedOrientation : 2; + UINT Reserved :28; + }; + UINT Value; +} DXGK_INTEGRATEDDISPLAYFLAGS, *PDXGK_INTEGRATEDDISPLAYFLAGS; + +typedef union _DXGK_STANDARD_COLORIMETRY_FLAGS +{ + struct + { + UINT BT2020YCC : 1; + UINT BT2020RGB : 1; + UINT ST2084 : 1; + UINT Reserved :29; + }; + ULONG Value; +} DXGK_STANDARD_COLORIMETRY_FLAGS, *PDXGK_STANDARD_COLORIMETRY_FLAGS; + +typedef struct _DXGK_COLORIMETRY +{ + // Color primaries + D3DKMDT_2DOFFSET RedPoint; + D3DKMDT_2DOFFSET GreenPoint; + D3DKMDT_2DOFFSET BluePoint; + D3DKMDT_2DOFFSET WhitePoint; + + // Luminance values in (1 / 10000) nits + ULONG MinLuminance; + ULONG MaxLuminance; + ULONG MaxFullFrameLuminance; + + // Supported bit depths by wire format + D3DKMDT_WIRE_FORMAT_AND_PREFERENCE FormatBitDepths; + + // Standard colorimetry support flags + DXGK_STANDARD_COLORIMETRY_FLAGS StandardColorimetryFlags; +} DXGK_COLORIMETRY, *PDXGK_COLORIMETRY; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef struct _DXGK_DEVICE_TYPE_CAPS +{ + union + { + struct + { + UINT32 Discrete : 1; + UINT32 Detachable : 1; + UINT32 Reserved : 30; + }; + UINT32 Value; + }; +} DXGK_DEVICE_TYPE_CAPS; + +#endif + +typedef struct _DXGK_QUERYINTEGRATEDDISPLAYOUT +{ + DXGK_INTEGRATEDDISPLAYFLAGS Flags; + + D3DKMDT_VIDEO_SIGNAL_INFO NativeTiming; + + DXGK_MONITORLINKINFO_CAPABILITIES LinkCapabilities; + + DXGK_COLORIMETRY Colorimetry; + + DXGK_DISPLAY_TECHNOLOGY DisplayTechnology; + DXGK_DISPLAY_USAGE IntendedUsage; + BYTE Instance; + DXGK_DISPLAY_DESCRIPTOR_TYPE DescriptorType; + + BYTE Descriptor[1]; +} DXGK_QUERYINTEGRATEDDISPLAYOUT, *PDXGK_QUERYINTEGRATEDDISPLAYOUT; + +typedef struct _DXGK_QAITARGETIN +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; +} DXGK_QAITARGETIN; + +typedef DXGK_QAITARGETIN DXGK_QUERYINTEGRATEDDISPLAYIN; +typedef DXGK_QAITARGETIN DXGK_QUERYCOLORIMETRYOVERRIDESIN; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +typedef enum _DXGK_GAMMA_DATA_TYPE +{ + DXGK_GAMMA_DATA_TYPE_FIXED_POINT = 0, + DXGK_GAMMA_DATA_TYPE_FLOAT, +}DXGK_GAMMA_DATA_TYPE; + +typedef struct _DKGK_GAMMA_DATA_CAP +{ + DXGK_GAMMA_DATA_TYPE DataType; + union + { + struct + { + UINT BitCountOfInteger : 6; // Bit count of integer if DataType is fixed-point(DXGK_GAMMA_DATA_TYPE_FIXED_POINT) + UINT BitCountOfFraction: 6; // Bit count of fraction if DataType is fixed-point(DXGK_GAMMA_DATA_TYPE_FIXED_POINT) + }; + + struct + { + UINT BitCountOfExponent: 6; // Bit count of exponent if the DataType is float(DXGK_GAMMA_DATA_TYPE_FLOAT) + UINT BitCountOfMantissa: 6; // Bit count of mantissa if the DataType is float(DXGK_GAMMA_DATA_TYPE_FLOAT) + }; + + UINT Value; + }; + + float NumericRangeMin; // Minimum number of gamma data + float NumericRangeMax; // Maximum number of gamma data + // Examples: [-4, 4]: NumericRangeMin = -4; NumericRangeMax = 4 + // [0, 1]: NumericRangeMin = 0; NumericRangeMax = 1 + // [-1.5, 2.5]:NumericRangeMin = -1.5; NumericRangeMax = 2.5 + // [0, 65504]: NumericRangeMin = 0; NumericRangeMax = 65504 + +}DKGK_GAMMA_DATA_CAP; + +typedef struct _DXGK_GAMMA_1DLUT_CAP +{ + UINT NumberOfLUTEntries; // Number of lookup table entries. + DKGK_GAMMA_DATA_CAP GammaDataCap; +}DXGK_GAMMA_1DLUT_CAP, *PDXGK_GAMMA_1DLUT_CAP; + +typedef struct _DXGK_GAMMA_MATRIX_CAP +{ + union + { + struct + { + UINT MatrixSizeX : 10; // X-dimension of Matrix + UINT MatrixSizeY : 10; // Y-dimension of Matrix + // Examples 3x3 ColorMatrix : SizeX = 3; SizeY = 3; + // 3x11 ColorMatrix: SizeX = 3; SizeY = 11; + }; + UINT Value; + }; + DKGK_GAMMA_DATA_CAP GammaDataCap; +}DXGK_GAMMA_MATRIX_CAP, *PDXGK_GAMMA_MATRIX_CAP; + +typedef enum _DXGK_TARGET_GAMMA_CAPS_VERSION +{ + DXGK_TARGET_GAMMA_CAPS_VERSION_DEFALUT = 0, + DXGK_TARGET_GAMMA_CAPS_VERSION_1 = 1, + DXGK_TARGET_GAMMA_CAPS_VERSION_NOT_SUPPORTED = DXGK_TARGET_GAMMA_CAPS_VERSION_DEFALUT, +}DXGK_TARGET_GAMMA_CAPS_VERSION; + +typedef struct _DXGK_TARGET_GAMMA_CAPS +{ + DXGK_TARGET_GAMMA_CAPS_VERSION Version; + DXGK_GAMMA_1DLUT_CAP LookupTable1DDegammaCap; + DXGK_GAMMA_MATRIX_CAP ColorMatrix3x3Cap; + DXGK_GAMMA_1DLUT_CAP LookupTable1DRegammaCap; +}DXGK_TARGET_GAMMA_CAPS, *PDXGK_TARGET_GAMMA_CAPS; + +typedef DXGK_QAITARGETIN DXGK_QUERYTARGETGAMMACAPSIN; + +typedef struct _DXGK_QAISOURCEIN +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID Source; +} DXGK_QAISOURCEIN; + +typedef DXGK_QAISOURCEIN DXGK_QUERY_SCANOUT_CAPS_IN; +typedef struct _DXGK_QUERY_SCANOUT_CAPS_OUT +{ + UINT Caps; +} DXGK_QUERY_SCANOUT_CAPS_OUT, *PDXGK_QUERY_SCANOUT_CAPS_OUT; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6 + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +typedef struct _DXGK_QUERYDISPLAYIDIN +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; +} DXGK_QUERYDISPLAYIDIN; + +typedef struct _DXGK_QUERYDISPLAYIDOUT +{ + UINT Length; + BYTE* pDescriptor; +} DXGK_QUERYDISPLAYIDOUT; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef struct _DXGK_QUERYINTEGRATEDDISPLAYOUT2 +{ + DXGK_INTEGRATEDDISPLAYFLAGS Flags; + + D3DKMDT_VIDEO_SIGNAL_INFO NativeTiming; + + DXGK_MONITORLINKINFO_CAPABILITIES LinkCapabilities; + + DXGK_COLORIMETRY Colorimetry; + + DXGK_DISPLAY_TECHNOLOGY DisplayTechnology; + DXGK_DISPLAY_USAGE IntendedUsage; + BYTE Instance; + DXGK_DISPLAY_DESCRIPTOR_TYPE DescriptorType; + + D3DKMDT_WIRE_FORMAT_AND_PREFERENCE DitheringSupport; +} DXGK_QUERYINTEGRATEDDISPLAYOUT2, *PDXGK_QUERYINTEGRATEDDISPLAYOUT2; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +typedef struct _DXGK_PHYSICAL_MEMORY_CAPS +{ + PHYSICAL_ADDRESS HighestVisibleAddress; +} DXGK_PHYSICAL_MEMORY_CAPS; + +typedef struct _DXGK_IOMMU_CAPS +{ + union + { + struct + { + UINT32 IommuIsolationSupported : 1; + UINT32 IommuIsolationRequired : 1; + UINT32 DmaRemappingSupported : 1; + UINT32 Reserved : 29; + }; + UINT32 Value; + }; +} DXGK_IOMMU_CAPS; + +typedef UINT_PTR DXGK_PAGE_NUMBER; + +typedef struct _DXGK_ADL_FLAGS +{ + union + { + struct + { + UINT32 Contiguous : 1; + UINT32 Reserved : 31; + }; + UINT32 Value; + }; +} DXGK_ADL_FLAGS; + +typedef struct _DXGK_ADL +{ + UINT32 PageCount; + DXGK_ADL_FLAGS Flags; + + union + { + // Contiguous == 1 + DXGK_PAGE_NUMBER BasePageNumber; + + // Contiguous == 0 + _Field_size_(PageCount) + const DXGK_PAGE_NUMBER *Pages; + }; +} DXGK_ADL; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +typedef struct _DXGK_NATIVE_FENCE_CAPS +{ + DXGK_SEGMENTPREFERENCE PreferredSegmentForCurrentValue; // Segment set for native fence current values in GPU local memory. + DXGK_SEGMENTPREFERENCE PreferredSegmentForMonitoredValue; // Segment set for native fence monitored values in GPU local memory. + UINT CurrentValueStride; // Stride for current values of native fences that are packed in the same page. + UINT MonitoredValueStride; // Stride for monitored values of native fences that are packed in the same page. + BOOLEAN MapToCmpAddressSpace; // Specifies whether native fence current and monitored values should be mapped to + // a separate kernel only GPU VA address space for use by the context management processor. +} DXGK_NATIVE_FENCE_CAPS; + +typedef struct _DXGKARG_CREATENATIVEFENCE +{ + HANDLE hNativeFence; // in: Runtime handle/out: Driver handle + D3DDDI_NATIVEFENCEMAPPING NativeFenceMapping; // in: current process mapping information for this fence + D3DGPU_VIRTUAL_ADDRESS CurrentValueGpuVaInCmpAddressSpace; // in: Read/write mapping of the current value for the GPU in the context management processor address space + D3DGPU_VIRTUAL_ADDRESS MonitoredValueGpuVaInCmpAddressSpace; // in: Read/write mapping of the monitored value for the GPU in the context management processor address space + + _Field_size_bytes_(PrivateDriverDataSize) + VOID* pPrivateDriverData; // in: Private driver data from the user mode CreateNativeFence call + UINT PrivateDriverDataSize; // in: size of pPrivateDriverData array in bytes +} DXGKARG_CREATENATIVEFENCE; + +typedef _Inout_ DXGKARG_CREATENATIVEFENCE* INOUT_PDXGKARG_CREATENATIVEFENCE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATENATIVEFENCE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATENATIVEFENCE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATENATIVEFENCE pCreateNativeFence + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYNATIVEFENCE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYNATIVEFENCE( + IN_CONST_HANDLE hNativeFence + ); + + +typedef struct _DXGKARG_UPDATEMONITOREDVALUES +{ + _Field_size_(UpdatedValueCount) + HANDLE* NativeFenceArray; // in: Native fence handles. + _Field_size_(UpdatedValueCount) + UINT64* UpdatedValueArray; // in: New monitored values. + UINT UpdatedValueCount; // in: Number of native fences that OS updates monitored values of. +} DXGKARG_UPDATEMONITOREDVALUES; + +typedef _In_ CONST DXGKARG_UPDATEMONITOREDVALUES* IN_CONST_PDXGKARG_UPDATEMONITOREDVALUES; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UPDATEMONITOREDVALUES) + _IRQL_requires_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_UPDATEMONITOREDVALUES( + IN_CONST_PDXGKARG_UPDATEMONITOREDVALUES pUpdateMonitoredValues + ); + + +typedef struct _DXGKARG_NOTIFYCURRENTVALUEUPDATES +{ + _Field_size_(UpdatedValueCount) + HANDLE* NativeFenceArray; // in: Native fence handles. + UINT UpdatedValueCount; // in: Number of native fences that OS updates current values of. +} DXGKARG_NOTIFYCURRENTVALUEUPDATES; + +typedef _In_ CONST DXGKARG_NOTIFYCURRENTVALUEUPDATES* IN_CONST_PDXGKARG_NOTIFYCURRENTVALUEUPDATES; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_NOTIFYCURRENTVALUEUPDATES) + _IRQL_requires_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_NOTIFYCURRENTVALUEUPDATES( + IN_CONST_PDXGKARG_NOTIFYCURRENTVALUEUPDATES pNotifyCurrentValueUpdates + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM3_1 + +// +// Defines for runtime power management +// + +#define DXGK_FSTATE_UNKNOWN_POWER 0xFFFFFFFF +#define DXGK_FSTATE_UNKNOWN_TIME 0xFFFFFFFFFFFFFFFF +#define DXGK_MAX_F_STATES 8 +#define DXGK_POWER_COMPONENT_NAME_SIZE 40 +#define DXGK_MAX_POWER_COMPONENT_PROVIDERS 16 + +// +// The folowing GUIDs are recommended to use in power control requests between miniport and PEP. +// + +// {6131C9ED-B9EC-40B3-A5E2-C0613E437B7E} +DEFINE_GUID(GUID_DXGKDDI_POWER_VOLTAGE_UP, +0x6131c9ed, 0xb9ec, 0x40b3, 0xa5, 0xe2, 0xc0, 0x61, 0x3e, 0x43, 0x7b, 0x7e); + +// {7F81CE3D-5989-4519-8394-B457F637BA39} +DEFINE_GUID(GUID_DXGKDDI_POWER_VOLTAGE_DOWN, +0x7f81ce3d, 0x5989, 0x4519, 0x83, 0x94, 0xb4, 0x57, 0xf6, 0x37, 0xba, 0x39); + +// {78BA81DB-0F5C-45FD-8F03-C7B5CCD1E0DA} +// Could be used when miniport requests a change in voltage but it is not known in what direction +// it will be changed. +DEFINE_GUID(GUID_DXGKDDI_POWER_VOLTAGE, +0x78ba81db, 0xf5c, 0x45fd, 0x8f, 0x3, 0xc7, 0xb5, 0xcc, 0xd1, 0xe0, 0xda); + +// {8C7FDE48-FF0B-48FF-936B-332ABB9BD3B3} +DEFINE_GUID(GUID_DXGKDDI_POWER_CLOCK_UP, +0x8c7fde48, 0xff0b, 0x48ff, 0x93, 0x6b, 0x33, 0x2a, 0xbb, 0x9b, 0xd3, 0xb3); + +// {611114F3-CB1E-4D0C-8EE8-872E1FBDACEB} +DEFINE_GUID(GUID_DXGKDDI_POWER_CLOCK_DOWN, +0x611114f3, 0xcb1e, 0x4d0c, 0x8e, 0xe8, 0x87, 0x2e, 0x1f, 0xbd, 0xac, 0xeb); + +// {51C6873B-1C29-4C45-8246-05E4D6D80D15} +// Could be used when miniport requests a change in clock but it is not known in what direction +// it will be changed. +DEFINE_GUID(GUID_DXGKDDI_POWER_CLOCK, +0x51c6873b, 0x1c29, 0x4c45, 0x82, 0x46, 0x5, 0xe4, 0xd6, 0xd8, 0xd, 0x15); + +// {1995DCB1-986E-47BA-9A73-60AF5111938B} +DEFINE_GUID(GUID_DXGKDDI_POWER_BANDWIDTH_UP, +0x1995dcb1, 0x986e, 0x47ba, 0x9a, 0x73, 0x60, 0xaf, 0x51, 0x11, 0x93, 0x8b); + +// {97CE1383-EF2D-49CB-9BCF-26A738F3CE32} +DEFINE_GUID(GUID_DXGKDDI_POWER_BANDWIDTH_DOWN, +0x97ce1383, 0xef2d, 0x49cb, 0x9b, 0xcf, 0x26, 0xa7, 0x38, 0xf3, 0xce, 0x32); + +// {38751BFD-64BA-4962-A5A9-9F2E627A643E} +// Could be used when miniport requests a change in bandwidth but it is not known in what +// direction it will be changed. +DEFINE_GUID(GUID_DXGKDDI_POWER_BANDWIDTH, +0x38751bfd, 0x64ba, 0x4962, 0xa5, 0xa9, 0x9f, 0x2e, 0x62, 0x7a, 0x64, 0x3e); + +// +// The folowing GUIDs are used by Dxgkrnl to notify the miniport driver about certain events. +// + +// {CBA549D4-CF3A-445C-9468-2383FD523116} +DEFINE_GUID(GUID_DXGKDDI_POWER_MANAGEMENT_PREPARE_TO_START, +0xcba549d4, 0xcf3a, 0x445c, 0x94, 0x68, 0x23, 0x83, 0xfd, 0x52, 0x31, 0x16); + +// {6C929C1D-7D76-4538-93AD-449DC9FDC239} +DEFINE_GUID(GUID_DXGKDDI_POWER_MANAGEMENT_STARTED, +0x6c929c1d, 0x7d76, 0x4538, 0x93, 0xad, 0x44, 0x9d, 0xc9, 0xfd, 0xc2, 0x39); + +// {0A9D9621-BC21-4DD4-A0FC-D976E428F738} +DEFINE_GUID(GUID_DXGKDDI_POWER_MANAGEMENT_STOPPED, +0xa9d9621, 0xbc21, 0x4dd4, 0xa0, 0xfc, 0xd9, 0x76, 0xe4, 0x28, 0xf7, 0x38); + +// +// This GUID is used to identify Azure Triage events from the KMD +// +// {45125F6F-6132-4082-AD17-ED27F8DD02F9} +DEFINE_GUID(GUID_DXGKDDI_AZURE_TRIAGE_EVENT, +0x45125F6F, 0x6132, 0x4082, 0xAD, 0x17, 0xED, 0x27, 0xF8, 0xDD, 0x02, 0xF9); + +typedef struct _DXGK_POWER_RUNTIME_STATE +{ + // This value specifies, in 100 nanosecond units, the time the component takes to return to the F0 state. + // The attribute for F0 should be 0. + ULONGLONG TransitionLatency; + + // This value specifies, in 100 nanosecond units, the minimal amount of time required to spend in + // this F-state to make it worthwhile. The attribute for F0 should be 0. + ULONGLONG ResidencyRequirement; + + // This value specifies, in microwatt units, the power draw of the component in this F-state. + // Should be non-zero for the F0 state. + ULONG NominalPower; + +} DXGK_POWER_RUNTIME_STATE; + +typedef enum _DXGK_POWER_COMPONENT_TYPE +{ + DXGK_POWER_COMPONENT_ENGINE = 0, + DXGK_POWER_COMPONENT_MONITOR = 1, + DXGK_POWER_COMPONENT_MONITOR_REFRESH = 2, +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGK_POWER_COMPONENT_MEMORY = 3, + DXGK_POWER_COMPONENT_MEMORY_REFRESH = 4, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGK_POWER_COMPONENT_OTHER = 5, +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGK_POWER_COMPONENT_D3_TRANSITION = 6, +#endif +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGK_POWER_COMPONENT_SHARED = 7, + DXGK_POWER_COMPONENT_MAX = 8, +#elif (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + DXGK_POWER_COMPONENT_MAX = 7, +#else + DXGK_POWER_COMPONENT_MAX = 6, +#endif +} DXGK_POWER_COMPONENT_TYPE; + +typedef struct _DXGK_POWER_COMPONENT_MAPPING +{ + DXGK_POWER_COMPONENT_TYPE ComponentType; + union + { + struct //DXGK_POWER_COMPONENT_ENGINE_DESC + { + UINT NodeIndex; + } EngineDesc; + struct //DXGK_POWER_COMPONENT_MONITOR_REFRESH_DESC + { + UINT VidPnSourceID; + } MonitorRefreshDesc; + struct //DXGK_POWER_COMPONENT_MONITOR_DESC + { + UINT VidPnTargetID; + } MonitorDesc; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + struct //DXGK_POWER_COMPONENT_MEMORY_DESC + { + UINT SegmentID; // Zero based memory segment index + } MemoryDesc; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + struct //DXGK_POWER_COMPONENT_SHARED_DESC + { + union + { + struct + { + WORD SharedTypeFlag; // DXGKMT_POWER_SHARED_TYPE + WORD DriverCustomValueSet; // Indicates if custom value, rather than DXGKMT_POWER_SHARED_TYPE + }; + UINT SharedType; + }; + } SharedDesc; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + }; +} DXGK_POWER_COMPONENT_MAPPING; + +typedef struct _DXGK_POWER_COMPONENT_INDEX +{ + union + { + struct + { + WORD PhysicalAdapterComponentIndex; // Zero based index relative to the physical adapter. + WORD PhysicalAdapterIndex; // Physical adapter in a LDA configuration the component belongs to + }; + UINT Value; + }; +} DXGK_POWER_COMPONENT_INDEX; + +typedef struct _DXGK_POWER_COMPONENT_FLAGS +{ + union + { + struct + { + UINT Reserved0 : 1; // Old drivers used to set the flag + UINT DriverCompletesFStateTransition : 1; + UINT TransitionTo_F0_OnDx : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT NoDebounce : 1; + UINT ActiveInD3 : 1; + UINT Reserved : 27; // 0xFFFFFFE0 +#else + UINT Reserved : 29; // 0xFFFFFFF8 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + }; + UINT Value; + }; +} DXGK_POWER_COMPONENT_FLAGS; + +typedef struct _DXGK_POWER_RUNTIME_COMPONENT +{ + ULONG StateCount; + DXGK_POWER_RUNTIME_STATE States[DXGK_MAX_F_STATES]; + DXGK_POWER_COMPONENT_MAPPING ComponentMapping; + DXGK_POWER_COMPONENT_FLAGS Flags; + GUID ComponentGuid; + UCHAR ComponentName[DXGK_POWER_COMPONENT_NAME_SIZE]; + ULONG ProviderCount; + ULONG Providers[DXGK_MAX_POWER_COMPONENT_PROVIDERS]; +} DXGK_POWER_RUNTIME_COMPONENT; + +#endif // DXGKDDI_INTERFACE_VERSION_WIN8 + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) +// +// Defines for Windows Next runtime power management enhancements +// +#define DXGK_MAX_P_STATES 32 + +// the primary P-State enumeration structure +typedef struct _DXGK_POWER_P_STATE +{ + ULONG OperatingFrequency; +} DXGK_POWER_P_STATE; + +// placeholder structure for hardware behavioral flags +typedef struct _DXGK_POWER_COMPONENT_P_FLAGS +{ + union + { + struct + { + UINT Reserved : 32; + }; + UINT Value; + }; +} DXGK_POWER_COMPONENT_P_FLAGS; + +// the per-component p-state information structure +typedef struct _DXGK_POWER_P_COMPONENT +{ + ULONG StateCount; + DXGK_POWER_P_STATE States[DXGK_MAX_P_STATES]; + DXGK_POWER_COMPONENT_P_FLAGS Flags; +} DXGK_POWER_P_COMPONENT; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +typedef struct _DXGK_QUERYADAPTERINFOFLAGS +{ + union + { + struct + { + UINT VirtualMachineData : 1; // 0x00000001 + UINT SecureVirtualMachine : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC + }; + UINT Value; + }; + } DXGK_QUERYADAPTERINFOFLAGS; + #endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGKARG_QUERYADAPTERINFO +{ + DXGK_QUERYADAPTERINFOTYPE Type; + VOID* pInputData; + UINT InputDataSize; + VOID* pOutputData; + UINT OutputDataSize; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGK_QUERYADAPTERINFOFLAGS Flags; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + HANDLE hKmdProcessHandle; // in: driver process handle (maybe NULL) +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) +} DXGKARG_QUERYADAPTERINFO; + +typedef _In_ CONST DXGKARG_QUERYADAPTERINFO* IN_CONST_PDXGKARG_QUERYADAPTERINFO; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYADAPTERINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYADAPTERINFO( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_QUERYADAPTERINFO pQueryAdapterInfo + ); + +typedef struct _DXGKARG_ACQUIRESWIZZLINGRANGE +{ + HANDLE hAllocation; + UINT PrivateDriverData; // in: Passed in when UMD calls LockCB + UINT RangeId; + UINT SegmentId; + SIZE_T RangeSize; + PHYSICAL_ADDRESS CPUTranslatedAddress; +} DXGKARG_ACQUIRESWIZZLINGRANGE; + +typedef _Inout_ DXGKARG_ACQUIRESWIZZLINGRANGE* INOUT_PDXGKARG_ACQUIRESWIZZLINGRANGE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_ACQUIRESWIZZLINGRANGE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_ACQUIRESWIZZLINGRANGE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_ACQUIRESWIZZLINGRANGE pAcquireSwizzlingRange + ); + +typedef struct _DXGKARG_RELEASESWIZZLINGRANGE +{ + HANDLE hAllocation; + UINT PrivateDriverData; + UINT RangeId; +} DXGKARG_RELEASESWIZZLINGRANGE; + +typedef _In_ CONST DXGKARG_RELEASESWIZZLINGRANGE* IN_CONST_PDXGKARG_RELEASESWIZZLINGRANGE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RELEASESWIZZLINGRANGE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RELEASESWIZZLINGRANGE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_RELEASESWIZZLINGRANGE pReleaseSwizzlingRange + ); + +typedef struct _DXGK_ALLOCATIONINFOFLAGS +{ + union + { + struct + { + UINT CpuVisible : 1; // 0x00000001 + UINT PermanentSysMem : 1; // 0x00000002 + UINT Cached : 1; // 0x00000004 + UINT Protected : 1; // 0x00000008 + UINT ExistingSysMem : 1; // 0x00000010 + UINT ExistingKernelSysMem : 1; // 0x00000020 + UINT FromEndOfSegment : 1; // 0x00000040 + UINT Swizzled : 1; // 0x00000080 + UINT Overlay : 1; // 0x00000100 + UINT Capture : 1; // 0x00000200 + UINT UseAlternateVA : 1; // 0x00000400 + UINT SynchronousPaging : 1; // 0x00000800 + UINT LinkMirrored : 1; // 0x00001000 + UINT LinkInstanced : 1; // 0x00002000 + UINT HistoryBuffer : 1; // 0x00004000 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT AccessedPhysically : 1; // 0x00008000 + UINT ExplicitResidencyNotification : 1; + // 0x00010000 + UINT HardwareProtected : 1; // 0x00020000 + UINT CpuVisibleOnDemand : 1; // 0x00040000 Following fields are RESERVED and +#else // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT Reserved : 4; // 0x00078000 Following fields are RESERVED and +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT DXGK_ALLOC_RESERVED16 : 1; + UINT DXGK_ALLOC_RESERVED15 : 1; + UINT DXGK_ALLOC_RESERVED14 : 1; + UINT DXGK_ALLOC_RESERVED13 : 1; + UINT DXGK_ALLOC_RESERVED12 : 1; + UINT DXGK_ALLOC_RESERVED11 : 1; + UINT DXGK_ALLOC_RESERVED10 : 1; + UINT DXGK_ALLOC_RESERVED9 : 1; + UINT DXGK_ALLOC_RESERVED4 : 1; + UINT DXGK_ALLOC_RESERVED3 : 1; + UINT DXGK_ALLOC_RESERVED2 : 1; + UINT DXGK_ALLOC_RESERVED1 : 1; + UINT DXGK_ALLOC_RESERVED0 : 1; + }; + UINT Value; + }; +} DXGK_ALLOCATIONINFOFLAGS; + +typedef struct _DXGK_ALLOCATIONINFOFLAGS_WDDM2_0 +{ + union + { + struct + { + UINT CpuVisible : 1; // 0x00000001 + UINT PermanentSysMem : 1; // 0x00000002 + UINT Cached : 1; // 0x00000004 + UINT Protected : 1; // 0x00000008 + UINT ExistingSysMem : 1; // 0x00000010 + UINT ExistingKernelSysMem : 1; // 0x00000020 + UINT FromEndOfSegment : 1; // 0x00000040 + UINT DisableLargePageMapping : 1; // 0x00000080 // Swizzled + UINT Overlay : 1; // 0x00000100 + UINT Capture : 1; // 0x00000200 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT CreateInVpr : 1; // 0x00000400 In +#else + UINT Reserved00 : 1; // 0x00000400 // UseAlternateVA +#endif + UINT DXGK_ALLOC_RESERVED17 : 1; // 0x00000800 // Reserved + UINT Reserved02 : 1; // 0x00001000 // repurposed LinkMirrored +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT MapApertureCpuVisible : 1; // 0x00002000 +#else + UINT Reserved03 : 1; // 0x00002000 // LinkInstanced +#endif + UINT HistoryBuffer : 1; // 0x00004000 + UINT AccessedPhysically : 1; // 0x00008000 + UINT ExplicitResidencyNotification : 1; // 0x00010000 + UINT HardwareProtected : 1; // 0x00020000 + UINT CpuVisibleOnDemand : 1; // 0x00040000 Following fields are RESERVED + UINT DXGK_ALLOC_RESERVED16 : 1; + UINT DXGK_ALLOC_RESERVED15 : 1; + UINT DXGK_ALLOC_RESERVED14 : 1; + UINT DXGK_ALLOC_RESERVED13 : 1; + UINT DXGK_ALLOC_RESERVED12 : 1; + UINT DXGK_ALLOC_RESERVED11 : 1; + UINT DXGK_ALLOC_RESERVED10 : 1; + UINT DXGK_ALLOC_RESERVED9 : 1; + UINT DXGK_ALLOC_RESERVED4 : 1; + UINT DXGK_ALLOC_RESERVED3 : 1; + UINT DXGK_ALLOC_RESERVED2 : 1; + UINT DXGK_ALLOC_RESERVED1 : 1; + UINT DXGK_ALLOC_RESERVED0 : 1; + }; + UINT Value; + }; +} DXGK_ALLOCATIONINFOFLAGS_WDDM2_0; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) +typedef struct _DXGK_ALLOCATIONINFOFLAGS2 +{ + union + { + struct + { + UINT ShareBackingStoreWithKmd : 1; // 0x00000001 Allocation backing store pointer is shared with KMD + UINT Reserved : 31; + }; + UINT Value; + }; +} DXGK_ALLOCATIONINFOFLAGS2; +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0 + +typedef struct _DXGK_ALLOCATIONUSAGEINFO1 +{ + union + { + struct + { + UINT PrivateFormat : 1; // 0x00000001 - Allocation is a private IHV format. Default is standard format. + UINT Swizzled : 1; // 0x00000002 - Allocation is swizzled/tiled. + UINT MipMap : 1; // 0x00000004 - Allocation is a mip mapped texture. + UINT Cube : 1; // 0x00000008 - Allocation is a cube texture. + UINT Volume : 1; // 0x00000010 - Allocation is a volume texture. + UINT Vertex : 1; // 0x00000020 - Allocation is a vertex buffer. + UINT Index : 1; // 0x00000040 - Allocation is an index buffer. + UINT Reserved : 25; // 0xFFFFFF80 - Reserved must be set to zero. + }; + UINT Value; + } Flags; + + union + { + D3DDDIFORMAT Format; // Allocation format (Flags.PrivateFormat==0) + UINT PrivateFormat; // Allocation format (Flags.PrivateFormat==1) + }; + + UINT SwizzledFormat; // Swizzled format for the allocation (IHV private). + UINT ByteOffset; // Offset within the VidMm allocation to the start of this allocation. + UINT Width; // Width (in pixel) of the allocation. + UINT Height; // Height (in line) of the allocation. + UINT Pitch; // Pitch (in bytes) of the allocation. + UINT Depth; // Depth (in level) of the allocation (mipmap/volume only). + UINT SlicePitch; // Pitch from one level to another (cube/volume only). +} DXGK_ALLOCATIONUSAGEINFO1; + +typedef struct _DXGK_ALLOCATIONUSAGEHINT +{ + UINT Version; + DXGK_ALLOCATIONUSAGEINFO1 v1; +} DXGK_ALLOCATIONUSAGEHINT; + +typedef struct _DXGK_ALLOCATIONINFO +{ + VOID* pPrivateDriverData; // in: Private data for each allocation allocated by the user mode driver + UINT PrivateDriverDataSize; // in: Size of the private data + UINT Alignment; + SIZE_T Size; // out: Allocation size + SIZE_T PitchAlignedSize; // out: Allocation pitch aligned size (for aperture segment requiring Pitch alignment only). + DXGK_SEGMENTBANKPREFERENCE HintedBank; + DXGK_SEGMENTPREFERENCE PreferredSegment; + UINT SupportedReadSegmentSet; + UINT SupportedWriteSegmentSet; + UINT EvictionSegmentSet; + union + { + UINT MaximumRenamingListLength; // out: Used only prior WDDMv2 + UINT PhysicalAdapterIndex; // out: WDDMv2 and higher only + }; + HANDLE hAllocation; // out: Private driver data for allocation + union + { + DXGK_ALLOCATIONINFOFLAGS Flags; // out: Except the reserved fields + DXGK_ALLOCATIONINFOFLAGS_WDDM2_0 FlagsWddm2; // out: Except the reserved fields + }; + DXGK_ALLOCATIONUSAGEHINT* pAllocationUsageHint; + UINT AllocationPriority; // out: Starting allocation priority. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) +#if defined(_AMD64_) || defined(_ARM64_) + // Adding Flags2 does not change the size of the DXGK_ALLOCATIONINFO structure + // on 64 bit builds because of alignment. At the moment 32 bit builds do not need + // the functionality, provided by Flags2. + DXGK_ALLOCATIONINFOFLAGS2 Flags2; // out: +#endif +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0 +} DXGK_ALLOCATIONINFO; + +typedef struct _DXGK_ALLOCATIONINFO_TEST +{ + UINT Alignment; + SIZE_T Size; // out: Allocation size + SIZE_T PitchAlignedSize; // out: Allocation pitch aligned size (for aperture segment requiring Pitch alignment only). + DXGK_SEGMENTBANKPREFERENCE HintedBank; + DXGK_SEGMENTPREFERENCE PreferredSegment; + UINT SupportedReadSegmentSet; + UINT SupportedWriteSegmentSet; + UINT EvictionSegmentSet; + UINT PhysicalAdapterIndex; // out: WDDMv2 and higher only + DXGK_ALLOCATIONINFOFLAGS_WDDM2_0 FlagsWddm2; // out: Except the reserved fields + UINT AllocationPriority; // out: Starting allocation priority. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + DXGK_ALLOCATIONINFOFLAGS2 Flags2; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) +} DXGK_ALLOCATIONINFO_TEST; + +typedef struct _DXGK_CREATEALLOCATIONFLAGS +{ + union + { + struct + { + UINT Resource : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_CREATEALLOCATIONFLAGS; + +typedef struct _DXGKARG_CREATEALLOCATION +{ + CONST VOID* pPrivateDriverData; + UINT PrivateDriverDataSize; + UINT NumAllocations; + DXGK_ALLOCATIONINFO* pAllocationInfo; + HANDLE hResource; + DXGK_CREATEALLOCATIONFLAGS Flags; +} DXGKARG_CREATEALLOCATION; + +typedef _Inout_ DXGKARG_CREATEALLOCATION* INOUT_PDXGKARG_CREATEALLOCATION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEALLOCATION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEALLOCATION( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATEALLOCATION pCreateAllocation + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +typedef struct _DXGK_CREATECONTEXTALLOCATIONFLAGS +{ + union + { + struct + { + UINT SharedAcrossContexts : 1; // 0x00000001 - If not set, the allocation is associated with the hContext member of DXGKARGCB_CREATECONTEXTALLOCATION, + // and it will be made resident when hContext is scheduled to run on the GPU. + // If set, the allocation is associated with all contexts on the hDevice member, + // and it will be made resident when any context that belongs to hDevice is + // scheduled to run on the GPU. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT MapGpuVirtualAddress : 1; // When set Dxgkrnl will map a GpuMmu virtual address and pass it in InitContextResource. + UINT Reserved :30; // 0xFFFFFFFC +#else + UINT Reserved :31; // 0xFFFFFFFE +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + }; + UINT Value; + }; +} DXGK_CREATECONTEXTALLOCATIONFLAGS; + +// Context allocation creation callback. +// + +typedef struct _DXGKARGCB_CREATECONTEXTALLOCATION +{ + DXGK_CREATECONTEXTALLOCATIONFLAGS ContextAllocationFlags; // in: Flags that specify the behavior of the allocation being created. + HANDLE hAdapter; // in: Adapter the allocation is created for. + HANDLE hDevice; // in: DXG assigned value for the device that was passed to DxgkDdiCreateDevice, + // or NULL for system device. + HANDLE hContext; // in: When ContextAllocationFlags.SharedAcrossContexts bit is set to 0, + // this parameter contains DXG assigned value for the context that was passed to + // DxgkDdiCreateContext or DxgkDdiCreateHwContext, or NULL for system context. + // This parameter should be NULL when ContextAllocationFlags.SharedAcrossContexts bit is set to 1. + HANDLE hDriverAllocation; // Driver created handle that identifies the created allocation on its side, + // this value is subsequently passed as DXGKARG_BUILDPAGINGBUFFER::Transfer::hAllocation + // and DXGKARG_BUILDPAGINGBUFFER::InitContextResource::hAllocation + // to DxgkDdiBuildPagingBuffer driver callback. + SIZE_T Size; // in: Allocation size. + UINT Alignment; // in: The required alignment for the allocation. + UINT SupportedSegmentSet; // in: Segment identifiers that the display miniport driver can set + // in the PreferredSegment member for read or write operations. + UINT EvictionSegmentSet; // in: Identifiers of segments that can be used for eviction. + DXGK_SEGMENTPREFERENCE PreferredSegment; // in: Preferred segments identifiers that the display miniport driver requests that + // the video memory manager use to page-in the allocation. + DXGK_SEGMENTBANKPREFERENCE HintedBank; // in: Bank ordering preferences that the display miniport driver requests that + // the video memory manager use to page-in the allocation. + DXGK_ALLOCATIONINFOFLAGS Flags; // in: Properties that indicate the type of allocation to create. + HANDLE hAllocation; // out: DXG assigned handle for this allocation. This value is subsequently passed as + // hAllocation to DxgkCbDestroyContextAllocation +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT PhysicalAdapterIndex; // in: Physical adapter index (engine ordinal) for WDDMv2 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +} DXGKARGCB_CREATECONTEXTALLOCATION; + +typedef _Inout_ DXGKARGCB_CREATECONTEXTALLOCATION* INOUT_PDXGKARGCB_CREATECONTEXTALLOCATION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_CREATECONTEXTALLOCATION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_CREATECONTEXTALLOCATION)( + INOUT_PDXGKARGCB_CREATECONTEXTALLOCATION + ); + +// Context allocation destruction callback. +// + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_DESTROYCONTEXTALLOCATION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_DESTROYCONTEXTALLOCATION)( + IN_CONST_HANDLE hAdapter, // in: Adapter the allocation was created for. + IN_CONST_HANDLE hAllocation // in: DXG assigned handle for this allocation that was returned from DxgkCbCreateContextAllocation + // as DXGKARGCB_CREATECONTEXTALLOCATION::hAllocation member. + ); + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef struct _DXGK_DESCRIBEALLOCATIONFLAGS +{ + union + { + struct + { + UINT CheckDisplayMode : 1; // 0x00000001 // Indicates that this allocation is being queried to check display mode + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_DESCRIBEALLOCATIONFLAGS; +#endif + +typedef struct _DXGKARG_DESCRIBEALLOCATION +{ + HANDLE hAllocation; //in: Driver returned handle in DXGK_ALLOCATIONINFO upon CreateAllocation + UINT Width; //out:Width of specified allocation + UINT Height; //out:Height of specified allocation + D3DDDIFORMAT Format; //out:Format of specified allocation + D3DDDI_MULTISAMPLINGMETHOD MultisampleMethod; //out:Multisample method used of specified allocation + D3DDDI_RATIONAL RefreshRate; //out:RefreshRate the primary surface created with if applicable + UINT PrivateDriverFormatAttribute; //out:Private format attribute of specified allocation +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + DXGK_DESCRIBEALLOCATIONFLAGS Flags; + D3DDDI_ROTATION Rotation; //out:Rotation for display mode +#endif +} DXGKARG_DESCRIBEALLOCATION; + +typedef _Inout_ DXGKARG_DESCRIBEALLOCATION* INOUT_PDXGKARG_DESCRIBEALLOCATION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESCRIBEALLOCATION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESCRIBEALLOCATION( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_DESCRIBEALLOCATION pDescribeAllocation + ); + +typedef struct _DXGKARG_GETSTANDARDALLOCATIONDRIVERDATA +{ + D3DKMDT_STANDARDALLOCATION_TYPE StandardAllocationType; // in : Type of standard allocation to describe + union + { + D3DKMDT_SHAREDPRIMARYSURFACEDATA* pCreateSharedPrimarySurfaceData; + D3DKMDT_SHADOWSURFACEDATA* pCreateShadowSurfaceData; + D3DKMDT_STAGINGSURFACEDATA* pCreateStagingSurfaceData; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + D3DKMDT_GDISURFACEDATA* pCreateGdiSurfaceData; +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + D3DKMDT_VIRTUALGPUSURFACEDATA* pCreateVirtualGpuSurfaceData; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + }; + VOID* pAllocationPrivateDriverData; // in/out : If non-NULL ptr to buffer driver should place the PrivateDriverData that describes the allocation associated with this standard allocation + UINT AllocationPrivateDriverDataSize; // out : Size of buffer required to hold the PrivateDriverData that describes the allocation for this standard allocation + VOID* pResourcePrivateDriverData; // in/out : If non-NULL ptr to buffer driver should place the PrivateDriverData that describes the resource associated with this standard allocation + UINT ResourcePrivateDriverDataSize; // out : Size of buffer required to hold the PrivateDriverData that describes the resource for this standard allocation +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM_2_0) + UINT PhysicalAdapterIndex; // in +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM_2_0) +} DXGKARG_GETSTANDARDALLOCATIONDRIVERDATA; + +typedef _Inout_ DXGKARG_GETSTANDARDALLOCATIONDRIVERDATA* INOUT_PDXGKARG_GETSTANDARDALLOCATIONDRIVERDATA; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_GETSTANDARDALLOCATIONDRIVERDATA) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_GETSTANDARDALLOCATIONDRIVERDATA( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_GETSTANDARDALLOCATIONDRIVERDATA pGetStandardAllocationDriverData + ); + +typedef struct _DXGK_DESTROYALLOCATIONFLAGS +{ + union + { + struct + { + UINT DestroyResource : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_DESTROYALLOCATIONFLAGS; + +typedef struct _DXGKARG_DESTROYALLOCATION +{ + UINT NumAllocations; + CONST HANDLE* pAllocationList; + HANDLE hResource; + DXGK_DESTROYALLOCATIONFLAGS Flags; +} DXGKARG_DESTROYALLOCATION; + +typedef _In_ CONST DXGKARG_DESTROYALLOCATION* IN_CONST_PDXGKARG_DESTROYALLOCATION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYALLOCATION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYALLOCATION( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_DESTROYALLOCATION pDestroyAllocation + ); + +typedef struct _DXGK_PATCHFLAGS +{ + union + { + struct + { + UINT Paging : 1; // 0x00000001 command buffer is a paging buffer. + UINT Present : 1; // 0x00000002 command buffer contain a present operation. + UINT RedirectedPresent : 1; // 0x00000004 command buffer contains a redirected present operation. + UINT NullRendering : 1; // 0x00000008 GPU should skip rendering of DMA buffer (perf analysis) + UINT Reserved :28; // 0xFFFFFFF0 + }; + UINT Value; + }; +} DXGK_PATCHFLAGS; + +typedef struct _DXGKARG_PATCH +{ + union + { + HANDLE hDevice; // in: driver device handle for driver not MultiEngineAware. + HANDLE hContext; // in: driver context handle for MultiEngineAware driver. + }; + UINT DmaBufferSegmentId; // in: segment id of DMA buffer + PHYSICAL_ADDRESS DmaBufferPhysicalAddress; // in: physical address of DMA buffer + VOID* pDmaBuffer; // in: Virtual address to beginning of + // the DMA buffer. + UINT DmaBufferSize; // in: length of the DMA buffer.. + UINT DmaBufferSubmissionStartOffset; // in: Byte offset from the beginning + // of the DMA buffer to the start + // of this submission. + UINT DmaBufferSubmissionEndOffset; // in: Byte offset from the beginning + // of the DMA buffer to the end of + // this submission. + VOID* pDmaBufferPrivateData; // in: Virtual address to the private + // data associated with this DMA buffer. + UINT DmaBufferPrivateDataSize; // in: Size of the private data. + UINT DmaBufferPrivateDataSubmissionStartOffset; // in: Byte offset from the beginning of the + // private data to the start of this + // submission. + UINT DmaBufferPrivateDataSubmissionEndOffset; // in: Byte offset from the beginning of the + // private data to the end of this + // submission. + CONST DXGK_ALLOCATIONLIST* pAllocationList; // in: Pointer to the allocation list + // associated with this DMA buffer. + UINT AllocationListSize; // in: Size of the allocation list. + CONST D3DDDI_PATCHLOCATIONLIST* pPatchLocationList; // in: Pointer to the patch location list associated + // with this DMA buffer. + UINT PatchLocationListSize; // in: Size of the patch location list. + UINT PatchLocationListSubmissionStart; // in: First element for this submission. + UINT PatchLocationListSubmissionLength; // in: Number of element in this submission. + UINT SubmissionFenceId; // in: Submission fence id. + DXGK_PATCHFLAGS Flags; // in: Flags + UINT EngineOrdinal; // in: Engine Ordinal within it's node. +} DXGKARG_PATCH; + +typedef _In_ CONST DXGKARG_PATCH* IN_CONST_PDXGKARG_PATCH; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_PATCH) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_PATCH( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_PATCH pPatch + ); + +typedef struct _DXGK_SUBMITCOMMANDFLAGS +{ + union + { + struct + { + UINT Paging : 1; // command buffer is a paging buffer. + UINT Present : 1; // command buffer contain a present operation. + UINT RedirectedPresent : 1; // command buffer contains a redirected present operation. + UINT NullRendering : 1; // GPU should skip rendering of DMA buffer (perf analysis) + UINT Flip : 1; // command buffer is for flip. + UINT FlipWithNoWait : 1; // command buffer is for flip with no built-in-wait for next vsync. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + UINT ContextSwitch : 1; // GPU should switch from the last executed context on this node to the null context. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT Resubmission : 1; // Indicates whether this DMA packet is being resubmitted to the GPU due to an earlier preemption. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT VirtualMachineData : 1; // Indicates that the submission is from a paravirtualized adapter. + UINT Reserved :23; +#else + UINT Reserved :24; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +#else + UINT Reserved :25; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +#else + UINT Reserved :26; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + }; + UINT Value; + }; +} DXGK_SUBMITCOMMANDFLAGS; + +// Definition for DXGKARG_SUBMITCOMMAND +// +typedef struct _DXGKARG_SUBMITCOMMAND +{ + union + { + HANDLE hDevice; // in: driver device handle for driver not MultiEngineAware. + HANDLE hContext; // in: driver context handle for MultiEngineAware driver. + }; + UINT DmaBufferSegmentId; // in: segment id of DMA buffer + PHYSICAL_ADDRESS DmaBufferPhysicalAddress; // in: physical address of DMA buffer + UINT DmaBufferSize; // in: length of the DMA buffer.. + UINT DmaBufferSubmissionStartOffset; // in: Byte offset from the beginning + // of the DMA buffer to the start + // of this submission. + UINT DmaBufferSubmissionEndOffset; // in: Byte offset from the beginning + // of the DMA buffer to the end of + // this submission. + VOID* pDmaBufferPrivateData; // in: Virtual address to the private + // data associated with this DMA buffer. + UINT DmaBufferPrivateDataSize; // in: Size of the private data. + UINT DmaBufferPrivateDataSubmissionStartOffset; // in: Byte offset from the beginning of the + // private data to the start of this + // submission. + UINT DmaBufferPrivateDataSubmissionEndOffset; // in: Byte offset from the beginning of the + // private data to the end of this + // submission. + UINT SubmissionFenceId; // in: Submission fence id. + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPnSourceId (flip only) + D3DDDI_FLIPINTERVAL_TYPE FlipInterval; // in: Flip Interval (flip only) + DXGK_SUBMITCOMMANDFLAGS Flags; // in: Flags + UINT EngineOrdinal; // in: Engine Ordinal within it's node. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + D3DGPU_VIRTUAL_ADDRESS DmaBufferVirtualAddress; // in: M1 temporary _ADVSCH_ +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + UINT NodeOrdinal; // in: NodeOrdinal to identify the node when hContext is NULL. +#endif // DXGKDDI_INTERFACE_VERSION +} DXGKARG_SUBMITCOMMAND; + +// Device Driver Interface to submit command buffer to h/w command execution unit. +// +typedef _In_ CONST DXGKARG_SUBMITCOMMAND* IN_CONST_PDXGKARG_SUBMITCOMMAND; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SUBMITCOMMAND) + _IRQL_requires_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SUBMITCOMMAND( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SUBMITCOMMAND pSubmitCommand + ); + +typedef struct _DXGK_PREEMPTCOMMANDFLAGS +{ + union + { + struct + { + UINT Reserved :32; // 0xFFFFFFFF + }; + UINT Value; + }; +} DXGK_PREEMPTCOMMANDFLAGS; + +// Definition for DXGKARG_PREEMPTCOMMAND +// +typedef struct _DXGKARG_PREEMPTCOMMAND +{ + UINT PreemptionFenceId; // in: preemption uniqueness id + UINT NodeOrdinal; // in: node ordinal to preempt + UINT EngineOrdinal; // in: engine ordinal to preempt + DXGK_PREEMPTCOMMANDFLAGS Flags; // in: flags +} DXGKARG_PREEMPTCOMMAND; + +// Device Driver Interface to preempt command. +// +typedef _In_ CONST DXGKARG_PREEMPTCOMMAND* IN_CONST_PDXGKARG_PREEMPTCOMMAND; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_PREEMPTCOMMAND) + _IRQL_requires_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_PREEMPTCOMMAND( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_PREEMPTCOMMAND pPreemptCommand + ); + +// Device Driver Interface to cancel a command that won't be submitted to hardware. +// +typedef struct _DXGKARG_CANCELCOMMAND +{ + HANDLE hContext; // in: driver context handle. + VOID* pDmaBuffer; // in: CPU address of the DMA buffer. + UINT DmaBufferSize; // in: length of the DMA buffer. + UINT DmaBufferSubmissionStartOffset; // in: Byte offset from the beginning + // of the DMA buffer to the start + // of this submission. + UINT DmaBufferSubmissionEndOffset; // in: Byte offset from the beginning + // of the DMA buffer to the end of + // this submission. + VOID* pDmaBufferPrivateData; // in: Virtual address to the private + // data associated with this DMA buffer. + UINT DmaBufferPrivateDataSize; // in: Size of the private data. + UINT DmaBufferPrivateDataSubmissionStartOffset; // in: Byte offset from the beginning of the + // private data to the start of this + // submission. + UINT DmaBufferPrivateDataSubmissionEndOffset; // in: Byte offset from the beginning of the + // private data to the end of this + // submission. + CONST DXGK_ALLOCATIONLIST* pAllocationList; // in: Pointer to the allocation list + // associated with this DMA buffer. + UINT AllocationListSize; // in: Size of the allocation list. + CONST D3DDDI_PATCHLOCATIONLIST* pPatchLocationList; // in: Pointer to the patch location list associated + // with this DMA buffer. + UINT PatchLocationListSize; // in: Size of the patch location list. + UINT PatchLocationListSubmissionStart; // in: First element for this submission. + UINT PatchLocationListSubmissionLength; // in: Number of element in this submission. +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + D3DGPU_VIRTUAL_ADDRESS DmaBufferVirtualAddress; // in: Virtual address of the DMA buffer for virtual contexts + UINT DmaBufferUmdPrivateDataSize; // in: The size of the private driver data passed from UMD +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +} DXGKARG_CANCELCOMMAND; + +typedef _In_ CONST DXGKARG_CANCELCOMMAND* IN_CONST_PDXGKARG_CANCELCOMMAND; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CANCELCOMMAND) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CANCELCOMMAND( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_CANCELCOMMAND pCancelCommand + ); + +// Definition for DXGKARG_QUERYCURRENTFENCE +// +typedef struct _DXGKARG_QUERYCURRENTFENCE +{ + UINT CurrentFence; + UINT NodeOrdinal; + UINT EngineOrdinal; +} DXGKARG_QUERYCURRENTFENCE; + +// Device Driver Interface to query completed submission fence. +// +typedef _Inout_ DXGKARG_QUERYCURRENTFENCE* INOUT_PDXGKARG_QUERYCURRENTFENCE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYCURRENTFENCE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYCURRENTFENCE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_QUERYCURRENTFENCE pCurrentFence + ); + +// Device Driver Interface to control vertical sync interrupt. +// +typedef _In_ CONST DXGK_INTERRUPT_TYPE IN_CONST_DXGK_INTERRUPT_TYPE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CONTROLINTERRUPT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CONTROLINTERRUPT( + IN_CONST_HANDLE hAdapter, + IN_CONST_DXGK_INTERRUPT_TYPE InterruptType, + IN_BOOLEAN EnableInterrupt + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +// +// WDDM 1.3 DDI for controlling interrupts by extended state +// + +// NON-CRTC_VSYNC states +typedef enum _DXGK_INTERRUPT_STATE +{ + DXGK_INTERRUPT_ENABLE = 0, + DXGK_INTERRUPT_DISABLE = 1, +} DXGK_INTERRUPT_STATE; + +// CRTC_VSYNC states +typedef enum _DXGK_CRTC_VSYNC_STATE +{ + DXGK_VSYNC_ENABLE = 0, + DXGK_VSYNC_DISABLE_KEEP_PHASE = 1, + DXGK_VSYNC_DISABLE_NO_PHASE = 2, +} DXGK_CRTC_VSYNC_STATE; + +typedef struct _DXGKARG_CONTROLINTERRUPT2 +{ + DXGK_INTERRUPT_TYPE InterruptType; + union + { + DXGK_INTERRUPT_STATE InterruptState; + DXGK_CRTC_VSYNC_STATE CrtcVsyncState; + }; +} DXGKARG_CONTROLINTERRUPT2; + +typedef _In_ CONST DXGKARG_CONTROLINTERRUPT2 IN_CONST_DXGKARG_CONTROLINTERRUPT2; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CONTROLINTERRUPT2) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CONTROLINTERRUPT2( + IN_CONST_HANDLE hAdapter, + IN_CONST_DXGKARG_CONTROLINTERRUPT2 InterruptControl + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) +typedef struct _DXGKARG_CONTROLINTERRUPT3 +{ + DXGK_INTERRUPT_TYPE InterruptType; + union + { + DXGK_INTERRUPT_STATE InterruptState; + DXGK_CRTC_VSYNC_STATE CrtcVsyncState; + }; + + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; +}DXGKARG_CONTROLINTERRUPT3; + +typedef _In_ CONST DXGKARG_CONTROLINTERRUPT3* IN_CONST_PDXGKARG_CONTROLINTERRUPT3; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_CONTROLINTERRUPT3) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CONTROLINTERRUPT3( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_CONTROLINTERRUPT3 InterruptControl +); + +#endif + +typedef enum _DXGK_BUILDPAGINGBUFFER_OPERATION +{ + DXGK_OPERATION_TRANSFER = 0, // WDDMv1 Only + DXGK_OPERATION_FILL = 1, // WDDMv1 Only + DXGK_OPERATION_DISCARD_CONTENT = 2, // WDDMv1 Only + DXGK_OPERATION_READ_PHYSICAL = 3, // WDDMv1 Only + DXGK_OPERATION_WRITE_PHYSICAL = 4, // WDDMv1 Only + DXGK_OPERATION_MAP_APERTURE_SEGMENT = 5, // Common WDDMv1 & WDDMv2 + DXGK_OPERATION_UNMAP_APERTURE_SEGMENT = 6, // Common WDDMv1 & WDDMv2 + DXGK_OPERATION_SPECIAL_LOCK_TRANSFER = 7, // WDDMv1 Only +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + DXGK_OPERATION_VIRTUAL_TRANSFER = 8, // WDDMv2 Only + DXGK_OPERATION_VIRTUAL_FILL = 9, // WDDMv2 Only +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + DXGK_OPERATION_INIT_CONTEXT_RESOURCE = 10, // Common WDDMv1 & WDDMv2 +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + DXGK_OPERATION_UPDATE_PAGE_TABLE = 11, + DXGK_OPERATION_FLUSH_TLB = 12, + DXGK_OPERATION_UPDATE_CONTEXT_ALLOCATION = 13, + DXGK_OPERATION_COPY_PAGE_TABLE_ENTRIES = 14, + DXGK_OPERATION_NOTIFY_RESIDENCY = 15, +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + DXGK_OPERATION_SIGNAL_MONITORED_FENCE = 16, +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + DXGK_OPERATION_MAP_APERTURE_SEGMENT2 = 17, +#endif // DXGKDDI_INTERFACE_VERSION +} DXGK_BUILDPAGINGBUFFER_OPERATION; + +typedef struct _DXGK_TRANSFERFLAGS +{ + union + { + struct + { + UINT Swizzle : 1; // 0x00000001 + UINT Unswizzle : 1; // 0x00000002 + UINT AllocationIsIdle : 1; // 0x00000004 + UINT TransferStart : 1; // 0x00000008 + UINT TransferEnd : 1; // 0x00000010 + UINT Reserved :27; // 0xFFFFFFE0 + }; + UINT Value; + }; +} DXGK_TRANSFERFLAGS; + +typedef struct _DXGK_DISCARDCONTENTFLAGS +{ + union + { + struct + { + UINT AllocationIsIdle : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_DISCARDCONTENTFLAGS; + +typedef struct _DXGK_MAPAPERTUREFLAGS +{ + union + { + struct + { + UINT CacheCoherent : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_MAPAPERTUREFLAGS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +typedef struct _DXGK_BUILDPAGINGBUFFER_COPY_RANGE +{ + UINT NumPageTableEntries; + D3DGPU_VIRTUAL_ADDRESS SrcPageTableAddress; + D3DGPU_VIRTUAL_ADDRESS DstPageTableAddress; + UINT SrcStartPteIndex; + UINT DstStartPteIndex; +} DXGK_BUILDPAGINGBUFFER_COPY_RANGE; + +typedef struct _DXGK_BUILDPAGINGBUFFER_FLUSHTLB +{ + D3DGPU_PHYSICAL_ADDRESS RootPageTableAddress; + HANDLE hProcess; + D3DGPU_VIRTUAL_ADDRESS StartVirtualAddress; + D3DGPU_VIRTUAL_ADDRESS EndVirtualAddress; +} DXGK_BUILDPAGINGBUFFER_FLUSHTLB; + +typedef struct _DXGK_BUILDPAGINGBUFFER_UPDATEPAGETABLE +{ + UINT PageTableLevel; + HANDLE hAllocation; + DXGK_PAGETABLEUPDATEADDRESS PageTableAddress; + DXGK_PTE* pPageTableEntries; + UINT StartIndex; + UINT NumPageTableEntries; + UINT Reserved0; + DXGK_UPDATEPAGETABLEFLAGS Flags; + UINT64 DriverProtection; + UINT64 AllocationOffsetInBytes; + HANDLE hProcess; + DXGK_PAGETABLEUPDATEMODE UpdateMode; + DXGK_PTE* pPageTableEntries64KB; + D3DGPU_VIRTUAL_ADDRESS FirstPteVirtualAddress; +} DXGK_BUILDPAGINGBUFFER_UPDATEPAGETABLE; + +typedef struct _DXGK_BUILDPAGINGBUFFER_FILLVIRTUAL +{ + HANDLE hAllocation; + UINT64 AllocationOffsetInBytes; + UINT64 FillSizeInBytes; + UINT FillPattern; + D3DGPU_VIRTUAL_ADDRESS DestinationVirtualAddress; +} DXGK_BUILDPAGINGBUFFER_FILLVIRTUAL; + +typedef enum _DXGK_MEMORY_TRANSFER_DIRECTION +{ + DXGK_MEMORY_TRANSFER_LOCAL_TO_SYSTEM = 0, + DXGK_MEMORY_TRANSFER_SYSTEM_TO_LOCAL = 1, + DXGK_MEMORY_TRANSFER_LOCAL_TO_LOCAL = 2, +} DXGK_MEMORY_TRANSFER_DIRECTION; + +typedef struct _DXGK_TRANSFERVIRTUALFLAGS +{ + union + { + struct + { + UINT Src64KBPages : 1; + UINT Dst64KBPages : 1; + UINT Reserved : 30; + }; + UINT Flags; + }; +} DXGK_TRANSFERVIRTUALFLAGS; + +typedef struct _DXGK_BUILDPAGINGBUFFER_TRANSFERVIRTUAL +{ + HANDLE hAllocation; + UINT64 AllocationOffsetInBytes; + UINT64 TransferSizeInBytes; + D3DGPU_VIRTUAL_ADDRESS SourceVirtualAddress; + D3DGPU_VIRTUAL_ADDRESS DestinationVirtualAddress; + D3DGPU_VIRTUAL_ADDRESS SourcePageTable; + DXGK_MEMORY_TRANSFER_DIRECTION TransferDirection; + DXGK_TRANSFERVIRTUALFLAGS Flags; + D3DGPU_VIRTUAL_ADDRESS DestinationPageTable; +} DXGK_BUILDPAGINGBUFFER_TRANSFERVIRTUAL; + +typedef struct _DXGK_BUILDPAGINGBUFFER_NOTIFYRESIDENCY +{ + HANDLE hAllocation; + D3DGPU_PHYSICAL_ADDRESS PhysicalAddress; + union + { + UINT Resident : 1; + UINT Reserved : 31; + }; +} DXGK_BUILDPAGINGBUFFER_NOTIFYRESIDENCY; + +typedef struct _DXGK_BUILDPAGINGBUFFER_COPYPAGETABLEENTRIES +{ + UINT NumRanges; + DXGK_BUILDPAGINGBUFFER_COPY_RANGE* pRanges; +} DXGK_BUILDPAGINGBUFFER_COPYPAGETABLEENTRIES; + +typedef struct _DXGK_BUILDPAGINGBUFFER_UPDATECONTEXTALLOCATION +{ + D3DGPU_VIRTUAL_ADDRESS ContextAllocation; + UINT64 ContextAllocationSize; + PVOID pDriverPrivateData; + UINT DriverPrivateDataSize; +} DXGK_BUILDPAGINGBUFFER_UPDATECONTEXTALLOCATION; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGK_BUILDPAGINGBUFFER_SIGNALMONITOREDFENCE +{ + D3DGPU_VIRTUAL_ADDRESS MonitoredFenceGpuVa; + UINT64 MonitoredFenceValue; +} DXGK_BUILDPAGINGBUFFER_SIGNALMONITOREDFENCE; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGKARG_BUILDPAGINGBUFFER +{ + VOID* pDmaBuffer; + UINT DmaSize; + VOID* pDmaBufferPrivateData; + UINT DmaBufferPrivateDataSize; + DXGK_BUILDPAGINGBUFFER_OPERATION Operation; + UINT MultipassOffset; + union + { + struct + { + HANDLE hAllocation; + UINT TransferOffset; + SIZE_T TransferSize; + struct + { + UINT SegmentId; + union + { + LARGE_INTEGER SegmentAddress; + MDL* pMdl; + }; + } Source; + struct + { + UINT SegmentId; + union + { + LARGE_INTEGER SegmentAddress; + MDL* pMdl; + }; + } Destination; + DXGK_TRANSFERFLAGS Flags; + UINT MdlOffset; + } Transfer; + + struct + { + HANDLE hAllocation; + SIZE_T FillSize; + UINT FillPattern; + struct + { + UINT SegmentId; + LARGE_INTEGER SegmentAddress; + } Destination; + } Fill; + + struct + { + HANDLE hAllocation; + DXGK_DISCARDCONTENTFLAGS Flags; + UINT SegmentId; + PHYSICAL_ADDRESS SegmentAddress; + } DiscardContent; + + struct + { + UINT SegmentId; + PHYSICAL_ADDRESS PhysicalAddress; + } ReadPhysical; + + struct + { + UINT SegmentId; + PHYSICAL_ADDRESS PhysicalAddress; + } WritePhysical; + + struct + { + HANDLE hDevice; + HANDLE hAllocation; + UINT SegmentId; + SIZE_T OffsetInPages; + SIZE_T NumberOfPages; + PMDL pMdl; + DXGK_MAPAPERTUREFLAGS Flags; + ULONG MdlOffset; + } MapApertureSegment; + + struct + { + HANDLE hDevice; + HANDLE hAllocation; + UINT SegmentId; + SIZE_T OffsetInPages; + SIZE_T NumberOfPages; + PHYSICAL_ADDRESS DummyPage; + } UnmapApertureSegment; + + struct + { + HANDLE hAllocation; + UINT TransferOffset; + SIZE_T TransferSize; + struct + { + UINT SegmentId; + union + { + LARGE_INTEGER SegmentAddress; + MDL* pMdl; + }; + } Source; + struct + { + UINT SegmentId; + union + { + LARGE_INTEGER SegmentAddress; + MDL* pMdl; + }; + } Destination; + DXGK_TRANSFERFLAGS Flags; + UINT SwizzlingRangeId; + UINT SwizzlingRangeData; + } SpecialLockTransfer; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + + struct + { + HANDLE hAllocation; + struct + { + UINT SegmentId; + union + { + LARGE_INTEGER SegmentAddress; + MDL* pMdl; + }; + PVOID VirtualAddress; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + D3DGPU_VIRTUAL_ADDRESS GpuVirtualAddress; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + } Destination; + } InitContextResource; + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + + DXGK_BUILDPAGINGBUFFER_TRANSFERVIRTUAL TransferVirtual; + DXGK_BUILDPAGINGBUFFER_FILLVIRTUAL FillVirtual; + DXGK_BUILDPAGINGBUFFER_UPDATEPAGETABLE UpdatePageTable; + DXGK_BUILDPAGINGBUFFER_FLUSHTLB FlushTlb; + DXGK_BUILDPAGINGBUFFER_COPYPAGETABLEENTRIES CopyPageTableEntries; + DXGK_BUILDPAGINGBUFFER_UPDATECONTEXTALLOCATION UpdateContextAllocation; + DXGK_BUILDPAGINGBUFFER_NOTIFYRESIDENCY NotifyResidency; + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + + DXGK_BUILDPAGINGBUFFER_SIGNALMONITOREDFENCE SignalMonitoredFence; + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + + struct + { + HANDLE hDevice; + HANDLE hAllocation; + UINT SegmentId; + SIZE_T OffsetInPages; + SIZE_T NumberOfPages; + DXGK_ADL Adl; + DXGK_MAPAPERTUREFLAGS Flags; + ULONG AdlOffset; + PVOID CpuVisibleAddress; + } MapApertureSegment2; + +#endif // DXGKDDI_INTERFACE_VERSION + + struct + { + UINT Reserved[64]; + } Reserved; + }; + HANDLE hSystemContext; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + D3DGPU_VIRTUAL_ADDRESS DmaBufferGpuVirtualAddress; // GPU virtual address of the start of the DMA buffer + UINT DmaBufferWriteOffset; // Current operation offset in bytes from the start of the DMA buffer. + // Available starting from version 0x5012. +#endif // DXGKDDI_INTERFACE_VERSION +} DXGKARG_BUILDPAGINGBUFFER; + +// Device Driver Interface to build a paging buffer. +// +typedef _In_ DXGKARG_BUILDPAGINGBUFFER* IN_PDXGKARG_BUILDPAGINGBUFFER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_BUILDPAGINGBUFFER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_BUILDPAGINGBUFFER( + IN_CONST_HANDLE hAdapter, + IN_PDXGKARG_BUILDPAGINGBUFFER pBuildPagingBuffer + ); + +// DXGK_TRANSFERFLAGS.Swizzle +// +// This indicates that the source should be swizzled to the destination. +// +// DXGK_TRANSFERFLAGS.Unswizzle +// +// This indicates that the source should be unswizzled to the destination. +// +// DXGK_TRANSFERFLAGS.AllocationIsIdle +// +// This indicates that the given allocation is idle, i.e. no work +// has been queued or will be queued to the GPU referencing this +// allocation until the call to DdiBuildPagingBuffer returns. +// +// DXGK_TRANSFERFLAGS.FillDestination +// +// This indicates that the driver should fill the destination +// with the provided pattern. No source is provided. +// + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef struct _DXGKARG_SETROOTPAGETABLE +{ + HANDLE hContext; + D3DGPU_PHYSICAL_ADDRESS Address; + UINT NumEntries; +} DXGKARG_SETROOTPAGETABLE; + +typedef _In_ CONST DXGKARG_SETROOTPAGETABLE* IN_CONST_PDXGKARG_SETROOTPAGETABLE; + +typedef + _Function_class_DXGK_(DXGKDDI_SETROOTPAGETABLE) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +APIENTRY +DXGKDDI_SETROOTPAGETABLE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETROOTPAGETABLE pSetPageTable + ); + +typedef struct _DXGKARG_GETROOTPAGETABLESIZE +{ + UINT NumberOfPte; // In/Out + UINT PhysicalAdapterIndex; // In +} DXGKARG_GETROOTPAGETABLESIZE; +typedef _Inout_ DXGKARG_GETROOTPAGETABLESIZE* INOUT_PDXGKARG_GETROOTPAGETABLESIZE; + +typedef + _Function_class_DXGK_(DXGKDDI_GETROOTPAGETABLESIZE) + _IRQL_requires_(PASSIVE_LEVEL) +SIZE_T +APIENTRY +DXGKDDI_GETROOTPAGETABLESIZE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_GETROOTPAGETABLESIZE pArgs + ); + +typedef struct _DXGK_CREATEPROCESSFLAGS +{ + union + { + struct + { + UINT SystemProcess : 1; + UINT GdiProcess : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT VirtualMachineProcess : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + UINT VirtualMachineWorkerProcess : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT SessionIsolatedContainer : 1; + UINT Reserved : 27; +#else + UINT Reserved : 28; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) +#else + UINT Reserved : 29; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) +#else + UINT Reserved : 30; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + }; + UINT Value; + }; +} DXGK_CREATEPROCESSFLAGS; + +typedef struct _DXGKARG_CREATEPROCESS +{ + HANDLE hDxgkProcess; // in + HANDLE hKmdProcess; // out + DXGK_CREATEPROCESSFLAGS Flags; // in + UINT NumPasid; // in + _Field_size_(NumPasid) + ULONG* pPasid; // in +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + HANDLE hKmdVmWorkerProcess;// in Driver VM worker process handle when VirtualMachineProcess is set. + UINT ProcessNameLength; // in + _Field_size_(ProcessNameLength) + WCHAR* pProcessName; // in Maybe NULL +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) +} DXGKARG_CREATEPROCESS; +typedef _Inout_ DXGKARG_CREATEPROCESS* INOUT_PDXGKARG_CREATEPROCESS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEPROCESS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEPROCESS( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATEPROCESS pArgs + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYPROCESS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYPROCESS( + IN_CONST_HANDLE hAdapter, + IN_CONST_HANDLE hKmdProcess + ); + +typedef struct _DXGKARG_SUBMITCOMMANDVIRTUAL +{ + HANDLE hContext; + D3DGPU_VIRTUAL_ADDRESS DmaBufferVirtualAddress; + UINT DmaBufferSize; + VOID* pDmaBufferPrivateData; + UINT DmaBufferPrivateDataSize; + UINT DmaBufferUmdPrivateDataSize; + UINT SubmissionFenceId; + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + D3DDDI_FLIPINTERVAL_TYPE FlipInterval; + DXGK_SUBMITCOMMANDFLAGS Flags; + UINT EngineOrdinal; + UINT NodeOrdinal; +} DXGKARG_SUBMITCOMMANDVIRTUAL; + +typedef _In_ CONST DXGKARG_SUBMITCOMMANDVIRTUAL* IN_CONST_PDXGKARG_SUBMITCOMMANDVIRTUAL; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SUBMITCOMMANDVIRTUAL) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SUBMITCOMMANDVIRTUAL( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SUBMITCOMMANDVIRTUAL pSubmitCommand + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGKARG_SUBMITCOMMANDTOHWQUEUE +{ + HANDLE hHwQueue; + UINT64 HwQueueProgressFenceId; // Fence ID that will be signaled upon this DMA buffer completion. + D3DGPU_VIRTUAL_ADDRESS DmaBufferVirtualAddress; + UINT DmaBufferSize; + UINT DmaBufferPrivateDataSize; + _Field_size_bytes_ (DmaBufferPrivateDataSize) + VOID* pDmaBufferPrivateData; + DXGK_SUBMITCOMMANDFLAGS Flags; + D3DGPU_VIRTUAL_ADDRESS HwQueueProgressFenceGpuVa; // GPU VA of the fence signaled upon this DMA buffer completion. + VOID* HwQueueProgressFenceCpuVa; // Kernel mode CPU VA of the fence being signaled. +} DXGKARG_SUBMITCOMMANDTOHWQUEUE; + +typedef _In_ CONST DXGKARG_SUBMITCOMMANDTOHWQUEUE* IN_CONST_PDXGKARG_SUBMITCOMMANDTOHWQUEUE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SUBMITCOMMANDTOHWQUEUE) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SUBMITCOMMANDTOHWQUEUE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SUBMITCOMMANDTOHWQUEUE pSubmitCommandToHwQueue + ); + +typedef struct _DXGKARG_SWITCHTOHWCONTEXTLIST +{ + HANDLE hHwContextFirst; // Hardware context that should be executed by the GPU first. If the GPU is currently not executing this context, + // it needs to preempt the current work and switch to hHwContextFirst. + // May be NULL if the GPU is instructed to become idle. + HANDLE hHwContextSecond; // Hardware context that should be executed by the GPU + // once all queues in hHwContextFirst are idle or blocked on waits. + // May be NULL. + UINT NodeOrdinal; // Node ordinal of engine that is instructed to switch to the new context(s). + UINT EngineOrdinal; // Engine ordinal of engine that is instructed to switch to the new context(s). +} DXGKARG_SWITCHTOHWCONTEXTLIST; + +typedef _In_ CONST DXGKARG_SWITCHTOHWCONTEXTLIST* IN_CONST_PDXGKARG_SWITCHTOHWCONTEXTLIST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SWITCHTOHWCONTEXTLIST) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SWITCHTOHWCONTEXTLIST( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SWITCHTOHWCONTEXTLIST pHwContextList + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +typedef struct _DXGK_UPDATEHWCONTEXTSTATE_FLAGS +{ + union + { + struct + { + UINT Suspended : 1; // The context is asked to be suspended. Otherwise, the context is runnable. + UINT InterruptOnSwitchCompletion : 1; // HW is required to raise DXGK_INTERRUPT_HWCONTEXTLIST_SWITCH_COMPLETED + // interrupt when the context state update is effective on the GPU. + UINT Reserved :30; + }; + UINT Value; + }; +} DXGK_UPDATEHWCONTEXTSTATE_FLAGS; + +typedef struct _DXGKARG_UPDATEHWCONTEXTSTATE +{ + HANDLE hHwContext; // Hardware context whose priority or execution state is being changed. + UINT64 ContextSwitchFence; // Context switch fence value associated with this state change request. + UINT Priority; // Execution priority of this context relative to other running contexts on this node. + DXGK_UPDATEHWCONTEXTSTATE_FLAGS Flags; // Context execution state flags. +} DXGKARG_UPDATEHWCONTEXTSTATE; + +typedef _In_ CONST DXGKARG_UPDATEHWCONTEXTSTATE* IN_CONST_PDXGKARG_UPDATEHWCONTEXTSTATE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UPDATEHWCONTEXTSTATE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_UPDATEHWCONTEXTSTATE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_UPDATEHWCONTEXTSTATE pUpdateHwContextState + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef enum _DXGK_SCHEDULING_LOG_OPERATION +{ + DXGK_SCHEDULING_LOG_OPERATION_CONTEXT_STATE_CHANGE = 0 +} DXGK_SCHEDULING_LOG_OPERATION; + +typedef enum _DXGK_SCHEDULING_LOG_CONTEXT_STATE +{ + DXGK_SCHEDULING_LOG_CONTEXT_STATE_IDLE = 0, + DXGK_SCHEDULING_LOG_CONTEXT_STATE_RUNNING = 1, + DXGK_SCHEDULING_LOG_CONTEXT_STATE_READY = 2, + DXGK_SCHEDULING_LOG_CONTEXT_STATE_READY_STANDBY = 3, +} DXGK_SCHEDULING_LOG_CONTEXT_STATE; + +typedef struct _DXGK_SCHEDULING_LOG_CONTEXT_STATE_CHANGE +{ + HANDLE hKmdContext; + DXGK_SCHEDULING_LOG_CONTEXT_STATE newContextState; +} DXGK_SCHEDULING_LOG_CONTEXT_STATE_CHANGE; + +typedef struct _DXGK_SCHEDULING_LOG_HEADER +{ + union + { + struct + { + UINT32 FirstFreeEntryIndex; // same as LowPart of AtomicWraparoundAndEntryIndex + UINT32 WraparoundCount; // same as HighPart of AtomicWraparoundAndEntryIndex + }; + + ULARGE_INTEGER AtomicWraparoundAndEntryIndex; + }; + + UINT64 NumberOfEntries; + UINT64 Reserved[2]; +} DXGK_SCHEDULING_LOG_HEADER; + +typedef struct _DXGK_SCHEDULING_LOG_ENTRY +{ + UINT64 GpuTimeStamp; + + // OperationType is of DXGK_SCHEDULING_LOG_OPERATION type + // UINT is used because enums as bitfields are not a part of standard C++. + UINT OperationType : 32; + UINT ReservedOperationTypeBits: 32; + union + { + DXGK_SCHEDULING_LOG_CONTEXT_STATE_CHANGE ContextStateChange; + UINT64 ReservedOperationData[2]; + }; +} DXGK_SCHEDULING_LOG_ENTRY; + +typedef struct _DXGK_SCHEDULING_LOG_BUFFER +{ + DXGK_SCHEDULING_LOG_HEADER Header; + + _Field_size_(Header.NumberOfEntries) + DXGK_SCHEDULING_LOG_ENTRY Entries[1]; +} DXGK_SCHEDULING_LOG_BUFFER; + +typedef struct _DXGKARG_SETSCHEDULINGLOGBUFFER +{ + UINT NodeOrdinal; // in: node ordinal + UINT EngineOrdinal; // in: engine ordinal + UINT NumberOfEntries; // in: number of entries in the log entries array + + _Field_size_bytes_(32 + 32 * NumberOfEntries) + DXGK_SCHEDULING_LOG_BUFFER* LogBufferCpuVa; // in: kernel mode CPU VA of the log buffer + + D3DGPU_VIRTUAL_ADDRESS LogBufferGpuVa; // in: GPU VA of the log buffer + + _Field_range_(0, NumberOfEntries - 1) + UINT InterruptEntry; // in: index of entry to raise interrupt when writing to +} DXGKARG_SETSCHEDULINGLOGBUFFER; + +typedef _In_ CONST DXGKARG_SETSCHEDULINGLOGBUFFER* IN_CONST_PDXGKARG_SETSCHEDULINGLOGBUFFER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETSCHEDULINGLOGBUFFER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETSCHEDULINGLOGBUFFER( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETSCHEDULINGLOGBUFFER pSetSchedulingLogBuffer + ); + +typedef enum _DXGK_SCHEDULING_PRIORITY_BAND +{ + DXGK_SCHEDULING_PRIORITY_BAND_IDLE = 0, + DXGK_SCHEDULING_PRIORITY_BAND_NORMAL = 1, + DXGK_SCHEDULING_PRIORITY_BAND_FOCUS = 2, + DXGK_SCHEDULING_PRIORITY_BAND_REALTIME = 3, + DXGK_SCHEDULING_PRIORITY_BAND_COUNT = 4 +} DXGK_SCHEDULING_PRIORITY_BAND; + +typedef struct _DXGKARG_SETUPPRIORITYBANDS +{ + // Grace period when preempting another priority band for this priority band. + // The value for idle priority band is ignored, as it never preempts other bands. + UINT64 gracePeriodForBand[DXGK_SCHEDULING_PRIORITY_BAND_COUNT]; + + // Default quantum for scheduling across processes within a priority band. + UINT64 processQuantumForBand[DXGK_SCHEDULING_PRIORITY_BAND_COUNT]; + + // Default grace period for processes that preempt each other within a priority band. + UINT64 processGracePeriodForBand[DXGK_SCHEDULING_PRIORITY_BAND_COUNT]; + + // For normal priority band, specifies the target GPU percentage in situations when it's starved by the focus band. + // Valid values are between 0 and 50, with the default being 10. + UINT targetNormalBandPercentage; +} DXGKARG_SETUPPRIORITYBANDS; + +typedef _In_ CONST DXGKARG_SETUPPRIORITYBANDS* IN_CONST_PDXGKARG_SETUPPRIORITYBANDS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETUPPRIORITYBANDS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETUPPRIORITYBANDS( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETUPPRIORITYBANDS pSetupPriorityBands + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_NOTIFYFOCUSPRESENT) + _IRQL_requires_min_(PASSIVE_LEVEL) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_NOTIFYFOCUSPRESENT( + IN_CONST_HANDLE hAdapter + ); + +typedef struct _DXGKARG_SETCONTEXTSCHEDULINGPROPERTIES +{ + HANDLE hContext; + + // Priority band this context is assigned to. + // Assigning a context to focus and realtime priority bands requires the calling process to have + // SE_INC_BASE_PRIORITY_NAME privilege. + DXGK_SCHEDULING_PRIORITY_BAND priorityBand; + + // For contexts assigned to the realtime priority band, specifies priority level relative to other + // realtime band contexts. Valid values are between 0 and 31. + INT realtimeBandPriorityLevel; + + // Specifies context priority relative to other contexts within the same process. + // Valid values are between -7 and +7, default value is 0. + INT inProcessPriority; + + // Specifies context quantum relative to other contexts of the same priority within the same process. + UINT64 quantum; + + // Specifies context grace period when preempting other contexts of the same priority within the same process. + UINT64 gracePeriodSamePriority; + + // Specifies context grace period when preempting contexts of a lower priority within the same process. + UINT64 gracePeriodLowerPriority; +} DXGKARG_SETCONTEXTSCHEDULINGPROPERTIES; + +typedef _In_ CONST DXGKARG_SETCONTEXTSCHEDULINGPROPERTIES* IN_CONST_PDXGKARG_SETCONTEXTSCHEDULINGPROPERTIES; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETCONTEXTSCHEDULINGPROPERTIES) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETCONTEXTSCHEDULINGPROPERTIES( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETCONTEXTSCHEDULINGPROPERTIES pSetContextSchedulingProperties + ); + +typedef struct _DXGKARG_SUSPENDCONTEXT +{ + HANDLE hContext; + + // A monotonically increasing per context value that will be reported when this + // suspend request is completed. + UINT64 contextSuspendFence; +} DXGKARG_SUSPENDCONTEXT; + +typedef _In_ CONST DXGKARG_SUSPENDCONTEXT* IN_CONST_PDXGKARG_SUSPENDCONTEXT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SUSPENDCONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SUSPENDCONTEXT( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SUSPENDCONTEXT pSuspendContext + ); + +typedef struct _DXGKARG_RESUMECONTEXT +{ + HANDLE hContext; +} DXGKARG_RESUMECONTEXT; + +typedef _In_ CONST DXGKARG_RESUMECONTEXT* IN_CONST_PDXGKARG_RESUMECONTEXT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESUMECONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RESUMECONTEXT( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_RESUMECONTEXT pResumeContext + ); + +typedef struct _DXGK_VIRTUALMACHINEDATAFLAGS +{ + union + { + struct + { + UINT SecureVirtualMachine : 1; + UINT LinuxVirtualMachine : 1; + }; + UINT Value; + }; +} DXGK_VIRTUALMACHINEDATAFLAGS; + +typedef struct _DXGKARG_SETVIRTUALMACHINEDATA +{ + HANDLE hKmdVmWorkerProcess; // in + GUID* pVmGuid; // in + DXGK_VIRTUALMACHINEDATAFLAGS Flags; // in +} DXGKARG_SETVIRTUALMACHINEDATA; +typedef _In_ CONST DXGKARG_SETVIRTUALMACHINEDATA* IN_CONST_PDXGKARG_SETVIRTUALMACHINEDATA; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETVIRTUALMACHINEDATA) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETVIRTUALMACHINEDATA( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETVIRTUALMACHINEDATA Args + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef enum _DXGK_KERNEL_SUBMISSION_TYPE +{ + DXGK_KERNEL_SUBMISSION_BUILD_PAGING_BUFFER = 0, + DXGK_KERNEL_SUBMISSION_RENDERGDI = 1, + DXGK_KERNEL_SUBMISSION_PRESENTBLT = 2 +} DXGK_KERNEL_SUBMISSION_TYPE; + +typedef struct _DXGKARG_SIGNALMONITOREDFENCE +{ + DXGK_KERNEL_SUBMISSION_TYPE KernelSubmissionType; + VOID* pDmaBuffer; + D3DGPU_VIRTUAL_ADDRESS DmaBufferGpuVirtualAddress; + UINT DmaSize; + VOID* pDmaBufferPrivateData; + UINT DmaBufferPrivateDataSize; + UINT MultipassOffset; + D3DGPU_VIRTUAL_ADDRESS MonitoredFenceGpuVa; + UINT64 MonitoredFenceValue; + VOID* MonitoredFenceCpuVa; // Kernel mode CPU VA of the fence being signaled. + HANDLE hHwQueue; +} DXGKARG_SIGNALMONITOREDFENCE; + +typedef _Inout_ DXGKARG_SIGNALMONITOREDFENCE* INOUT_PDXGKARG_SIGNALMONITOREDFENCE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SIGNALMONITOREDFENCE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SIGNALMONITOREDFENCE( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_SIGNALMONITOREDFENCE pSignalMonitoredFence + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_PRESENTTOHWQUEUE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_PRESENTTOHWQUEUE( + IN_CONST_HANDLE hHwQueue, + INOUT_PDXGKARG_PRESENT pPresent + ); + +typedef struct _DXGK_VALIDATESUBMITCOMMANDFLAGS +{ + union + { + struct + { + UINT HardwareQueueSubmission : 1; + UINT Reserved :31; + }; + UINT Value; + }; +} DXGK_VALIDATESUBMITCOMMANDFLAGS; + +typedef struct _DXGKARG_VALIDATESUBMITCOMMAND +{ + D3DGPU_VIRTUAL_ADDRESS Commands; + UINT CommandLength; + DXGK_VALIDATESUBMITCOMMANDFLAGS Flags; + UINT ContextCount; + HANDLE Context[D3DDDI_MAX_BROADCAST_CONTEXT]; + VOID* pPrivateDriverData; + UINT PrivateDriverDataSize; + UINT UmdPrivateDataSize; + UINT64 HwQueueProgressFenceId; +} DXGKARG_VALIDATESUBMITCOMMAND; + +typedef _Inout_ DXGKARG_VALIDATESUBMITCOMMAND* INOUT_PDXGKARG_VALIDATESUBMITCOMMAND; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VALIDATESUBMITCOMMAND) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_VALIDATESUBMITCOMMAND( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_VALIDATESUBMITCOMMAND pArgs + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef struct _DXGKARG_RENDERGDI +{ + CONST VOID* pCommand; + UINT CommandLength; + VOID* pDmaBuffer; + D3DGPU_VIRTUAL_ADDRESS DmaBufferGpuVirtualAddress; + UINT DmaSize; + VOID* pDmaBufferPrivateData; + UINT DmaBufferPrivateDataSize; + DXGK_ALLOCATIONLIST* pAllocationList; + UINT AllocationListSize; + UINT MultipassOffset; +} DXGKARG_RENDERGDI; + +typedef _Inout_ DXGKARG_RENDERGDI* INOUT_PDXGKARG_RENDERGDI; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RENDERGDI) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RENDERGDI( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_RENDERGDI pRenderGdi + ); + +typedef struct _DXGKARG_MAPCPUHOSTAPERTURE +{ + HANDLE hAllocation; + WORD SegmentId; + WORD PhysicalAdapterIndex; + UINT64 NumberOfPages; + UINT32* pCpuHostAperturePages; + UINT64* pMemorySegmentPages; +} DXGKARG_MAPCPUHOSTAPERTURE; + +typedef _In_ CONST DXGKARG_MAPCPUHOSTAPERTURE* IN_CONST_PDXGKARG_MAPCPUHOSTAPERTURE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MAPCPUHOSTAPERTURE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_MAPCPUHOSTAPERTURE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_MAPCPUHOSTAPERTURE pArgs + ); + +typedef struct _DXGKARG_UNMAPCPUHOSTAPERTURE +{ + UINT64 NumberOfPages; + UINT32* pCpuHostAperturePages; + WORD SegmentId; + WORD PhysicalAdapterIndex; +} DXGKARG_UNMAPCPUHOSTAPERTURE; + +typedef _In_ CONST DXGKARG_UNMAPCPUHOSTAPERTURE* IN_CONST_PDXGKARG_UNMAPCPUHOSTAPERTURE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UNMAPCPUHOSTAPERTURE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_UNMAPCPUHOSTAPERTURE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_UNMAPCPUHOSTAPERTURE pArgs + ); + +typedef struct DXGKARG_SETSTABLEPOWERSTATE +{ + BOOL Enabled; +} DXGKARG_SETSTABLEPOWERSTATE; + +typedef _In_ CONST DXGKARG_SETSTABLEPOWERSTATE* IN_CONST_PDXGKARG_SETSTABLEPOWERSTATE; + +typedef + _Function_class_DXGK_(DXGKDDI_SETSTABLEPOWERSTATE) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +APIENTRY +DXGKDDI_SETSTABLEPOWERSTATE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETSTABLEPOWERSTATE pArgs + ); + +typedef struct _DXGKARG_SETVIDEOPROTECTEDREGION +{ + UINT PhysicalAdapterIndex; // In + UINT SegmentIndex; // In + UINT VprIndex; // In + SIZE_T CurrentStartOffset; // In + SIZE_T CurrentSize; // In + SIZE_T NewStartOffset; // In + SIZE_T NewSize; // In +} DXGKARG_SETVIDEOPROTECTEDREGION; +typedef _In_ CONST DXGKARG_SETVIDEOPROTECTEDREGION* IN_CONST_PDXGKARG_SETVIDEOPROTECTEDREGION; + +typedef + _Function_class_DXGK_(DXGKDDI_SETVIDEOPROTECTEDREGION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETVIDEOPROTECTEDREGION( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETVIDEOPROTECTEDREGION pArgs + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef struct _DXGKARG_ESCAPE +{ + HANDLE hDevice; // in: driver device handle + D3DDDI_ESCAPEFLAGS Flags; // in: flags + VOID* pPrivateDriverData; // in/out: escape data + UINT PrivateDriverDataSize; // in: size of escape data + HANDLE hContext; // in: driver context handle +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + HANDLE hKmdProcessHandle; // in: driver process handle (maybe NULL) +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +} DXGKARG_ESCAPE; + +typedef _In_ CONST DXGKARG_ESCAPE* IN_CONST_PDXGKARG_ESCAPE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_ESCAPE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_ESCAPE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_ESCAPE pEscape + ); + +#define DXGK_SECONDARY_BUCKETING_TAG ((DWORD)'bSsM') + +typedef struct _DXGKARG_COLLECTDBGINFO_EXT +{ + UINT BucketingKey; // out: Key for IHV specific secondary OCA bucketing + UINT CurrentDmaBufferOffset; // out: execution offset in the current DMA buffer + UINT Reserved2; + UINT Reserved3; + UINT Reserved4; + UINT Reserved5; + UINT Reserved6; + UINT Reserved7; +} DXGKARG_COLLECTDBGINFO_EXT; + +typedef struct _DXGKARG_COLLECTDBGINFO +{ + UINT Reason; // in: bugcheck code for debug report + VOID* pBuffer; // out: pointer to the buffer to save the info + SIZE_T BufferSize; // in: maximum size of the buffer in bytes + DXGKARG_COLLECTDBGINFO_EXT* pExtension; // out: optional extension +} DXGKARG_COLLECTDBGINFO; + +typedef _In_ CONST DXGKARG_COLLECTDBGINFO* IN_CONST_PDXGKARG_COLLECTDBGINFO; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_COLLECTDBGINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_COLLECTDBGINFO( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_COLLECTDBGINFO pCollectDbgInfo + ); + +typedef struct _DXGK_OVERLAYINFO +{ + HANDLE hAllocation; // in: Allocation to be displayed + PHYSICAL_ADDRESS PhysicalAddress; // in: Physical address of allocation + UINT SegmentId; // in: Segment ID of allocation + RECT DstRect; // in: Source rect + RECT SrcRect; // in: Dest rect + VOID* pPrivateDriverData; // in: Private driver data + UINT PrivateDriverDataSize; // in: Size of private driver data +} DXGK_OVERLAYINFO; + +typedef struct _DXGKARG_CREATEOVERLAY +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn where overlay is displayed + DXGK_OVERLAYINFO OverlayInfo; // in: Overlay info + HANDLE hOverlay; // out: Driver handle +} DXGKARG_CREATEOVERLAY; + +typedef _Inout_ DXGKARG_CREATEOVERLAY* INOUT_PDXGKARG_CREATEOVERLAY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEOVERLAY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEOVERLAY( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATEOVERLAY pCreateOverlay + ); + +typedef struct _DXGKARG_UPDATEOVERLAY +{ + DXGK_OVERLAYINFO OverlayInfo; // in: Overlay info +} DXGKARG_UPDATEOVERLAY; + +typedef _In_ CONST DXGKARG_UPDATEOVERLAY* IN_CONST_PDXGKARG_UPDATEOVERLAY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UPDATEOVERLAY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_UPDATEOVERLAY( + IN_CONST_HANDLE hOverlay, + IN_CONST_PDXGKARG_UPDATEOVERLAY pUpdateOverlay + ); + +typedef struct _DXGKARG_FLIPOVERLAY +{ + HANDLE hSource; // in: Source allocation + PHYSICAL_ADDRESS SrcPhysicalAddress; // in: Physical address of source allocation + UINT SrcSegmentId; // in: Segment ID of source allocation + VOID* pPrivateDriverData; // in: Private driver data + UINT PrivateDriverDataSize; // in: Size of private driver data +} DXGKARG_FLIPOVERLAY; + +typedef _In_ CONST DXGKARG_FLIPOVERLAY* IN_CONST_PDXGKARG_FLIPOVERLAY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_FLIPOVERLAY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_FLIPOVERLAY( + IN_CONST_HANDLE hOverlay, + IN_CONST_PDXGKARG_FLIPOVERLAY pFlipOverlay + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYOVERLAY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYOVERLAY( + IN_CONST_HANDLE hOverlay + ); + +typedef struct _DXGKARG_GETSCANLINE +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; // in: adapter's VidPN Target ID + BOOLEAN InVerticalBlank; // out: Within vertical blank + UINT ScanLine; // out: Current scan line +} DXGKARG_GETSCANLINE; + +typedef _Inout_ DXGKARG_GETSCANLINE* INOUT_PDXGKARG_GETSCANLINE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_GETSCANLINE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_GETSCANLINE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_GETSCANLINE pGetScanLine + ); + +///////////////////////// LDDM display miniport VidPN management DDI ///////////////////////////// + + +/*++ +Routine Description: + IsSupportedVidPn LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pIsSupportedVidPnArg + ->pDesiredVidPn - VidPN whose support with respect to display adapter's capabilities + is in question. + + ->bIsVidPnSupported - Placeholder for the predicate specifying whether the specified VidPN + is supported by the specified display adapter. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - Low memory condition prevented successful completion of this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_VIDPN* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Remarks: + Predicate specifying whether the provided VidPN configuration is supported (i.e. can be extended + to a functional VidPN). + +Assumptions: + Specified VidPN must at a minimum specify a valid topology, but can also have some or all + of its targets/sources configured with respectively pinned modes. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef struct _DXGKARG_ISSUPPORTEDVIDPN +{ + IN D3DKMDT_HVIDPN hDesiredVidPn; + OUT BOOLEAN IsVidPnSupported; +} DXGKARG_ISSUPPORTEDVIDPN; + +typedef _Inout_ DXGKARG_ISSUPPORTEDVIDPN* INOUT_PDXGKARG_ISSUPPORTEDVIDPN; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_ISSUPPORTEDVIDPN) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_ISSUPPORTEDVIDPN( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_ISSUPPORTEDVIDPN pIsSupportedVidPn + ); + + +/*++ +Routine Description: + EnumVidPnCofuncModality LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + hConstrainingVidPn - VidPN whose cofunctional mode sets are to be (re)enumerated + with respect to its topology and pinned modes (if any). + + EnumPivotType - Specifies what is the type of the mode enumeration pivot (if any). + No pivot is specified using D3DKMDT_EPT_NOPIVOT. + + EnumPivot.VidPnSourceId - If (EnumPivotType == D3DKMDT_EPT_VIDPNSOURCE), specifies the ID + of the VidPN source whose mode set must not be changed during the enumeration. + If EnumPivotType is D3DKMDT_EPT_SCALING or D3DKMDT_EPT_ROTATION, + the VidPnSourceId and VidPnTargetId specifies the path whose scaling or rotation support does + not need to be updated. + Undefined otherwise. + + EnumPivot.VidPnSourceId - If (EnumPivotType == D3DKMDT_EPT_VIDPNTARGET), specifies the ID + of the VidPN source whose mode set must not be changed during the enumeration. + If EnumPivotType is D3DKMDT_EPT_SCALING or D3DKMDT_EPT_ROTATION, + the VidPnSourceId and VidPnTargetId specifies the path whose scaling or rotation support does + not need to be updated. + Undefined otherwise. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - Low memory condition prevented successful completion of this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_VIDPN* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Remarks: + Enumerates cofunctional video present source and target mode sets on each video present path + in the specified VidPN's topology. + +Assumptions: + Specified VidPN's support has been confirmed via IsSupportedVidPn call by the OS. + Miniport can assume it reported that it supports this VidPN. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef struct _DXGK_ENUM_PIVOT +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; +} DXGK_ENUM_PIVOT; + + +typedef struct _DXGKARG_ENUMVIDPNCOFUNCMODALITY +{ + IN D3DKMDT_HVIDPN hConstrainingVidPn; + IN D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE EnumPivotType; + IN DXGK_ENUM_PIVOT EnumPivot; +} DXGKARG_ENUMVIDPNCOFUNCMODALITY; + +typedef _In_ CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST IN_CONST_PDXGKARG_ENUMVIDPNCOFUNCMODALITY_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_ENUMVIDPNCOFUNCMODALITY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_ENUMVIDPNCOFUNCMODALITY( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_ENUMVIDPNCOFUNCMODALITY_CONST pEnumCofuncModality + ); + + +/*++ +Routine Description: + RecommendFunctionalVidPn LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter + - LDDM display miniport adapter handle. + + pRecommendFunctionalVidPnArg + + ->NumberOfVidPnTargets + - Number of VidPN target IDs listed in pVidPnTargetPrioritizationVector. + + ->pVidPnTargetPrioritizationVector + - Vector of VidPN targets IDs, ordered most important first, representing the + importance of monitors connected to them. + + ->hRecommendedFunctionalVidPn + - Handle of an empty VidPN object to be populated by miniport with the + functional VidPN recommended for the current state of display adapter. + + ->RequestReason + - Type of reason behind OS'es request of a new functional VidPN. + Note that hotkey, power, and thermal events are mapped directly from the + respective invalidation reasons specified via + DXGK_INTERFACESPECIFICDATA::pfnInvalidateActiveVidPn. + + ->hContext + - Optional context originating from the miniport on calls such as + DXGK_INTERFACESPECIFICDATA::pfnInvalidateActiveVidPn. When miniport needs + to invalidate an active VidPN, it should pass private context to be received + via this parameter so it could distinguish between different concurrent requests + of the same type leading OS to request a new functional VidPN. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN + - Installed LDDM display adapter miniport has no VidPN recommendation + for the current configuration of the display adapter. + + STATUS_NO_MEMORY + - Low memory condition prevented successful completion of this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_{VIDPN|MONITOR}* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Remarks: + Obtains a VidPN recommended by the LDDM display miniport, given the current state of the h/w. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef enum _DXGK_RECOMMENDFUNCTIONALVIDPN_REASON +{ + DXGK_RFVR_UNINITIALIZED = 0, + DXGK_RFVR_HOTKEY = 1, + DXGK_RFVR_USERMODE = 2, + DXGK_RFVR_FIRMWARE = 3, +} +DXGK_RECOMMENDFUNCTIONALVIDPN_REASON; + +typedef struct _DXGKARG_RECOMMENDFUNCTIONALVIDPN +{ + IN UINT NumberOfVidPnTargets; + IN CONST D3DDDI_VIDEO_PRESENT_TARGET_ID* pVidPnTargetPrioritizationVector; + IN D3DKMDT_HVIDPN hRecommendedFunctionalVidPn; + IN DXGK_RECOMMENDFUNCTIONALVIDPN_REASON RequestReason; + IN OPTIONAL VOID* pPrivateDriverData; + IN UINT PrivateDriverDataSize; +} DXGKARG_RECOMMENDFUNCTIONALVIDPN; + +typedef _In_ CONST DXGKARG_RECOMMENDFUNCTIONALVIDPN* CONST IN_CONST_PDXGKARG_RECOMMENDFUNCTIONALVIDPN_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RECOMMENDFUNCTIONALVIDPN) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RECOMMENDFUNCTIONALVIDPN( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_RECOMMENDFUNCTIONALVIDPN_CONST pRecommendFunctionalVidPn + ); + +/*++ +Routine Description: + SetVidPnSourceAddress LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pSetVidPnSourceVisibility + ->VidPnSourceId - ID of the VidPN source whose state needs to be changed. + + ->PrimarySegment - Segment of the primary surface to scan from. + + ->PrimaryAddress - Address of the primary surface to scan from. + + ->hAllocation - Driver assigned allocation handle for the primary surface + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + +Side-effects: + On success, adapters starts scanning from the specified primary surface on the specified VidPN source. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef struct _DXGK_SETVIDPNSOURCEADDRESS_FLAGS +{ + union + { + struct + { + + UINT ModeChange : 1; // 0x00000001 + UINT FlipImmediate : 1; // 0x00000002 + UINT FlipOnNextVSync : 1; // 0x00000004 +#if ((DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) || \ + (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN8)) + UINT FlipStereo : 1; // 0x00000008 This is a flip from a stereo alloc. Used in addition to FlipImmediate or FlipOnNextVSync. + UINT FlipStereoTemporaryMono : 1; // 0x00000010 This is a flip from a stereo alloc. The left image should used. Used in addition to FlipImmediate or FlipOnNextVSync. + UINT FlipStereoPreferRight : 1; // 0x00000010 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. + UINT SharedPrimaryTransition : 1; // 0x00000020 We are transitioning to or away from a shared managed primary allocation +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + UINT IndependentFlipExclusive : 1; // 0x00000040 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + UINT MoveFlip : 1; // 0x00000080 + UINT Reserved :23; +#else + UINT Reserved :24; // 0xFFFFFF80 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) +#else + UINT Reserved :25; // 0xFFFFFFC0 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +#else + UINT Reserved :29; // 0xFFFFFFF8 +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + }; + UINT Value; + }; +} DXGK_SETVIDPNSOURCEADDRESS_FLAGS; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) +typedef struct _DXGK_SETVIDPNSOURCEADDRESS_INPUT_FLAGS +{ + union + { + struct + { + UINT FlipStereo : 1; // 0x00000001 This is a flip from a stereo alloc. Used in addition to FlipImmediate or FlipOnNextVSync. + UINT FlipStereoTemporaryMono : 1; // 0x00000002 This is a flip from a stereo alloc. The left image should used. Used in addition to FlipImmediate or FlipOnNextVSync. + 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. + UINT RetryAtLowerIrql : 1; // 0x00000008 This is called at lower IRQL after receiving a PrePresent request. + UINT Reserved :28; // 0xFFFFFFF0 + }; + UINT Value; + }; +} DXGK_SETVIDPNSOURCEADDRESS_INPUT_FLAGS; + +typedef struct _DXGK_SETVIDPNSOURCEADDRESS_OUTPUT_FLAGS +{ + union + { + struct + { + UINT PrePresentNeeded : 1; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + UINT HwFlipQueueDrainNeeded : 1; + UINT HwFlipQueueDrainAllPlanes : 1; + UINT HwFlipQueueDrainAllSources : 1; + UINT Reserved :28; +#else + UINT Reserved :31; // 0xFFFFFFFE +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + }; + UINT Value; + }; +} DXGK_SETVIDPNSOURCEADDRESS_OUTPUT_FLAGS; + +typedef struct _DXGK_PLANE_SPECIFIC_INPUT_FLAGS +{ + union + { + struct + { + UINT Enabled : 1; // 0x00000001 + UINT FlipImmediate : 1; // 0x00000002 + UINT FlipOnNextVSync : 1; // 0x00000004 + UINT SharedPrimaryTransition : 1; // 0x00000008 We are transitioning to or away from a shared managed primary allocation + UINT IndependentFlipExclusive : 1; // 0x00000010 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + UINT FlipImmediateNoTearing : 1; // 0x00000020 + UINT Reserved :26; // 0xFFFFFFC0 +#else + UINT Reserved :27; // 0xFFFFFFE0 +#endif + }; + UINT Value; + }; +} DXGK_PLANE_SPECIFIC_INPUT_FLAGS; + +typedef struct _DXGK_PLANE_SPECIFIC_OUTPUT_FLAGS +{ + union + { + struct + { + UINT FlipConvertedToImmediate : 1; // 0x00000001 + UINT PostPresentNeeded : 1; // 0x00000002 Should only be set for immediate flips if driver requires a postpresent call on this plane +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + UINT HsyncInterruptCompletion : 1; // 0x00000004 Should be set for immediate flips that are completed on Hsync interrupt notification and not upon the return from the DDI. + UINT Reserved :29; // 0xFFFFFFF8 +#else + UINT Reserved :30; // 0xFFFFFFFC +#endif + }; + UINT Value; + }; +} DXGK_PLANE_SPECIFIC_OUTPUT_FLAGS; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES3 +{ + DXGK_MULTIPLANE_OVERLAY_FLAGS Flags; + RECT SrcRect; + RECT DstRect; + RECT ClipRect; + D3DDDI_ROTATION Rotation; + DXGK_MULTIPLANE_OVERLAY_BLEND Blend; + D3DDDI_COLOR_SPACE_TYPE ColorSpaceType; + DXGK_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + UINT SDRWhiteLevel; +#endif +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT DirtyRectCnt; + _Field_size_opt_(DirtyRectCnt) + CONST RECT* pDirtyRects; +#endif +} DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES3; + +typedef struct _DXGK_HDR_METADATA +{ + D3DDDI_HDR_METADATA_TYPE Type; + UINT Size; + VOID* pMetaData; +} DXGK_HDR_METADATA; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +typedef struct _DXGK_PRIMARYDATA +{ + HANDLE hAllocation; + WORD SegmentId; + PHYSICAL_ADDRESS SegmentAddress; +} DXGK_PRIMARYDATA; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +typedef struct _DXGKARG_SETVIDPNSOURCEADDRESS +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + UINT PrimarySegment; + PHYSICAL_ADDRESS PrimaryAddress; + HANDLE hAllocation; + UINT ContextCount; + HANDLE Context[1+D3DDDI_MAX_BROADCAST_CONTEXT]; + DXGK_SETVIDPNSOURCEADDRESS_FLAGS Flags; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT Duration; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + DXGK_PRIMARYDATA PrimaryData[D3DDDI_MAX_BROADCAST_CONTEXT]; + UINT DriverPrivateDataSize; + _Field_size_bytes_(DriverPrivateDataSize) + PVOID pDriverPrivateData; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 +} DXGKARG_SETVIDPNSOURCEADDRESS; + +typedef _In_ CONST DXGKARG_SETVIDPNSOURCEADDRESS* IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETVIDPNSOURCEADDRESS) + _IRQL_requires_min_(PASSIVE_LEVEL) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_SETVIDPNSOURCEADDRESS( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESS pSetVidPnSourceAddress + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef struct _DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY +{ + UINT ContextCount; + HANDLE Context[1+D3DDDI_MAX_BROADCAST_CONTEXT]; + + DXGK_SETVIDPNSOURCEADDRESS_FLAGS Flags; + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + + UINT PlaneCount; + DXGK_MULTIPLANE_OVERLAY_PLANE* pPlanes; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + UINT Duration; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 +} DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY; + +typedef _In_ CONST DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY* IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY + pSetVidPnSourceAddressWithMultiPlaneOverlay + ); + +typedef _In_ CONST DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY* + IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY; +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +typedef struct _DXGK_MULTIPLANE_OVERLAY_PLANE2 +{ + UINT LayerIndex; // The zero-based index of the overlay plane to display. The top plane (in the z-direction) has index zero. The planes' index values must be sequential from top to bottom. + BOOL Enabled; // Indicates whether the overlay plane specified by LayerIndex is enabled for display. + + UINT AllocationSegment; // The identifier of a segment that data is read from. + PHYSICAL_ADDRESS AllocationAddress; // A PHYSICAL_ADDRESS data type (which is defined as LARGE_INTEGER) that indicates the physical address, within the segment that AllocationSegment specifies, where the data is read. + HANDLE hAllocation; // A handle to the allocation to be displayed on the overlay plane. + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES2 PlaneAttributes; // A structure of type DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES1 that specifies overlay plane attributes. +} DXGK_MULTIPLANE_OVERLAY_PLANE2; + +typedef struct _DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2 +{ + UINT ContextCount; // The number of contexts in the array that the Context member specifies. + HANDLE Context[1+D3DDDI_MAX_BROADCAST_CONTEXT]; // An array of handles to the contexts that contributed to a display operation. + + DXGK_SETVIDPNSOURCEADDRESS_FLAGS Flags; // A DXGK_SETVIDPNSOURCEADDRESS_FLAGS structure that identifies the type of display operation to perform. + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // An integer that identifies a video present source on the display adapter. + + UINT PlaneCount; // The number of overlay planes in the pPlanes list. + DXGK_MULTIPLANE_OVERLAY_PLANE2* pPlanes; // An array of DXGK_MULTIPLANE_OVERLAY_PLANE2 structures that specify the overlay planes to display. + UINT Duration; // The length of time, in units of 100 nanoseconds, between when the current present operation flips to the screen and the next vertical blanking interrupt occurs. +} DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2; + +typedef _In_ CONST DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2* IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2 + pSetVidPnSourceAddressWithMultiPlaneOverlay + ); + +typedef _In_ CONST DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2* + IN_CONST_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2; + +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) +#define DXGK_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3_DURATION_MAX (UINT)-1 +#endif + +typedef struct _DXGK_PRIMARYCONTEXTDATA +{ + HANDLE hContext; + HANDLE hAllocation; + WORD SegmentId; + PHYSICAL_ADDRESS SegmentAddress; +} DXGK_PRIMARYCONTEXTDATA; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_PLANE3 +{ + UINT LayerIndex; + ULONGLONG PresentId; + DXGK_PLANE_SPECIFIC_INPUT_FLAGS InputFlags; + DXGK_PLANE_SPECIFIC_OUTPUT_FLAGS OutputFlags; + UINT MaxImmediateFlipLine; + UINT ContextCount; + _Field_size_(ContextCount) DXGK_PRIMARYCONTEXTDATA** ppContextData; + + UINT DriverPrivateDataSize; + _Field_size_bytes_(DriverPrivateDataSize) + PVOID pDriverPrivateData; + + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES3 PlaneAttributes; +} DXGK_MULTIPLANE_OVERLAY_PLANE3; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION_FLAGS +{ + union + { + struct + { + UINT VerticalFlip : 1; // 0x00000001 + UINT HorizontalFlip : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC + }; + UINT Value; + }; +} DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION_FLAGS; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION +{ + DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION_FLAGS Flags; + RECT SrcRect; + RECT DstRect; + D3DDDI_ROTATION Rotation; +} DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#define DXGK_HWFLIPQUEUE_TIMESTAMP_CANCELLED (0ui64) + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9 + +typedef struct _DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3 +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + DXGK_SETVIDPNSOURCEADDRESS_INPUT_FLAGS InputFlags; + DXGK_SETVIDPNSOURCEADDRESS_OUTPUT_FLAGS OutputFlags; + + UINT PlaneCount; + _Field_size_(PlaneCount) DXGK_MULTIPLANE_OVERLAY_PLANE3** ppPlanes; + DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION* pPostComposition; + UINT Duration; + DXGK_HDR_METADATA* pHDRMetaData; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + UINT64 TargetFlipTime; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9 +} DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3; + +typedef _Inout_ DXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3* IN_OUT_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +NTSTATUS +APIENTRY +DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3 + pSetVidPnSourceAddressWithMultiPlaneOverlay + ); + +typedef struct _DXGKARG_POSTMULTIPLANEOVERLAYPRESENT +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; + UINT PhysicalAdapterMask; + DWORD LayerIndex; + ULONGLONG PresentID; +} DXGKARG_POSTMULTIPLANEOVERLAYPRESENT; + +typedef _In_ CONST DXGKARG_POSTMULTIPLANEOVERLAYPRESENT* IN_CONST_PDXGKARG_POSTMULTIPLANEOVERLAYPRESENT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_POSTMULTIPLANEOVERLAYPRESENT) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_POSTMULTIPLANEOVERLAYPRESENT( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_POSTMULTIPLANEOVERLAYPRESENT + pPostPresent + ); + +typedef struct _DXGKARG_VALIDATEUPDATEALLOCPROPERTY +{ + HANDLE hAllocation; // [in] Handle to the driver open allocation to be updated. + UINT SupportedSegmentSet; // [in] New supported segment set, ignored if the same. + D3DDDI_SEGMENTPREFERENCE PreferredSegment; // [in] New preferred segment set, ignored if the same. + D3DDDI_UPDATEALLOCPROPERTY_FLAGS Flags; // [in] Flags to set on the allocation, ignored if the same. + union + { + struct + { + UINT SetAccessedPhysically : 1; // [in] When set to 1, will set AccessedPhysically to new value + UINT SetSupportedSegmentSet : 1; // [in] When set to 1, will set SupportedSegmentSet to new value + UINT SetPreferredSegment : 1; // [in] When set to 1, will set PreferredSegment to new value + UINT Reserved : 29; + }; + UINT PropertyMaskValue; + }; +} DXGKARG_VALIDATEUPDATEALLOCPROPERTY; + +typedef _In_ CONST DXGKARG_VALIDATEUPDATEALLOCPROPERTY* IN_CONST_PDXGKARG_VALIDATEUPDATEALLOCPROPERTY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VALIDATEUPDATEALLOCATIONPROPERTY) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_VALIDATEUPDATEALLOCATIONPROPERTY( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_VALIDATEUPDATEALLOCPROPERTY pValidateUpdateAllocProperty + ); +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGKARG_CREATEPERIODICFRAMENOTIFICATION +{ + HANDLE hAdapter; // [in] Handle to the adapter associated with the VidPnSource + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnTargetId; // [in] The output that the notification will be attached to + UINT64 Time; // [in] Represents an offset before the VSync. + // The Time value may not be longer than a VSync interval. + // In units of 100ns. + UINT NotificationID; // [in] Id that represents this instance of the notification + // used to identify which interrupt has fired. + HANDLE hNotification; // [out] Handle to the notification object, later used to destroy +} DXGKARG_CREATEPERIODICFRAMENOTIFICATION; + +typedef _Inout_ DXGKARG_CREATEPERIODICFRAMENOTIFICATION* INOUT_PDXGKARG_CREATEPERIODICFRAMENOTIFICATION; + +typedef + _Check_return_ + _Function_class_DXGK_ (DXGKARG_CREATEPERIODICFRAMENOTIFICATION) + _IRQL_requires_max_ (PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEPERIODICFRAMENOTIFICATION ( + INOUT_PDXGKARG_CREATEPERIODICFRAMENOTIFICATION pCreatePeriodicFrameNotification + ); + +typedef struct _DXGKARG_DESTROYPERIODICFRAMENOTIFICATION +{ + HANDLE hNotification; // [in] Handle to the notification object to destroy + HANDLE hAdapter; // [in] Handle to the adapter associated with the notification +} DXGKARG_DESTROYPERIODICFRAMENOTIFICATION; + +typedef _In_ CONST DXGKARG_DESTROYPERIODICFRAMENOTIFICATION* IN_CONST_PDXGKARG_DESTROYPERIODICFRAMENOTIFICATION; + +typedef + _Check_return_ + _Function_class_DXGK_ (DXGKARG_DESTROYPERIODICFRAMENOTIFICATION) + _IRQL_requires_max_ (PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYPERIODICFRAMENOTIFICATION ( + IN_CONST_PDXGKARG_DESTROYPERIODICFRAMENOTIFICATION pDestroyPeriodicFrameNotification + ); + +typedef struct _DXGK_MULTIPLANEOVERLAYCAPS +{ + union + { + struct + { + UINT Rotation : 1; // Full rotation + UINT RotationWithoutIndependentFlip : 1; // Rotation, but without simultaneous IndependentFlip support + UINT VerticalFlip : 1; // Can flip the data vertically + UINT HorizontalFlip : 1; // Can flip the data horizontally + UINT StretchRGB : 1; // Supports RGB formats + UINT StretchYUV : 1; // Supports YUV formats + UINT BilinearFilter : 1; // Blinear filtering + UINT HighFilter : 1; // Better than bilinear filtering + UINT Shared : 1; // MPO resources are shared across VidPnSources + UINT Immediate : 1; // Immediate flip support + UINT Plane0ForVirtualModeOnly : 1; // Stretching plane 0 will also stretch the HW cursor and should only be used for virtual mode support + UINT Reserved : 21; + }; + UINT Value; + }; +} DXGK_MULTIPLANEOVERLAYCAPS; + +typedef struct _DXGKARG_GETMULTIPLANEOVERLAYCAPS +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // [in] + UINT MaxPlanes; // [out] Total number of planes supported (including the DWM's primary) + UINT MaxRGBPlanes; // [out] Maximum number of RGB planes supported (including the DWM's primary) + UINT MaxYUVPlanes; // [out] Maximum number of YUV planes supported + DXGK_MULTIPLANEOVERLAYCAPS OverlayCaps; // [out] Plane capabilities + float MaxStretchFactor; // [out] + float MaxShrinkFactor; // [out] +} DXGKARG_GETMULTIPLANEOVERLAYCAPS; + +typedef _Inout_ DXGKARG_GETMULTIPLANEOVERLAYCAPS* IN_OUT_PDXGKARG_GETMULTIPLANEOVERLAYCAPS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_GETMULTIPLANEOVERLAYCAPS) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_GETMULTIPLANEOVERLAYCAPS( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_GETMULTIPLANEOVERLAYCAPS + pGetMultiPlaneOverlayCaps + ); + +typedef struct _DXGKARG_GETPOSTCOMPOSITIONCAPS +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // [in] + float MaxStretchFactor; // [out] + float MaxShrinkFactor; // [out] +} DXGKARG_GETPOSTCOMPOSITIONCAPS; + +typedef _Inout_ DXGKARG_GETPOSTCOMPOSITIONCAPS* IN_OUT_PDXGKARG_GETPOSTCOMPOSITIONCAPS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_GETPOSTCOMPOSITIONCAPS) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_GETPOSTCOMPOSITIONCAPS( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_GETPOSTCOMPOSITIONCAPS + pGetPostCompositionCaps + ); +#endif //(DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) +typedef struct _DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT +{ + UINT PlaneCount; + DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_PLANE* pPlanes; + BOOL Supported; + DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO ReturnInfo; +} DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT; + +typedef _Inout_ DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT* IN_OUT_PDXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT + pCheckMultiPlaneOverlaySupport + ); +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT2) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT2( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT2 + pCheckMultiPlaneOverlaySupport + ); +#endif // DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) +typedef struct _DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE2 +{ + HANDLE hAllocation; + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + UINT LayerIndex; + DXGK_MULTIPLANE_OVERLAY_ATTRIBUTES3 PlaneAttributes; +} DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE2; + +typedef struct _DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION_WITH_SOURCE +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION PostComposition; +} DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION_WITH_SOURCE; + +typedef struct _DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT3 +{ + UINT PlaneCount; + _Field_size_(PlaneCount) DXGK_MULTIPLANE_OVERLAY_PLANE_WITH_SOURCE2** ppPlanes; + UINT PostCompositionCount; + _Field_size_(PostCompositionCount) DXGK_MULTIPLANE_OVERLAY_POST_COMPOSITION_WITH_SOURCE** ppPostComposition; + BOOL Supported; + DXGK_CHECK_MULTIPLANE_OVERLAY_SUPPORT_RETURN_INFO ReturnInfo; +} DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT3; + +typedef _Inout_ DXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT3* IN_OUT_PDXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT3; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT3) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT3( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_CHECKMULTIPLANEOVERLAYSUPPORT3 + pCheckMultiPlaneOverlaySupport + ); +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +/*++ +Routine Description: + SetVidPnSourceVisibility LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pSetVidPnSourceVisibility + ->VidPnSourceId - ID of the VidPN source whose state needs to be changed. + + ->Visible - Visible or not for the specified VidPN source. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + +Side-effects: + When Visible == TRUE, tells the miniport to scan out data from the primary surface + associated with the the specified VidPN source to the VidPN target(s) connected + to that source by the active VidPN's topology. + When Visible == FALSE, tells miniport the miniport to stop reading from the primary surface + associated with the specified VidPN source and present black on all the VidPN targets + connected to that source via by active VidPN's topology. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef struct _DXGKARG_SETVIDPNSOURCEVISIBILITY +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + BOOLEAN Visible; +} DXGKARG_SETVIDPNSOURCEVISIBILITY; + +typedef _In_ CONST DXGKARG_SETVIDPNSOURCEVISIBILITY* IN_CONST_PDXGKARG_SETVIDPNSOURCEVISIBILITY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETVIDPNSOURCEVISIBILITY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETVIDPNSOURCEVISIBILITY( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETVIDPNSOURCEVISIBILITY pSetVidPnSourceVisibility + ); + +/*++ +Routine Description: + CommitVidPn LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pCommitVidPnArg + ->hFunctionalVidPn - Handle of a functional VidPN to commit to h/w. + + ->AffectedVidPnSourceId - ID of the VidPN source for which the commit should take place. + + ->MonitorConnectivityChecks - Specifies miniport whether to validate specified VidPN's topology + against connected monitors or ignore its monitor connectivity checks. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_VIDPN* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Side-effects: + Commits the specified functional VidPN to h/w. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef struct _DXGKARG_COMMITVIDPN_FLAGS +{ + UINT PathPowerTransition : 1; + UINT PathPoweredOff : 1; + UINT Reserved : 30; +} DXGKARG_COMMITVIDPN_FLAGS; + +typedef struct _DXGKARG_COMMITVIDPN +{ + IN D3DKMDT_HVIDPN hFunctionalVidPn; + IN D3DDDI_VIDEO_PRESENT_SOURCE_ID AffectedVidPnSourceId; + IN D3DKMDT_MONITOR_CONNECTIVITY_CHECKS MonitorConnectivityChecks; + IN HANDLE hPrimaryAllocation; // Driver assigned primary surface allocation handle. + IN DXGKARG_COMMITVIDPN_FLAGS Flags; +} DXGKARG_COMMITVIDPN; + +typedef _In_ CONST DXGKARG_COMMITVIDPN* CONST IN_CONST_PDXGKARG_COMMITVIDPN_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_COMMITVIDPN) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_COMMITVIDPN( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_COMMITVIDPN_CONST pCommitVidPn + ); + + +/*++ +Routine Description: + UpdateActiveVidPnPresentPath LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pUpdateActiveVidPnPresentPathArg + ->VidPnPresentPathInfo - VidPN present path information to update the respective + present path in the active VidPN with. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_VIDPN* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Side-effects: + Updates settings on the specified VidPN present path of the active VidPN set on the adapter. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef struct _DXGKARG_UPDATEACTIVEVIDPNPRESENTPATH +{ + IN D3DKMDT_VIDPN_PRESENT_PATH VidPnPresentPathInfo; +} DXGKARG_UPDATEACTIVEVIDPNPRESENTPATH; + +typedef _In_ CONST DXGKARG_UPDATEACTIVEVIDPNPRESENTPATH* CONST IN_CONST_PDXGKARG_UPDATEACTIVEVIDPNPRESENTPATH_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_UPDATEACTIVEVIDPNPRESENTPATH_CONST pUpdateActiveVidPnPresentPath + ); + + +/*++ +Routine Description: + RecommendVidPnTopology LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pUpdateActiveVidPnPresentPathArg + ->hVidPn - Handle of the VidPN whose topology is to be augmented with miniport's recommendation. + + ->VidPnSourceId - ID of the VidPN source for which miniport is asked to recommend path(s). + + ->RequestReason - Reason why OS asked for recommendation. + + ->hFallbackVidPn - Handle of the VidPN that OS will use if miniport provides no recommendation. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY + - Miniport has no recommendation for augmentation of the specified VidPN's topology. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_{VIDPN|MONITOR|* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Side-effects: + On success, topology of the specified VidPN is augmented with miniport's recommendation with path(s) + originating from the specified source. + +Remarks: + On success, miniport must add at least one path to the specified VidPN's source. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef enum _DXGK_RECOMMENDVIDPNTOPOLOGY_REASON +{ + DXGK_RVT_UNINITIALIZED = 0, + DXGK_RVT_INITIALIZATION_NOLKG = 1, + DXGK_RVT_AUGMENTATION_NOLKG = 2, + DXGK_RVT_AUGMENTATION_LKGOVERRIDE = 3, + DXGK_RVT_INITIALIZATION_LKGOVERRIDE = 4, +} +DXGK_RECOMMENDVIDPNTOPOLOGY_REASON; + +typedef struct _DXGKARG_RECOMMENDVIDPNTOPOLOGY +{ + IN D3DKMDT_HVIDPN hVidPn; + IN D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; + IN DXGK_RECOMMENDVIDPNTOPOLOGY_REASON RequestReason; + IN D3DKMDT_HVIDPNTOPOLOGY hFallbackTopology; +} DXGKARG_RECOMMENDVIDPNTOPOLOGY; + +typedef _In_ CONST DXGKARG_RECOMMENDVIDPNTOPOLOGY* CONST IN_CONST_PDXGKARG_RECOMMENDVIDPNTOPOLOGY_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RECOMMENDVIDPNTOPOLOGY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RECOMMENDVIDPNTOPOLOGY( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_RECOMMENDVIDPNTOPOLOGY_CONST pRecommendVidPnTopology + ); + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_VIDPNTOPOLOGY_INTERFACE +// NOTE: Exposed by OS to miniport via DXGK_VIDPN_INTERFACE::pfnGetTopology + +typedef _In_ CONST D3DKMDT_HVIDPNTOPOLOGY IN_CONST_D3DKMDT_HVIDPNTOPOLOGY; +typedef _In_ D3DKMDT_HVIDPNTOPOLOGY IN_D3DKMDT_HVIDPNTOPOLOGY; +typedef _In_ CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID; +typedef _In_ CONST D3DDDI_VIDEO_PRESENT_TARGET_ID IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID; +typedef _In_ CONST D3DKMDT_VIDPN_PRESENT_PATH_INDEX IN_CONST_D3DKMDT_VIDPN_PRESENT_PATH_INDEX; +typedef _Out_ D3DDDI_VIDEO_PRESENT_TARGET_ID* OUT_PD3DDDI_VIDEO_PRESENT_TARGET_ID; +typedef _Out_ D3DDDI_VIDEO_PRESENT_SOURCE_ID* OUT_PD3DDDI_VIDEO_PRESENT_SOURCE_ID; +typedef _Outptr_ D3DKMDT_VIDPN_PRESENT_PATH** DEREF_OUT_PPD3DKMDT_VIDPN_PRESENT_PATH; +typedef _Outptr_ CONST D3DKMDT_VIDPN_PRESENT_PATH** DEREF_OUT_CONST_PPD3DKMDT_VIDPN_PRESENT_PATH; +typedef _In_ D3DKMDT_VIDPN_PRESENT_PATH* IN_PD3DKMDT_VIDPN_PRESENT_PATH; +typedef _In_ CONST D3DKMDT_VIDPN_PRESENT_PATH* IN_CONST_PD3DKMDT_VIDPN_PRESENT_PATH; +typedef _In_ CONST D3DKMDT_VIDPN_PRESENT_PATH* CONST IN_CONST_PD3DKMDT_VIDPN_PRESENT_PATH_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_GETNUMPATHS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_GETNUMPATHS)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + OUT_PSIZE_T pNumPaths + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_GETNUMPATHSFROMSOURCE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_GETNUMPATHSFROMSOURCE)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + OUT_PSIZE_T pNumPathsFromSource + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_ENUMPATHTARGETSFROMSOURCE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_ENUMPATHTARGETSFROMSOURCE)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + IN_CONST_D3DKMDT_VIDPN_PRESENT_PATH_INDEX VidPnPresentPathIndex, + OUT_PD3DDDI_VIDEO_PRESENT_TARGET_ID pVidPnTargetId + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_GETPATHSOURCEFROMTARGET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_GETPATHSOURCEFROMTARGET)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidTopology, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + OUT_PD3DDDI_VIDEO_PRESENT_SOURCE_ID pVidPnSourceId + ); + +// NOTE: To dispose of use DXGDMM_VIDPNTOPOLOGY_INTERFACE::pfnReleasePathInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_ACQUIREPATHINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_ACQUIREPATHINFO)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_PRESENT_PATH ppVidPnPresentPathInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_ACQUIREFIRSTPATHINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_ACQUIREFIRSTPATHINFO)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_PRESENT_PATH ppFirstVidPnPresentPathInfo + ); + + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_ACQUIRENEXTPATHINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_ACQUIRENEXTPATHINFO)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_CONST_PD3DKMDT_VIDPN_PRESENT_PATH_CONST pVidPnPresentPathInfo, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_PRESENT_PATH ppNextVidPnPresentPathInfo + ); + +// NOTE: This updates what the path supports for transformations. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_UPDATEPATHSUPPORTINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_UPDATEPATHSUPPORTINFO)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY i_hVidPnTopology, + IN_CONST_PD3DKMDT_VIDPN_PRESENT_PATH i_pVidPnPresentPathInfo + ); + +// NOTE: To dispose of use DXGDMM_VIDPNTOPOLOGY_INTERFACE::pfnReleasePathInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_RELEASEPATHINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_RELEASEPATHINFO)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_CONST_PD3DKMDT_VIDPN_PRESENT_PATH_CONST pVidPnPresentPathInfo + ); + +// NOTE: To dispose of use DXGDMM_VIDPNTOPOLOGY_INTERFACE::pfnReleasePathInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_CREATENEWPATHINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_CREATENEWPATHINFO)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + DEREF_OUT_PPD3DKMDT_VIDPN_PRESENT_PATH ppNewVidPnPresentPathInfo + ); + +// NOTE: Releases the new path info, rendering it inaccessible. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_ADDPATH) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_ADDPATH)( + IN_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_PD3DKMDT_VIDPN_PRESENT_PATH pVidPnPresentPath + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTOPOLOGY_REMOVEPATH) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTOPOLOGY_REMOVEPATH)( + IN_CONST_D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId + ); + +typedef struct _DXGK_VIDPNTOPOLOGY_INTERFACE +{ + DXGKDDI_VIDPNTOPOLOGY_GETNUMPATHS pfnGetNumPaths; + DXGKDDI_VIDPNTOPOLOGY_GETNUMPATHSFROMSOURCE pfnGetNumPathsFromSource; + DXGKDDI_VIDPNTOPOLOGY_ENUMPATHTARGETSFROMSOURCE pfnEnumPathTargetsFromSource; + DXGKDDI_VIDPNTOPOLOGY_GETPATHSOURCEFROMTARGET pfnGetPathSourceFromTarget; + DXGKDDI_VIDPNTOPOLOGY_ACQUIREPATHINFO pfnAcquirePathInfo; + DXGKDDI_VIDPNTOPOLOGY_ACQUIREFIRSTPATHINFO pfnAcquireFirstPathInfo; + DXGKDDI_VIDPNTOPOLOGY_ACQUIRENEXTPATHINFO pfnAcquireNextPathInfo; + DXGKDDI_VIDPNTOPOLOGY_UPDATEPATHSUPPORTINFO pfnUpdatePathSupportInfo; + DXGKDDI_VIDPNTOPOLOGY_RELEASEPATHINFO pfnReleasePathInfo; + DXGKDDI_VIDPNTOPOLOGY_CREATENEWPATHINFO pfnCreateNewPathInfo; + DXGKDDI_VIDPNTOPOLOGY_ADDPATH pfnAddPath; + DXGKDDI_VIDPNTOPOLOGY_REMOVEPATH pfnRemovePath; +} DXGK_VIDPNTOPOLOGY_INTERFACE; + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_VIDPNSOURCEMODESET_INTERFACE (exposed by OS to miniport) +// NOTE: Exposed by OS to miniport via DXGK_VIDPN_INTERFACE::pfnAcquireSourceModeSet. + +typedef _In_ D3DKMDT_HVIDPNSOURCEMODESET IN_D3DKMDT_HVIDPNSOURCEMODESET; +typedef _In_ CONST D3DKMDT_HVIDPNSOURCEMODESET IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET; +typedef _In_ D3DKMDT_VIDPN_SOURCE_MODE* CONST IN_PD3DKMDT_VIDPN_SOURCE_MODE_CONST; +typedef _In_ CONST D3DKMDT_VIDPN_SOURCE_MODE* CONST IN_CONST_PD3DKMDT_VIDPN_SOURCE_MODE_CONST; +typedef _Outptr_ D3DKMDT_VIDPN_SOURCE_MODE** DEREF_OUT_PPD3DKMDT_VIDPN_SOURCE_MODE; +typedef _Outptr_ CONST D3DKMDT_VIDPN_SOURCE_MODE** DEREF_OUT_CONST_PPD3DKMDT_VIDPN_SOURCE_MODE; +typedef _In_ CONST D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID IN_CONST_D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_GETNUMMODES) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_GETNUMMODES)( + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + OUT_PSIZE_T_CONST pNumSourceModes + ); + +// NOTE: To dispose of use DXGK_VIDPNSOURCEMODESET_INTERFACE::pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_ACQUIREFIRSTMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_ACQUIREFIRSTMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_SOURCE_MODE ppFirstVidPnSourceModeInfo + ); + +// NOTE: To dispose of use DXGK_VIDPNSOURCEMODESET_INTERFACE::pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_ACQUIRENEXTMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_ACQUIRENEXTMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + IN_CONST_PD3DKMDT_VIDPN_SOURCE_MODE_CONST pVidPnSourceModeInfo, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_SOURCE_MODE ppNextVidPnSourceModeInfo + ); + +// NOTE: To dispose of use DXGK_VIDPNSOURCEMODESET_INTERFACE::pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_ACQUIREPINNEDMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_ACQUIREPINNEDMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_SOURCE_MODE ppPinnedVidPnSourceModeInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_RELEASEMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_RELEASEMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + IN_CONST_PD3DKMDT_VIDPN_SOURCE_MODE_CONST pVidPnSourceModeInfo + ); + +// NOTE: To dispose of use DXGK_VIDPNSOURCEMODESET_INTERFACE::pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_CREATENEWMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_CREATENEWMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + DEREF_OUT_PPD3DKMDT_VIDPN_SOURCE_MODE ppNewVidPnSourceModeInfo + ); + +// NOTE: On success, releases the new mode info, rendering it inaccessible. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_ADDMODE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_ADDMODE)( + IN_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + IN_PD3DKMDT_VIDPN_SOURCE_MODE_CONST pVidPnSourceModeInfo + ); + +// NOTE: Mode ID is assigned to the mode by Windows Graphics Kernel at creation time +// using DXGK_VIDPNSOURCEMODESET_INTERFACE::pfnCreateNewModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNSOURCEMODESET_PINMODE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNSOURCEMODESET_PINMODE)( + IN_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet, + IN_CONST_D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID VidPnSourceModeId + ); + +typedef struct _DXGK_VIDPNSOURCEMODESET_INTERFACE +{ + DXGKDDI_VIDPNSOURCEMODESET_GETNUMMODES pfnGetNumModes; + DXGKDDI_VIDPNSOURCEMODESET_ACQUIREFIRSTMODEINFO pfnAcquireFirstModeInfo; + DXGKDDI_VIDPNSOURCEMODESET_ACQUIRENEXTMODEINFO pfnAcquireNextModeInfo; + DXGKDDI_VIDPNSOURCEMODESET_ACQUIREPINNEDMODEINFO pfnAcquirePinnedModeInfo; + DXGKDDI_VIDPNSOURCEMODESET_RELEASEMODEINFO pfnReleaseModeInfo; + DXGKDDI_VIDPNSOURCEMODESET_CREATENEWMODEINFO pfnCreateNewModeInfo; + DXGKDDI_VIDPNSOURCEMODESET_ADDMODE pfnAddMode; + DXGKDDI_VIDPNSOURCEMODESET_PINMODE pfnPinMode; +} DXGK_VIDPNSOURCEMODESET_INTERFACE; + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_VIDPNTARGETMODESET_INTERFACE +// NOTE: Exposed by OS to miniport via DXGK_VIDPN_INTERFACE::pfnAcquireTargetModeSet. + +typedef _In_ D3DKMDT_HVIDPNTARGETMODESET IN_D3DKMDT_HVIDPNTARGETMODESET; +typedef _In_ CONST D3DKMDT_HVIDPNTARGETMODESET IN_CONST_D3DKMDT_HVIDPNTARGETMODESET; +typedef _In_ D3DKMDT_VIDPN_TARGET_MODE* CONST IN_PD3DKMDT_VIDPN_TARGET_MODE_CONST; +typedef _In_ CONST D3DKMDT_VIDPN_TARGET_MODE* CONST IN_CONST_PD3DKMDT_VIDPN_TARGET_MODE_CONST; +typedef _Outptr_ D3DKMDT_VIDPN_TARGET_MODE** DEREF_OUT_PPD3DKMDT_VIDPN_TARGET_MODE; +typedef _Outptr_ CONST D3DKMDT_VIDPN_TARGET_MODE** DEREF_OUT_CONST_PPD3DKMDT_VIDPN_TARGET_MODE; +typedef _In_ CONST D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID IN_CONST_D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_GETNUMMODES) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_GETNUMMODES)( + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + OUT_PSIZE_T_CONST pNumTargetModes + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_ACQUIREFIRSTMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_ACQUIREFIRSTMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_TARGET_MODE ppFirstVidPnTargetModeInfo + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_ACQUIRENEXTMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_ACQUIRENEXTMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + IN_CONST_PD3DKMDT_VIDPN_TARGET_MODE_CONST pVidPnTargetModeInfo, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_TARGET_MODE ppNextVidPnTargetModeInfo + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_ACQUIREPINNEDMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_ACQUIREPINNEDMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + DEREF_OUT_CONST_PPD3DKMDT_VIDPN_TARGET_MODE ppPinnedVidPnTargetModeInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_RELEASEMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_RELEASEMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + IN_CONST_PD3DKMDT_VIDPN_TARGET_MODE_CONST pVidPnTargetModeInfo + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_CREATENEWMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_CREATENEWMODEINFO)( + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + DEREF_OUT_PPD3DKMDT_VIDPN_TARGET_MODE ppNewVidPnTargetModeInfo + ); + +// NOTE: On success, releases the new mode info, rendering it inaccessible. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_ADDMODE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_ADDMODE)( + IN_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + IN_PD3DKMDT_VIDPN_TARGET_MODE_CONST pVidPnTargetModeInfo + ); + +// NOTE: Mode ID is assigned to the mode by Windows Graphics Kernel at creation time +// using DXGKTARGETMODESET_INTERFACE::pfnCreateNewModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPNTARGETMODESET_PINMODE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPNTARGETMODESET_PINMODE)( + IN_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet, + IN_CONST_D3DKMDT_VIDEO_PRESENT_TARGET_MODE_ID VidPnTargetModeId + ); + +typedef struct _DXGK_VIDPNTARGETMODESET_INTERFACE +{ + DXGKDDI_VIDPNTARGETMODESET_GETNUMMODES pfnGetNumModes; + DXGKDDI_VIDPNTARGETMODESET_ACQUIREFIRSTMODEINFO pfnAcquireFirstModeInfo; + DXGKDDI_VIDPNTARGETMODESET_ACQUIRENEXTMODEINFO pfnAcquireNextModeInfo; + DXGKDDI_VIDPNTARGETMODESET_ACQUIREPINNEDMODEINFO pfnAcquirePinnedModeInfo; + DXGKDDI_VIDPNTARGETMODESET_RELEASEMODEINFO pfnReleaseModeInfo; + DXGKDDI_VIDPNTARGETMODESET_CREATENEWMODEINFO pfnCreateNewModeInfo; + DXGKDDI_VIDPNTARGETMODESET_ADDMODE pfnAddMode; + DXGKDDI_VIDPNTARGETMODESET_PINMODE pfnPinMode; +} DXGK_VIDPNTARGETMODESET_INTERFACE; + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_VIDPN_INTERFACE +// NOTE: Exposed by OS to miniport via DXGK_INTERFACESPECIFICDATA::pfnQueryVidPnInterface. + +typedef _In_ D3DKMDT_HVIDPN IN_D3DKMDT_HVIDPN; +typedef _In_ CONST D3DKMDT_HVIDPN IN_CONST_D3DKMDT_HVIDPN; +typedef _Out_ D3DKMDT_HVIDPNTOPOLOGY* OUT_PD3DKMDT_HVIDPNTOPOLOGY; +typedef _Outptr_ CONST DXGK_VIDPNTOPOLOGY_INTERFACE** DEREF_OUT_CONST_PPDXGK_VIDPNTOPOLOGY_INTERFACE; + +////////////// +// Topology // +////////////// + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_GETTOPOLOGY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_GETTOPOLOGY)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + OUT_PD3DKMDT_HVIDPNTOPOLOGY phVidPnTopology, + DEREF_OUT_CONST_PPDXGK_VIDPNTOPOLOGY_INTERFACE ppVidPnTopologyInterface + ); + + +///////////////////// +// Source modality // +///////////////////// + +typedef _In_ CONST D3DKMDT_HVIDPNSOURCEMODESET IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET; +typedef _Out_ D3DKMDT_HVIDPNSOURCEMODESET* OUT_PD3DKMDT_HVIDPNSOURCEMODESET; +typedef _Outptr_ CONST DXGK_VIDPNSOURCEMODESET_INTERFACE** DEREF_OUT_CONST_PPDXGK_VIDPNSOURCEMODESET_INTERFACE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_ACQUIRESOURCEMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_ACQUIRESOURCEMODESET)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + OUT_PD3DKMDT_HVIDPNSOURCEMODESET phVidPnSourceModeSet, + DEREF_OUT_CONST_PPDXGK_VIDPNSOURCEMODESET_INTERFACE ppVidPnSourceModeSetInterface + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_RELEASESOURCEMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_RELEASESOURCEMODESET)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_CREATENEWSOURCEMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_CREATENEWSOURCEMODESET)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + OUT_PD3DKMDT_HVIDPNSOURCEMODESET phNewVidPnSourceModeSet, + DEREF_OUT_CONST_PPDXGK_VIDPNSOURCEMODESET_INTERFACE ppVidPnSourceModeSetInterface + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_ASSIGNSOURCEMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_ASSIGNSOURCEMODESET)( + IN_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + IN_CONST_D3DKMDT_HVIDPNSOURCEMODESET hVidPnSourceModeSet + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_ASSIGNMULTISAMPLINGMETHODSET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_ASSIGNMULTISAMPLINGMETHODSET)( + IN_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, + IN_CONST_SIZE_T NumMethods, + _In_reads_(NumMethods) CONST D3DDDI_MULTISAMPLINGMETHOD* pSupportedMethodSet + ); + + +///////////////////// +// Target modality // +///////////////////// + +typedef _In_ CONST D3DKMDT_HVIDPNTARGETMODESET IN_CONST_D3DKMDT_HVIDPNTARGETMODESET; +typedef _Out_ D3DKMDT_HVIDPNTARGETMODESET* OUT_PD3DKMDT_HVIDPNTARGETMODESET; +typedef _Outptr_ CONST DXGK_VIDPNTARGETMODESET_INTERFACE** DEREF_OUT_CONST_PPDXGK_VIDPNTARGETMODESET_INTERFACE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_ACQUIRETARGETMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_ACQUIRETARGETMODESET)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + OUT_PD3DKMDT_HVIDPNTARGETMODESET phVidPnTargetModeSet, + DEREF_OUT_CONST_PPDXGK_VIDPNTARGETMODESET_INTERFACE ppVidPnTargetModeSetInterface + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_RELEASETARGETMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_RELEASETARGETMODESET)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_CREATENEWTARGETMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_CREATENEWTARGETMODESET)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + OUT_PD3DKMDT_HVIDPNTARGETMODESET phNewVidPnTargetModeSet, + DEREF_OUT_CONST_PPDXGK_VIDPNTARGETMODESET_INTERFACE ppVidPnTargetModeSetInterace + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_VIDPN_ASSIGNTARGETMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_VIDPN_ASSIGNTARGETMODESET)( + IN_D3DKMDT_HVIDPN hVidPn, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + IN_CONST_D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet + ); + + +// DXGK_VIDPN_INTERFACE interface versions. +typedef enum _DXGK_VIDPN_INTERFACE_VERSION +{ + DXGK_VIDPN_INTERFACE_VERSION_UNINITIALIZED = 0, + DXGK_VIDPN_INTERFACE_VERSION_V1 = 1, + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + DXGK_VIDPN_INTERFACE_VERSION_V2 = 2, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) +} DXGK_VIDPN_INTERFACE_VERSION; + +typedef struct _DXGK_VIDPN_INTERFACE +{ + // Specifies the version of this interface as well as all the sub-interfaces, which are accessible + // only via this interface (i.e. DXGK_VIDPNTOPOLOGY_INTERFACE, DXGK_VIDPNSOURCEMODESET_INTERFACE, + // and DXGK_VIDPNTARGETMODESET_INTERFACE). + DXGK_VIDPN_INTERFACE_VERSION Version; + + // Topology + DXGKDDI_VIDPN_GETTOPOLOGY pfnGetTopology; + + // Source modality + DXGKDDI_VIDPN_ACQUIRESOURCEMODESET pfnAcquireSourceModeSet; + DXGKDDI_VIDPN_RELEASESOURCEMODESET pfnReleaseSourceModeSet; + DXGKDDI_VIDPN_CREATENEWSOURCEMODESET pfnCreateNewSourceModeSet; + DXGKDDI_VIDPN_ASSIGNSOURCEMODESET pfnAssignSourceModeSet; + DXGKDDI_VIDPN_ASSIGNMULTISAMPLINGMETHODSET pfnAssignMultisamplingMethodSet; + + // Target modality + DXGKDDI_VIDPN_ACQUIRETARGETMODESET pfnAcquireTargetModeSet; + DXGKDDI_VIDPN_RELEASETARGETMODESET pfnReleaseTargetModeSet; + DXGKDDI_VIDPN_CREATENEWTARGETMODESET pfnCreateNewTargetModeSet; + DXGKDDI_VIDPN_ASSIGNTARGETMODESET pfnAssignTargetModeSet; +} +DXGK_VIDPN_INTERFACE; + + +// Callback miniport uses to query DXGK_VIDPN_INTERFACE. + +typedef _In_ CONST DXGK_VIDPN_INTERFACE_VERSION IN_CONST_DXGK_VIDPN_INTERFACE_VERSION; +typedef _Outptr_ CONST DXGK_VIDPN_INTERFACE** DEREF_OUT_CONST_PPDXGK_VIDPN_INTERFACE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_QUERYVIDPNINTERFACE) + _IRQL_requires_max_(APC_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_QUERYVIDPNINTERFACE)( + IN_CONST_D3DKMDT_HVIDPN hVidPn, + IN_CONST_DXGK_VIDPN_INTERFACE_VERSION VidPnInterfaceVersion, + DEREF_OUT_CONST_PPDXGK_VIDPN_INTERFACE ppVidPnInterface + ); + + +///////////////////////////// +// Monitor source modality // +///////////////////////////// + +typedef _In_ CONST D3DKMDT_HMONITORSOURCEMODESET IN_CONST_D3DKMDT_HMONITORSOURCEMODESET; +typedef _In_ D3DKMDT_MONITOR_SOURCE_MODE* CONST IN_PD3DKMDT_MONITOR_SOURCE_MODE_CONST; +typedef _In_ CONST D3DKMDT_MONITOR_SOURCE_MODE* CONST IN_CONST_PD3DKMDT_MONITOR_SOURCE_MODE_CONST; +typedef _Outptr_ D3DKMDT_MONITOR_SOURCE_MODE** DEREF_OUT_PPD3DKMDT_MONITOR_SOURCE_MODE; +typedef _Outptr_ CONST D3DKMDT_MONITOR_SOURCE_MODE** DEREF_OUT_CONST_PPD3DKMDT_MONITOR_SOURCE_MODE; + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_MONITORSOURCEMODESET_INTERFACE +// NOTE: Exposed by OS to miniport via DXGK_MONITOR_INTERFACE::pfnAcquireMonitorSourceModeSet. + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_GETNUMMODES) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_GETNUMMODES)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + OUT_PSIZE_T_CONST pNumMonitorSourceModes + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_ACQUIREPREFERREDMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_ACQUIREPREFERREDMODEINFO)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_SOURCE_MODE ppFirstMonitorSourceModeInfo + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_ACQUIREFIRSTMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_ACQUIREFIRSTMODEINFO)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_SOURCE_MODE ppFirstMonitorSourceModeInfo + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_ACQUIRENEXTMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_ACQUIRENEXTMODEINFO)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + IN_CONST_PD3DKMDT_MONITOR_SOURCE_MODE_CONST pMonitorSourceModeInfo, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_SOURCE_MODE ppNextMonitorSourceModeInfo + ); + +// NOTE: To dispose of use pfnReleaseModeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_CREATENEWMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_CREATENEWMODEINFO)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + DEREF_OUT_PPD3DKMDT_MONITOR_SOURCE_MODE ppNewMonitorSourceModeInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_ADDMODE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_ADDMODE)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + IN_PD3DKMDT_MONITOR_SOURCE_MODE_CONST pMonitorSourceModeInfo + ); + +// NOTE: On success, releases the new mode info, rendering it inaccessible. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORSOURCEMODESET_RELEASEMODEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORSOURCEMODESET_RELEASEMODEINFO)( + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet, + IN_CONST_PD3DKMDT_MONITOR_SOURCE_MODE_CONST pMonitorSourceModeInfo + ); + + +typedef struct _DXGK_MONITORSOURCEMODESET_INTERFACE +{ + DXGKDDI_MONITORSOURCEMODESET_GETNUMMODES pfnGetNumModes; + DXGKDDI_MONITORSOURCEMODESET_ACQUIREPREFERREDMODEINFO pfnAcquirePreferredModeInfo; + DXGKDDI_MONITORSOURCEMODESET_ACQUIREFIRSTMODEINFO pfnAcquireFirstModeInfo; + DXGKDDI_MONITORSOURCEMODESET_ACQUIRENEXTMODEINFO pfnAcquireNextModeInfo; + DXGKDDI_MONITORSOURCEMODESET_CREATENEWMODEINFO pfnCreateNewModeInfo; + DXGKDDI_MONITORSOURCEMODESET_ADDMODE pfnAddMode; + DXGKDDI_MONITORSOURCEMODESET_RELEASEMODEINFO pfnReleaseModeInfo; +} DXGK_MONITORSOURCEMODESET_INTERFACE; + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_MONITORFREQUENCYRANGESET_INTERFACE +// NOTE: Exposed by OS to miniport via DXGK_MONITOR_INTERFACE::pfnAcquireMonitorFrequencyRangeSet. + +typedef _In_ CONST D3DKMDT_HMONITORFREQUENCYRANGESET IN_CONST_D3DKMDT_HMONITORFREQUENCYRANGESET; +typedef _In_ CONST D3DKMDT_MONITOR_FREQUENCY_RANGE* CONST IN_CONST_PD3DKMDT_MONITOR_FREQUENCY_RANGE_CONST; +typedef _Outptr_ CONST D3DKMDT_MONITOR_FREQUENCY_RANGE** DEREF_OUT_CONST_PPD3DKMDT_MONITOR_FREQUENCY_RANGE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORFREQUENCYRANGESET_GETNUMFREQUENCYRANGES) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORFREQUENCYRANGESET_GETNUMFREQUENCYRANGES)( + IN_CONST_D3DKMDT_HMONITORFREQUENCYRANGESET hMonitorFrequencyRangeSet, + OUT_PSIZE_T_CONST pNumMonitorFrequencyRanges + ); + +// NOTE: To dispose of use pfnReleaseFrequencyRangeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORFREQUENCYRANGESET_ACQUIREFIRSTFREQUENCYRANGEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORFREQUENCYRANGESET_ACQUIREFIRSTFREQUENCYRANGEINFO)( + IN_CONST_D3DKMDT_HMONITORFREQUENCYRANGESET hMonitorFrequencyRangeSet, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_FREQUENCY_RANGE ppFirstMonitorFrequencyRangeInfo + ); + +// NOTE: To dispose of use pfnReleaseFrequencyRangeInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORFREQUENCYRANGESET_ACQUIRENEXTFREQUENCYRANGEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORFREQUENCYRANGESET_ACQUIRENEXTFREQUENCYRANGEINFO)( + IN_CONST_D3DKMDT_HMONITORFREQUENCYRANGESET hMonitorFrequencyRangeSet, + IN_CONST_PD3DKMDT_MONITOR_FREQUENCY_RANGE_CONST pMonitorFrequencyRangeInfo, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_FREQUENCY_RANGE ppNextMonitorFrequencyRangeInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORFREQUENCYRANGESET_RELEASEFREQUENCYRANGEINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORFREQUENCYRANGESET_RELEASEFREQUENCYRANGEINFO)( + IN_CONST_D3DKMDT_HMONITORFREQUENCYRANGESET hMonitorFrequencyRangeSet, + IN_CONST_PD3DKMDT_MONITOR_FREQUENCY_RANGE_CONST pMonitorFrequencyRangeInfo + ); + +typedef struct _DXGK_MONITORFREQUENCYRANGESET_INTERFACE +{ + DXGKDDI_MONITORFREQUENCYRANGESET_GETNUMFREQUENCYRANGES pfnGetNumFrequencyRanges; + DXGKDDI_MONITORFREQUENCYRANGESET_ACQUIREFIRSTFREQUENCYRANGEINFO pfnAcquireFirstFrequencyRangeInfo; + DXGKDDI_MONITORFREQUENCYRANGESET_ACQUIRENEXTFREQUENCYRANGEINFO pfnAcquireNextFrequencyRangeInfo; + DXGKDDI_MONITORFREQUENCYRANGESET_RELEASEFREQUENCYRANGEINFO pfnReleaseFrequencyRangeInfo; +} DXGK_MONITORFREQUENCYRANGESET_INTERFACE; + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DXGK_MONITORDESCRIPTORSET_INTERFACE +// NOTE: Exposed by OS to miniport via DXGK_MONITOR_INTERFACE::pfnAcquireMonitorDescriptorSet. + +typedef _In_ CONST D3DKMDT_HMONITORDESCRIPTORSET IN_CONST_D3DKMDT_HMONITORDESCRIPTORSET; +typedef _In_ CONST D3DKMDT_MONITOR_DESCRIPTOR* CONST IN_CONST_PD3DKMDT_MONITOR_DESCRIPTOR_CONST; +typedef _Outptr_ CONST D3DKMDT_MONITOR_DESCRIPTOR** DEREF_OUT_CONST_PPD3DKMDT_MONITOR_DESCRIPTOR; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORDESCRIPTORSET_GETNUMDESCRIPTORS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORDESCRIPTORSET_GETNUMDESCRIPTORS)( + IN_CONST_D3DKMDT_HMONITORDESCRIPTORSET hMonitorDescriptorSet, + OUT_PSIZE_T_CONST pNumMonitorDescriptors + ); + +// NOTE: To dispose of use pfnReleaseDescriptorInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORDESCRIPTORSET_ACQUIREFIRSTDESCRIPTORINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORDESCRIPTORSET_ACQUIREFIRSTDESCRIPTORINFO)( + IN_CONST_D3DKMDT_HMONITORDESCRIPTORSET hMonitorDescriptorSet, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_DESCRIPTOR ppFirstMonitorDescriptorInfo + ); + +// NOTE: To dispose of use pfnReleaseDescriptorInfo. +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORDESCRIPTORSET_ACQUIRENEXTDESCRIPTORINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORDESCRIPTORSET_ACQUIRENEXTDESCRIPTORINFO)( + IN_CONST_D3DKMDT_HMONITORDESCRIPTORSET hMonitorDescriptorSet, + IN_CONST_PD3DKMDT_MONITOR_DESCRIPTOR_CONST pMonitorDescriptorInfo, + DEREF_OUT_CONST_PPD3DKMDT_MONITOR_DESCRIPTOR ppNextMonitorDescriptorInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITORDESCRIPTORSET_RELEASEDESCRIPTORINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITORDESCRIPTORSET_RELEASEDESCRIPTORINFO)( + IN_CONST_D3DKMDT_HMONITORDESCRIPTORSET hMonitorDescriptorSet, + IN_CONST_PD3DKMDT_MONITOR_DESCRIPTOR_CONST pMonitorDescriptorInfo + ); + +typedef struct _DXGK_MONITORDESCRIPTORSET_INTERFACE +{ + DXGKDDI_MONITORDESCRIPTORSET_GETNUMDESCRIPTORS pfnGetNumDescriptors; + DXGKDDI_MONITORDESCRIPTORSET_ACQUIREFIRSTDESCRIPTORINFO pfnAcquireFirstDescriptorInfo; + DXGKDDI_MONITORDESCRIPTORSET_ACQUIRENEXTDESCRIPTORINFO pfnAcquireNextDescriptorInfo; + DXGKDDI_MONITORDESCRIPTORSET_RELEASEDESCRIPTORINFO pfnReleaseDescriptorInfo; +} DXGK_MONITORDESCRIPTORSET_INTERFACE; + + +typedef _In_ CONST D3DKMDT_ADAPTER IN_CONST_D3DKMDT_ADAPTER; +typedef _Out_ D3DKMDT_HMONITORDESCRIPTORSET* OUT_PD3DKMDT_HMONITORDESCRIPTORSET; +typedef _Out_ D3DKMDT_HMONITORSOURCEMODESET* OUT_PD3DKMDT_HMONITORSOURCEMODESET; +typedef _Out_ D3DKMDT_HMONITORFREQUENCYRANGESET* OUT_PD3DKMDT_HMONITORFREQUENCYRANGESET; +typedef _Outptr_ CONST DXGK_MONITORSOURCEMODESET_INTERFACE** DEREF_OUT_CONST_PPDXGK_MONITORSOURCEMODESET_INTERFACE; +typedef _Outptr_ CONST DXGK_MONITORFREQUENCYRANGESET_INTERFACE** DEREF_OUT_CONST_PPDXGK_MONITORFREQUENCYRANGESET_INTERFACE; +typedef _Outptr_ CONST DXGK_MONITORDESCRIPTORSET_INTERFACE** DEREF_OUT_CONST_PPDXGK_MONITORDESCRIPTORSET_INTERFACE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITOR_ACQUIREMONITORSOURCEMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITOR_ACQUIREMONITORSOURCEMODESET)( + IN_CONST_D3DKMDT_ADAPTER hAdapter, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId, + OUT_PD3DKMDT_HMONITORSOURCEMODESET phMonitorSourceModeSet, + DEREF_OUT_CONST_PPDXGK_MONITORSOURCEMODESET_INTERFACE ppMonitorSourceModeSetInterface + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITOR_RELEASEMONITORSOURCEMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITOR_RELEASEMONITORSOURCEMODESET)( + IN_CONST_D3DKMDT_ADAPTER hAdapter, + IN_CONST_D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITOR_GETMONITORFREQUENCYRANGESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITOR_GETMONITORFREQUENCYRANGESET)( + IN_CONST_D3DKMDT_ADAPTER hAdapter, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId, + OUT_PD3DKMDT_HMONITORFREQUENCYRANGESET phMonitorFrequencyRangeSet, + DEREF_OUT_CONST_PPDXGK_MONITORFREQUENCYRANGESET_INTERFACE ppMonitorFrequencyRangeSetInterface + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITOR_GETMONITORDESCRIPTORSET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITOR_GETMONITORDESCRIPTORSET)( + IN_CONST_D3DKMDT_ADAPTER hAdapter, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId, + OUT_PD3DKMDT_HMONITORDESCRIPTORSET phMonitorDescriptorSet, + DEREF_OUT_CONST_PPDXGK_MONITORDESCRIPTORSET_INTERFACE ppMonitorDescriptorSetInterface + ); + + +// DXGK_MONITOR_INTERFACE interface versions. +typedef enum _DXGK_MONITOR_INTERFACE_VERSION +{ + DXGK_MONITOR_INTERFACE_VERSION_UNINITIALIZED = 0, + DXGK_MONITOR_INTERFACE_VERSION_V1 = 1, + DXGK_MONITOR_INTERFACE_VERSION_V2 = 2, +} DXGK_MONITOR_INTERFACE_VERSION; + +typedef struct _DXGK_MONITOR_INTERFACE +{ + // Specifies the version of this interface as well as all the sub-interfaces, which are accessible + // only via this interface (i.e. DXGK_VIDPNTOPOLOGY_INTERFACE, DXGK_VIDPNSOURCEMODESET_INTERFACE, + // and DXGK_VIDPNTARGETMODESET_INTERFACE). + DXGK_MONITOR_INTERFACE_VERSION Version; + + DXGKDDI_MONITOR_ACQUIREMONITORSOURCEMODESET pfnAcquireMonitorSourceModeSet; + DXGKDDI_MONITOR_RELEASEMONITORSOURCEMODESET pfnReleaseMonitorSourceModeSet; + DXGKDDI_MONITOR_GETMONITORFREQUENCYRANGESET pfnGetMonitorFrequencyRangeSet; + DXGKDDI_MONITOR_GETMONITORDESCRIPTORSET pfnGetMonitorDescriptorSet; +} +DXGK_MONITOR_INTERFACE; + +// Definition of DXGK_MONITOR_INTERFACE interface versions 2 + +typedef _In_ CONST DXGK_TARGETMODE_DETAIL_TIMING* IN_CONST_PDXGK_TARGETMODE_DETAIL_TIMING; +typedef DXGK_TARGETMODE_DETAIL_TIMING** DEREF_ECOUNT_PPDXGK_TARGETMODE_DETAIL_TIMING; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITOR_GETADDITIONALMONITORMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITOR_GETADDITIONALMONITORMODESET)( + IN_CONST_D3DKMDT_ADAPTER hAdapter, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId, + OUT_PUINT pNumberModes, + _At_(*ppAdditionalModesSet, _Inout_updates_(*pNumberModes)) + DEREF_ECOUNT_PPDXGK_TARGETMODE_DETAIL_TIMING ppAdditionalModesSet + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_MONITOR_RELEASEADDITIONALMONITORMODESET) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKDDI_MONITOR_RELEASEADDITIONALMONITORMODESET)( + IN_CONST_D3DKMDT_ADAPTER hAdapter, + IN_CONST_D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId, + IN_CONST_PDXGK_TARGETMODE_DETAIL_TIMING pAdditionalModesSet + ); + + +typedef struct _DXGK_MONITOR_INTERFACE_V2 +{ + // Specifies the version of this interface as well as all the sub-interfaces, which are accessible + // only via this interface (i.e. DXGK_VIDPNTOPOLOGY_INTERFACE, DXGK_VIDPNSOURCEMODESET_INTERFACE, + // and DXGK_VIDPNTARGETMODESET_INTERFACE). Miniport driver MUST check interface version before using + // this interface. All the old field in this interface must keep exactly same sequence as old + // DXGK_MONITOR_INTERFACE. + DXGK_MONITOR_INTERFACE_VERSION Version; + + DXGKDDI_MONITOR_ACQUIREMONITORSOURCEMODESET pfnAcquireMonitorSourceModeSet; + DXGKDDI_MONITOR_RELEASEMONITORSOURCEMODESET pfnReleaseMonitorSourceModeSet; + DXGKDDI_MONITOR_GETMONITORFREQUENCYRANGESET pfnGetMonitorFrequencyRangeSet; + DXGKDDI_MONITOR_GETMONITORDESCRIPTORSET pfnGetMonitorDescriptorSet; + + // New added functions for DXGK_MONITOR_INTERFACE_V2 + DXGKDDI_MONITOR_GETADDITIONALMONITORMODESET pfnGetAdditionalMonitorModeSet; + DXGKDDI_MONITOR_RELEASEADDITIONALMONITORMODESET pfnReleaseAdditionalMonitorModeSet; +} +DXGK_MONITOR_INTERFACE_V2; + +// Callback miniport uses to query DXGK_MONITOR_INTERFACE. + +typedef _In_ CONST DXGK_MONITOR_INTERFACE_VERSION IN_CONST_DXGK_MONITOR_INTERFACE_VERSION; +typedef _Outptr_ CONST DXGK_MONITOR_INTERFACE** DEREF_OUT_CONST_PPDXGK_MONITOR_INTERFACE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_QUERYMONITORINTERFACE) + _IRQL_requires_max_(APC_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_QUERYMONITORINTERFACE)( + IN_CONST_HANDLE hAdapter, + IN_CONST_DXGK_MONITOR_INTERFACE_VERSION MonitorInterfaceVersion, + DEREF_OUT_CONST_PPDXGK_MONITOR_INTERFACE ppMonitorInterface + ); + + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + +/////////////////////////////////////////////////////////////// +// New DMM DDIs for CCD support +// + +typedef struct _DXGKARG_QUERYVIDPNHWCAPABILITY +{ + IN D3DKMDT_HVIDPN hFunctionalVidPn; + IN D3DDDI_VIDEO_PRESENT_SOURCE_ID SourceId; + IN D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; + OUT D3DKMDT_VIDPN_HW_CAPABILITY VidPnHWCaps; +} +DXGKARG_QUERYVIDPNHWCAPABILITY; + +typedef _Inout_ DXGKARG_QUERYVIDPNHWCAPABILITY* INOUT_PDXGKARG_QUERYVIDPNHWCAPABILITY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYVIDPNHWCAPABILITY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYVIDPNHWCAPABILITY( + IN_CONST_HANDLE i_hAdapter, + INOUT_PDXGKARG_QUERYVIDPNHWCAPABILITY io_pVidPnHWCaps + ); +/*++ +Routine Description: + Calls miniport to report the hardware capability on a specified functional VidPN + supported by the adapter. + +Arguments: + i_hAdapter + -> WDDM display miniport adapter handle. + + io_pVidPnHWCaps + + -> hFunctionalVidPn + - handle of a functional VidPn to query hardware capability on. + + -> hTargetId + - ID of the target in the path this query on. + + -> VidPnHWCaps + - structure to hold the returned hardware capability. + +Return Value: + STATUS_SUCCESS + - Request completed successfully. + + STATUS_NO_MEMORY + - Low memory condition prevented successful completion of this request. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +// +// Definitions for the kernel mode display only device present. +// + +typedef + _Function_class_DXGK_(DXGKCB_PRESENT_DISPLAYONLY_PROGRESS) + _IRQL_requires_min_(PASSIVE_LEVEL) + _IRQL_requires_max_(PROFILE_LEVEL - 1) +VOID (APIENTRY CALLBACK *DXGKCB_PRESENT_DISPLAYONLY_PROGRESS)( + IN_CONST_HANDLE hAdapter, IN_CONST_PDXGKARGCB_PRESENT_DISPLAYONLY_PROGRESS + ); + +typedef struct _D3DKMT_PRESENT_DISPLAY_ONLY_FLAGS +{ + union + { + struct + { + UINT Rotate : 1; // 0x00000001 + UINT Reserved : 31; // 0xFFFFFFFE + }; + UINT Value; + }; +} D3DKMT_PRESENT_DISPLAY_ONLY_FLAGS; + +typedef struct _DXGKARG_PRESENT_DISPLAYONLY +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPn where the image is presented + VOID* pSource; // in: Start address of source image + ULONG BytesPerPixel; // in: Bytes per pixel in source image + LONG Pitch; // in: Bytes per line in source image + D3DKMT_PRESENT_DISPLAY_ONLY_FLAGS Flags; // in: Flags of current present, + ULONG NumMoves; // in: Number of screen to screen moves + _Field_size_(NumMoves) + D3DKMT_MOVE_RECT* pMoves; // in: Point to the list of moves + ULONG NumDirtyRects; // in: Number of direct rects + _Field_size_(NumDirtyRects) + RECT* pDirtyRect; // in: Point to the list of dirty rects + DXGKCB_PRESENT_DISPLAYONLY_PROGRESS pfnPresentDisplayOnlyProgress; // in: Point to present progress callback +} DXGKARG_PRESENT_DISPLAYONLY; + +typedef _In_ CONST DXGKARG_PRESENT_DISPLAYONLY* IN_CONST_PDXGKARG_PRESENT_DISPLAYONLY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_PRESENTDISPLAYONLY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_PRESENTDISPLAYONLY( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_PRESENT_DISPLAYONLY pPresentDisplayOnly + ); + +#endif // DXGKDDI_INTERFACE_VERSION + +//////////////////// Timeout Detection and Recovery ///////////////////////////////////////////////////////// + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +/////////////////////////////////////////////////////////////// +// New DDIs for TDR support. +// + +typedef struct _DXGKARG_QUERYDEPENDENTENGINEGROUP +{ + UINT NodeOrdinal; // in: node ordinal for the engine being reset + UINT EngineOrdinal; // in: engine ordinal for the engine being reset + ULONGLONG DependentNodeOrdinalMask; // out: bit mask describing all nodes affected by the engine being reset +} DXGKARG_QUERYDEPENDENTENGINEGROUP; + +typedef _Inout_ DXGKARG_QUERYDEPENDENTENGINEGROUP* INOUT_DXGKARG_QUERYDEPENDENTENGINEGROUP; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYDEPENDENTENGINEGROUP) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYDEPENDENTENGINEGROUP( + IN_CONST_HANDLE hAdapter, + INOUT_DXGKARG_QUERYDEPENDENTENGINEGROUP pQueryDependentEngineGroup + ); + +typedef struct _DXGK_ENGINESTATUS +{ + union + { + struct + { + UINT Responsive : 1; // 0x00000001 // set to 1 if the engine is making progress, set to 0 if the engine is not responding to requests to report its progress + UINT Reserved : 31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_ENGINESTATUS; + +typedef struct _DXGKARG_QUERYENGINESTATUS +{ + UINT NodeOrdinal; // in: node ordinal + UINT EngineOrdinal; // in: engine ordinal + DXGK_ENGINESTATUS EngineStatus; // out: engine status +} DXGKARG_QUERYENGINESTATUS; + +typedef _Inout_ DXGKARG_QUERYENGINESTATUS* INOUT_PDXGKARG_QUERYENGINESTATUS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYENGINESTATUS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYENGINESTATUS( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_QUERYENGINESTATUS pQueryEngineStatus + ); + +typedef struct _DXGKARG_RESETENGINE +{ + UINT NodeOrdinal; // in: node ordinal + UINT EngineOrdinal; // in: engine ordinal + UINT LastAbortedFenceId; // out: fence ID of the last packet aborted in the middle of the execution +} DXGKARG_RESETENGINE; + +typedef _Inout_ DXGKARG_RESETENGINE* INOUT_PDXGKARG_RESETENGINE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESETENGINE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RESETENGINE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_RESETENGINE pResetEngine + ); + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGKARG_RESETHWENGINE +{ + UINT NodeOrdinal; // in: node ordinal + UINT EngineOrdinal; // in: engine ordinal +} DXGKARG_RESETHWENGINE; + +typedef _Inout_ DXGKARG_RESETHWENGINE* INOUT_PDXGKARG_RESETHWENGINE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESETHWENGINE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RESETHWENGINE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_RESETHWENGINE pResetHwEngine + ); + +typedef struct _DXGK_INVALIDATEHWCONTEXTFLAGS +{ + union + { + struct + { + UINT CollateralDamage : 1; // 0x00000001 + // When set to 0, indicates that the context being invalidated was the primary cause of the engine hang. + // When set to 1, indicates that the context being invalidated was not the primary cause of the engine hang, + // but still needs to be reset because it was affected by the hang. + + UINT Reserved : 31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_INVALIDATEHWCONTEXTFLAGS; + +typedef struct _DXGKARGCB_INVALIDATEHWCONTEXT +{ + HANDLE hAdapter; // in: Adapter handle + HANDLE hHwContext; // in: For contexts that were invalidated by HW engine reset operation, + // DXG assigned value for the context that was passed to + // DxgkDdiCreateContext. + DXGK_INVALIDATEHWCONTEXTFLAGS Flags; +} DXGKARGCB_INVALIDATEHWCONTEXT; + +typedef _In_ CONST DXGKARGCB_INVALIDATEHWCONTEXT* IN_CONST_PDXGKARGCB_INVALIDATEHWCONTEXT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_INVALIDATEHWCONTEXT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_INVALIDATEHWCONTEXT)( + IN_CONST_PDXGKARGCB_INVALIDATEHWCONTEXT + ); + +typedef +_Function_class_DXGK_(DXGKCB_INDICATE_CONNECTOR_CHANGE) +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_INDICATE_CONNECTOR_CHANGE)( + IN_CONST_HANDLE hAdapter + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESETFROMTIMEOUT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY CALLBACK +DXGKDDI_RESETFROMTIMEOUT( + IN_CONST_HANDLE hAdapter + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESTARTFROMTIMEOUT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY CALLBACK +DXGKDDI_RESTARTFROMTIMEOUT( + IN_CONST_HANDLE hAdapter + ); + +typedef enum _DXGK_ACTIVE_VIDPN_INVALIDATION_REASON +{ + DXGK_AVIR_UNINITIALIZED = DXGK_RFVR_UNINITIALIZED, + DXGK_AVIR_HOTKEY = DXGK_RFVR_HOTKEY, + DXGK_AVIR_USERMODE = DXGK_RFVR_USERMODE, +} +DXGK_ACTIVE_VIDPN_INVALIDATION_REASON; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_UNBLOCKUEFIFRAMEBUFFERRANGES) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_UNBLOCKUEFIFRAMEBUFFERRANGES)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGK_SEGMENTMEMORYSTATE pSegmentMemoryState); +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGK_INTERFACESPECIFICDATA +{ + HANDLE hAdapter; // in: handle to dxgkrnl's adapter object + + // + // D3DDDI interface callback functions + // + DXGKCB_GETHANDLEDATA pfnGetHandleDataCb; + DXGKCB_GETHANDLEPARENT pfnGetHandleParentCb; + DXGKCB_ENUMHANDLECHILDREN pfnEnumHandleChildrenCb; + DXGKCB_NOTIFY_INTERRUPT pfnNotifyInterruptCb; + DXGKCB_NOTIFY_DPC pfnNotifyDpcCb; + DXGKCB_QUERYVIDPNINTERFACE pfnQueryVidPnInterfaceCb; + DXGKCB_GETCAPTUREADDRESS pfnGetCaptureAddressCb; +} DXGK_INTERFACESPECIFICDATA; + +typedef struct _DXGKARG_SETDISPLAYPRIVATEDRIVERFORMAT +{ + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: Identifies which VidPn we are changing the private driver format attribute of + HANDLE PrimaryAllocation; // in: If non zero specifies the current primary allocation for the given VidPn + UINT PrivateDriverFormatAttribute; // in: PrivateFormatAttribute to set for the given VidPn +} DXGKARG_SETDISPLAYPRIVATEDRIVERFORMAT; + +typedef _In_ DXGKARG_SETDISPLAYPRIVATEDRIVERFORMAT* IN_CONST_PDXGKARG_SETDISPLAYPRIVATEDRIVERFORMAT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETDISPLAYPRIVATEDRIVERFORMAT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETDISPLAYPRIVATEDRIVERFORMAT( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETDISPLAYPRIVATEDRIVERFORMAT pSetDisplayPrivateDriverFormat + ); + + +/*++ +Routine Description: + RecommendMonitorModes LDDM display miniport VidPN management DDI method + +Arguments: + hAdapter - LDDM display miniport adapter handle. + + pUpdateActiveVidPnPresentPathArg + ->VideoPresentTargetId - ID of the video present target to which the monitor in question is connected. + + ->hMonitorSourceModeSet - Handle of the monitor mode set. + + ->pMonitorSourceModeSetInterface - Reference to the monitor mode set interface. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_{VIDPN|MONITOR|* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Side-effects: + On success, optionally, adds one or more monitor source modes to the mode set of the monitor connected to the specified target. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef struct _DXGKARG_RECOMMENDMONITORMODES +{ + IN D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId; + IN D3DKMDT_HMONITORSOURCEMODESET hMonitorSourceModeSet; + IN CONST DXGK_MONITORSOURCEMODESET_INTERFACE* pMonitorSourceModeSetInterface; + +} DXGKARG_RECOMMENDMONITORMODES; + +typedef _In_ CONST DXGKARG_RECOMMENDMONITORMODES* CONST IN_CONST_PDXGKARG_RECOMMENDMONITORMODES_CONST; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RECOMMENDMONITORMODES) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RECOMMENDMONITORMODES( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_RECOMMENDMONITORMODES_CONST pRecommendMonitorModes + ); + +//////////////////// Power management ///////////////////////////////////////////////////////// + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDISETPOWERCOMPONENTFSTATE) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDISETPOWERCOMPONENTFSTATE( + IN_CONST_HANDLE DriverContext, + UINT ComponentIndex, + UINT FState + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDISETPOWERPSTATE) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDISETPOWERPSTATE( + IN_CONST_HANDLE DriverContext, + UINT ComponentIndex, + UINT RequestedComponentPState +); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDIPOWERRUNTIMECONTROLREQUEST) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDIPOWERRUNTIMECONTROLREQUEST( + IN_CONST_HANDLE DriverContext, + IN LPCGUID PowerControlCode, + IN OPTIONAL PVOID InBuffer, + IN SIZE_T InBufferSize, + OUT OPTIONAL PVOID OutBuffer, + IN SIZE_T OutBufferSize, + OUT OPTIONAL PSIZE_T BytesReturned + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_POWERRUNTIMESETDEVICEHANDLE) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_POWERRUNTIMESETDEVICEHANDLE( + IN_CONST_HANDLE DriverContext, + IN HANDLE PoDeviceHandle + ); + +typedef + _Function_class_DXGK_(DXGKCB_SETPOWERCOMPONENTACTIVE) + _IRQL_requires_max_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_SETPOWERCOMPONENTACTIVE)( + IN_CONST_HANDLE hAdapter, + UINT ComponentIndex + ); + +typedef DXGKCB_SETPOWERCOMPONENTACTIVE *PDXGKCB_SETPOWERCOMPONENTACTIVE; + +typedef + _Function_class_DXGK_(DXGKCB_POWERRUNTIMECONTROLREQUEST) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_POWERRUNTIMECONTROLREQUEST)( + IN_CONST_HANDLE hAdapter, + IN LPCGUID PowerControlCode, + IN OPTIONAL PVOID InBuffer, + IN SIZE_T InBufferSize, + OUT OPTIONAL PVOID OutBuffer, + IN SIZE_T OutBufferSize, + OUT OPTIONAL PSIZE_T BytesReturned + ); + +typedef DXGKCB_POWERRUNTIMECONTROLREQUEST *PDXGKCB_POWERRUNTIMECONTROLREQUEST; + +typedef + _Function_class_DXGK_(DXGKCB_SETPOWERCOMPONENTIDLE) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_SETPOWERCOMPONENTIDLE)( + IN_CONST_HANDLE hAdapter, + UINT ComponentIndex + ); + +typedef DXGKCB_SETPOWERCOMPONENTIDLE *PDXGKCB_SETPOWERCOMPONENTIDLE; + +typedef + _Function_class_DXGK_(DXGKCB_SETPOWERCOMPONENTLATENCY) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_SETPOWERCOMPONENTLATENCY)( + IN_CONST_HANDLE hAdapter, + UINT ComponentIndex, + ULONGLONG Latency + ); + +typedef DXGKCB_SETPOWERCOMPONENTLATENCY *PDXGKCB_SETPOWERCOMPONENTLATENCY; + +typedef + _Function_class_DXGK_(DXGKCB_SETPOWERCOMPONENTRESIDENCY) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_SETPOWERCOMPONENTRESIDENCY)( + IN_CONST_HANDLE hAdapter, + UINT ComponentIndex, + ULONGLONG Residency + ); + +typedef DXGKCB_SETPOWERCOMPONENTRESIDENCY *PDXGKCB_SETPOWERCOMPONENTRESIDENCY; + +typedef + _Function_class_DXGK_(DXGKCB_COMPLETEFSTATETRANSITION) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_COMPLETEFSTATETRANSITION)( + IN_CONST_HANDLE hAdapter, + UINT ComponentIndex + ); + +typedef DXGKCB_COMPLETEFSTATETRANSITION *PDXGKCB_COMPLETEFSTATETRANSITION; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef enum _DXGK_HARDWARE_CONTENT_PROTECTION_TEARDOWN_FLAGS +{ + DXGK_HARDWARE_CONTENT_PROTECTION_TEARDOWN_FLAG_PREEMPTIVE = 1 +} DXGK_HARDWARE_CONTENT_PROTECTION_TEARDOWN_FLAGS; + +typedef + _Function_class_DXGK_(DXGKCB_HARDWARECONTENTPROTECTIONTEARDOWN) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_HARDWARECONTENTPROTECTIONTEARDOWN)( + IN_CONST_HANDLE hAdapter, + UINT Flags + ); + +#endif + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +typedef + _Function_class_DXGK_(DXGKCB_MULTIPLANEOVERLAYDISABLED) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_MULTIPLANEOVERLAYDISABLED)( + IN_CONST_HANDLE hAdapter, + UINT VidPnSourceId + ); + +typedef + _Function_class_DXGK_(DXGKCB_MITIGATEDRANGEUPDATE) + _IRQL_requires_max_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_DXGKCB_MITIGATEDRANGEUPDATE)( + IN_CONST_HANDLE hAdapter, + IN ULONG VirtualFunctionIndex + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +typedef _Out_ DXGKARG_GETNODEMETADATA* OUT_PDXGKARG_GETNODEMETADATA; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_GETNODEMETADATA) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_GETNODEMETADATA( + IN_CONST_HANDLE hAdapter, + UINT NodeOrdinalAndAdapterIndex, // WDDMv2: High word is physical adapter index, low word is node ordinal + OUT_PDXGKARG_GETNODEMETADATA pGetNodeMetadata + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +#define DXGKNODEMETADATA_GETNODEORDINAL(NodeOrdinalAndAdapterIndex) (NodeOrdinalAndAdapterIndex & 0xFFFF) +#define DXGKNODEMETADATA_GETPHYSICALADAPTERINDEX(NodeOrdinalAndAdapterIndex) (NodeOrdinalAndAdapterIndex >> 16) +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +// Callback for p-state completion +typedef + _Function_class_DXGK_(DXGKCB_COMPLETEPSTATETRANSITION) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_COMPLETEPSTATETRANSITION)( + IN_CONST_HANDLE hAdapter, + IN UINT ComponentIndex, + IN UINT CompletedPState + ); + +typedef DXGKCB_COMPLETEPSTATETRANSITION *PDXGKCB_COMPLETEPSTATETRANSITION; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef struct _DXGKARGCB_MAPCONTEXTALLOCATION +{ + D3DGPU_VIRTUAL_ADDRESS BaseAddress; + D3DGPU_VIRTUAL_ADDRESS MinimumAddress; + D3DGPU_VIRTUAL_ADDRESS MaximumAddress; + HANDLE hAllocation; + D3DGPU_SIZE_T OffsetInPages; + D3DGPU_SIZE_T SizeInPages; + D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE Protection; + UINT64 DriverProtection; +} DXGKARGCB_MAPCONTEXTALLOCATION; + +typedef _In_ CONST DXGKARGCB_MAPCONTEXTALLOCATION* IN_CONST_PDXGKARGCB_MAPCONTEXTALLOCATION; + +typedef + _Function_class_DXGK_(DXGKCB_MAPCONTEXTALLOCATION) + _IRQL_requires_max_(PASSIVE_LEVEL) +D3DGPU_VIRTUAL_ADDRESS +(APIENTRY CALLBACK *DXGKCB_MAPCONTEXTALLOCATION)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_MAPCONTEXTALLOCATION pArgs + ); + +typedef struct _DXGKARGCB_UPDATECONTEXTALLOCATION +{ + HANDLE hAllocation; + PVOID pPrivateDriverData; + UINT PrivateDriverDataSize; +} DXGKARGCB_UPDATECONTEXTALLOCATION; + +typedef _In_ CONST DXGKARGCB_UPDATECONTEXTALLOCATION* IN_CONST_PDXGKARGCB_UPDATECONTEXTALLOCATION; + +typedef + _Function_class_DXGK_(DXGKCB_UPDATECONTEXTALLOCATION) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_UPDATECONTEXTALLOCATION)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_UPDATECONTEXTALLOCATION pArgs + ); + +typedef struct _DXGKARGCB_RESERVEGPUVIRTUALADDRESSRANGE +{ + HANDLE hDxgkProcess; // in + UINT64 SizeInBytes; // in: size of the virtual address range. Must be multiple of the leaf page table coverage size. + UINT Alignment; // in: number of bytes to align the start address to. Must be power of 2. + UINT64 StartVirtualAddress; // out + UINT64 BaseAddress; // in: base address of the virtual address range in bytes. Must be aligned to the leaf page table coverage size. + union + { + struct + { + UINT AllowUserModeMapping : 1; // in: Allow UMD to map allocations to the range. + }; + UINT Flags; + }; +} DXGKARGCB_RESERVEGPUVIRTUALADDRESSRANGE; + +typedef _Inout_ DXGKARGCB_RESERVEGPUVIRTUALADDRESSRANGE* INOUT_PDXGKARGCB_RESERVEGPUVIRTUALADDRESSRANGE; + +typedef + _Function_class_DXGK_(DXGKCB_RESERVEGPUVIRTUALADDRESSRANGE) + _IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_RESERVEGPUVIRTUALADDRESSRANGE)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_RESERVEGPUVIRTUALADDRESSRANGE pArgs + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +typedef + _Function_class_DXGK_(DXGKCB_NOTIFYVSYNC) + _IRQL_requires_max_(DISPATCH_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_NOTIFYVSYNC)( + IN_CONST_HANDLE hAdapter, + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId + ); + +typedef DXGKCB_NOTIFYVSYNC *PDXGKCB_NOTIFYVSYNC; + +// +// History buffer precision information +// Used with QueryAdapterInfo + DXGKQAITYPE_HISTORYBUFFERPRECISION to +// obtain precision ifnormation for nodes. +// +typedef struct _DXGKARG_HISTORYBUFFERPRECISION +{ + UINT32 PrecisionBits; +} DXGKARG_HISTORYBUFFERPRECISION; + + +typedef struct _DXGK_HISTORY_BUFFER_HEADER +{ + UINT32 RenderCbSequence; + UINT32 NumTimestamps; + UINT32 PrivateDataSize; + UINT32 Reserved; +} DXGK_HISTORY_BUFFER_HEADER; + +typedef struct _DXGK_HISTORY_BUFFER +{ + DXGK_HISTORY_BUFFER_HEADER Header; + UINT8 DriverPrivateData[1]; +} DXGK_HISTORY_BUFFER; + +// +// History buffer format DDI. +// Called during DMA completion DPC +// +typedef struct _DXGKARG_FORMATHISTORYBUFFER +{ + DXGK_HISTORY_BUFFER* pHistoryBuffer; + UINT32 HistoryBufferSize; + PVOID pFormattedBuffer; + UINT32 FormattedBufferSize; + UINT32 NumTimestamps; + DXGKARG_HISTORYBUFFERPRECISION Precision; + UINT32 Offset; + } DXGKARG_FORMATHISTORYBUFFER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_FORMATHISTORYBUFFER) + _IRQL_requires_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_FORMATHISTORYBUFFER( + IN_CONST_HANDLE hContext, + IN DXGKARG_FORMATHISTORYBUFFER* pFormatData + ); + +// +// GPU Clock calibration DDI +// Called on timer +// + +typedef _Out_ DXGKARG_CALIBRATEGPUCLOCK* OUT_PDXGKARG_CALIBRATEGPUCLOCK; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CALIBRATEGPUCLOCK) + _IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CALIBRATEGPUCLOCK( + IN_CONST_HANDLE hAdapter, + IN UINT32 NodeOrdinal, + IN UINT32 EngineOrdinal, + OUT_PDXGKARG_CALIBRATEGPUCLOCK pClockCalibration + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) +/*++ +Routine Description: + ControlModeBehavior - requests high-level mode enumeration and setting behaviors + +Arguments: + hAdapter WDDM display miniport adapter handle. + + pControlModeBehaviorArg + ->Request Input flags indicating the behaviors the OS is requesting. + + ->Satisfied Output flags reporting which requests were satisfied. + + ->NotSatisfied Output flags reporting which requests were NOT satisfied. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_VIDPN* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef union _DXGK_MODE_BEHAVIOR_FLAGS +{ + struct + { + UINT PrioritizeHDR : 1; // 0x00000001 + UINT ColorimetricControl : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC + }; + UINT Value; +} DXGK_MODE_BEHAVIOR_FLAGS; + + +typedef struct _DXGKARG_CONTROLMODEBEHAVIOR +{ + + IN DXGK_MODE_BEHAVIOR_FLAGS Request; + OUT DXGK_MODE_BEHAVIOR_FLAGS Satisfied; + OUT DXGK_MODE_BEHAVIOR_FLAGS NotSatisfied; +} DXGKARG_CONTROLMODEBEHAVIOR; + + +typedef _Inout_ DXGKARG_CONTROLMODEBEHAVIOR* INOUT_PDXGKARG_CONTROLMODEBEHAVIOR; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CONTROLMODEBEHAVIOR) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CONTROLMODEBEHAVIOR( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CONTROLMODEBEHAVIOR pControlModeBehaviorArg + ); + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Purpose: Exposes driver/hardware per monitor/target capabilities. +// Mode enumeration is typically required to discover if the capability is supported in a particular display +// configuration but if the capability is not supported then mode enumeration is unnecessary. +// +typedef struct _DXGK_MONITORLINKINFO +{ + DXGK_MONITORLINKINFO_USAGEHINTS UsageHints; + DXGK_MONITORLINKINFO_CAPABILITIES Capabilities; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + D3DKMDT_WIRE_FORMAT_AND_PREFERENCE DitheringSupport; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4 +} DXGK_MONITORLINKINFO; + + +/*++ +Routine Description: + UpdateMonitorLinkInfo - Reports static per monitor capabilities + +Arguments: + hAdapter - WDDM display miniport adapter handle. + + pUpdateMonitorLinkInfoArg + ->VideoPresentTargetId - ID of the video present target to which the monitor in question is connected. + + ->MonitorLinkInfo - Structure with overrides from the OS and space for the caps from the driver. + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_{VIDPN|MONITOR|* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Side-effects: + None + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ +typedef struct _DXGKARG_UPDATEMONITORLINKINFO +{ + IN D3DDDI_VIDEO_PRESENT_TARGET_ID VideoPresentTargetId; + IN DXGK_MONITORLINKINFO MonitorLinkInfo; + +} DXGKARG_UPDATEMONITORLINKINFO; + +typedef _Inout_ DXGKARG_UPDATEMONITORLINKINFO* INOUT_PDXGKARG_UPDATEMONITORLINKINFO; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_UPDATEMONITORLINKINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_UPDATEMONITORLINKINFO( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_UPDATEMONITORLINKINFO pUpdateMonitorLinkInfoArg + ); + + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if defined(__cplusplus) && !defined(SORTPP_PASS) +typedef enum _DXGK_CONNECTION_STATUS : UINT { + ConnectionStatusUninitialized = 0, + + TargetStatusDisconnected = 4, + TargetStatusConnected, + TargetStatusJoined, + + MonitorStatusDisconnected = 8, + MonitorStatusUnknown, + MonitorStatusConnected, + + LinkConfigurationStarted =12, + LinkConfigurationFailed, + LinkConfigurationSucceeded, +} DXGK_CONNECTION_STATUS, *PDXGK_CONNECTION_STATUS; +#else +typedef UINT DXGK_CONNECTION_STATUS; +#endif // defined(__cplusplus) && !defined(SORTPP_PASS) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) +typedef struct _DXGK_CONNECTION_MONITOR_CONNECT_FLAGS +{ + union + { + struct + { + UINT Usb4DisplayPortMonitor : 1; + UINT Reserved :31; + }; + UINT Value; + }; +} DXGK_CONNECTION_MONITOR_CONNECT_FLAGS; + +typedef struct _DXGK_CONNECTION_USB4_INFO +{ + UINT Dpcd_DP_IN_Adapter_Number; + UINT Dpcd_USB4_Driver_ID; + BYTE Dpcd_USB4_ROUTER_TOPOLOGY_ID[5]; +} DXGK_CONNECTION_USB4_INFO, *PDXGK_CONNECTION_USB4_INFO; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + +// +// Connection change structure which is indicated as available by the miniport +// and then picked up by the OS from the driver. +// +typedef struct _DXGK_CONNECTION_CHANGE { + ULONGLONG ConnectionChangeId; + D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId :24; + DXGK_CONNECTION_STATUS ConnectionStatus : 4; + UINT Reserved : 4; + union { + struct { + D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY LinkTargetType; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + DXGK_CONNECTION_MONITOR_CONNECT_FLAGS MonitorConnectFlags; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + } MonitorConnect; + struct { + D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY BaseTargetType; + D3DDDI_VIDEO_PRESENT_TARGET_ID NewTargetId; + } TargetConnect; + struct { + D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY BaseTargetType; + D3DDDI_VIDEO_PRESENT_TARGET_ID NewTargetId; + } TargetJoin; + }; +} DXGK_CONNECTION_CHANGE, *PDXGK_CONNECTION_CHANGE; + + +/*++ +Routine Description: + SetTimingsFromVidPn WDDM display miniport VidPN management DDI method + +Arguments: + hAdapter WDDM display miniport adapter handle. + + pSetTimingsFromVidPnArg + ->hFunctionalVidPn Handle of a functional VidPN to applyt to hardware. + + ->SetFlags Flags to modify the behavior of the call. + + ->PathCount Count of paths in the pSetTimingPathInfo array of pointers. + + ->pSetTimingPathInfo - Array of pointers, one per path, describing the timing changes + The structure for each path, provides details beyond those + in the VidPn and contain fields for the driver to describe + the results of the request + +Return Value: + STATUS_SUCCESS + - Request has been completed successfully. + + STATUS_NO_MEMORY + - There is insufficient memory to complete this request. + + One of the invalid parameter STATUS_GRAPHICS_* codes that can be returned by the OS via + DXGDDI_VIDPN* interfaces. These codes should only occur during development since they + indicate a bug in the driver or OS. + +Side-effects: + The driver may report changes in link status triggered by attmepting to change the timings. + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef struct _DXGK_SET_TIMING_FLAGS +{ + union + { + struct + { + UINT Reserved; + }; + UINT Value; + }; +} DXGK_SET_TIMING_FLAGS; + +typedef struct _DXGK_SET_TIMING_RESULTS +{ + union + { + struct + { + UINT ConnectionStatusChanges : 1; // One or more connection status changes were detected in the course of this call + UINT Reserved :31; + }; + UINT Value; + }; +} DXGK_SET_TIMING_RESULTS, *PDXGK_SET_TIMING_RESULTS; + + +#if defined(__cplusplus) && !defined(SORTPP_PASS) + +typedef enum _DXGK_PATH_UPDATE : UINT +{ + DXGK_PATH_UPDATE_UNMODIFIED = 0, + DXGK_PATH_UPDATE_ADDED = 1, + DXGK_PATH_UPDATE_MODIFIED = 2, + DXGK_PATH_UPDATE_REMOVED = 3 +} DXGK_PATH_UPDATE; + +typedef enum _DXGK_SYNC_LOCK_STYLE : UINT +{ + DXGK_SYNC_LOCK_STYLE_NONE = 0, + DXGK_SYNC_LOCK_STYLE_IDENTICAL = 1, +} DXGK_SYNC_LOCK_STYLE; + +typedef enum _DXGK_GLITCH_CAUSE : UINT8 +{ + DXGK_GLITCH_CAUSE_DRIVER_ERROR = 0, + DXGK_GLITCH_CAUSE_TIMING_CHANGE = 1, + DXGK_GLITCH_CAUSE_PIPELINE_CHANGE = 2, + DXGK_GLITCH_CAUSE_MEMORY_TIMING = 3, + DXGK_GLITCH_CAUSE_ENCODER_RECONFIG = 4, + DXGK_GLITCH_CAUSE_MODIFIED_WIRE_USAGE = 5, + DXGK_GLITCH_CAUSE_METADATA_CHANGE = 6, + DXGK_GLITCH_CAUSE_NONE =255 +} DXGK_GLITCH_CAUSE; + +typedef enum _DXGK_GLITCH_EFFECT : UINT8 +{ + DXGK_GLITCH_EFFECT_SYNC_LOSS = 0, + DXGK_GLITCH_EFFECT_GARBAGE_CONTENT = 1, + DXGK_GLITCH_EFFECT_STALE_CONTENT = 2, + DXGK_GLITCH_EFFECT_BLACK_CONTENT = 3, + DXGK_GLITCH_EFFECT_DEGRADED_CONTENT = 4, + DXGK_GLITCH_EFFECT_SEAMLESS =255 +} DXGK_GLITCH_EFFECT; + +typedef enum _DXGK_GLITCH_DURATION : UINT8 +{ + DXGK_GLITCH_DURATION_INDEFINITE = 0, + DXGK_GLITCH_DURATION_MULTI_FRAME = 1, + DXGK_GLITCH_DURATION_SINGLE_FRAME = 2, + DXGK_GLITCH_DURATION_MULTI_LINE = 3, + DXGK_GLITCH_DURATION_SINGLE_LINE = 4, + DXGK_GLITCH_DURATION_NONE =255 +} DXGK_GLITCH_DURATION; + +#else +typedef UINT DXGK_PATH_UPDATE; +typedef UINT DXGK_SYNC_LOCK_STYLE; +typedef UINT8 DXGK_GLITCH_CAUSE; +typedef UINT8 DXGK_GLITCH_EFFECT; +typedef UINT8 DXGK_GLITCH_DURATION; +#endif // defined(__cplusplus) && !defined(SORTPP_PASS) + +typedef struct _DXGK_SET_TIMING_PATH_INFO +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; + + union + { + // Since this enum type is also used by OS to specify the input + // colorspace of MPOs hence we are deprecating its use starting + // WDDM2.3. WDDM2.3 and above drivers should use the new + // type D3DDDI_OUTPUT_WIRE_COLOR_SPACE_TYPE + D3DDDI_COLOR_SPACE_TYPE OutputColorSpace; + + D3DDDI_OUTPUT_WIRE_COLOR_SPACE_TYPE OutputWireColorSpace; + }; + + D3DKMDT_WIRE_FORMAT_AND_PREFERENCE SelectedWireFormat; + + union + { + struct + { + DXGK_PATH_UPDATE VidPnPathUpdates : 2; // Indicates how the VidPn description of this path has been modified since the last successful call + UINT Active : 1; // The host should be driving a signal to the target (timing or training) + UINT IgnoreConnectivity : 1; // Used to force output to an undetected monitor on an analog target + UINT PreserveInherited : 1; // Driver should preserve the timings and content inherited from previous driver + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + UINT SyncLockGroup : 3; + DXGK_SYNC_LOCK_STYLE SyncLockStyle : 4; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + UINT Reserved :20; +#else + UINT Reserved :27; +#endif // DXGKDDI_INTERFACE_VERSION + } Input; + UINT InputFlags; + }; + + union + { + struct + { + UINT RecheckMPO : 1; // Active plane(s) on other paths need to be released before visibility can be turned on + UINT Reserved :31; + } Output; + UINT OutputFlags; + }; + + DXGK_CONNECTION_CHANGE TargetState; // Indicates the target state as a result of this call + + union + { + struct + { + DXGK_GLITCH_CAUSE GlitchCause; + DXGK_GLITCH_EFFECT GlitchEffect; + DXGK_GLITCH_DURATION GlitchDuration; + UINT8 Reserved; + }; + UINT DiagnosticInfo; + }; +} DXGK_SET_TIMING_PATH_INFO; + +typedef struct _DXGKARG_SETTIMINGSFROMVIDPN +{ + D3DKMDT_HVIDPN hFunctionalVidPn; + DXGK_SET_TIMING_FLAGS SetFlags; + PDXGK_SET_TIMING_RESULTS pResultsFlags; + UINT PathCount; + _Field_size_(PathCount) DXGK_SET_TIMING_PATH_INFO * pSetTimingPathInfo; +} DXGKARG_SETTIMINGSFROMVIDPN; + + +typedef _Inout_ DXGKARG_SETTIMINGSFROMVIDPN* IN_OUT_PDXGKARG_SETTIMINGSFROMVIDPN; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTIMINGSFROMVIDPN) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTIMINGSFROMVIDPN( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGKARG_SETTIMINGSFROMVIDPN pSetTimings + ); + + + +/*++ +Routine Description: + SetTargetGamma - Sets the gama ramp on the specified target id + +Arguments: + hAdapter WDDM display miniport adapter handle. + + pSetTargetGammaArg + ->TargetId Target to be modified + + ->GammaRamp Gamma look up table + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef struct _DXGKARG_SETTARGETGAMMA +{ + IN D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; + IN D3DKMDT_GAMMA_RAMP GammaRamp; +} DXGKARG_SETTARGETGAMMA; + + +typedef _In_ CONST DXGKARG_SETTARGETGAMMA* IN_CONST_PDXGKARG_SETTARGETGAMMA; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTARGETGAMMA) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTARGETGAMMA( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETTARGETGAMMA pSetTargetGammaArg + ); + +/*++ +Routine Description: + SetTargetContentType - Sets the content type for which the driver should be optimizing + +Arguments: + hAdapter WDDM display miniport adapter handle. + + pSetTargetContentTypeArg + ->TargetId Target to be modified + + ->ContentType New type of content being displayed + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef struct _DXGKARG_SETTARGETCONTENTTYPE +{ + IN D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; + IN D3DKMDT_VIDPN_PRESENT_PATH_CONTENT ContentType; +} DXGKARG_SETTARGETCONTENTTYPE; + + +typedef _In_ CONST DXGKARG_SETTARGETCONTENTTYPE* IN_CONST_PDXGKARG_SETTARGETCONTENTTYPE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTARGETCONTENTTYPE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTARGETCONTENTTYPE( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETTARGETCONTENTTYPE pSetTargetContentTypeArg + ); + + + + +/*++ +Routine Description: + SetTargetAnalogCopyProtection - Sets the analog copy protection on the specified target id + +Arguments: + hAdapter WDDM display miniport adapter handle. + + pSetTargetAnalogCopyProtectionArg + ->TargetId Target to be modified + + ->AnalogCopyProtection Analog copy protection + +Environment: + Kernel mode. PASSIVE_LEVEL. + +--*/ + +typedef struct _DXGKARG_SETTARGETANALOGCOPYPROTECTION +{ + IN D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; + D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE CopyProtectionType; + UINT APSTriggerBits; + D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_SUPPORT CopyProtectionSupport; +} DXGKARG_SETTARGETANALOGCOPYPROTECTION; + + +typedef _In_ CONST DXGKARG_SETTARGETANALOGCOPYPROTECTION* IN_CONST_PDXGKARG_SETTARGETANALOGCOPYPROTECTION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTARGETANALOGCOPYPROTECTION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTARGETANALOGCOPYPROTECTION( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_SETTARGETANALOGCOPYPROTECTION pSetTargetAnalogCopyProtectionArg + ); + + +#if defined(__cplusplus) && !defined(SORTPP_PASS) +typedef enum _DXGK_DISPLAYDETECTCONTROLTYPE : UINT +{ + DXGK_DDCT_UNINITIALIZED = 0, + DXGK_DDCT_POLLONE, + DXGK_DDCT_POLLALL, + DXGK_DDCT_ENABLEHPD, + DXGK_DDCT_DISABLEHPD, +} DXGK_DISPLAYDETECTCONTROLTYPE; +#else +typedef UINT DXGK_DISPLAYDETECTCONTROLTYPE; +#endif // defined(__cplusplus) && !defined(SORTPP_PASS) + + +typedef struct _DXGKARG_DISPLAYDETECTCONTROL +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId :24; + DXGK_DISPLAYDETECTCONTROLTYPE Type : 4; + UINT NonDestructiveOnly : 1; + UINT Reserved : 3; +} DXGKARG_DISPLAYDETECTCONTROL; + +typedef _In_ CONST DXGKARG_DISPLAYDETECTCONTROL* IN_CONST_PDXGKARG_DISPLAYDETECTCONTROL; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DISPLAYDETECTCONTROL) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DISPLAYDETECTCONTROL( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARG_DISPLAYDETECTCONTROL pDisplayDetectControl + ); + + +typedef struct _DXGKARG_QUERYCONNECTIONCHANGE +{ + DXGK_CONNECTION_CHANGE ConnectionChange; // out: Buffer into which the oldest available change is copied by driver +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + DXGK_CONNECTION_USB4_INFO Usb4MonitorInfo; // out: OS allocated structure driver should complete if MonitorConnect.Flags.Usb4DisplayPortMonitor was set +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) +} DXGKARG_QUERYCONNECTIONCHANGE; + +typedef _In_ DXGKARG_QUERYCONNECTIONCHANGE* IN_PDXGKARG_QUERYCONNECTIONCHANGE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYCONNECTIONCHANGE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYCONNECTIONCHANGE( + IN_CONST_HANDLE hAdapter, + IN_PDXGKARG_QUERYCONNECTIONCHANGE pQueryConnectionChange + ); + +typedef struct _DXGK_INHERITED_TIMING_INFO +{ + union + { + // Since this enum type is also used by OS to specify the input + // colorspace of MPOs hence we are deprecating its use starting + // WDDM2.3. WDDM2.3 and above drivers should use the new + // type D3DDDI_OUTPUT_WIRE_COLOR_SPACE_TYPE + D3DDDI_COLOR_SPACE_TYPE OutputColorSpace; + + D3DDDI_OUTPUT_WIRE_COLOR_SPACE_TYPE OutputWireColorSpace; + }; + + D3DKMDT_WIRE_FORMAT_AND_PREFERENCE SelectedWireFormat; + union + { + struct + { + DXGK_GLITCH_CAUSE GlitchCause; + DXGK_GLITCH_EFFECT GlitchEffect; + DXGK_GLITCH_DURATION GlitchDuration; + UINT8 Reserved; + }; + UINT DiagnosticInfo; + }; +} DXGK_INHERITED_TIMING_INFO, *PDXGK_INHERITED_TIMING_INFO; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_2 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +typedef struct _DXGKARG_CREATEPROTECTEDSESSION +{ + HANDLE hProtectedSession; // in: DXG assigned value for the protected session that was passed to + // DxgkDdiCreateProtectedSession. + // out: Driver generated handle. + PVOID pPrivateDriverData; + UINT PrivateDriverDataSize; +} DXGKARG_CREATEPROTECTEDSESSION; + +typedef _Inout_ DXGKARG_CREATEPROTECTEDSESSION* INOUT_PDXGKARG_CREATEPROTECTEDSESSION; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CREATEPROTECTEDSESSION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEPROTECTEDSESSION( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_CREATEPROTECTEDSESSION pCreateProtectedSession + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_DESTROYPROTECTEDSESSION) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYPROTECTEDSESSION( + IN_CONST_HANDLE hAdapter, + IN_CONST_HANDLE hProtectedSession // in: Driver generated handle driver returned at DxgkDdiCreateProtectedSession. + ); + +typedef enum _DXGK_PROTECTED_SESSION_STATUS +{ + DXGK_PROTECTED_SESSION_STATUS_OK = 0, + DXGK_PROTECTED_SESSION_STATUS_INVALID = 1, +} DXGK_PROTECTED_SESSION_STATUS; + +typedef struct _DXGKARGCB_PROTECTEDSESSIONSTATUS +{ + HANDLE hProtectedSession; // in: DXG handle + // in: DXG assigned value for the protected session that was passed to + // DxgkDdiCreateProtectedSession. + DXGK_PROTECTED_SESSION_STATUS Status; +} DXGKARGCB_PROTECTEDSESSIONSTATUS; + +typedef _In_ CONST DXGKARGCB_PROTECTEDSESSIONSTATUS* IN_CONST_PDXGKARGCB_PROTECTEDSESSIONSTATUS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_SETPROTECTEDSESSIONSTATUS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_SETPROTECTEDSESSIONSTATUS)( + IN_CONST_PDXGKARGCB_PROTECTEDSESSIONSTATUS pProtectedSessionStatus + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_3 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef enum _DXGK_MEMORY_CACHING_TYPE +{ + DXGK_MEMORY_CACHING_TYPE_NON_CACHED, + DXGK_MEMORY_CACHING_TYPE_CACHED, + DXGK_MEMORY_CACHING_TYPE_WRITE_COMBINED +} DXGK_MEMORY_CACHING_TYPE; + +typedef struct _DXGKARGCB_ALLOCATECONTIGUOUSMEMORY +{ + _In_ SIZE_T NumberOfBytes; + _In_ PHYSICAL_ADDRESS LowestAcceptableAddress; + _In_ PHYSICAL_ADDRESS HighestAcceptableAddress; + _In_ PHYSICAL_ADDRESS BoundaryAddressMultiple; + _In_ DXGK_MEMORY_CACHING_TYPE CacheType; + _Out_ HANDLE hMemoryHandle; + _Out_ PVOID pMemory; +} DXGKARGCB_ALLOCATECONTIGUOUSMEMORY; + +typedef struct _DXGKARGCB_FREECONTIGUOUSMEMORY +{ + _In_ HANDLE hMemoryHandle; +} DXGKARGCB_FREECONTIGUOUSMEMORY; + +typedef struct _DXGKARGCB_ALLOCATEPAGESFORMDL +{ + _In_ PHYSICAL_ADDRESS LowAddress; + _In_ PHYSICAL_ADDRESS HighAddress; + _In_ PHYSICAL_ADDRESS SkipBytes; + _In_ SIZE_T TotalBytes; + _In_ DXGK_MEMORY_CACHING_TYPE CacheType; + _In_ ULONG Flags; + _Out_ HANDLE hMemoryHandle; + _Out_ PMDL pMdl; +} DXGKARGCB_ALLOCATEPAGESFORMDL; + +typedef struct _DXGKARGCB_FREEPAGESFROMMDL +{ + _In_ HANDLE hMemoryHandle; +} DXGKARGCB_FREEPAGESFROMMDL; + +typedef struct _DXGKARGCB_MAPMDLTOIOMMU +{ + _In_ PMDL pMdl; + _Out_ HANDLE hMemoryHandle; +} DXGKARGCB_MAPMDLTOIOMMU; + +typedef struct _DXGKARGCB_UNMAPMDLFROMIOMMU +{ + _In_ HANDLE hMemoryHandle; +} DXGKARGCB_UNMAPMDLFROMIOMMU; + +typedef struct _DXGKARGCB_PINFRAMEBUFFERFORSAVE +{ + _In_ UINT PhysicalAdapterIndex; + _In_ SIZE_T CommitSize; + _Out_ PMDL pMdl; +} DXGKARGCB_PINFRAMEBUFFERFORSAVE; + +typedef struct _DXGKARGCB_UNPINFRAMEBUFFERFORSAVE +{ + _In_ UINT PhysicalAdapterIndex; +} DXGKARGCB_UNPINFRAMEBUFFERFORSAVE; + +typedef struct _DXGKARGCB_MAPFRAMEBUFFERPOINTER +{ + _In_ UINT PhysicalAdapterIndex; + _In_ SIZE_T Size; + _Inout_ SIZE_T Offset; + _Out_ PVOID pBaseAddress; +} DXGKARGCB_MAPFRAMEBUFFERPOINTER; + +typedef struct _DXGKARGCB_UNMAPFRAMEBUFFERPOINTER +{ + _In_ UINT PhysicalAdapterIndex; + _In_ PVOID pBaseAddress; +} DXGKARGCB_UNMAPFRAMEBUFFERPOINTER; + +typedef _Inout_ DXGKARGCB_ALLOCATECONTIGUOUSMEMORY* INOUT_PDXGKARGCB_ALLOCATECONTIGUOUSMEMORY; +typedef _In_ CONST DXGKARGCB_FREECONTIGUOUSMEMORY* IN_CONST_PDXGKARGCB_FREECONTIGUOUSMEMORY; +typedef _Inout_ DXGKARGCB_ALLOCATEPAGESFORMDL* INOUT_PDXGKARGCB_ALLOCATEPAGESFORMDL; +typedef _In_ CONST DXGKARGCB_FREEPAGESFROMMDL* IN_CONST_PDXGKARGCB_FREEPAGESFROMMDL; +typedef _Inout_ DXGKARGCB_MAPMDLTOIOMMU* INOUT_PDXGKARGCB_MAPMDLTOIOMMU; +typedef _In_ CONST DXGKARGCB_UNMAPMDLFROMIOMMU* IN_CONST_PDXGKARGCB_UNMAPMDLFROMIOMMU; +typedef _Inout_ DXGKARGCB_PINFRAMEBUFFERFORSAVE* INOUT_PDXGKARGCB_PINFRAMEBUFFERFORSAVE; +typedef _In_ CONST DXGKARGCB_UNPINFRAMEBUFFERFORSAVE* IN_CONST_PDXGKARGCB_UNPINFRAMEBUFFERFORSAVE; +typedef _Inout_ DXGKARGCB_MAPFRAMEBUFFERPOINTER* INOUT_PDXGKARGCB_MAPFRAMEBUFFERPOINTER; +typedef _In_ CONST DXGKARGCB_UNMAPFRAMEBUFFERPOINTER* IN_CONST_PDXGKARGCB_UNMAPFRAMEBUFFERPOINTER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_ALLOCATECONTIGUOUSMEMORY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_ALLOCATECONTIGUOUSMEMORY)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_ALLOCATECONTIGUOUSMEMORY pAllocateContiguousMemory + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_FREECONTIGUOUSMEMORY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_FREECONTIGUOUSMEMORY)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_FREECONTIGUOUSMEMORY pFreeContiguousMemory + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_ALLOCATEPAGESFORMDL) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_ALLOCATEPAGESFORMDL)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_ALLOCATEPAGESFORMDL pAllocatePagesForMdl + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_FREEPAGESFROMMDL) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_FREEPAGESFROMMDL)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_FREEPAGESFROMMDL pFreePagesFromMdl + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_MAPMDLTOIOMMU) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_MAPMDLTOIOMMU)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_MAPMDLTOIOMMU pMapMdlToIoMmu + ); + +typedef + _Function_class_DXGK_(DXGKCB_UNMAPMDLFROMIOMMU) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_UNMAPMDLFROMIOMMU)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_UNMAPMDLFROMIOMMU pUnmapMdlFromIoMmu + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_PINFRAMEBUFFERFORSAVE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_PINFRAMEBUFFERFORSAVE)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_PINFRAMEBUFFERFORSAVE pPinFrameBufferForSave + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_UNPINFRAMEBUFFERFORSAVE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_UNPINFRAMEBUFFERFORSAVE)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_UNPINFRAMEBUFFERFORSAVE pUnpinFrameBufferForSave + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_MAPFRAMEBUFFERPOINTER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_MAPFRAMEBUFFERPOINTER)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_MAPFRAMEBUFFERPOINTER pMapFrameBufferPointer + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_UNMAPFRAMEBUFFERPOINTER) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_UNMAPFRAMEBUFFERPOINTER)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_UNMAPFRAMEBUFFERPOINTER pUnmapFrameBufferPointer + ); + +typedef struct _DXGKARG_BEGINEXCLUSIVEACCESS +{ + UINT Reserved; +} DXGKARG_BEGINEXCLUSIVEACCESS; + +typedef struct _DXGKARG_ENDEXCLUSIVEACCESS +{ + UINT Reserved; +} DXGKARG_ENDEXCLUSIVEACCESS; + +typedef _In_ DXGKARG_BEGINEXCLUSIVEACCESS* IN_PDXGKARG_BEGINEXCLUSIVEACCESS; +typedef _In_ DXGKARG_ENDEXCLUSIVEACCESS* IN_PDXGKARG_ENDEXCLUSIVEACCESS; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_BEGINEXCLUSIVEACCESS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_BEGINEXCLUSIVEACCESS( + IN_CONST_HANDLE hAdapter, + IN_PDXGKARG_BEGINEXCLUSIVEACCESS pBeginExclusiveAccess + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_ENDEXCLUSIVEACCESS) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_ENDEXCLUSIVEACCESS( + IN_CONST_HANDLE hAdapter, + IN_PDXGKARG_ENDEXCLUSIVEACCESS pEndExclusiveAccess + ); + +typedef struct _DXGKARG_RESUMEHWENGINE +{ + UINT NodeOrdinal; // in: node ordinal + UINT EngineOrdinal; // in: engine ordinal +} DXGKARG_RESUMEHWENGINE; + +typedef _Inout_ DXGKARG_RESUMEHWENGINE* INOUT_PDXGKARG_RESUMEHWENGINE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESUMEHWENGINE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RESUMEHWENGINE( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARG_RESUMEHWENGINE pResumeHwEngine + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef struct _DXGK_TRACKEDWORKLOAD_STATE_FLAGS +{ + union + { + struct + { + UINT Saturated : 1; // 0x00000001 + UINT OptimalLevel : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC + }; + UINT Value; + }; +} DXGK_TRACKEDWORKLOAD_STATE_FLAGS; + +typedef struct _DXGKARG_SETTRACKEDWORKLOADPOWERLEVEL +{ + UINT PowerLevel; // in: desired power level + UINT EffectivePowerLevel; // out: effective power level + DXGK_TRACKEDWORKLOAD_STATE_FLAGS Flags; // out: combination of DXGK_TRACKEDWORKLOAD_STATE_FLAGS +} DXGKARG_SETTRACKEDWORKLOADPOWERLEVEL; + +typedef _Inout_ DXGKARG_SETTRACKEDWORKLOADPOWERLEVEL* INOUT_PDXGKARG_SETTRACKEDWORKLOADPOWERLEVEL; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTRACKEDWORKLOADPOWERLEVEL) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTRACKEDWORKLOADPOWERLEVEL( + IN_CONST_HANDLE hContext, + INOUT_PDXGKARG_SETTRACKEDWORKLOADPOWERLEVEL pTrackedWorkloadPowerLevel + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_5 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef struct _DXGKARGCB_SIGNALEVENT +{ + HANDLE hDxgkProcess; + HANDLE hEvent; + union + { + struct + { +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + UINT CpuEventObject : 1; + UINT Reserved : 31; +#else + UINT Reserved : 32; +#endif + }; + UINT Flags; + }; +} DXGKARGCB_SIGNALEVENT; + +typedef _In_ CONST DXGKARGCB_SIGNALEVENT * IN_CONST_PDXGKARGCB_SIGNALEVENT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_SIGNALEVENT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_SIGNALEVENT)(IN_CONST_PDXGKARGCB_SIGNALEVENT); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_5 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +typedef enum _DXGK_FEATURE_ID +{ + // For each feature in this enumeration, if the driver supports it, + // it must invoke the OS QueryFeatureSupport callback + // to report the level of support (experimental, stable, always on), + // and only enable the feature if the OS returned Enabled=TRUE. + // Drivers that don't support the feature don't have to call the OS to query its status. + + // Hardware accelerated GPU scheduling + DXGK_FEATURE_HWSCH = 0, + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + + // Hardware flip queue + DXGK_FEATURE_HWFLIPQUEUE = 1, + + // Support for LDA in GPU-PV + DXGK_FEATURE_LDA_GPUPV = 2, + + // Support for signaling CPU event by KMD + DXGK_FEATURE_KMD_SIGNAL_CPU_EVENT = 3, + +#endif + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + + DXGK_FEATURE_USER_MODE_SUBMISSION = 4, + DXGK_FEATURE_SHARE_BACKING_STORE_WITH_KMD = 5, + +#endif + +} DXGK_FEATURE_ID; + +typedef struct _DXGKARGCB_ISFEATUREENABLED +{ + HANDLE DeviceHandle; // in: Device handle that was passed to the driver DxgkDdiStartDevice function. + DXGK_FEATURE_ID FeatureId; // in: Feature ID to query enabled state for. + BOOLEAN Enabled; // out: + // FALSE if the OS instructs the driver not to enable the feature. + // TRUE if the OS allows the driver to enable the feature. +} DXGKARGCB_ISFEATUREENABLED; + +typedef _Inout_ DXGKARGCB_ISFEATUREENABLED* INOUT_PDXGKARGCB_ISFEATUREENABLED; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_ISFEATUREENABLED) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_ISFEATUREENABLED)(INOUT_PDXGKARGCB_ISFEATUREENABLED); + +typedef struct _DXGK_KSR_MEMORY_RANGE +{ + // + // Bits 0-39 - Physical page number of the first page + // Bits 40-63 - Number of pages. + // + ULONGLONG MemoryRangeDesc; +} DXGK_KSR_MEMORY_RANGE, *PDXGK_KSR_MEMORY_RANGE; + +typedef struct _DXGKARGCB_SAVEMEMORYFORHOTUPDATE +{ + UINT NumDataMemoryRanges; + _Field_size_(NumDataMemoryRanges) + DXGK_KSR_MEMORY_RANGE* pDataMemoryRanges; + PMDL pDataMdl; + UINT DataSize; + _Field_size_(DataSize) + PVOID pData; + UINT MetaDataSize; + _Field_size_(MetaDataSize) + BYTE* pMetaData; +} DXGKARGCB_SAVEMEMORYFORHOTUPDATE; + +typedef _In_ CONST DXGKARGCB_SAVEMEMORYFORHOTUPDATE* IN_CONST_PDXGKARGCB_SAVEMEMORYFORHOTUPDATE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_SAVEMEMORYFORHOTUPDATE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_SAVEMEMORYFORHOTUPDATE)( + IN_CONST_HANDLE hAdapter, + IN_CONST_PDXGKARGCB_SAVEMEMORYFORHOTUPDATE pArgs + ); + +typedef struct _DXGK_SAVEMEMORYFORHOTUPDATEFLAGS +{ + union + { + struct + { + UINT CancelHotUpdate : 1; + UINT Reserved : 31; + }; + UINT Value; + }; +} DXGK_SAVEMEMORYFORHOTUPDATEFLAGS; + +typedef struct _DXGKARG_SAVEMEMORYFORHOTUPDATE +{ + DXGK_SAVEMEMORYFORHOTUPDATEFLAGS Flags; +} DXGKARG_SAVEMEMORYFORHOTUPDATE; + +typedef _In_ CONST DXGKARG_SAVEMEMORYFORHOTUPDATE* IN_CONST_PDXGKARG_SAVEMEMORYFORHOTUPDATE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SAVEMEMORYFORHOTUPDATE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SAVEMEMORYFORHOTUPDATE( + IN_CONST_HANDLE hContext, + IN_CONST_PDXGKARG_SAVEMEMORYFORHOTUPDATE pArgs + ); + +typedef struct _DXGK_RESTOREMEMORYFORHOTUPDATEFLAGS +{ + union + { + struct + { + UINT RestoreComplete : 1; + UINT Reserved : 31; + }; + UINT Value; + }; +} DXGK_RESTOREMEMORYFORHOTUPDATEFLAGS; + +typedef struct _DXGKARG_RESTOREMEMORYFORHOTUPDATE +{ + DXGK_RESTOREMEMORYFORHOTUPDATEFLAGS Flags; + PMDL pDataMdl; + UINT MetaDataSize; + _Field_size_(MetaDataSize) + PVOID pMetaData; +} DXGKARG_RESTOREMEMORYFORHOTUPDATE; + +typedef _In_ CONST DXGKARG_RESTOREMEMORYFORHOTUPDATE * IN_CONST_PDXGKARG_RESTOREMEMORYFORHOTUPDATE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_RESTOREMEMORYFORHOTUPDATE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_RESTOREMEMORYFORHOTUPDATE( + IN_CONST_HANDLE hContext, + IN_CONST_PDXGKARG_RESTOREMEMORYFORHOTUPDATE pArgs + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_6 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8) +typedef struct _DXGKARGCB_NOTIFYCURSORSUPPORTCHANGE +{ + HANDLE DeviceHandle; // in: Device handle + D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // in: VidPnSourceId +} DXGKARGCB_NOTIFYCURSORSUPPORTCHANGE; + +typedef _In_ CONST DXGKARGCB_NOTIFYCURSORSUPPORTCHANGE* IN_CONST_PDXGKARGCB_NOTIFYCURSORSUPPORTCHANGE; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_NOTIFYCURSORSUPPORTCHANGE) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_NOTIFYCURSORSUPPORTCHANGE)( + IN_CONST_PDXGKARGCB_NOTIFYCURSORSUPPORTCHANGE pArgs + ); +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_8 + +typedef enum _DXGIDDI_PARTITIONING_EVENT_TYPE +{ + DXGK_PARTITION_EVENT_FUNCTION_LEVEL_RESET = 0, + DXGK_PARTITION_EVENT_FUNDAMENTAL_WARM_RESET = 1, + DXGK_PARTITION_EVENT_DRIVER_INTERNAL = 2, +} DXGIDDI_PARTITIONING_EVENT_TYPE; + +#define DXGKDDI_PARTITION_EVENT_DESCRIPTION_MAX 255 + +typedef struct _DXGKDDICB_PARTITIONING_EVENT_NOTIFICATION +{ + _In_ HANDLE hAdapter; + _In_ DXGIDDI_PARTITIONING_EVENT_TYPE EventType; + _In_ ULONG PartitionId; + _In_ WCHAR EventDescription[DXGKDDI_PARTITION_EVENT_DESCRIPTION_MAX]; // a useful descriptive string for the driver to identify the meaning of the event and the data below + _In_ UINT64 EventData1; // a useful parameter for data that may help triage the event + _In_ UINT64 EventData2; // a useful parameter for data that may help triage the event + _In_ UINT64 EventData3; // a useful parameter for data that may help triage the event + _In_ UINT64 EventData4; // a useful parameter for data that may help triage the event + _In_ UINT64 EventData5; // a useful parameter for data that may help triage the event +} DXGKDDICB_PARTITIONING_EVENT_NOTIFICATION, +*PDXGKDDICB_PARTITIONING_EVENT_NOTIFICATION; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) +typedef enum _DXGK_PHYSICAL_MEMORY_TYPE +{ + DXGK_PHYSICAL_MEMORY_TYPE_MDL, + DXGK_PHYSICAL_MEMORY_TYPE_CONTIGUOUS_MEMORY, + DXGK_PHYSICAL_MEMORY_TYPE_SECTION, + DXGK_PHYSICAL_MEMORY_TYPE_IO_SPACE +} DXGK_PHYSICAL_MEMORY_TYPE; + +typedef enum _DXGK_ACCESS_MODE +{ + DXGK_ACCESS_MODE_KERNEL_MODE, + DXGK_ACCESS_MODE_USER_MODE +} DXGK_ACCESS_MODE; + +typedef struct _OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; + +typedef struct _DXGKARGCB_CREATE_PHYSICAL_MEMORY_OBJECT +{ + _In_opt_ HANDLE hAdapter; + _In_ SIZE_T Size; + _In_opt_ ULONG_PTR Context; + _In_ DXGK_PHYSICAL_MEMORY_TYPE Type; + _In_ DXGK_MEMORY_CACHING_TYPE CacheType; + union + { + struct + { + _In_ PHYSICAL_ADDRESS LowAddress; + _In_ PHYSICAL_ADDRESS HighAddress; + _In_ PHYSICAL_ADDRESS SkipBytes; + _In_ UINT Flags; + } Mdl; + struct + { + _In_ PHYSICAL_ADDRESS LowestAcceptableAddress; + _In_ PHYSICAL_ADDRESS HighestAcceptableAddress; + _In_ PHYSICAL_ADDRESS BoundaryAddressMultiple; + } ContiguousMemory; + struct + { + _In_ ACCESS_MASK DesiredAccess; + _In_ POBJECT_ATTRIBUTES ObjectAttributes; + _In_ ULONG PageProtection; + _In_ ULONG AllocationAttributes; + } Section; + struct + { + _In_ PHYSICAL_ADDRESS BaseAddress; + } IOSpace; + }; + _Out_ HANDLE hPhysicalMemoryObject; + _Out_ HANDLE hAdapterMemoryObject; +} DXGKARGCB_CREATE_PHYSICAL_MEMORY_OBJECT; + +typedef struct _DXGKARGCB_DESTROY_PHYSICAL_MEMORY_OBJECT +{ + _In_ HANDLE hPhysicalMemoryObject; + _In_opt_ HANDLE hAdapterMemoryObject; +} DXGKARGCB_DESTROY_PHYSICAL_MEMORY_OBJECT; + +typedef _Inout_ DXGKARGCB_CREATE_PHYSICAL_MEMORY_OBJECT* IN_OUT_PDXGKARGCB_CREATE_PHYSICAL_MEMORY_OBJECT; +typedef _In_ CONST DXGKARGCB_DESTROY_PHYSICAL_MEMORY_OBJECT* IN_CONST_PDXGKARGCB_DESTROY_PHYSICAL_MEMORY_OBJECT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_CREATEPHYSICALMEMORYOBJECT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_CREATEPHYSICALMEMORYOBJECT)( + IN_OUT_PDXGKARGCB_CREATE_PHYSICAL_MEMORY_OBJECT pArgs + ); + +typedef + _Function_class_DXGK_(DXGKCB_DESTROYPHYSICALMEMORYOBJECT) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_DESTROYPHYSICALMEMORYOBJECT)( + IN_CONST_PDXGKARGCB_DESTROY_PHYSICAL_MEMORY_OBJECT pArgs + ); + +typedef struct _DXGKARGCB_MAP_PHYSICAL_MEMORY +{ + _In_ HANDLE hPhysicalMemoryObject; + _In_ DXGK_ACCESS_MODE AccessMode; + _In_ SIZE_T Offset; + _In_ SIZE_T Size; + _Out_ void* pMappedAddress; +} DXGKARGCB_MAP_PHYSICAL_MEMORY; + +typedef struct _DXGKARGCB_UNMAP_PHYSICAL_MEMORY +{ + _In_ HANDLE hPhysicalMemoryObject; + _In_ void* pBaseAddress; + _In_ SIZE_T Size; +} DXGKARGCB_UNMAP_PHYSICAL_MEMORY; + +typedef _Inout_ DXGKARGCB_MAP_PHYSICAL_MEMORY* IN_OUT_PDXGKARGCB_MAP_PHYSICAL_MEMORY; +typedef _In_ CONST DXGKARGCB_UNMAP_PHYSICAL_MEMORY* IN_CONST_PDXGKARGCB_UNMAP_PHYSICAL_MEMORY; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_MAPPHYSICALMEMORY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_MAPPHYSICALMEMORY)( + IN_OUT_PDXGKARGCB_MAP_PHYSICAL_MEMORY pArgs + ); + +typedef + _Function_class_DXGK_(DXGKCB_UNMAPPHYSICALMEMORY) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_UNMAPPHYSICALMEMORY)( + IN_CONST_PDXGKARGCB_UNMAP_PHYSICAL_MEMORY pArgs + ); + +typedef struct _DXGKARGCB_ALLOCATE_ADL +{ + _In_ HANDLE hAdapterMemoryObject; + _In_ SIZE_T Offset; + _In_ SIZE_T Size; + union + { + struct + { + UINT32 RequireContiguous : 1; + UINT32 PreferContiguous : 1; + UINT32 Reserved : 30; + }; + UINT32 Value; + } Flags; + _Out_ DXGK_ADL *pAdl; +} DXGKARGCB_ALLOCATE_ADL; + +typedef struct _DXGKARGCB_FREE_ADL +{ + _In_ HANDLE hAdapterMemoryObject; + _In_ DXGK_ADL* pAdl; +} DXGKARGCB_FREE_ADL; + +typedef _Inout_ DXGKARGCB_ALLOCATE_ADL* IN_OUT_PDXGKARGCB_ALLOCATE_ADL; +typedef _In_ CONST DXGKARGCB_FREE_ADL* IN_CONST_PDXGKARGCB_FREE_ADL; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_ALLOCATEADL) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_ALLOCATEADL)( + IN_OUT_PDXGKARGCB_ALLOCATE_ADL pArgs + ); + +typedef + _Function_class_DXGK_(DXGKCB_FREEADL) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_FREEADL)( + IN_CONST_PDXGKARGCB_FREE_ADL pArgs + ); + +typedef struct _DXGKARGCB_OPEN_PHYSICAL_MEMORY_OBJECT +{ + _In_ HANDLE hPhysicalMemoryObject; + _In_ HANDLE hAdapter; + _Out_ HANDLE hAdapterMemoryObject; +} DXGKARGCB_OPEN_PHYSICAL_MEMORY_OBJECT; + +typedef struct _DXGKARGCB_CLOSE_PHYSICAL_MEMORY_OBJECT +{ + _In_ HANDLE hAdapterMemoryObject; +} DXGKARGCB_CLOSE_PHYSICAL_MEMORY_OBJECT; + +typedef _Inout_ DXGKARGCB_OPEN_PHYSICAL_MEMORY_OBJECT* IN_OUT_PDXGKARGCB_OPEN_PHYSICAL_MEMORY_OBJECT; +typedef _In_ CONST DXGKARGCB_CLOSE_PHYSICAL_MEMORY_OBJECT* IN_CONST_PDXGKARGCB_CLOSE_PHYSICAL_MEMORY_OBJECT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_OPENPHYSICALMEMORYOBJECT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_OPENPHYSICALMEMORYOBJECT)( + IN_OUT_PDXGKARGCB_OPEN_PHYSICAL_MEMORY_OBJECT pArgs + ); + +typedef + _Function_class_DXGK_(DXGKCB_CLOSEPHYSICALMEMORYOBJECT) + _IRQL_requires_(PASSIVE_LEVEL) +VOID +(APIENTRY CALLBACK *DXGKCB_CLOSEPHYSICALMEMORYOBJECT)( + IN_CONST_PDXGKARGCB_CLOSE_PHYSICAL_MEMORY_OBJECT pArgs + ); + +typedef struct _DXGKARGCB_QUERYFEATURESUPPORT +{ + HANDLE DeviceHandle; // in: Device handle that was passed to the driver DxgkDdiStartDevice function. + DXGK_FEATURE_ID FeatureId; // in: Feature ID to query enabled state for. + + _Field_range_(DXGK_FEATURE_SUPPORT_ALWAYS_OFF, DXGK_FEATURE_SUPPORT_ALWAYS_ON) + UINT DriverSupportState; // in: Driver support state for FeatureId as defined in DXGK_FEATURE_SUPPORT_* constants + + BOOLEAN Enabled; // out: + // FALSE if the OS instructs the driver not to enable the feature. + // TRUE if the OS allows the driver to enable the feature. +} DXGKARGCB_QUERYFEATURESUPPORT; + +typedef _Inout_ DXGKARGCB_QUERYFEATURESUPPORT* INOUT_PDXGKARGCB_QUERYFEATURESUPPORT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_QUERYFEATURESUPPORT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_QUERYFEATURESUPPORT)(INOUT_PDXGKARGCB_QUERYFEATURESUPPORT); + +typedef struct _DXGKARGCB_PINFRAMEBUFFERFORSAVE2 +{ + _In_ UINT PhysicalAdapterIndex; + _In_ SIZE_T CommitSize; + union + { + struct + { + UINT PreferContiguous : 1; + UINT Reserved : 31; + }; + UINT Value; + } Flags; + _Out_ DXGK_ADL* pAdl; +} DXGKARGCB_PINFRAMEBUFFERFORSAVE2; + +typedef _Inout_ DXGKARGCB_PINFRAMEBUFFERFORSAVE2* INOUT_PDXGKARGCB_PINFRAMEBUFFERFORSAVE2; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_PINFRAMEBUFFERFORSAVE2) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_PINFRAMEBUFFERFORSAVE2)( + IN_CONST_HANDLE hAdapter, + INOUT_PDXGKARGCB_PINFRAMEBUFFERFORSAVE2 pPinFrameBufferForSave2 + ); + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_9 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +#define DXGK_MAX_DOORBELL_SIZE_BYTES 16384 // 4 * PAGE_SIZE + +typedef struct _DXGK_USERMODESUBMISSION_CAPS +{ + union + { + struct + { + UINT SecondaryDoorbellSupported : 1; + UINT Reserved : 31; + }; + UINT Value; + } Flags; + + UINT DoorbellSizeInBytes; + UINT SecondaryDoorbellSizeInBytes; + UCHAR Reserved[16]; +} DXGK_USERMODESUBMISSION_CAPS; + +typedef struct _DXGKARG_CREATEDOORBELL_FLAGS +{ + union + { + struct + { + UINT ResizeRingBufferOperation : 1; + UINT Reserved : 31; + }; + UINT Value; + }; +}DXGKARG_CREATEDOORBELL_FLAGS; + +typedef struct _DXGKARG_CREATEDOORBELL +{ + HANDLE hHwQueue; // in: KMD handle of the HWQueue for which doorbell needs to be created + HANDLE hDoorbell; // in: Runtime handle/out: KMD handle + _Field_range_(0, D3DDDI_DOORBELL_PRIVATEDATA_MAX_BYTES_WDDM3_1) + UINT PrivateDriverDataSize; // in: Size of private driver data + _Field_size_(PrivateDriverDataSize) + void* PrivateDriverData; // in/out: Private driver data + HANDLE hRingBuffer; // in: KMD Handle of Ring buffer allocation + HANDLE hRingBufferControl; // in: KMD Handle of Ring buffer control allocation + DXGKARG_CREATEDOORBELL_FLAGS Flags; // in: flags +}DXGKARG_CREATEDOORBELL; + +typedef _Inout_ DXGKARG_CREATEDOORBELL* INOUT_PDXGKARG_CREATEDOORBELL; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_CREATEDOORBELL) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CREATEDOORBELL( + INOUT_PDXGKARG_CREATEDOORBELL pArgs +); + +typedef struct _DXGKARG_CONNECTDOORBELL_FLAGS +{ + union + { + struct + { + UINT RequireSecondaryAddress : 1; + UINT Reserved: 31; + }; + UINT Value; + }; +}DXGKARG_CONNECTDOORBELL_FLAGS; + +typedef struct _DXGKARG_CONNECTDOORBELL +{ + HANDLE hDoorbell; // in: KMD handle of the doorbell which needs to be connected + DXGKARG_CONNECTDOORBELL_FLAGS Flags; // in: flags + void* KernelCpuVirtualAddress; // out: kernel CPU VA of the doorbell + void* SecondaryKernelCpuVirtualAddress; // out opt: secondary kernel CPU VA of the doorbell + D3DDDI_DOORBELLSTATUS Status; // out: +}DXGKARG_CONNECTDOORBELL; + +typedef _Inout_ DXGKARG_CONNECTDOORBELL* INOUT_PDXGKARG_CONNECTDOORBELL; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_CONNECTDOORBELL) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CONNECTDOORBELL( + INOUT_PDXGKARG_CONNECTDOORBELL pArgs + ); + +typedef struct _DXGKARG_DISCONNECTDOORBELL_FLAGS +{ + union + { + struct + { + UINT Reserved : 32; + }; + UINT Value; + }; +}DXGKARG_DISCONNECTDOORBELL_FLAGS; + +typedef struct _DXGKARG_DISCONNECTDOORBELL +{ + HANDLE hDoorbell; // in: KMD handle of the doorbell to be disconnected + DXGKARG_DISCONNECTDOORBELL_FLAGS Flags; // in: flags +}DXGKARG_DISCONNECTDOORBELL; + +typedef _Inout_ DXGKARG_DISCONNECTDOORBELL* INOUT_PDXGKARG_DISCONNECTDOORBELL; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_DISCONNECTDOORBELL) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DISCONNECTDOORBELL( + INOUT_PDXGKARG_DISCONNECTDOORBELL pArgs +); + +typedef struct _DXGKARG_DESTROYDOORBELL +{ + HANDLE hDoorbell; // in: KMD handle of the doorbell to be destroyed +}DXGKARG_DESTROYDOORBELL; + +typedef _Inout_ DXGKARG_DESTROYDOORBELL* INOUT_PDXGKARG_DESTROYDOORBELL; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_DESTROYDOORBELL) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_DESTROYDOORBELL( + INOUT_PDXGKARG_DESTROYDOORBELL pArgs +); + +typedef struct _DXGKARG_NOTIFYWORKSUBMISSION_FLAGS +{ + union + { + struct + { + UINT Reserved : 32; + }; + UINT Value; + }; +}DXGKARG_NOTIFYWORKSUBMISSION_FLAGS; + +typedef struct _DXGKARG_NOTIFYWORKSUBMISSION +{ + HANDLE hHwQueue; // in: KMD handle of the HWQueue + DXGKARG_NOTIFYWORKSUBMISSION_FLAGS Flags; +}DXGKARG_NOTIFYWORKSUBMISSION; + +typedef _Inout_ DXGKARG_NOTIFYWORKSUBMISSION* INOUT_PDXGKARG_NOTIFYWORKSUBMISSION; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_NOTIFYWORKSUBMISSION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_NOTIFYWORKSUBMISSION( + INOUT_PDXGKARG_NOTIFYWORKSUBMISSION pArgs +); + +typedef struct _DXGKARGCB_DISCONNECTDOORBELL_FLAGS +{ + union + { + struct + { + UINT Reserved : 32; + }; + UINT Value; + }; +} DXGKARGCB_DISCONNECTDOORBELL_FLAGS; + +typedef struct _DXGKARGCB_DISCONNECTDOORBELL +{ + HANDLE hHwQueue; // in: DXG assigned handle of the HWQueue whose doorbell + // must be disconnected + DXGKARGCB_DISCONNECTDOORBELL_FLAGS Flags; // in: + D3DDDI_DOORBELLSTATUS DisconnectReason; // in: +} DXGKARGCB_DISCONNECTDOORBELL; + +typedef _Inout_ DXGKARGCB_DISCONNECTDOORBELL* INOUT_PDXGKARGCB_DISCONNECTDOORBELL; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKCB_DISCONNECTDOORBELL) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY CALLBACK* DXGKCB_DISCONNECTDOORBELL)( + INOUT_PDXGKARGCB_DISCONNECTDOORBELL pArgs + ); + +typedef struct _DXGKARG_FLUSHHWQUEUE_FLAGS +{ + union + { + struct + { + UINT Reserved : 32; + }; + UINT Value; + }; +} DXGKARG_FLUSHHWQUEUE_FLAGS; + +typedef struct _DXGKARG_FLUSHHWQUEUE +{ + HANDLE hHwQueue; // in: KMD handle of the HWQueue to flush + HANDLE Event; // event to signal after flush complete + DXGKARG_FLUSHHWQUEUE_FLAGS Flags; +}DXGKARG_FLUSHHWQUEUE; + +typedef _Inout_ DXGKARG_FLUSHHWQUEUE* INOUT_PDXGKARG_FLUSHHWQUEUE; + +typedef +_Check_return_ +_Function_class_DXGK_(DXGKDDI_FLUSHHWQUEUE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_FLUSHHWQUEUE( + INOUT_PDXGKARG_FLUSHHWQUEUE pArgs +); +#endif + +// +// Function pointer typedefs +// + +typedef DXGKDDI_QUERYADAPTERINFO *PDXGKDDI_QUERYADAPTERINFO; +typedef DXGKDDI_CREATEDEVICE *PDXGKDDI_CREATEDEVICE; +typedef DXGKDDI_CREATEALLOCATION *PDXGKDDI_CREATEALLOCATION; +typedef DXGKDDI_DESTROYALLOCATION *PDXGKDDI_DESTROYALLOCATION; +typedef DXGKDDI_DESCRIBEALLOCATION *PDXGKDDI_DESCRIBEALLOCATION; +typedef DXGKDDI_GETSTANDARDALLOCATIONDRIVERDATA *PDXGKDDI_GETSTANDARDALLOCATIONDRIVERDATA; +typedef DXGKDDI_ACQUIRESWIZZLINGRANGE *PDXGKDDI_ACQUIRESWIZZLINGRANGE; +typedef DXGKDDI_RELEASESWIZZLINGRANGE *PDXGKDDI_RELEASESWIZZLINGRANGE; +typedef DXGKDDI_PATCH *PDXGKDDI_PATCH; +typedef DXGKDDI_SUBMITCOMMAND *PDXGKDDI_SUBMITCOMMAND; +typedef DXGKDDI_PREEMPTCOMMAND *PDXGKDDI_PREEMPTCOMMAND; +typedef DXGKDDI_CANCELCOMMAND *PDXGKDDI_CANCELCOMMAND; +typedef DXGKDDI_BUILDPAGINGBUFFER *PDXGKDDI_BUILDPAGINGBUFFER; +typedef DXGKDDI_SETPALETTE *PDXGKDDI_SETPALETTE; +typedef DXGKDDI_SETPOINTERPOSITION *PDXGKDDI_SETPOINTERPOSITION; +typedef DXGKDDI_SETPOINTERSHAPE *PDXGKDDI_SETPOINTERSHAPE; +typedef DXGKDDI_RESETFROMTIMEOUT *PDXGKDDI_RESETFROMTIMEOUT; +typedef DXGKDDI_RESTARTFROMTIMEOUT *PDXGKDDI_RESTARTFROMTIMEOUT; +typedef DXGKDDI_ESCAPE *PDXGKDDI_ESCAPE; +typedef DXGKDDI_COLLECTDBGINFO *PDXGKDDI_COLLECTDBGINFO; +typedef DXGKDDI_QUERYCURRENTFENCE *PDXGKDDI_QUERYCURRENTFENCE; +typedef DXGKDDI_ISSUPPORTEDVIDPN *PDXGKDDI_ISSUPPORTEDVIDPN; +typedef DXGKDDI_RECOMMENDFUNCTIONALVIDPN *PDXGKDDI_RECOMMENDFUNCTIONALVIDPN; +typedef DXGKDDI_ENUMVIDPNCOFUNCMODALITY *PDXGKDDI_ENUMVIDPNCOFUNCMODALITY; +typedef DXGKDDI_SETVIDPNSOURCEADDRESS *PDXGKDDI_SETVIDPNSOURCEADDRESS; +typedef DXGKDDI_SETVIDPNSOURCEVISIBILITY *PDXGKDDI_SETVIDPNSOURCEVISIBILITY; +typedef DXGKDDI_COMMITVIDPN *PDXGKDDI_COMMITVIDPN; +typedef DXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH *PDXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH; +typedef DXGKDDI_RECOMMENDMONITORMODES *PDXGKDDI_RECOMMENDMONITORMODES; +typedef DXGKDDI_RECOMMENDVIDPNTOPOLOGY *PDXGKDDI_RECOMMENDVIDPNTOPOLOGY; +typedef DXGKDDI_GETSCANLINE *PDXGKDDI_GETSCANLINE; +typedef DXGKDDI_STOPCAPTURE *PDXGKDDI_STOPCAPTURE; +typedef DXGKDDI_CONTROLINTERRUPT *PDXGKDDI_CONTROLINTERRUPT; +typedef DXGKDDI_CREATEOVERLAY *PDXGKDDI_CREATEOVERLAY; +typedef DXGKDDI_DESTROYDEVICE *PDXGKDDI_DESTROYDEVICE; +typedef DXGKDDI_OPENALLOCATIONINFO *PDXGKDDI_OPENALLOCATIONINFO; +typedef DXGKDDI_CLOSEALLOCATION *PDXGKDDI_CLOSEALLOCATION; +typedef DXGKDDI_RENDER *PDXGKDDI_RENDER; +typedef DXGKDDI_PRESENT *PDXGKDDI_PRESENT; +typedef DXGKDDI_UPDATEOVERLAY *PDXGKDDI_UPDATEOVERLAY; +typedef DXGKDDI_FLIPOVERLAY *PDXGKDDI_FLIPOVERLAY; +typedef DXGKDDI_DESTROYOVERLAY *PDXGKDDI_DESTROYOVERLAY; +typedef DXGKDDI_CREATECONTEXT *PDXGKDDI_CREATECONTEXT; +typedef DXGKDDI_DESTROYCONTEXT *PDXGKDDI_DESTROYCONTEXT; +typedef DXGKDDI_SETDISPLAYPRIVATEDRIVERFORMAT *PDXGKDDI_SETDISPLAYPRIVATEDRIVERFORMAT; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) +typedef DXGKDDI_RENDERKM *PDXGKDDI_RENDERKM; +typedef DXGKDDI_QUERYVIDPNHWCAPABILITY *PDXGKDDI_QUERYVIDPNHWCAPABILITY; +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) +typedef DXGKDDISETPOWERCOMPONENTFSTATE *PDXGKDDISETPOWERCOMPONENTFSTATE; +typedef DXGKDDIPOWERRUNTIMECONTROLREQUEST *PDXGKDDIPOWERRUNTIMECONTROLREQUEST; +typedef DXGKDDI_QUERYDEPENDENTENGINEGROUP *PDXGKDDI_QUERYDEPENDENTENGINEGROUP; +typedef DXGKDDI_QUERYENGINESTATUS *PDXGKDDI_QUERYENGINESTATUS; +typedef DXGKDDI_RESETENGINE *PDXGKDDI_RESETENGINE; +typedef DXGKDDI_PRESENTDISPLAYONLY *PDXGKDDI_PRESENTDISPLAYONLY; +typedef DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY *PDXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY; +#endif // DXGKDDI_INTERFACE_VERSION +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) +typedef DXGKDDI_GETNODEMETADATA *PDXGKDDI_GETNODEMETADATA; +typedef DXGKDDISETPOWERPSTATE *PDXGKDDISETPOWERPSTATE; +typedef DXGKDDI_CONTROLINTERRUPT2 *PDXGKDDI_CONTROLINTERRUPT2; +typedef DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT *PDXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT; +typedef DXGKDDI_FORMATHISTORYBUFFER *PDXGKDDI_FORMATHISTORYBUFFER; +typedef DXGKDDI_CALIBRATEGPUCLOCK *PDXGKDDI_CALIBRATEGPUCLOCK; +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +typedef DXGKDDI_RENDERGDI *PDXGKDDI_RENDERGDI; +typedef DXGKDDI_SUBMITCOMMANDVIRTUAL *PDXGKDDI_SUBMITCOMMANDVIRTUAL; +typedef DXGKDDI_SETROOTPAGETABLE *PDXGKDDI_SETROOTPAGETABLE; +typedef DXGKDDI_GETROOTPAGETABLESIZE *PDXGKDDI_GETROOTPAGETABLESIZE; +typedef DXGKDDI_MAPCPUHOSTAPERTURE *PDXGKDDI_MAPCPUHOSTAPERTURE; +typedef DXGKDDI_UNMAPCPUHOSTAPERTURE *PDXGKDDI_UNMAPCPUHOSTAPERTURE; +typedef DXGKDDI_CREATEPROCESS *PDXGKDDI_CREATEPROCESS; +typedef DXGKDDI_DESTROYPROCESS *PDXGKDDI_DESTROYPROCESS; +typedef DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT2 *PDXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT2; +typedef DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2 *PDXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2; +typedef DXGKDDI_POWERRUNTIMESETDEVICEHANDLE *PDXGKDDI_POWERRUNTIMESETDEVICEHANDLE; +typedef DXGKDDI_SETSTABLEPOWERSTATE *PDXGKDDI_SETSTABLEPOWERSTATE; +typedef DXGKDDI_SETVIDEOPROTECTEDREGION *PDXGKDDI_SETVIDEOPROTECTEDREGION; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) +typedef DXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT3 *PDXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT3; +typedef DXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3 *PDXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3; +typedef DXGKDDI_POSTMULTIPLANEOVERLAYPRESENT *PDXGKDDI_POSTMULTIPLANEOVERLAYPRESENT; +typedef DXGKDDI_CONTROLMODEBEHAVIOR *PDXGKDDI_CONTROLMODEBEHAVIOR; +typedef DXGKDDI_UPDATEMONITORLINKINFO *PDXGKDDI_UPDATEMONITORLINKINFO; +typedef DXGKDDI_VALIDATEUPDATEALLOCATIONPROPERTY *PDXGKDDI_VALIDATEUPDATEALLOCATIONPROPERTY; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef DXGKDDI_CREATEHWCONTEXT *PDXGKDDI_CREATEHWCONTEXT; +typedef DXGKDDI_DESTROYHWCONTEXT *PDXGKDDI_DESTROYHWCONTEXT; +typedef DXGKDDI_CREATEHWQUEUE *PDXGKDDI_CREATEHWQUEUE; +typedef DXGKDDI_DESTROYHWQUEUE *PDXGKDDI_DESTROYHWQUEUE; +typedef DXGKDDI_SUBMITCOMMANDTOHWQUEUE *PDXGKDDI_SUBMITCOMMANDTOHWQUEUE; +typedef DXGKDDI_SWITCHTOHWCONTEXTLIST *PDXGKDDI_SWITCHTOHWCONTEXTLIST; +typedef DXGKDDI_RESETHWENGINE *PDXGKDDI_RESETHWENGINE; + +typedef DXGKDDI_CREATEPERIODICFRAMENOTIFICATION *PDXGKDDI_CREATEPERIODICFRAMENOTIFICATION; +typedef DXGKDDI_DESTROYPERIODICFRAMENOTIFICATION *PDXGKDDI_DESTROYPERIODICFRAMENOTIFICATION; + +typedef DXGKDDI_SETTIMINGSFROMVIDPN *PDXGKDDI_SETTIMINGSFROMVIDPN; +typedef DXGKDDI_SETTARGETGAMMA *PDXGKDDI_SETTARGETGAMMA; +typedef DXGKDDI_SETTARGETCONTENTTYPE *PDXGKDDI_SETTARGETCONTENTTYPE; +typedef DXGKDDI_SETTARGETANALOGCOPYPROTECTION *PDXGKDDI_SETTARGETANALOGCOPYPROTECTION; +typedef DXGKDDI_DISPLAYDETECTCONTROL *PDXGKDDI_DISPLAYDETECTCONTROL; +typedef DXGKDDI_QUERYCONNECTIONCHANGE *PDXGKDDI_QUERYCONNECTIONCHANGE; +typedef DXGKDDI_GETMULTIPLANEOVERLAYCAPS *PDXGKDDI_GETMULTIPLANEOVERLAYCAPS; +typedef DXGKDDI_GETPOSTCOMPOSITIONCAPS *PDXGKDDI_GETPOSTCOMPOSITIONCAPS; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +typedef DXGKDDI_UPDATEHWCONTEXTSTATE *PDXGKDDI_UPDATEHWCONTEXTSTATE; + +typedef DXGKDDI_CREATEPROTECTEDSESSION* PDXGKDDI_CREATEPROTECTEDSESSION; +typedef DXGKDDI_DESTROYPROTECTEDSESSION* PDXGKDDI_DESTROYPROTECTEDSESSION; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef DXGKDDI_SETSCHEDULINGLOGBUFFER *PDXGKDDI_SETSCHEDULINGLOGBUFFER; +typedef DXGKDDI_SETUPPRIORITYBANDS *PDXGKDDI_SETUPPRIORITYBANDS; +typedef DXGKDDI_NOTIFYFOCUSPRESENT *PDXGKDDI_NOTIFYFOCUSPRESENT; +typedef DXGKDDI_SETCONTEXTSCHEDULINGPROPERTIES *PDXGKDDI_SETCONTEXTSCHEDULINGPROPERTIES; +typedef DXGKDDI_SUSPENDCONTEXT *PDXGKDDI_SUSPENDCONTEXT; +typedef DXGKDDI_RESUMECONTEXT *PDXGKDDI_RESUMECONTEXT; +typedef DXGKDDI_SETVIRTUALMACHINEDATA *PDXGKDDI_SETVIRTUALMACHINEDATA; +typedef DXGKDDI_BEGINEXCLUSIVEACCESS *PDXGKDDI_BEGINEXCLUSIVEACCESS; +typedef DXGKDDI_ENDEXCLUSIVEACCESS *PDXGKDDI_ENDEXCLUSIVEACCESS; +typedef DXGKDDI_RESUMEHWENGINE *PDXGKDDI_RESUMEHWENGINE; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef DXGKDDI_SIGNALMONITOREDFENCE *PDXGKDDI_SIGNALMONITOREDFENCE; +typedef DXGKDDI_PRESENTTOHWQUEUE *PDXGKDDI_PRESENTTOHWQUEUE; +typedef DXGKDDI_VALIDATESUBMITCOMMAND *PDXGKDDI_VALIDATESUBMITCOMMAND; +typedef DXGKDDI_SETTRACKEDWORKLOADPOWERLEVEL *PDXGKDDI_SETTRACKEDWORKLOADPOWERLEVEL; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +typedef DXGKDDI_SAVEMEMORYFORHOTUPDATE *PDXGKDDI_SAVEMEMORYFORHOTUPDATE; +typedef DXGKDDI_RESTOREMEMORYFORHOTUPDATE *PDXGKDDI_RESTOREMEMORYFORHOTUPDATE; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + +typedef DXGKDDI_CONTROLINTERRUPT3 *PDXGKDDI_CONTROLINTERRUPT3; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +typedef DXGKDDI_SETFLIPQUEUELOGBUFFER *PDXGKDDI_SETFLIPQUEUELOGBUFFER; +typedef DXGKDDI_UPDATEFLIPQUEUELOG *PDXGKDDI_UPDATEFLIPQUEUELOG; +typedef DXGKDDI_CANCELQUEUEDFLIPS *PDXGKDDI_CANCELQUEUEDFLIPS; +typedef DXGKDDI_SETINTERRUPTTARGETPRESENTID *PDXGKDDI_SETINTERRUPTTARGETPRESENTID; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + +typedef DXGKDDI_SETALLOCATIONBACKINGSTORE *PDXGKDDI_SETALLOCATIONBACKINGSTORE; +typedef DXGKDDI_CREATECPUEVENT *PDXGKDDI_CREATECPUEVENT; +typedef DXGKDDI_DESTROYCPUEVENT *PDXGKDDI_DESTROYCPUEVENT; + +typedef DXGKDDI_CANCELFLIPS *PDXGKDDI_CANCELFLIPS; + +// +// Interface to use some WDDM3.0 features on Vibranium +// {E922004D-EB9C-4DE1-9224-A9CEAA959BCE} +// +DEFINE_GUID(GUID_DEVINTERFACE_WDDM3_ON_VB, 0xe922004d, 0xeb9c, 0x4de1, 0x92, 0x24, 0xa9, 0xce, 0xaa, 0x95, 0x9b, 0xce); + +#ifndef PINTERFACE_REFERENCE +typedef VOID (*PINTERFACE_REFERENCE)(PVOID Context); +#endif +#ifndef PINTERFACE_DEREFERENCE +typedef VOID (*PINTERFACE_DEREFERENCE)(PVOID Context); +#endif + +typedef struct _DXGK_WDDM3_ON_VB_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + OUT PDXGKDDI_SETALLOCATIONBACKINGSTORE DxgkDdiSetAllocationBackingStore; + OUT PDXGKDDI_CREATECPUEVENT DxgkDdiCreateCpuEvent; + OUT PDXGKDDI_DESTROYCPUEVENT DxgkDdiDestroyCpuEvent; +} DXGK_WDDM3_ON_VB_INTERFACE, *PDXGK_WDDM3_ON_VB_INTERFACE; + +#define DXGK_WDDM3_ON_VB_INTERFACE_VERSION_1 1 + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +typedef DXGKDDI_CREATENATIVEFENCE *PDXGKDDI_CREATENATIVEFENCE; +typedef DXGKDDI_DESTROYNATIVEFENCE *PDXGKDDI_DESTROYNATIVEFENCE; +typedef DXGKDDI_UPDATEMONITOREDVALUES *PDXGKDDI_UPDATEMONITOREDVALUES; +typedef DXGKDDI_NOTIFYCURRENTVALUEUPDATES *PDXGKDDI_NOTIFYCURRENTVALUEUPDATES; + +typedef DXGKDDI_CREATEDOORBELL *PDXGKDDI_CREATEDOORBELL; +typedef DXGKDDI_CONNECTDOORBELL *PDXGKDDI_CONNECTDOORBELL; +typedef DXGKDDI_DISCONNECTDOORBELL *PDXGKDDI_DISCONNECTDOORBELL; +typedef DXGKDDI_DESTROYDOORBELL *PDXGKDDI_DESTROYDOORBELL; +typedef DXGKDDI_NOTIFYWORKSUBMISSION *PDXGKDDI_NOTIFYWORKSUBMISSION; +typedef DXGKDDI_FLUSHHWQUEUE *PDXGKDDI_FLUSHHWQUEUE; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +#if defined (_MSC_VER) +#pragma warning(pop) +#endif + + + diff --git a/sdk/include/ddk/dispmprt.h b/sdk/include/ddk/dispmprt.h new file mode 100644 index 0000000000000..5df3b9ebe3a1b --- /dev/null +++ b/sdk/include/ddk/dispmprt.h @@ -0,0 +1,4429 @@ + +#ifndef _DISPMPRT_H_ +#define _DISPMPRT_H_ + +#if defined (_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4115) // named type definition in parentheses +#pragma warning(disable:4201) // nameless struct/union +#pragma warning(disable:4214) // bit field types other than int +#endif + +#ifndef _ACPIIOCT_H_ +#include "acpiioct.h" +#endif + +// +// Old includes which are only kept for now for compatibility +// + +#ifndef _NTOSP_ +#define _NTOSP_ + +// +// Structures used by the kernel drivers to describe which ports must be +// hooked out directly from the V86 emulator to the driver. +// + +typedef enum _EMULATOR_PORT_ACCESS_TYPE { + Uchar, + Ushort, + Ulong +} EMULATOR_PORT_ACCESS_TYPE, *PEMULATOR_PORT_ACCESS_TYPE; + +typedef struct _EMULATOR_ACCESS_ENTRY { + ULONG BasePort; + ULONG NumConsecutivePorts; + EMULATOR_PORT_ACCESS_TYPE AccessType; + UCHAR AccessMode; + UCHAR StringSupport; + PVOID Routine; +} EMULATOR_ACCESS_ENTRY, *PEMULATOR_ACCESS_ENTRY; + +#endif + +// +// Graphics support routines. +// + +typedef +VOID +(*PBANKED_SECTION_ROUTINE) ( + _In_ ULONG ReadBank, + _In_ ULONG WriteBank, + _In_ PVOID Context + ); + +// +// Exclude some items from video.h +// + +#define _NTOSDEF_ + +#include +#include + +// +// Define types used in d3dukmdt.h, included via d3dkmdt.h that are not defined in this scope. +// + +typedef unsigned int UINT; +typedef unsigned long DWORD; +typedef unsigned char BYTE; + +#include +#include "d3dkmddi.h" +#include "d3dkmdt.h" + +#define DlDebugPrintEx(arg) DlDebugPrint arg + +// +// ** New definitions ********************************************************* +// + +// +// Available only for Vista (LONGHORN) and later +// +#if (NTDDI_VERSION >= NTDDI_LONGHORN) + +// +// Define ACPI event IDs +// + +#define ACPI_NOTIFY_DOCK_EVENT 0x77 +#define ACPI_NOTIFY_PANEL_SWITCH 0x80 +#define ACPI_NOTIFY_DEVICE_HOTPLUG 0x81 +#define ACPI_NOTIFY_CYCLE_DISPLAY_HOTKEY 0x82 +#define ACPI_NOTIFY_NEXT_DISPLAY_HOTKEY 0x83 +#define ACPI_NOTIFY_PREV_DISPLAY_HOTKEY 0x84 +#define ACPI_NOTIFY_CYCLE_BRIGHTNESS_HOTKEY 0x85 +#define ACPI_NOTIFY_INC_BRIGHTNESS_HOTKEY 0x86 +#define ACPI_NOTIFY_DEC_BRIGHTNESS_HOTKEY 0x87 +#define ACPI_NOTIFY_ZERO_BRIGHTNESS_HOTKEY 0x88 +#define ACPI_NOTIFY_VIDEO_WAKEUP 0x90 + +// +// ACPI argument definitions +// + +#define ACPI_ARG_ENABLE_SWITCH_EVENT 0x0 +#define ACPI_ARG_ENABLE_AUTO_SWITCH 0x1 +#define ACPI_ARG_DISABLE_SWITCH_EVENT 0x2 +#define ACPI_ARG_ENABLE_AUTO_LCD_BRIGHTNESS 0x0 +#define ACPI_ARG_DISABLE_AUTO_LCD_BRIGHTNESS 0x4 + +// +// ACPI methods for the adapter +// + +#define ACPI_METHOD_DISPLAY_DOS (ULONG)('SOD_') +#define ACPI_METHOD_DISPLAY_DOD (ULONG)('DOD_') +#define ACPI_METHOD_DISPLAY_ROM (ULONG)('MOR_') +#define ACPI_METHOD_DISPLAY_GPD (ULONG)('DPG_') +#define ACPI_METHOD_DISPLAY_SPD (ULONG)('DPS_') +#define ACPI_METHOD_DISPLAY_VPO (ULONG)('OPV_') + +#define ACPI_METHOD_HARDWARE_ID (ULONG)('DIH_') +#define ACPI_METHOD_SUBSYSTEM_ID (ULONG)('BUS_') +#define ACPI_METHOD_REVISION_ID (ULONG)('VRH_') + +// +// ACPI methods for children +// + +#define ACPI_METHOD_OUTPUT_ADR (ULONG)('RDA_') +#define ACPI_METHOD_OUTPUT_BCL (ULONG)('LCB_') +#define ACPI_METHOD_OUTPUT_BCM (ULONG)('MCB_') +#define ACPI_METHOD_OUTPUT_DDC (ULONG)('CDD_') +#define ACPI_METHOD_OUTPUT_DCS (ULONG)('SCD_') +#define ACPI_METHOD_OUTPUT_DGS (ULONG)('SGD_') +#define ACPI_METHOD_OUTPUT_DSS (ULONG)('SSD_') + +// +// ACPI Flags +// + +#define DXGK_ACPI_POLL_DISPLAY_CHILDREN 0x00000001 +#define DXGK_ACPI_CHANGE_DISPLAY_MODE 0x00000002 +#define DXGK_ACPI_CHANGE_DISPLAY_TOPOLOGY 0x00000004 +#define DXGK_ACPI_CHAIN_NOT_HANDLED 0x00000008 + +// +// Exclude adapter access flags. +// + +#define DXGK_EXCLUDE_EVICT_ALL 0x00000001 +#define DXGK_EXCLUDE_CALL_SYNCHRONOUS 0x00000002 +#define DXGK_EXCLUDE_BRIDGE_ACCESS 0x00000004 + +#define DXGK_EXCLUDE_EVICT_STANDBY 0x00000008 +#define DXGK_EXCLUDE_EVICT_HIBERNATE 0x00000010 +#define DXGK_EXCLUDE_EVICT_SHUTDOWN 0x00000020 +#define DXGK_EXCLUDE_D3_STATE_TRANSITION 0x00000040 +#define DXGK_EXCLUDE_EVICT_DFX_STANDBY 0x00000080 + +// +// Max of 50 characters per string. +// + +#define DXGK_MAX_STRING_LEN 50 +#define DXGK_MAX_REG_SZ_LEN DXGK_MAX_STRING_LEN + 1 + +// +// Supported device space types. +// + +#define DXGK_WHICHSPACE_CONFIG PCI_WHICHSPACE_CONFIG +#define DXGK_WHICHSPACE_ROM PCI_WHICHSPACE_ROM +#define DXGK_WHICHSPACE_MCH 0x80000000 +#define DXGK_WHICHSPACE_BRIDGE 0x80000001 + +// +// The below is to allow drivers to use the updated annotations if they wish, +// but not yet require all drivers to update their annotations. +// + +#ifdef ENABLE_DXGK_SAL +#define _Function_class_DXGK_(param) _Function_class_(param) +#define _IRQL_requires_DXGK_(param) _IRQL_requires_(param) +#define _Field_size_bytes_DXGK_(param) _Field_size_bytes_(param) +#else +#define _Function_class_DXGK_(param) +#define _IRQL_requires_DXGK_(param) +#define _Field_size_bytes_DXGK_(param) +#endif + +// +// Linked display adapter support. +// + +typedef struct _LINKED_DEVICE { + ULONG ChainUid; + ULONG NumberOfLinksInChain; + BOOLEAN LeadLink; +} LINKED_DEVICE, *PLINKED_DEVICE; + +// +// Type of ACPI notification event. +// + +typedef enum _DXGK_EVENT_TYPE { + DxgkUndefinedEvent, + DxgkAcpiEvent, + DxgkPowerStateEvent, + DxgkDockingEvent, + DxgkChainedAcpiEvent +} DXGK_EVENT_TYPE, *PDXGK_EVENT_TYPE; + +typedef struct _DXGK_VIDEO_OUTPUT_CAPABILITIES { + D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY InterfaceTechnology; + D3DKMDT_MONITOR_ORIENTATION_AWARENESS MonitorOrientationAwareness; + BOOLEAN SupportsSdtvModes; +} DXGK_VIDEO_OUTPUT_CAPABILITIES, *PDXGK_VIDEO_OUTPUT_CAPABILITIES; + +typedef struct _DXGK_INTEGRATED_DISPLAY_CHILD { + D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY InterfaceTechnology; + USHORT DescriptorLength; +} DXGK_INTEGRATED_DISPLAY_CHILD, *PDXGK_INTEGRATED_DISPLAY_CHILD; + +typedef struct _DXGK_CHILD_CAPABILITIES { + + union + { + // + // If (CHILD_DESCRIPTOR::ChildDeviceType == TypeVideoOutput) + // + + DXGK_VIDEO_OUTPUT_CAPABILITIES VideoOutput; + + // + // If (CHILD_DESCRIPTOR::ChildDeviceType == TypeOther) + // + + struct + { + UINT MustBeZero; + } + Other; + + // + // If (CHILD_DESCRIPTOR::ChildDeviceType == TypeIntegratedDisplay) + // + + DXGK_INTEGRATED_DISPLAY_CHILD IntegratedDisplayChild; + } Type; + + DXGK_CHILD_DEVICE_HPD_AWARENESS HpdAwareness; +} DXGK_CHILD_CAPABILITIES, *PDXGK_CHILD_CAPABILITIES; + +#if defined (_MSC_VER) +// We don't want to add anything in the Type union which would increase the +// size beyond the original DXGK_VIDEO_OUTPUT_CAPABILITIES unexpectedly so assert it. +static_assert( FIELD_OFFSET( DXGK_CHILD_CAPABILITIES, HpdAwareness ) == 12, "Type field has changed size" ); +#endif + +typedef enum _DXGK_CHILD_DEVICE_TYPE { + TypeUninitialized, + TypeVideoOutput, + TypeOther, + TypeIntegratedDisplay +} DXGK_CHILD_DEVICE_TYPE, *PDXGK_CHILD_DEVICE_TYPE; + +// +// Child descriptor structure returned to us from the miniport +// +// NOTE: If (ChildDeviceType==TypeVideoOutput) then (ChildUid == video present target ID) +// + +typedef struct _DXGK_CHILD_DESCRIPTOR { + DXGK_CHILD_DEVICE_TYPE ChildDeviceType; + DXGK_CHILD_CAPABILITIES ChildCapabilities; + ULONG AcpiUid; + ULONG ChildUid; +} DXGK_CHILD_DESCRIPTOR, *PDXGK_CHILD_DESCRIPTOR; + +typedef struct _DXGK_DEVICE_DESCRIPTOR { + ULONG DescriptorOffset; + ULONG DescriptorLength; + _Field_size_bytes_DXGK_(DescriptorLength) PVOID DescriptorBuffer; +} DXGK_DEVICE_DESCRIPTOR, *PDXGK_DEVICE_DESCRIPTOR; + +typedef struct _DXGK_GENERIC_DESCRIPTOR { + WCHAR HardwareId[DXGK_MAX_REG_SZ_LEN]; + WCHAR InstanceId[DXGK_MAX_REG_SZ_LEN]; + WCHAR CompatibleId[DXGK_MAX_REG_SZ_LEN]; + WCHAR DeviceText[DXGK_MAX_REG_SZ_LEN]; +} DXGK_GENERIC_DESCRIPTOR, *PDXGK_GENERIC_DESCRIPTOR; + +// +// Types of status that the miniport can report back to us +// + +typedef enum _DXGK_CHILD_STATUS_TYPE{ + StatusUninitialized, + StatusConnection, + StatusRotation, +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + StatusMiracastConnection, +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +} DXGK_CHILD_STATUS_TYPE, *PDXGK_CHILD_STATUS_TYPE; + +// +// Child Status structure which can be queried directly or +// indicated up by the miniport +// + +typedef struct _DXGK_CHILD_STATUS { + DXGK_CHILD_STATUS_TYPE Type; + ULONG ChildUid; + union { + struct { + BOOLEAN Connected; + } HotPlug; + struct { + UCHAR Angle; + } Rotation; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + struct { + BOOLEAN Connected; + D3DKMDT_VIDEO_OUTPUT_TECHNOLOGY MiracastMonitorType; + } Miracast; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + }; +} DXGK_CHILD_STATUS, *PDXGK_CHILD_STATUS; + +// +// DxgkCbExcludeAdapterAccess callback. +// + +typedef +_Function_class_DXGK_(DXGKDDI_PROTECTED_CALLBACK) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +VOID +(*DXGKDDI_PROTECTED_CALLBACK)( + IN_CONST_PVOID MiniportDeviceContext, + _In_ PVOID ProtectedCallbackContext, + _In_ NTSTATUS ProtectionStatus + ); + +// +// GUID_DEVINTERFACE_I2C {2564AA4F-DDDB-4495-B497-6AD4A84163D7} +// + +DEFINE_GUID(GUID_DEVINTERFACE_I2C, 0x2564AA4F, 0xDDDB, 0x4495, 0xB4, 0x97, 0x6A, 0xD4, 0xA8, 0x41, 0x63, 0xD7); + +// +// GUID_DEVINTERFACE_OPM {BF4672DE-6B4E-4BE4-A325-68A91EA49C09} +// + +DEFINE_GUID(GUID_DEVINTERFACE_OPM, 0xBF4672DE, 0x6B4E, 0x4BE4, 0xA3, 0x25, 0x68, 0xA9, 0x1E, 0xA4, 0x9C, 0x09); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +// +// GUID_DEVINTERFACE_OPM_2_JTP {E929EEA4-B9F1-407B-AAB9-AB08BB44FBF4} +// + +DEFINE_GUID(GUID_DEVINTERFACE_OPM_2_JTP, 0xE929EEA4, 0xB9F1, 0x407B, 0xAA, 0xB9, 0xAB, 0x08, 0xBB, 0x44, 0xFB, 0xF4); + +// +// GUID_DEVINTERFACE_OPM_2 {7F098726-2EBB-4FF3-A27F-1046B95DC517} +// + +DEFINE_GUID(GUID_DEVINTERFACE_OPM_2, 0x7F098726, 0x2EBB, 0x4FF3, 0xA2, 0x7F, 0x10, 0x46, 0xB9, 0x5D, 0xC5, 0x17); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +// +// GUID_DEVINTERFACE_OPM_3 {693A2CB1-8C8D-4AB6-9555-4B85EF2C7C6B} +// + +DEFINE_GUID(GUID_DEVINTERFACE_OPM_3, 0x693a2cb1, 0x8c8d, 0x4ab6, 0x95, 0x55, 0x4b, 0x85, 0xef, 0x2c, 0x7c, 0x6b); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +// +// GUID_DEVINTERFACE_BRIGHTNESS {FDE5BBA4-B3F9-46FB-BDAA-0728CE3100B4} +// + +DEFINE_GUID(GUID_DEVINTERFACE_BRIGHTNESS, 0xFDE5BBA4, 0xB3F9, 0x46FB, 0xBD, 0xAA, 0x07, 0x28, 0xCE, 0x31, 0x00, 0xB4); + +// +// GUID_DEVINTERFACE_BRIGHTNESS_2 {148A3C98-0ECD-465A-B634-B05F195F7739} +// + +DEFINE_GUID(GUID_DEVINTERFACE_BRIGHTNESS_2, 0x148A3C98, 0x0ECD, 0x465A, 0xB6, 0x34, 0xB0, 0x5F, 0x19, 0x5F, 0x77, 0x39); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +// +// GUID_DEVINTERFACE_UMDF_DISPLAY {AF03F190-22AF-48CB-94BB-B78E76A25107} +// + +DEFINE_GUID(GUID_DEVINTERFACE_MIRACAST_DISPLAY, 0xaf03f190, 0x22af, 0x48cb, 0x94, 0xbb, 0xb7, 0x8e, 0x76, 0xa2, 0x51, 0x7); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +// +// GUID_DEVINTERFACE_BRIGHTNESS_3 {197A4A6E-0391-4322-96EA-C2760F881D3A} +// + +DEFINE_GUID(GUID_DEVINTERFACE_BRIGHTNESS_3, 0x197a4a6e, 0x391, 0x4322, 0x96, 0xea, 0xc2, 0x76, 0xf, 0x88, 0x1d, 0x3a); + +// +// I2C Interface queried from the miniport. +// + +#define DXGK_I2C_INTERFACE_VERSION_1 0x01 + +typedef +_Function_class_DXGK_(DXGKDDI_I2C_TRANSMIT_DATA_TO_DISPLAY) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_I2C_TRANSMIT_DATA_TO_DISPLAY)( + _In_ PVOID MiniportDeviceContext, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + _In_ ULONG SevenBitI2CAddress, + _In_ ULONG DataLength, + _In_reads_bytes_(DataLength) CONST VOID* Data + ); + +typedef +_Function_class_DXGK_(DXGKDDI_I2C_RECEIVE_DATA_FROM_DISPLAY) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_I2C_RECEIVE_DATA_FROM_DISPLAY)( + _In_ PVOID MiniportDeviceContext, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + _In_ ULONG SevenBitI2CAddress, + _In_ ULONG Flags, + _In_ ULONG DataLength, + _Out_writes_bytes_(DataLength) PVOID Data + ); + +typedef struct _DXGK_I2C_INTERFACE { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + DXGKDDI_I2C_TRANSMIT_DATA_TO_DISPLAY DxgkDdiI2CTransmitDataToDisplay; + DXGKDDI_I2C_RECEIVE_DATA_FROM_DISPLAY DxgkDdiI2CReceiveDataFromDisplay; +} DXGK_I2C_INTERFACE, *PDXGK_I2C_INTERFACE; + +// +// OPM Interface from the miniport. +// + +#define DXGK_OPM_INTERFACE_VERSION_1 0x01 + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_GET_CERTIFICATE_SIZE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_GET_CERTIFICATE_SIZE)( + _In_ PVOID MiniportDeviceContext, + _In_ DXGKMDT_CERTIFICATE_TYPE CertificateType, + _Out_ PULONG CertificateSize + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_GET_CERTIFICATE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_GET_CERTIFICATE)( + _In_ PVOID MiniportDeviceContext, + _In_ DXGKMDT_CERTIFICATE_TYPE CertificateType, + _In_ ULONG CertificateSize, + _Out_writes_bytes_(CertificateSize) PVOID CertificateBuffer + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT)( + _In_ PVOID MiniportDeviceContext, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + _In_ DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS NewVideoOutputSemantics, + _Out_ PHANDLE NewProtectedOutputHandle + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_GET_RANDOM_NUMBER) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_GET_RANDOM_NUMBER)( + _In_ PVOID MiniportDeviceContext, + _In_ HANDLE ProtectedOutputHandle, + _Out_ PDXGKMDT_OPM_RANDOM_NUMBER RandomNumber + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS)( + _In_ PVOID MiniportDeviceContext, + _In_ HANDLE ProtectedOutputHandle, + _In_ CONST DXGKMDT_OPM_ENCRYPTED_PARAMETERS* EncryptedParameters + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_GET_INFORMATION) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_GET_INFORMATION)( + _In_ PVOID MiniportDeviceContext, + _In_ HANDLE ProtectedOutputHandle, + _In_ CONST DXGKMDT_OPM_GET_INFO_PARAMETERS* Parameters, + _Out_ PDXGKMDT_OPM_REQUESTED_INFORMATION RequestedInformation + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION)( + _In_ PVOID MiniportDeviceContext, + _In_ HANDLE ProtectedOutputHandle, + _In_ CONST DXGKMDT_OPM_COPP_COMPATIBLE_GET_INFO_PARAMETERS* Parameters, + _Out_ PDXGKMDT_OPM_REQUESTED_INFORMATION RequestedInformation + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT)( + _In_ PVOID MiniportDeviceContext, + _In_ HANDLE ProtectedOutputHandle, + _In_ CONST DXGKMDT_OPM_CONFIGURE_PARAMETERS* Parameters, + _In_ ULONG AdditionalParametersSize, + _In_ CONST VOID* AdditionalParameters + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT)( + _In_ PVOID MiniportDeviceContext, + _In_ HANDLE ProtectedOutputHandle + ); + +typedef struct _DXGK_OPM_INTERFACE { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + DXGKDDI_OPM_GET_CERTIFICATE_SIZE DxgkDdiOPMGetCertificateSize; + DXGKDDI_OPM_GET_CERTIFICATE DxgkDdiOPMGetCertificate; + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT DxgkDdiOPMCreateProtectedOutput; + DXGKDDI_OPM_GET_RANDOM_NUMBER DxgkDdiOPMGetRandomNumber; + DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS DxgkDdiOPMSetSigningKeyAndSequenceNumbers; + DXGKDDI_OPM_GET_INFORMATION DxgkDdiOPMGetInformation; + DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION DxgkDdiOPMGetCOPPCompatibleInformation; + DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT DxgkDdiOPMConfigureProtectedOutput; + DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT DxgkDdiOPMDestroyProtectedOutput; +} DXGK_OPM_INTERFACE, *PDXGK_OPM_INTERFACE; + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) +// +// OPM Interface V2 from the miniport. +// + +#define DXGK_OPM_INTERFACE_VERSION_2_JTP 0x02 + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY_JTP) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY_JTP)( + _In_ PVOID MiniportDeviceContext, + _In_ DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS NewVideoOutputSemantics, + _In_ ULONG64 OPMEncoderContext, + _In_ DXGKMDT_OPM_ACTUAL_OUTPUT_FORMAT* pActualOutputFormat, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID NonLocalOutputId, + _Out_ PHANDLE NewProtectedOutputHandle + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_VIRTUAL_MODE_JTP) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_VIRTUAL_MODE_JTP)( + _In_ PVOID MiniportDeviceContext, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, + _In_ DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS NewVideoOutputSemantics, + _In_ DXGKMDT_OPM_ACTUAL_OUTPUT_FORMAT* pActualOutputFormat, + _Out_ PHANDLE NewProtectedOutputHandle + ); + +typedef struct _DXGK_OPM_INTERFACE_2_JTP { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + // v1 Ddi's + DXGKDDI_OPM_GET_CERTIFICATE_SIZE DxgkDdiOPMGetCertificateSize; + DXGKDDI_OPM_GET_CERTIFICATE DxgkDdiOPMGetCertificate; + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT DxgkDdiOPMCreateProtectedOutput; + DXGKDDI_OPM_GET_RANDOM_NUMBER DxgkDdiOPMGetRandomNumber; + DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS DxgkDdiOPMSetSigningKeyAndSequenceNumbers; + DXGKDDI_OPM_GET_INFORMATION DxgkDdiOPMGetInformation; + DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION DxgkDdiOPMGetCOPPCompatibleInformation; + DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT DxgkDdiOPMConfigureProtectedOutput; + DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT DxgkDdiOPMDestroyProtectedOutput; + + // v2 Ddi's + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_VIRTUAL_MODE_JTP DxgkDdiOPMCreateProtectedOutputVirtualMode; + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY_JTP DxgkDdiOPMCreateProtectedOutputNonLocalDisplay; +} DXGK_OPM_INTERFACE_2_JTP, *PDXGK_OPM_INTERFACE_2_JTP; + +#define DXGK_OPM_INTERFACE_VERSION_2 0x03 + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY)( + _In_ PVOID MiniportDeviceContext, + _In_ DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS NewVideoOutputSemantics, + _In_ UINT64 OPMEncoderContext, + _In_ DXGKMDT_OPM_ACTUAL_OUTPUT_FORMAT* pActualOutputFormat, + _In_ UINT64 NonLocalOutputId, + _In_ DXGKMDT_OPM_CONNECTOR_TYPE NonLocalConnectorType, + _Out_ PHANDLE NewProtectedOutputHandle + ); + +typedef struct _DXGK_OPM_INTERFACE_2 { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + // v1 Ddi's + DXGKDDI_OPM_GET_CERTIFICATE_SIZE DxgkDdiOPMGetCertificateSize; + DXGKDDI_OPM_GET_CERTIFICATE DxgkDdiOPMGetCertificate; + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT DxgkDdiOPMCreateProtectedOutput; + DXGKDDI_OPM_GET_RANDOM_NUMBER DxgkDdiOPMGetRandomNumber; + DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS DxgkDdiOPMSetSigningKeyAndSequenceNumbers; + DXGKDDI_OPM_GET_INFORMATION DxgkDdiOPMGetInformation; + DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION DxgkDdiOPMGetCOPPCompatibleInformation; + DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT DxgkDdiOPMConfigureProtectedOutput; + DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT DxgkDdiOPMDestroyProtectedOutput; + + // v2 Ddi + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY DxgkDdiOPMCreateProtectedOutputNonLocalDisplay; +} DXGK_OPM_INTERFACE_2, *PDXGK_OPM_INTERFACE_2; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) +// +// OPM Interface V3 from the miniport. +// + +#define DXGK_OPM_INTERFACE_VERSION_3 0x04 + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_SET_SRM_LIST) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_SET_SRM_LIST)( + _In_ PVOID MiniportDeviceContext, + _In_ ULONG SrmListSize, + _In_reads_bytes_(SrmListSize) PVOID SrmListBuffer + ); + +typedef +_Function_class_DXGK_(DXGKDDI_OPM_GET_SRM_LIST_VERSION) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_OPM_GET_SRM_LIST_VERSION)( + _In_ PVOID MiniportDeviceContext, + _Inout_ PULONG SrmListVersionSize, + _Out_writes_bytes_(*SrmListVersionSize) PVOID SrmListVersionBuffer + ); + +typedef struct _DXGK_OPM_INTERFACE_3 { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + // v1 Ddi's + DXGKDDI_OPM_GET_CERTIFICATE_SIZE DxgkDdiOPMGetCertificateSize; + DXGKDDI_OPM_GET_CERTIFICATE DxgkDdiOPMGetCertificate; + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT DxgkDdiOPMCreateProtectedOutput; + DXGKDDI_OPM_GET_RANDOM_NUMBER DxgkDdiOPMGetRandomNumber; + DXGKDDI_OPM_SET_SIGNING_KEY_AND_SEQUENCE_NUMBERS DxgkDdiOPMSetSigningKeyAndSequenceNumbers; + DXGKDDI_OPM_GET_INFORMATION DxgkDdiOPMGetInformation; + DXGKDDI_OPM_GET_COPP_COMPATIBLE_INFORMATION DxgkDdiOPMGetCOPPCompatibleInformation; + DXGKDDI_OPM_CONFIGURE_PROTECTED_OUTPUT DxgkDdiOPMConfigureProtectedOutput; + DXGKDDI_OPM_DESTROY_PROTECTED_OUTPUT DxgkDdiOPMDestroyProtectedOutput; + + // v2 Ddi + DXGKDDI_OPM_CREATE_PROTECTED_OUTPUT_NONLOCAL_DISPLAY DxgkDdiOPMCreateProtectedOutputNonLocalDisplay; + + // v3 Ddi's + DXGKDDI_OPM_SET_SRM_LIST DxgkDdiOPMSetSrmList; + DXGKDDI_OPM_GET_SRM_LIST_VERSION DxgkDdiOPMGetSrmListVersion; +} DXGK_OPM_INTERFACE_3, *PDXGK_OPM_INTERFACE_3; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +#define DXGK_BRIGHTNESS_INTERFACE_VERSION_1 0x01 + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET_POSSIBLE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET_POSSIBLE)( + _In_ PVOID Context, + _In_ ULONG BufferSize, + _Out_ PUCHAR LevelCount, + _Out_writes_bytes_to_(BufferSize, *LevelCount) PUCHAR BrightnessLevels + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_SET) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_SET)( + _In_ PVOID Context, + _In_ UCHAR Brightness + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET)( + _In_ PVOID Context, + _Out_ PUCHAR Brightness + ); + +typedef struct +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + OUT DXGK_BRIGHTNESS_GET_POSSIBLE GetPossibleBrightness; + OUT DXGK_BRIGHTNESS_SET SetBrightness; + OUT DXGK_BRIGHTNESS_GET GetBrightness; +} DXGK_BRIGHTNESS_INTERFACE, *PDXGK_BRIGHTNESS_INTERFACE; + + +#define DXGK_BRIGHTNESS_INTERFACE_VERSION_2 0x02 + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET_CAPS) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET_CAPS)( + _In_ PVOID Context, + _Out_ DXGK_BRIGHTNESS_CAPS *BrightnessCaps + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_SET_STATE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_SET_STATE)( + _In_ PVOID Context, + _In_ DXGK_BRIGHTNESS_STATE* BrightnessState + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_SET_BACKLIGHT_OPTIMIZATION) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_SET_BACKLIGHT_OPTIMIZATION)( + _In_ PVOID Context, + _In_ DXGK_BACKLIGHT_OPTIMIZATION_LEVEL OptimizationLevel + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET_BACKLIGHT_REDUCTION) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET_BACKLIGHT_REDUCTION)( + _In_ PVOID Context, + _Out_ DXGK_BACKLIGHT_INFO* BacklightInfo + ); + +typedef struct +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + OUT DXGK_BRIGHTNESS_GET_POSSIBLE GetPossibleBrightness; + OUT DXGK_BRIGHTNESS_SET SetBrightness; + OUT DXGK_BRIGHTNESS_GET GetBrightness; + OUT DXGK_BRIGHTNESS_GET_CAPS GetBrightnessCaps; + OUT DXGK_BRIGHTNESS_SET_STATE SetBrightnessState; + OUT DXGK_BRIGHTNESS_SET_BACKLIGHT_OPTIMIZATION SetBacklightOptimization; + OUT DXGK_BRIGHTNESS_GET_BACKLIGHT_REDUCTION GetBacklightReduction; +} DXGK_BRIGHTNESS_INTERFACE_2, *PDXGK_BRIGHTNESS_INTERFACE_2; + +#define DXGK_BRIGHTNESS_INTERFACE_VERSION_3 0x03 + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_SET_3) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_SET_3)( + _In_ PVOID Context, + _In_ ULONG ChildUid, + _In_ PDXGK_BRIGHTNESS_SET_IN pIn + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET_3) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET_3)( + _In_ PVOID Context, + _In_ ULONG ChildUid, + _Out_ PDXGK_BRIGHTNESS_GET_OUT pOut + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET_CAPS_3) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET_CAPS_3)( + _In_ PVOID Context, + _In_ ULONG ChildUid, + _Out_ DXGK_BRIGHTNESS_CAPS *pBrightnessCaps + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_GET_NIT_RANGES) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_GET_NIT_RANGES)( + _In_ PVOID Context, + _In_ ULONG ChildUid, + _Out_ PDXGK_BRIGHTNESS_GET_NIT_RANGES_OUT pOut + ); + +typedef +_Function_class_DXGK_(DXGK_BRIGHTNESS_SET_BACKLIGHT_OPTIMIZATION_3) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGK_BRIGHTNESS_SET_BACKLIGHT_OPTIMIZATION_3)( + _In_ PVOID Context, + _In_ ULONG ChildUid, + _In_ DXGK_BACKLIGHT_OPTIMIZATION_LEVEL OptimizationLevel + ); + +typedef struct +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + OUT DXGK_BRIGHTNESS_SET_3 SetBrightness; + OUT DXGK_BRIGHTNESS_GET_3 GetBrightness; + OUT DXGK_BRIGHTNESS_GET_CAPS_3 GetBrightnessCaps; + OUT DXGK_BRIGHTNESS_GET_NIT_RANGES GetNitRanges; + OUT DXGK_BRIGHTNESS_SET_BACKLIGHT_OPTIMIZATION_3 SetBacklightOptimization; +} DXGK_BRIGHTNESS_INTERFACE_3, *PDXGK_BRIGHTNESS_INTERFACE_3; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +// +// Miracast Display Interface queried from the miniport. +// + +#define DXGK_MIRACAST_DISPLAY_INTERFACE_VERSION_1 0x01 + +// +// Basic caps for the Miracast display devices. +// + +typedef struct _DXGK_MIRACAST_CAPS +{ + // + // Size of private driver data provided at encode chunk complete + // interrupt. + // + + ULONG MaxChunkPrivateDriverDataSize; + + union + { + struct + { + UINT HdcpSupport : 1; + UINT Reserved : 31; + }; + UINT Value; + }Flags; +} DXGK_MIRACAST_CAPS, *PDXGK_MIRACAST_CAPS; + +typedef +_Function_class_DXGK_(DXGKDDI_MIRACAST_QUERY_CAPS) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_MIRACAST_QUERY_CAPS)( + _In_ PVOID DriverContext, + _In_ ULONG MiracastCapsSize, + _Out_ DXGK_MIRACAST_CAPS* MiracastCaps + ); + +typedef +_Function_class_DXGK_(DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +VOID +(*DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK)( + _In_ PVOID CallbackContext, + _In_ PIO_STATUS_BLOCK pIoStatusBlock + ); + +typedef +_Function_class_DXGK_(DXGKCB_MIRACAST_SEND_MESSAGE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKCB_MIRACAST_SEND_MESSAGE)( + _In_ HANDLE MiracastHandle, + _In_ ULONG InputBufferSize, + _In_reads_bytes_(InputBufferSize) VOID* pInputBuffer, + _In_ ULONG OutputBufferSize, + _Out_writes_bytes_(OutputBufferSize) VOID* pOutputBuffer, + _In_opt_ DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK pCallback, + _In_opt_ PVOID pCallbackContext + ); + +typedef +_Function_class_DXGK_(DXGKCB_MIRACAST_REPORT_CHUNK_INFO) +_IRQL_requires_DXGK_(DISPATCH_LEVEL) +NTSTATUS +(*DXGKCB_MIRACAST_REPORT_CHUNK_INFO)( + _In_ HANDLE MiracastHandle, + _In_ DXGK_MIRACAST_CHUNK_INFO* pChunkInfo, + _In_ PVOID pPrivateDriverData, + _In_ UINT PrivateDataDriverSize + ); + +typedef struct _DXGK_MIRACAST_DISPLAY_CALLBACKS +{ + HANDLE MiracastHandle; + DXGKCB_MIRACAST_SEND_MESSAGE DxgkCbMiracastSendMessage; + DXGKCB_MIRACAST_REPORT_CHUNK_INFO DxgkCbReportChunkInfo; +} DXGK_MIRACAST_DISPLAY_CALLBACKS, *PDXGK_MIRACAST_DISPLAY_CALLBACKS; + +typedef +_Function_class_DXGK_(DXGKDDI_MIRACAST_CREATE_CONTEXT) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_MIRACAST_CREATE_CONTEXT)( + _In_ PVOID DriverContext, + _In_ DXGK_MIRACAST_DISPLAY_CALLBACKS* MiracastCallbacks, + _Out_ PVOID* MiracastContext, + _Out_ ULONG* TargetId + ); + +typedef +_Function_class_DXGK_(DXGKDDI_MIRACAST_DESTROY_CONTEXT) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +VOID +(*DXGKDDI_MIRACAST_DESTROY_CONTEXT)( + _In_ PVOID DriverContext, + _In_ PVOID MiracastContext + ); + +typedef +_Function_class_DXGK_(DXGKDDI_MIRACAST_HANDLE_IO_CONTROL) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_MIRACAST_HANDLE_IO_CONTROL)( + _In_ PVOID DriverContext, + _In_ PVOID MiracastContext, + _In_ ULONG InputBufferSize, + _In_reads_bytes_(InputBufferSize) VOID* pInputBuffer, + _In_ ULONG OutputBufferSize, + _Out_writes_bytes_(OutputBufferSize) VOID* pOutputBuffer, + _Out_ ULONG* BytesReturned + ); + +typedef struct _DXGK_MIRACAST_INTERFACE { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + DXGKDDI_MIRACAST_QUERY_CAPS DxgkDdiMiracastQueryCaps; + DXGKDDI_MIRACAST_CREATE_CONTEXT DxgkDdiMiracastCreateContext; + DXGKDDI_MIRACAST_HANDLE_IO_CONTROL DxgkDdiMiracastIoControl; + DXGKDDI_MIRACAST_DESTROY_CONTEXT DxgkDdiMiracastDestroyContext; +} DXGK_MIRACAST_DISPLAY_INTERFACE, *PDXGK_MIRACAST_DISPLAY_INTERFACE; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + +// +// Services exported by DxgkCbQueryServices() +// + +typedef enum +{ + DxgkServicesAgp, + DxgkServicesDebugReport, + DxgkServicesTimedOperation, + DxgkServicesSPB, + DxgkServicesBDD, + DxgkServicesFirmwareTable, + DxgkServicesIDD, +} DXGK_SERVICES; + +// +// AGP Services +// + +#define DXGK_AGP_INTERFACE_VERSION_1 0x01 + +#define DXGK_AGPCOMMAND_AGP1X 0x00001 +#define DXGK_AGPCOMMAND_AGP2X 0x00002 +#define DXGK_AGPCOMMAND_AGP4X 0x00004 +#define DXGK_AGPCOMMAND_AGP8X 0x00008 +#define DXGK_AGPCOMMAND_DISABLE_SBA 0x10000 +#define DXGK_AGPCOMMAND_DISABLE_FW 0x20000 + +typedef +_Function_class_DXGK_(DXGKCB_AGP_ALLOCATE_POOL) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_AGP_ALLOCATE_POOL)( + IN HANDLE Context, + IN ULONG AllocationSize, + IN MEMORY_CACHING_TYPE CacheType, + OUT PPHYSICAL_ADDRESS PhysicalAddress, + OUT PVOID *VirtualAddress + ); + +typedef +_Function_class_DXGK_(DXGKCB_AGP_FREE_POOL) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_AGP_FREE_POOL)( + IN HANDLE Context, + IN PVOID VirtualAddress + ); + +typedef +_Function_class_DXGK_(DXGKCB_AGP_SET_COMMAND) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_AGP_SET_COMMAND)( + _In_ HANDLE Context, + _In_ ULONG Command + ); + +typedef struct _DXGK_AGP_INTERFACE { + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + DXGKCB_AGP_ALLOCATE_POOL AgpAllocatePool; + DXGKCB_AGP_FREE_POOL AgpFreePool; + DXGKCB_AGP_SET_COMMAND AgpSetCommand; +} DXGK_AGP_INTERFACE, *PDXGK_AGP_INTERFACE; + +// +// Debug Report API +// + +DECLARE_HANDLE(DXGK_DEBUG_REPORT_HANDLE); +#define DXGK_DEBUG_REPORT_INTERFACE_VERSION_1 0x01 +#define DXGK_DEBUG_REPORT_MAX_SIZE 0xF800 + +typedef struct _DXGK_DEBUG_REPORT_INTERFACE +{ + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + DXGK_DEBUG_REPORT_HANDLE + (*DbgReportCreate)( + _In_ HANDLE DeviceHandle, + _In_ ULONG ulCode, + _In_ ULONG_PTR ulpArg1, + _In_ ULONG_PTR ulpArg2, + _In_ ULONG_PTR ulpArg3, + _In_ ULONG_PTR ulpArg4 + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + _Success_(return != 0) + BOOLEAN + (*DbgReportSecondaryData)( + _Inout_ DXGK_DEBUG_REPORT_HANDLE hReport, + _In_reads_bytes_(ulDataSize) PVOID pvData, + _In_ ULONG ulDataSize + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + VOID + (*DbgReportComplete)( + _Inout_ DXGK_DEBUG_REPORT_HANDLE hReport + ); +} DXGK_DEBUG_REPORT_INTERFACE, *PDXGK_DEBUG_REPORT_INTERFACE; + +// +// Timed Operation API +// + +#define DXGK_TIMED_OPERATION_INTERFACE_VERSION_1 0x01 +#define DXGK_TIMED_OPERATION_TIMEOUT_MAX_SECONDS 5 + +typedef struct _DXGK_TIMED_OPERATION +{ + USHORT Size; + ULONG_PTR OwnerTag; + BOOLEAN OsHandled; + BOOLEAN TimeoutTriggered; + LARGE_INTEGER Timeout; + LARGE_INTEGER StartTick; +} DXGK_TIMED_OPERATION, *PDXGK_TIMED_OPERATION; + +typedef struct _DXGK_TIMED_OPERATION_INTERFACE +{ + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*TimedOperationStart)( + _Out_ DXGK_TIMED_OPERATION* Op, + _In_ const LARGE_INTEGER* Timeout, + _In_ BOOLEAN OsHandled + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*TimedOperationDelay)( + _Inout_ DXGK_TIMED_OPERATION* Op, + _In_ KPROCESSOR_MODE WaitMode, + _In_ BOOLEAN Alertable, + _In_opt_ const LARGE_INTEGER* Interval + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*TimedOperationWaitForSingleObject)( + _Inout_ DXGK_TIMED_OPERATION* Op, + _In_ PVOID Object, + _In_ KWAIT_REASON WaitReason, + _In_ KPROCESSOR_MODE WaitMode, + _In_ BOOLEAN Alertable, + _In_opt_ const LARGE_INTEGER* Timeout + ); +} DXGK_TIMED_OPERATION_INTERFACE, *PDXGK_TIMED_OPERATION_INTERFACE; + +// +// Serial Peripheral Bus services +// + +#define DXGK_SPB_INTERFACE_VERSION_1 0x01 + +typedef struct _DXGK_SPB_INTERFACE +{ + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*OpenSpbResource)( + _In_ HANDLE DeviceHandle, + _In_ LARGE_INTEGER SpbReourceId, + _In_opt_ UNICODE_STRING* SpbResourceSubName, + _In_ ACCESS_MASK DesiredAccess, + _In_ ULONG ShareAccess, + _In_ ULONG OpenOptions, + _Outptr_ VOID** SpbResource + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*CloseSpbResource)( + _In_ HANDLE DeviceHandle, + _In_ VOID* SpbResource + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*ReadSpbResource)( + _In_ HANDLE DeviceHandle, + _In_ VOID* SpbResource, + _In_ ULONG Length, + _Out_writes_bytes_(Length) VOID* Buffer, + _In_opt_ LARGE_INTEGER* ByteOffset, + _In_opt_ HANDLE EventHandle, + _Out_ IO_STATUS_BLOCK* IoStatusBlock + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*WriteSpbResource)( + _In_ HANDLE DeviceHandle, + _In_ VOID* SpbResource, + _In_ ULONG Length, + _In_reads_bytes_(Length) VOID* Buffer, + _In_opt_ LARGE_INTEGER* ByteOffset, + _In_opt_ HANDLE EventHandle, + _Out_ IO_STATUS_BLOCK* IoStatusBlock + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + NTSTATUS + (*SpbResourceIoControl)( + _In_ HANDLE DeviceHandle, + _In_ VOID* SpbResource, + _In_ ULONG IoControlCode, + _In_ ULONG InBufferSize, + _In_reads_bytes_(InBufferSize) VOID* InputBuffer, + _In_ ULONG OutBufferSize, + _Out_writes_bytes_(OutBufferSize) VOID* OutputBuffer, + _In_opt_ HANDLE EventHandle, + _Out_ IO_STATUS_BLOCK* IoStatusBlock + ); +} DXGK_SPB_INTERFACE, *PDXGK_SPB_INTERFACE; + +// +// System firmware table service +// + +#define DXGK_FIRMWARE_TABLE_INTERFACE_VERSION_1 0x01 + +typedef struct _DXGK_FIRMWARE_TABLE_INTERFACE +{ + USHORT Size; + USHORT Version; + PVOID Context; + PINTERFACE_REFERENCE InterfaceReference; + PINTERFACE_DEREFERENCE InterfaceDereference; + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + _Success_(return >= 0 || return == STATUS_BUFFER_TOO_SMALL) + NTSTATUS + (*EnumSystemFirmwareTables)( + _In_ VOID* Context, + _In_ ULONG ProviderSignature, + _In_ ULONG BufferSize, + _Pre_opt_bytecap_(BufferSize) + _When_(return == STATUS_BUFFER_TOO_SMALL, _Post_equal_to_(_Old_(Buffer))) + _When_(return != STATUS_BUFFER_TOO_SMALL, _Post_valid_) + VOID* Buffer, + _Out_ ULONG* RequiredSize + ); + + _IRQL_requires_DXGK_(PASSIVE_LEVEL) + _Success_(return >= 0 || return == STATUS_BUFFER_TOO_SMALL) + _When_(Buffer == NULL, _At_(BufferSize, _In_range_(==, 0))) + NTSTATUS + (*ReadSystemFirmwareTable)( + _In_ VOID* Context, + _In_ ULONG ProviderSignature, + _In_ ULONG TableId, + _In_ ULONG BufferSize, + _Pre_opt_bytecap_(BufferSize) + _When_(return == STATUS_BUFFER_TOO_SMALL, _Post_equal_to_(_Old_(Buffer))) + _When_(return != STATUS_BUFFER_TOO_SMALL, _Post_valid_) + VOID* Buffer, + _Out_ ULONG* RequiredSize + ); + +} DXGK_FIRMWARE_TABLE_INTERFACE, *PDXGK_FIRMWARE_TABLE_INTERFACE; + + +typedef enum { + DockStateUnsupported = 0, + DockStateUnDocked = 1, + DockStateDocked = 2, + DockStateUnknown = 3, +} DOCKING_STATE; + +// +// Device Information Structure to provide OS provided data +// structures to the miniport +// + +typedef struct _DXGK_DEVICE_INFO { + PVOID MiniportDeviceContext; + PDEVICE_OBJECT PhysicalDeviceObject; + UNICODE_STRING DeviceRegistryPath; + PCM_RESOURCE_LIST TranslatedResourceList; + LARGE_INTEGER SystemMemorySize; + PHYSICAL_ADDRESS HighestPhysicalAddress; + PHYSICAL_ADDRESS AgpApertureBase; + SIZE_T AgpApertureSize; + DOCKING_STATE DockingState; +} DXGK_DEVICE_INFO, *PDXGK_DEVICE_INFO; + +// +// DxgKrnl interface +// + +#define DXGK_ACPI_PASS_ARGS_TO_CHILDREN 'araP' +#define DXGK_ACPI_USE_ACPI_UID ' diU' +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) +#define DXGK_ACPI_USE_EVAL_EX 'xEvE' +#endif // DXGKDDI_INTERFACE_VERSION + + +typedef +_Function_class_DXGK_(DXGKCB_EVAL_ACPI_METHOD) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_EVAL_ACPI_METHOD)( + _In_ HANDLE DeviceHandle, + _In_ ULONG DeviceUid, + _In_reads_bytes_(AcpiInputSize) PACPI_EVAL_INPUT_BUFFER_COMPLEX AcpiInputBuffer, + _In_range_(>=, sizeof(ACPI_EVAL_INPUT_BUFFER_COMPLEX)) ULONG AcpiInputSize, + _Out_writes_bytes_(AcpiOutputSize) PACPI_EVAL_OUTPUT_BUFFER AcpiOutputBuffer, + _In_range_(>=, sizeof(ACPI_EVAL_OUTPUT_BUFFER)) ULONG AcpiOutputSize + ); + +typedef +_Function_class_DXGK_(DXGKCB_GET_DEVICE_INFORMATION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_GET_DEVICE_INFORMATION)( + _In_ HANDLE DeviceHandle, + _Out_ PDXGK_DEVICE_INFO DeviceInfo + ); + +typedef +_Function_class_DXGK_(DXGKCB_INDICATE_CHILD_STATUS) +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_INDICATE_CHILD_STATUS)( + _In_ HANDLE DeviceHandle, + _In_ PDXGK_CHILD_STATUS ChildStatus + ); + +typedef +_Function_class_DXGK_(DXGKCB_MAP_MEMORY) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_MAP_MEMORY)( + _In_ HANDLE DeviceHandle, + _In_ PHYSICAL_ADDRESS TranslatedAddress, + _In_ ULONG Length, + _In_ BOOLEAN InIoSpace, + _In_ BOOLEAN MapToUserMode, + _In_ MEMORY_CACHING_TYPE CacheType, + _Outptr_ PVOID *VirtualAddress + ); + +typedef +_Function_class_DXGK_(DXGKCB_QUERY_SERVICES) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_QUERY_SERVICES)( + _In_ HANDLE DeviceHandle, + _In_ DXGK_SERVICES ServicesType, + _Inout_ PINTERFACE Interface + ); + +typedef +_Function_class_DXGK_(DXGKCB_QUEUE_DPC) +_Success_(return != 0) +BOOLEAN +(APIENTRY *DXGKCB_QUEUE_DPC)( + _In_ HANDLE DeviceHandle + ); + +typedef +_Function_class_DXGK_(DXGKCB_READ_DEVICE_SPACE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_READ_DEVICE_SPACE)( + _In_ HANDLE DeviceHandle, + _In_ ULONG DataType, + _Out_writes_bytes_to_(Length, *BytesRead) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length, + _Out_ PULONG BytesRead + ); + +typedef +_Function_class_DXGK_(DXGKCB_SYNCHRONIZE_EXECUTION) +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_SYNCHRONIZE_EXECUTION)( + _In_ HANDLE DeviceHandle, + _In_ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, + _In_ PVOID Context, + _In_ ULONG MessageNumber, + _Out_ PBOOLEAN ReturnValue + ); + +typedef +_Function_class_DXGK_(DXGKCB_UNMAP_MEMORY) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_UNMAP_MEMORY)( + _In_ HANDLE DeviceHandle, + _In_ PVOID VirtualAddress + ); + +typedef +_Function_class_DXGK_(DXGKCB_WRITE_DEVICE_SPACE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_WRITE_DEVICE_SPACE)( + _In_ HANDLE DeviceHandle, + _In_ ULONG DataType, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length, + _Out_ _Out_range_(<=, Length) PULONG BytesWritten + ); + +typedef +_Function_class_DXGK_(DXGKCB_IS_DEVICE_PRESENT) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_IS_DEVICE_PRESENT)( + _In_ HANDLE DeviceHandle, + _In_ PPCI_DEVICE_PRESENCE_PARAMETERS DevicePresenceParameters, + _Out_ PBOOLEAN DevicePresent + ); + +typedef +_Function_class_DXGK_(DXGKCB_LOG_ETW_EVENT) +_When_(EventBufferSize > 256, _IRQL_requires_DXGK_(PASSIVE_LEVEL)) +VOID +(APIENTRY *DXGKCB_LOG_ETW_EVENT)( + _In_ CONST LPCGUID EventGuid, + _In_ UCHAR Type, + _In_ USHORT EventBufferSize, + _In_reads_bytes_(EventBufferSize) PVOID EventBuffer + ); + +typedef +_Function_class_DXGK_(DXGKCB_EXCLUDE_ADAPTER_ACCESS) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_EXCLUDE_ADAPTER_ACCESS)( + _In_ HANDLE DeviceHandle, + _In_ ULONG Attributes, + _In_ DXGKDDI_PROTECTED_CALLBACK DxgkProtectedCallback, + _In_ PVOID ProtectedCallbackContext + ); + +typedef struct _DXGK_START_INFO { + ULONG RequiredDmaQueueEntry; + GUID AdapterGuid; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + + LUID AdapterLuid; + +#endif // DXGKDDI_INTERFACE_VERSION + +} DXGK_START_INFO, *PDXGK_START_INFO; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +typedef +_Function_class_DXGK_(DXGKCB_ACQUIRE_POST_DISPLAY_OWNERSHIP) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_ACQUIRE_POST_DISPLAY_OWNERSHIP)( + _In_ HANDLE DeviceHandle, + _Out_ PDXGK_DISPLAY_INFORMATION DisplayInfo +); + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef enum _DXGK_FRAMEBUFFER_STATE { + FrameBufferStateUnknown = 0, + FrameBufferStateInitializedByFirmware = 1, + FrameBufferStateInitializedByDriver = 2, +} DXGK_FRAMEBUFFER_STATE; + +typedef struct _DXGK_DISPLAY_OWNERSHIP_FLAGS { + union { + struct { + DXGK_FRAMEBUFFER_STATE FrameBufferState : 4; + }; + UINT Value; + }; +} DXGK_DISPLAY_OWNERSHIP_FLAGS, *PDXGK_DISPLAY_OWNERSHIP_FLAGS; + +typedef +_Function_class_DXGK_(DXGKCB_ACQUIRE_POST_DISPLAY_OWNERSHIP2) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(APIENTRY *DXGKCB_ACQUIRE_POST_DISPLAY_OWNERSHIP2)( + _In_ HANDLE DeviceHandle, + _Out_ PDXGK_DISPLAY_INFORMATION DisplayInfo, + _Out_ PDXGK_DISPLAY_OWNERSHIP_FLAGS Flags +); + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef struct _DXGK_DIAGNOSTIC_CATEGORIES +{ + union + { + struct + { + UINT Notifications : 1; // 0x00000001 +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT Progressions : 1; // 0x00000002 + UINT Reserved :30; // 0xFFFFFFFC +#elif (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT Reserved :31; // 0xFFFFFFFE +#endif (DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WDDM2_5) + }; + UINT Value; + }; +} DXGK_DIAGNOSTIC_CATEGORIES; + +#define DXGK_DIAGCAT_NOTIFICATIONS_BIT 0 +#define DXGK_DIAGCAT_NOTIFICATIONS_MASK (1<= DXGKDDI_INTERFACE_VERSION_WDDM2_5) +#define DXGK_DIAGCAT_PROGRESSIONS_BIT 1 +#define DXGK_DIAGCAT_PROGRESSIONS_MASK (1<= DXGKDDI_INTERFACE_VERSION_WDDM2_5) +typedef struct _DXGK_DIAGTYPE_PROGRESSIONS +{ + union + { + struct + { + UINT SyncLockEnableSync : 1; // 0x00000001 + UINT Reserved :31; // 0xFFFFFFFE + }; + UINT Value; + }; +} DXGK_DIAGTYPE_PROGRESSIONS; + +#define DXGK_DIAG_PROGRESSIONS_SYNCLOCK_ENABLE_SYNC_BIT 0 +#define DXGK_DIAG_PROGRESSIONS_SYNCLOCK_ENABLE_SYNC_MASK (1<= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef struct _DXGK_DIAGNOSTIC_TYPES +{ + union + { + DXGK_DIAGTYPE_NOTIFICATIONS Notifications; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + DXGK_DIAGTYPE_PROGRESSIONS Progressions; +#endif (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + UINT Value; + }; +} DXGK_DIAGNOSTIC_TYPES; + + +typedef struct _DXGK_DIAGNOSTIC_HEADER +{ + DXGK_DIAGNOSTIC_CATEGORIES Category; + DXGK_DIAGNOSTIC_TYPES Type; + union + { + struct + { + UINT Size :16; // 0x0000FFFF - Size of whole diagnostic structure, including header + UINT Reserved :16; // 0xFFFF0000 + }; + UINT Value; + }; + UINT SequenceNumber; + union + { + D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; + D3DDDI_VIDEO_PRESENT_SOURCE_ID SourceId; + UINT Id; + }; +} DXGK_DIAGNOSTIC_HEADER; + +typedef union _DXGK_DIAGNOSTIC_PSR_REFRESH_REASON +{ + struct + { + UINT Present : 1; // 0x00000001 + UINT CursorUpdate : 1; // 0x00000002 + UINT VSyncEnabled : 1; // 0x00000004 + UINT ColorTransformationChange : 1; // 0x00000008 + UINT BrightnessChange : 1; // 0x00000010 + UINT SinkRequest : 1; // 0x00000020 + UINT Other : 1; // 0x00000040 + UINT Reserved :25; // 0xFFFFFF80 + }; + UINT Value; +} DXGK_DIAGNOSTIC_PSR_REFRESH_REASON; + +typedef struct _DXGK_DIAGNOSTIC_PSR +{ + DXGK_DIAGNOSTIC_HEADER Header; + union + { + DXGK_DIAGNOSTIC_PSR_REFRESH_REASON RefreshReason; + UINT Value; + }; +} DXGK_DIAGNOSTIC_PSR; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) +typedef struct _DXGK_DIAGNOSTIC_SYNCLOCK_ENABLESYNC +{ + DXGK_DIAGNOSTIC_HEADER Header; + union + { + struct + { + UINT DuringSetTiming : 1; + UINT EnableSyncStart : 1; + UINT EnableSyncEnd : 1; + UINT Reserved :29; + } SyncLockEnableSync; + UINT Value; + }; +} DXGK_DIAGNOSTIC_SYNCLOCK_ENABLESYNC; +#endif (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef _In_ DXGK_DIAGNOSTIC_HEADER* IN_PDXGK_DIAGNOSTIC_HEADER; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKCB_REPORT_DIAGNOSTIC) + _IRQL_requires_max_(DISPATCH_LEVEL) + _IRQL_requires_same_ +NTSTATUS +(APIENTRY CALLBACK *DXGKCB_REPORT_DIAGNOSTIC)( + _In_ HANDLE DeviceHandle, + IN_PDXGK_DIAGNOSTIC_HEADER pDiagnostic + ); + + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM2_4 + + +typedef struct _DXGKRNL_INTERFACE { + ULONG Size; + ULONG Version; + HANDLE DeviceHandle; + + DXGKCB_EVAL_ACPI_METHOD DxgkCbEvalAcpiMethod; + DXGKCB_GET_DEVICE_INFORMATION DxgkCbGetDeviceInformation; + DXGKCB_INDICATE_CHILD_STATUS DxgkCbIndicateChildStatus; + DXGKCB_MAP_MEMORY DxgkCbMapMemory; + DXGKCB_QUEUE_DPC DxgkCbQueueDpc; + DXGKCB_QUERY_SERVICES DxgkCbQueryServices; + DXGKCB_READ_DEVICE_SPACE DxgkCbReadDeviceSpace; + DXGKCB_SYNCHRONIZE_EXECUTION DxgkCbSynchronizeExecution; + DXGKCB_UNMAP_MEMORY DxgkCbUnmapMemory; + DXGKCB_WRITE_DEVICE_SPACE DxgkCbWriteDeviceSpace; + DXGKCB_IS_DEVICE_PRESENT DxgkCbIsDevicePresent; + + DXGKCB_GETHANDLEDATA DxgkCbGetHandleData; + DXGKCB_GETHANDLEPARENT DxgkCbGetHandleParent; + DXGKCB_ENUMHANDLECHILDREN DxgkCbEnumHandleChildren; + DXGKCB_NOTIFY_INTERRUPT DxgkCbNotifyInterrupt; + DXGKCB_NOTIFY_DPC DxgkCbNotifyDpc; + DXGKCB_QUERYVIDPNINTERFACE DxgkCbQueryVidPnInterface; + DXGKCB_QUERYMONITORINTERFACE DxgkCbQueryMonitorInterface; + DXGKCB_GETCAPTUREADDRESS DxgkCbGetCaptureAddress; + + DXGKCB_LOG_ETW_EVENT DxgkCbLogEtwEvent; + + DXGKCB_EXCLUDE_ADAPTER_ACCESS DxgkCbExcludeAdapterAccess; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + + DXGKCB_CREATECONTEXTALLOCATION DxgkCbCreateContextAllocation; + DXGKCB_DESTROYCONTEXTALLOCATION DxgkCbDestroyContextAllocation; + DXGKCB_SETPOWERCOMPONENTACTIVE DxgkCbSetPowerComponentActive; + DXGKCB_SETPOWERCOMPONENTIDLE DxgkCbSetPowerComponentIdle; + DXGKCB_ACQUIRE_POST_DISPLAY_OWNERSHIP DxgkCbAcquirePostDisplayOwnership; + DXGKCB_POWERRUNTIMECONTROLREQUEST DxgkCbPowerRuntimeControlRequest; + DXGKCB_SETPOWERCOMPONENTLATENCY DxgkCbSetPowerComponentLatency; + DXGKCB_SETPOWERCOMPONENTRESIDENCY DxgkCbSetPowerComponentResidency; + DXGKCB_COMPLETEFSTATETRANSITION DxgkCbCompleteFStateTransition; + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + + DXGKCB_COMPLETEPSTATETRANSITION DxgkCbCompletePStateTransition; + +#endif // DXGKDDI_INTERFACE_VERSION_WDDM1_3 + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + + DXGKCB_MAPCONTEXTALLOCATION DxgkCbMapContextAllocation; + DXGKCB_UPDATECONTEXTALLOCATION DxgkCbUpdateContextAllocation; + DXGKCB_RESERVEGPUVIRTUALADDRESSRANGE DxgkCbReserveGpuVirtualAddressRange; + DXGKCB_ACQUIREHANDLEDATA DxgkCbAcquireHandleData; + DXGKCB_RELEASEHANDLEDATA DxgkCbReleaseHandleData; + DXGKCB_HARDWARECONTENTPROTECTIONTEARDOWN DxgkCbHardwareContentProtectionTeardown; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + + DXGKCB_MULTIPLANEOVERLAYDISABLED DxgkCbMultiPlaneOverlayDisabled; + DXGKCB_DXGKCB_MITIGATEDRANGEUPDATE DxgkCbMitigatedRangeUpdate; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + + DXGKCB_INVALIDATEHWCONTEXT DxgkCbInvalidateHwContext; + DXGKCB_INDICATE_CONNECTOR_CHANGE DxgkCbIndicateConnectorChange; + DXGKCB_UNBLOCKUEFIFRAMEBUFFERRANGES DxgkCbUnblockUEFIFrameBufferRanges; + DXGKCB_ACQUIRE_POST_DISPLAY_OWNERSHIP2 DxgkCbAcquirePostDisplayOwnership2; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + + DXGKCB_SETPROTECTEDSESSIONSTATUS DxgkCbSetProtectedSessionStatus; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + DXGKCB_ALLOCATECONTIGUOUSMEMORY DxgkCbAllocateContiguousMemory; + DXGKCB_FREECONTIGUOUSMEMORY DxgkCbFreeContiguousMemory; + DXGKCB_ALLOCATEPAGESFORMDL DxgkCbAllocatePagesForMdl; + DXGKCB_FREEPAGESFROMMDL DxgkCbFreePagesFromMdl; + DXGKCB_PINFRAMEBUFFERFORSAVE DxgkCbPinFrameBufferForSave; + DXGKCB_UNPINFRAMEBUFFERFORSAVE DxgkCbUnpinFrameBufferForSave; + DXGKCB_MAPFRAMEBUFFERPOINTER DxgkCbMapFrameBufferPointer; + DXGKCB_UNMAPFRAMEBUFFERPOINTER DxgkCbUnmapFrameBufferPointer; + DXGKCB_MAPMDLTOIOMMU DxgkCbMapMdlToIoMmu; + DXGKCB_UNMAPMDLFROMIOMMU DxgkCbUnmapMdlFromIoMmu; + DXGKCB_REPORT_DIAGNOSTIC DxgkCbReportDiagnostic; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + DXGKCB_SIGNALEVENT DxgkCbSignalEvent; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + DXGKCB_ISFEATUREENABLED DxgkCbIsFeatureEnabled; + DXGKCB_SAVEMEMORYFORHOTUPDATE DxgkCbSaveMemoryForHotUpdate; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8) + DXGKCB_NOTIFYCURSORSUPPORTCHANGE DxgkCbNotifyCursorSupportChange; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_8) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + DXGKCB_QUERYFEATURESUPPORT DxgkCbQueryFeatureSupport; + DXGKCB_CREATEPHYSICALMEMORYOBJECT DxgkCbCreatePhysicalMemoryObject; + DXGKCB_DESTROYPHYSICALMEMORYOBJECT DxgkCbDestroyPhysicalMemoryObject; + DXGKCB_MAPPHYSICALMEMORY DxgkCbMapPhysicalMemory; + DXGKCB_UNMAPPHYSICALMEMORY DxgkCbUnmapPhysicalMemory; + DXGKCB_ALLOCATEADL DxgkCbAllocateAdl; + DXGKCB_FREEADL DxgkCbFreeAdl; + DXGKCB_OPENPHYSICALMEMORYOBJECT DxgkCbOpenPhysicalMemoryObject; + DXGKCB_CLOSEPHYSICALMEMORYOBJECT DxgkCbClosePhysicalMemoryObject; + DXGKCB_PINFRAMEBUFFERFORSAVE2 DxgkCbPinFrameBufferForSave2; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + DXGKCB_DISCONNECTDOORBELL DxgkCbDisconnectDoorbell; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +} DXGKRNL_INTERFACE, *PDXGKRNL_INTERFACE; + +// +// Kernel Mode Driver Interface +// + +// +// Define parameter types for SAL-annotated DDI parameters. These are used by +// the DDI function name typedefs. They are not needed in a driver's DDI function +// definitions, and should not be used in driver code. +// +// Naming convention: Concatenate all SAL annotations, an underscore, other modifiers +// such as CONST, and the type of the parameter, and use uppercase +// only. +// +typedef _In_ CONST PDEVICE_OBJECT IN_CONST_PDEVICE_OBJECT; +typedef _Inout_ PLINKED_DEVICE INOUT_PLINKED_DEVICE; +typedef _Inout_ PDXGK_CHILD_DESCRIPTOR INOUT_PDXGK_CHILD_DESCRIPTOR; +typedef _In_ PDXGK_CHILD_STATUS IN_PDXGK_CHILD_STATUS; +typedef _Inout_ PDXGK_CHILD_STATUS INOUT_PDXGK_CHILD_STATUS; +typedef _Inout_ PDXGK_DEVICE_DESCRIPTOR INOUT_PDXGK_DEVICE_DESCRIPTOR; +typedef _In_ DXGK_EVENT_TYPE IN_DXGK_EVENT_TYPE; +typedef _In_ PDXGK_START_INFO IN_PDXGK_START_INFO; +typedef _In_ PDXGKRNL_INTERFACE IN_PDXGKRNL_INTERFACE; +typedef _In_ PQUERY_INTERFACE IN_PQUERY_INTERFACE; +typedef _In_ PVIDEO_REQUEST_PACKET IN_PVIDEO_REQUEST_PACKET; + +// +// Function name typedefs +// + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_ADD_DEVICE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +NTAPI +DXGKDDI_ADD_DEVICE( + IN_CONST_PDEVICE_OBJECT PhysicalDeviceObject, + OUT_PPVOID MiniportDeviceContext + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_START_DEVICE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +NTAPI +DXGKDDI_START_DEVICE( + IN_CONST_PVOID MiniportDeviceContext, + IN_PDXGK_START_INFO DxgkStartInfo, + IN_PDXGKRNL_INTERFACE DxgkInterface, + OUT_PULONG NumberOfVideoPresentSources, + OUT_PULONG NumberOfChildren + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_STOP_DEVICE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_STOP_DEVICE( + IN_CONST_PVOID MiniportDeviceContext + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_REMOVE_DEVICE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_REMOVE_DEVICE( + IN_CONST_PVOID MiniportDeviceContext + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_DISPATCH_IO_REQUEST) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DISPATCH_IO_REQUEST( + IN_CONST_PVOID MiniportDeviceContext, + IN_ULONG VidPnSourceId, + IN_PVIDEO_REQUEST_PACKET VideoRequestPacket + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_QUERY_CHILD_RELATIONS) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_QUERY_CHILD_RELATIONS( + IN_CONST_PVOID MiniportDeviceContext, + _Inout_updates_bytes_(ChildRelationsSize) PDXGK_CHILD_DESCRIPTOR ChildRelations, + _In_ ULONG ChildRelationsSize + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_QUERY_CHILD_STATUS) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_QUERY_CHILD_STATUS( + IN_CONST_PVOID MiniportDeviceContext, + INOUT_PDXGK_CHILD_STATUS ChildStatus, + IN_BOOLEAN NonDestructiveOnly + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_INTERRUPT_ROUTINE) +_IRQL_requires_DXGK_(HIGH_LEVEL) // HIGH_LEVEL is best approximation of DIRQL +BOOLEAN +DXGKDDI_INTERRUPT_ROUTINE( + IN_CONST_PVOID MiniportDeviceContext, + IN_ULONG MessageNumber + ); + +typedef +_Function_class_DXGK_(DXGKDDI_DPC_ROUTINE) +_IRQL_requires_DXGK_(DISPATCH_LEVEL) +VOID +DXGKDDI_DPC_ROUTINE( + IN_CONST_PVOID MiniportDeviceContext + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_QUERY_DEVICE_DESCRIPTOR) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_QUERY_DEVICE_DESCRIPTOR( + IN_CONST_PVOID MiniportDeviceContext, + IN_ULONG ChildUid, + INOUT_PDXGK_DEVICE_DESCRIPTOR DeviceDescriptor + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_SET_POWER_STATE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_SET_POWER_STATE( + IN_CONST_PVOID MiniportDeviceContext, + IN_ULONG DeviceUid, + IN_DEVICE_POWER_STATE DevicePowerState, + IN_POWER_ACTION ActionType + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_NOTIFY_ACPI_EVENT) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_NOTIFY_ACPI_EVENT( + IN_CONST_PVOID MiniportDeviceContext, + IN_DXGK_EVENT_TYPE EventType, + IN_ULONG Event, + IN_PVOID Argument, + OUT_PULONG AcpiFlags + ); + +typedef +_Function_class_DXGK_(DXGKDDI_RESET_DEVICE) +VOID +DXGKDDI_RESET_DEVICE( + IN_CONST_PVOID MiniportDeviceContext + ); + +typedef +_Function_class_DXGK_(DXGKDDI_UNLOAD) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +VOID +DXGKDDI_UNLOAD( + VOID + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_QUERY_INTERFACE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_QUERY_INTERFACE( + IN_CONST_PVOID MiniportDeviceContext, + IN_PQUERY_INTERFACE QueryInterface + ); + +typedef +_Function_class_DXGK_(DXGKDDI_CONTROL_ETW_LOGGING) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +VOID +DXGKDDI_CONTROL_ETW_LOGGING( + IN_BOOLEAN Enable, + IN_ULONG Flags, + IN_UCHAR Level + ); + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_LINK_DEVICE) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_LINK_DEVICE( + IN_CONST_PDEVICE_OBJECT PhysicalDeviceObject, + IN_CONST_PVOID MiniportDeviceContext, + INOUT_PLINKED_DEVICE LinkedDevice + ); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +typedef struct _DXGK_PRE_START_INFO { + union { + struct { + UINT ReservedIn; + }; + UINT Input; + }; + union { + struct { + UINT SupportPreserveBootDisplay : 1; + UINT IsUEFIFrameBufferCpuAccessibleDuringStartup : 1; + UINT ReservedOut :30; + }; + UINT Output; + }; +} DXGK_PRE_START_INFO, *PDXGK_PRE_START_INFO; +typedef _Inout_ PDXGK_PRE_START_INFO IN_OUT_PDXGK_PRE_START_INFO; + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_EXCHANGEPRESTARTINFO) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_EXCHANGEPRESTARTINFO( + IN_CONST_HANDLE hAdapter, + IN_OUT_PDXGK_PRE_START_INFO pPreStartInfo + ); + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTARGETADJUSTEDCOLORIMETRY) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTARGETADJUSTEDCOLORIMETRY( + IN_CONST_HANDLE hAdapter, + IN D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, + IN DXGK_COLORIMETRY AdjustedColorimetry + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +typedef struct _DXGKARG_QUERYDIAGNOSTICTYPESSUPPORT +{ + _In_ DXGK_DIAGNOSTIC_CATEGORIES DiagnosticCategory; + _Out_ DXGK_DIAGNOSTIC_TYPES NoninvasiveTypes; + _Out_ DXGK_DIAGNOSTIC_TYPES InvasiveTypes; +} DXGKARG_QUERYDIAGNOSTICTYPESSUPPORT, *PDXGKARG_QUERYDIAGNOSTICTYPESSUPPORT; +typedef _Inout_ PDXGKARG_QUERYDIAGNOSTICTYPESSUPPORT INOUT_PDXGKARG_QUERYDIAGNOSTICTYPESSUPPORT; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_QUERYDIAGNOSTICTYPESSUPPORT) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_QUERYDIAGNOSTICTYPESSUPPORT( + IN_CONST_PVOID MiniportDeviceContext, + INOUT_PDXGKARG_QUERYDIAGNOSTICTYPESSUPPORT pArgQueryDiagnosticTypesSupport + ); + +typedef struct _DXGKARG_CONTROLDIAGNOSTICREPORTING +{ + _In_ DXGK_DIAGNOSTIC_CATEGORIES DiagnosticCategory; + _In_ DXGK_DIAGNOSTIC_TYPES RequestedDiagnostics; +} DXGKARG_CONTROLDIAGNOSTICREPORTING, *PDXGKARG_CONTROLDIAGNOSTICREPORTING; +typedef _In_ PDXGKARG_CONTROLDIAGNOSTICREPORTING IN_PDXGKARG_CONTROLDIAGNOSTICREPORTING; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_CONTROLDIAGNOSTICREPORTING) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_CONTROLDIAGNOSTICREPORTING( + IN_CONST_PVOID MiniportDeviceContext, + IN_PDXGKARG_CONTROLDIAGNOSTICREPORTING pArgControlDiagnosticReporting + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +typedef struct _DXGKARG_SETTARGETADJUSTEDCOLORIMETRY2 +{ + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; + _In_ DXGK_COLORIMETRY AdjustedColorimetry; + _In_ UINT SdrWhiteLevel; // SDR white level in integer nits +} DXGKARG_SETTARGETADJUSTEDCOLORIMETRY2, *PDXGKARG_SETTARGETADJUSTEDCOLORIMETRY2; +typedef _In_ PDXGKARG_SETTARGETADJUSTEDCOLORIMETRY2 IN_PDXGKARG_SETTARGETADJUSTEDCOLORIMETRY2; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_SETTARGETADJUSTEDCOLORIMETRY2) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_SETTARGETADJUSTEDCOLORIMETRY2( + IN_CONST_HANDLE hAdapter, + IN_PDXGKARG_SETTARGETADJUSTEDCOLORIMETRY2 pArgSetTargetAdjustedColorimetry + ); + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +// +// Function pointer typedefs +// + +typedef DXGKDDI_ADD_DEVICE *PDXGKDDI_ADD_DEVICE; +typedef DXGKDDI_START_DEVICE *PDXGKDDI_START_DEVICE; +typedef DXGKDDI_STOP_DEVICE *PDXGKDDI_STOP_DEVICE; +typedef DXGKDDI_REMOVE_DEVICE *PDXGKDDI_REMOVE_DEVICE; +typedef DXGKDDI_DISPATCH_IO_REQUEST *PDXGKDDI_DISPATCH_IO_REQUEST; +typedef DXGKDDI_QUERY_CHILD_RELATIONS *PDXGKDDI_QUERY_CHILD_RELATIONS; +typedef DXGKDDI_QUERY_CHILD_STATUS *PDXGKDDI_QUERY_CHILD_STATUS; +typedef DXGKDDI_INTERRUPT_ROUTINE *PDXGKDDI_INTERRUPT_ROUTINE; +typedef DXGKDDI_DPC_ROUTINE *PDXGKDDI_DPC_ROUTINE; +typedef DXGKDDI_QUERY_DEVICE_DESCRIPTOR *PDXGKDDI_QUERY_DEVICE_DESCRIPTOR; +typedef DXGKDDI_SET_POWER_STATE *PDXGKDDI_SET_POWER_STATE; +typedef DXGKDDI_NOTIFY_ACPI_EVENT *PDXGKDDI_NOTIFY_ACPI_EVENT; +typedef DXGKDDI_RESET_DEVICE *PDXGKDDI_RESET_DEVICE; +typedef DXGKDDI_UNLOAD *PDXGKDDI_UNLOAD; +typedef DXGKDDI_QUERY_INTERFACE *PDXGKDDI_QUERY_INTERFACE; +typedef DXGKDDI_CONTROL_ETW_LOGGING *PDXGKDDI_CONTROL_ETW_LOGGING; +typedef DXGKDDI_LINK_DEVICE *PDXGKDDI_LINK_DEVICE; +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +typedef DXGKDDI_EXCHANGEPRESTARTINFO *PDXGKDDI_EXCHANGEPRESTARTINFO; +typedef DXGKDDI_SETTARGETADJUSTEDCOLORIMETRY *PDXGKDDI_SETTARGETADJUSTEDCOLORIMETRY; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) +typedef DXGKDDI_QUERYDIAGNOSTICTYPESSUPPORT *PDXGKDDI_QUERYDIAGNOSTICTYPESSUPPORT; +typedef DXGKDDI_CONTROLDIAGNOSTICREPORTING *PDXGKDDI_CONTROLDIAGNOSTICREPORTING; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) +typedef DXGKDDI_SETTARGETADJUSTEDCOLORIMETRY2 *PDXGKDDI_SETTARGETADJUSTEDCOLORIMETRY2; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +// +// Function name typedefs +// + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_STOP_DEVICE_AND_RELEASE_POST_DISPLAY_OWNERSHIP) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_STOP_DEVICE_AND_RELEASE_POST_DISPLAY_OWNERSHIP( + _In_ PVOID MiniportDeviceContext, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, + _Out_ PDXGK_DISPLAY_INFORMATION DisplayInfo +); + +typedef struct _DXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS +{ + union + { + struct + { + UINT Reserved : 32; // 0xFFFFFFFF + }; + UINT Value; + }; +} DXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS, *PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS; + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_SYSTEM_DISPLAY_ENABLE) +NTSTATUS +APIENTRY +DXGKDDI_SYSTEM_DISPLAY_ENABLE( + _In_ PVOID MiniportDeviceContext, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, + _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS Flags, + _Out_ UINT* Width, + _Out_ UINT* Height, + _Out_ D3DDDIFORMAT* ColorFormat +); + +typedef +_Function_class_DXGK_(DXGKDDI_SYSTEM_DISPLAY_WRITE) +VOID +APIENTRY +DXGKDDI_SYSTEM_DISPLAY_WRITE( + _In_ PVOID MiniportDeviceContext, + _In_reads_bytes_(SourceHeight * SourceStride) PVOID Source, + _In_ UINT SourceWidth, + _In_ UINT SourceHeight, + _In_ UINT SourceStride, + _In_ UINT PositionX, + _In_ UINT PositionY +); + +// +// ELD and Container ID structures +// + +typedef struct _DXGK_CHILD_CONTAINER_ID +{ + GUID ContainerId; + struct + { + ULONG64 PortId; + USHORT ManufacturerName; + USHORT ProductCode; + } EldInfo; +} DXGK_CHILD_CONTAINER_ID, *PDXGK_CHILD_CONTAINER_ID; + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_GET_CHILD_CONTAINER_ID) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_GET_CHILD_CONTAINER_ID( + _In_ PVOID MiniportDeviceContext, + _In_ ULONG ChildUid, + _Inout_ PDXGK_CHILD_CONTAINER_ID ContainerId + ); + +// +// Surprise removal support function +// + +typedef enum _DXGK_SURPRISE_REMOVAL_TYPE +{ + DxgkRemovalHibernation = 0, + DxgkRemovalPnPNotify = 1, +} DXGK_SURPRISE_REMOVAL_TYPE; + +typedef + _Check_return_ +_Function_class_DXGK_(DXGKDDI_NOTIFY_SURPRISE_REMOVAL) +_IRQL_requires_DXGK_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_NOTIFY_SURPRISE_REMOVAL( + _In_ PVOID MiniportDeviceContext, + _In_ DXGK_SURPRISE_REMOVAL_TYPE RemovalType + ); + +// +// Function pointer typedefs +// + +typedef DXGKDDI_STOP_DEVICE_AND_RELEASE_POST_DISPLAY_OWNERSHIP *PDXGKDDI_STOP_DEVICE_AND_RELEASE_POST_DISPLAY_OWNERSHIP; +typedef DXGKDDI_SYSTEM_DISPLAY_ENABLE *PDXGKDDI_SYSTEM_DISPLAY_ENABLE; +typedef DXGKDDI_SYSTEM_DISPLAY_WRITE *PDXGKDDI_SYSTEM_DISPLAY_WRITE; +typedef DXGKDDI_GET_CHILD_CONTAINER_ID *PDXGKDDI_GET_CHILD_CONTAINER_ID; +typedef DXGKDDI_NOTIFY_SURPRISE_REMOVAL *PDXGKDDI_NOTIFY_SURPRISE_REMOVAL; + +#endif // DXGKDDI_INTERFACE_VERSION + + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +#define DXGK_DUMP_BUCKETING_BUFFER_SIZE 64 +#define DXGK_DUMP_DESCRIPTION_BUFFER_SIZE 128 + +typedef enum _DXGK_DIAGNOSTICINFO_TYPE +{ + DXGK_DI_ADDDEVICE=1, + DXGK_DI_STARTDEVICE, + DXGK_DI_BLACKSCREEN, +} DXGK_DIAGNOSTICINFO_TYPE; + +typedef struct _DXGKARG_COLLECTDIAGNOSTICINFO +{ + HANDLE hAdapter; + DXGK_DIAGNOSTICINFO_TYPE Type; + CHAR BucketingString[DXGK_DUMP_BUCKETING_BUFFER_SIZE]; + CHAR DescriptionString[DXGK_DUMP_DESCRIPTION_BUFFER_SIZE]; + union + { + PVOID pReserved; + }; + UINT BufferSizeIn; + UINT BufferSizeOut; + PVOID pBuffer; +} DXGKARG_COLLECTDIAGNOSTICINFO; + +typedef _Inout_ DXGKARG_COLLECTDIAGNOSTICINFO* INOUT_PDXGKARG_COLLECTDIAGNOSTICINFO; + +typedef + _Check_return_ + _Function_class_DXGK_(DXGKDDI_COLLECTDIAGNOSTICINFO) + _IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +APIENTRY +DXGKDDI_COLLECTDIAGNOSTICINFO( + IN_CONST_PDEVICE_OBJECT PhysicalDeviceObject, + INOUT_PDXGKARG_COLLECTDIAGNOSTICINFO pCollectDiagnosticInfo); + +typedef DXGKDDI_COLLECTDIAGNOSTICINFO *PDXGKDDI_COLLECTDIAGNOSTICINFO; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + + +// +// Driver initialization data structure +// + +typedef struct _DRIVER_INITIALIZATION_DATA { + ULONG Version; + PDXGKDDI_ADD_DEVICE DxgkDdiAddDevice; + PDXGKDDI_START_DEVICE DxgkDdiStartDevice; + PDXGKDDI_STOP_DEVICE DxgkDdiStopDevice; + PDXGKDDI_REMOVE_DEVICE DxgkDdiRemoveDevice; + PDXGKDDI_DISPATCH_IO_REQUEST DxgkDdiDispatchIoRequest; + PDXGKDDI_INTERRUPT_ROUTINE DxgkDdiInterruptRoutine; + PDXGKDDI_DPC_ROUTINE DxgkDdiDpcRoutine; + PDXGKDDI_QUERY_CHILD_RELATIONS DxgkDdiQueryChildRelations; + PDXGKDDI_QUERY_CHILD_STATUS DxgkDdiQueryChildStatus; + PDXGKDDI_QUERY_DEVICE_DESCRIPTOR DxgkDdiQueryDeviceDescriptor; + PDXGKDDI_SET_POWER_STATE DxgkDdiSetPowerState; + PDXGKDDI_NOTIFY_ACPI_EVENT DxgkDdiNotifyAcpiEvent; + PDXGKDDI_RESET_DEVICE DxgkDdiResetDevice; + PDXGKDDI_UNLOAD DxgkDdiUnload; + PDXGKDDI_QUERY_INTERFACE DxgkDdiQueryInterface; + PDXGKDDI_CONTROL_ETW_LOGGING DxgkDdiControlEtwLogging; + PDXGKDDI_QUERYADAPTERINFO DxgkDdiQueryAdapterInfo; + PDXGKDDI_CREATEDEVICE DxgkDdiCreateDevice; + PDXGKDDI_CREATEALLOCATION DxgkDdiCreateAllocation; + PDXGKDDI_DESTROYALLOCATION DxgkDdiDestroyAllocation; + PDXGKDDI_DESCRIBEALLOCATION DxgkDdiDescribeAllocation; + PDXGKDDI_GETSTANDARDALLOCATIONDRIVERDATA DxgkDdiGetStandardAllocationDriverData; + PDXGKDDI_ACQUIRESWIZZLINGRANGE DxgkDdiAcquireSwizzlingRange; + PDXGKDDI_RELEASESWIZZLINGRANGE DxgkDdiReleaseSwizzlingRange; + PDXGKDDI_PATCH DxgkDdiPatch; + PDXGKDDI_SUBMITCOMMAND DxgkDdiSubmitCommand; + PDXGKDDI_PREEMPTCOMMAND DxgkDdiPreemptCommand; + PDXGKDDI_BUILDPAGINGBUFFER DxgkDdiBuildPagingBuffer; + PDXGKDDI_SETPALETTE DxgkDdiSetPalette; + PDXGKDDI_SETPOINTERPOSITION DxgkDdiSetPointerPosition; + PDXGKDDI_SETPOINTERSHAPE DxgkDdiSetPointerShape; + PDXGKDDI_RESETFROMTIMEOUT DxgkDdiResetFromTimeout; + PDXGKDDI_RESTARTFROMTIMEOUT DxgkDdiRestartFromTimeout; + PDXGKDDI_ESCAPE DxgkDdiEscape; + PDXGKDDI_COLLECTDBGINFO DxgkDdiCollectDbgInfo; + PDXGKDDI_QUERYCURRENTFENCE DxgkDdiQueryCurrentFence; + PDXGKDDI_ISSUPPORTEDVIDPN DxgkDdiIsSupportedVidPn; + PDXGKDDI_RECOMMENDFUNCTIONALVIDPN DxgkDdiRecommendFunctionalVidPn; + PDXGKDDI_ENUMVIDPNCOFUNCMODALITY DxgkDdiEnumVidPnCofuncModality; + PDXGKDDI_SETVIDPNSOURCEADDRESS DxgkDdiSetVidPnSourceAddress; + PDXGKDDI_SETVIDPNSOURCEVISIBILITY DxgkDdiSetVidPnSourceVisibility; + PDXGKDDI_COMMITVIDPN DxgkDdiCommitVidPn; + PDXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH DxgkDdiUpdateActiveVidPnPresentPath; + PDXGKDDI_RECOMMENDMONITORMODES DxgkDdiRecommendMonitorModes; + PDXGKDDI_RECOMMENDVIDPNTOPOLOGY DxgkDdiRecommendVidPnTopology; + PDXGKDDI_GETSCANLINE DxgkDdiGetScanLine; + PDXGKDDI_STOPCAPTURE DxgkDdiStopCapture; + PDXGKDDI_CONTROLINTERRUPT DxgkDdiControlInterrupt; + PDXGKDDI_CREATEOVERLAY DxgkDdiCreateOverlay; + + // + // Device functions + // + + PDXGKDDI_DESTROYDEVICE DxgkDdiDestroyDevice; + PDXGKDDI_OPENALLOCATIONINFO DxgkDdiOpenAllocation; + PDXGKDDI_CLOSEALLOCATION DxgkDdiCloseAllocation; + PDXGKDDI_RENDER DxgkDdiRender; + PDXGKDDI_PRESENT DxgkDdiPresent; + + // + // Overlay functions + // + + PDXGKDDI_UPDATEOVERLAY DxgkDdiUpdateOverlay; + PDXGKDDI_FLIPOVERLAY DxgkDdiFlipOverlay; + PDXGKDDI_DESTROYOVERLAY DxgkDdiDestroyOverlay; + + // + // Context supports. + // + + PDXGKDDI_CREATECONTEXT DxgkDdiCreateContext; + PDXGKDDI_DESTROYCONTEXT DxgkDdiDestroyContext; + + // + // Linked Display Adapter support. + // + + PDXGKDDI_LINK_DEVICE DxgkDdiLinkDevice; + PDXGKDDI_SETDISPLAYPRIVATEDRIVERFORMAT DxgkDdiSetDisplayPrivateDriverFormat; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7) + // + // Extended for WDDM 2.0 + // + PVOID DxgkDdiDescribePageTable; + PVOID DxgkDdiUpdatePageTable; + PVOID DxgkDdiUpdatePageDirectory; + PVOID DxgkDdiMovePageDirectory; + + PVOID DxgkDdiSubmitRender; + PVOID DxgkDdiCreateAllocation2; + + // + // GDI acceleration. Extended for WDDM 1.0 + // + PDXGKDDI_RENDER DxgkDdiRenderKm; + + // + // New DMM DDIs for CCD support + // + VOID* Reserved; + PDXGKDDI_QUERYVIDPNHWCAPABILITY DxgkDdiQueryVidPnHWCapability; + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + PDXGKDDISETPOWERCOMPONENTFSTATE DxgkDdiSetPowerComponentFState; + + // + // New DDIs for TDR support. + // + PDXGKDDI_QUERYDEPENDENTENGINEGROUP DxgkDdiQueryDependentEngineGroup; + PDXGKDDI_QUERYENGINESTATUS DxgkDdiQueryEngineStatus; + PDXGKDDI_RESETENGINE DxgkDdiResetEngine; + + // + // New DDIs for PnP stop/start support. + // + PDXGKDDI_STOP_DEVICE_AND_RELEASE_POST_DISPLAY_OWNERSHIP DxgkDdiStopDeviceAndReleasePostDisplayOwnership; + + // + // New DDIs for system display support. + // + PDXGKDDI_SYSTEM_DISPLAY_ENABLE DxgkDdiSystemDisplayEnable; + PDXGKDDI_SYSTEM_DISPLAY_WRITE DxgkDdiSystemDisplayWrite; + + PDXGKDDI_CANCELCOMMAND DxgkDdiCancelCommand; + + // + // New DDI for the monitor container ID support. + // + PDXGKDDI_GET_CHILD_CONTAINER_ID DxgkDdiGetChildContainerId; + + PDXGKDDIPOWERRUNTIMECONTROLREQUEST DxgkDdiPowerRuntimeControlRequest; + + // + // New DDI for multi plane overlay support. + // + PDXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY DxgkDdiSetVidPnSourceAddressWithMultiPlaneOverlay; + + // + // New DDI for the surprise removal support. + // + PDXGKDDI_NOTIFY_SURPRISE_REMOVAL DxgkDdiNotifySurpriseRemoval; + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM1_3) + // + // New DDI for querying node metadata + // + PDXGKDDI_GETNODEMETADATA DxgkDdiGetNodeMetadata; + + // + // New DDI for power management enhancements + // + PDXGKDDISETPOWERPSTATE DxgkDdiSetPowerPState; + PDXGKDDI_CONTROLINTERRUPT2 DxgkDdiControlInterrupt2; + + // + // New DDI for multiplane overlay support + // + PDXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT DxgkDdiCheckMultiPlaneOverlaySupport; + + // + // New DDI for GPU clock calibration + // + PDXGKDDI_CALIBRATEGPUCLOCK DxgkDdiCalibrateGpuClock; + + // + // New DDI for history buffer formatting + // + PDXGKDDI_FORMATHISTORYBUFFER DxgkDdiFormatHistoryBuffer; + +#endif + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + + PDXGKDDI_RENDERGDI DxgkDdiRenderGdi; + PDXGKDDI_SUBMITCOMMANDVIRTUAL DxgkDdiSubmitCommandVirtual; + PDXGKDDI_SETROOTPAGETABLE DxgkDdiSetRootPageTable; + PDXGKDDI_GETROOTPAGETABLESIZE DxgkDdiGetRootPageTableSize; + PDXGKDDI_MAPCPUHOSTAPERTURE DxgkDdiMapCpuHostAperture; + PDXGKDDI_UNMAPCPUHOSTAPERTURE DxgkDdiUnmapCpuHostAperture; + PDXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT2 DxgkDdiCheckMultiPlaneOverlaySupport2; + PDXGKDDI_CREATEPROCESS DxgkDdiCreateProcess; + PDXGKDDI_DESTROYPROCESS DxgkDdiDestroyProcess; + PDXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY2 DxgkDdiSetVidPnSourceAddressWithMultiPlaneOverlay2; + void* Reserved1; + void* Reserved2; + PDXGKDDI_POWERRUNTIMESETDEVICEHANDLE DxgkDdiPowerRuntimeSetDeviceHandle; + PDXGKDDI_SETSTABLEPOWERSTATE DxgkDdiSetStablePowerState; + PDXGKDDI_SETVIDEOPROTECTEDREGION DxgkDdiSetVideoProtectedRegion; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + + PDXGKDDI_CHECKMULTIPLANEOVERLAYSUPPORT3 DxgkDdiCheckMultiPlaneOverlaySupport3; + PDXGKDDI_SETVIDPNSOURCEADDRESSWITHMULTIPLANEOVERLAY3 DxgkDdiSetVidPnSourceAddressWithMultiPlaneOverlay3; + PDXGKDDI_POSTMULTIPLANEOVERLAYPRESENT DxgkDdiPostMultiPlaneOverlayPresent; + PDXGKDDI_VALIDATEUPDATEALLOCATIONPROPERTY DxgkDdiValidateUpdateAllocationProperty; + + PDXGKDDI_CONTROLMODEBEHAVIOR DxgkDdiControlModeBehavior; + PDXGKDDI_UPDATEMONITORLINKINFO DxgkDdiUpdateMonitorLinkInfo; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + + // + // Hardware context scheduling support. + // + + PDXGKDDI_CREATEHWCONTEXT DxgkDdiCreateHwContext; + PDXGKDDI_DESTROYHWCONTEXT DxgkDdiDestroyHwContext; + + PDXGKDDI_CREATEHWQUEUE DxgkDdiCreateHwQueue; + PDXGKDDI_DESTROYHWQUEUE DxgkDdiDestroyHwQueue; + + PDXGKDDI_SUBMITCOMMANDTOHWQUEUE DxgkDdiSubmitCommandToHwQueue; + PDXGKDDI_SWITCHTOHWCONTEXTLIST DxgkDdiSwitchToHwContextList; + + PDXGKDDI_RESETHWENGINE DxgkDdiResetHwEngine; + + PDXGKDDI_CREATEPERIODICFRAMENOTIFICATION DxgkDdiCreatePeriodicFrameNotification; + PDXGKDDI_DESTROYPERIODICFRAMENOTIFICATION DxgkDdiDestroyPeriodicFrameNotification; + + PDXGKDDI_SETTIMINGSFROMVIDPN DxgkDdiSetTimingsFromVidPn; + + PDXGKDDI_SETTARGETGAMMA DxgkDdiSetTargetGamma; + PDXGKDDI_SETTARGETCONTENTTYPE DxgkDdiSetTargetContentType; + PDXGKDDI_SETTARGETANALOGCOPYPROTECTION DxgkDdiSetTargetAnalogCopyProtection; + PDXGKDDI_SETTARGETADJUSTEDCOLORIMETRY DxgkDdiSetTargetAdjustedColorimetry; + + PDXGKDDI_DISPLAYDETECTCONTROL DxgkDdiDisplayDetectControl; + PDXGKDDI_QUERYCONNECTIONCHANGE DxgkDdiQueryConnectionChange; + + PDXGKDDI_EXCHANGEPRESTARTINFO DxgkDdiExchangePreStartInfo; + + PDXGKDDI_GETMULTIPLANEOVERLAYCAPS DxgkDdiGetMultiPlaneOverlayCaps; + PDXGKDDI_GETPOSTCOMPOSITIONCAPS DxgkDdiGetPostCompositionCaps; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_2) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + + PDXGKDDI_UPDATEHWCONTEXTSTATE DxgkDdiUpdateHwContextState; + + PDXGKDDI_CREATEPROTECTEDSESSION DxgkDdiCreateProtectedSession; + PDXGKDDI_DESTROYPROTECTEDSESSION DxgkDdiDestroyProtectedSession; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_3) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + + PDXGKDDI_SETSCHEDULINGLOGBUFFER DxgkDdiSetSchedulingLogBuffer; + PDXGKDDI_SETUPPRIORITYBANDS DxgkDdiSetupPriorityBands; + PDXGKDDI_NOTIFYFOCUSPRESENT DxgkDdiNotifyFocusPresent; + PDXGKDDI_SETCONTEXTSCHEDULINGPROPERTIES DxgkDdiSetContextSchedulingProperties; + PDXGKDDI_SUSPENDCONTEXT DxgkDdiSuspendContext; + PDXGKDDI_RESUMECONTEXT DxgkDdiResumeContext; + PDXGKDDI_SETVIRTUALMACHINEDATA DxgkDdiSetVirtualMachineData; + PDXGKDDI_BEGINEXCLUSIVEACCESS DxgkDdiBeginExclusiveAccess; + PDXGKDDI_ENDEXCLUSIVEACCESS DxgkDdiEndExclusiveAccess; + PDXGKDDI_QUERYDIAGNOSTICTYPESSUPPORT DxgkDdiQueryDiagnosticTypesSupport; + PDXGKDDI_CONTROLDIAGNOSTICREPORTING DxgkDdiControlDiagnosticReporting; + PDXGKDDI_RESUMEHWENGINE DxgkDdiResumeHwEngine; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_4) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + + PDXGKDDI_SIGNALMONITOREDFENCE DxgkDdiSignalMonitoredFence; + PDXGKDDI_PRESENTTOHWQUEUE DxgkDdiPresentToHwQueue; + PDXGKDDI_VALIDATESUBMITCOMMAND DxgkDdiValidateSubmitCommand; + PDXGKDDI_SETTARGETADJUSTEDCOLORIMETRY2 DxgkDdiSetTargetAdjustedColorimetry2; + PDXGKDDI_SETTRACKEDWORKLOADPOWERLEVEL DxgkDdiSetTrackedWorkloadPowerLevel; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_5) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + PDXGKDDI_SAVEMEMORYFORHOTUPDATE DxgkDdiSaveMemoryForHotUpdate; + PDXGKDDI_RESTOREMEMORYFORHOTUPDATE DxgkDdiRestoreMemoryForHotUpdate; + PDXGKDDI_COLLECTDIAGNOSTICINFO DxgkDdiCollectDiagnosticInfo; + void* Reserved3; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_6) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + PDXGKDDI_CONTROLINTERRUPT3 DxgkDdiControlInterrupt3; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_7) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + + PDXGKDDI_SETFLIPQUEUELOGBUFFER DxgkDdiSetFlipQueueLogBuffer; + PDXGKDDI_UPDATEFLIPQUEUELOG DxgkDdiUpdateFlipQueueLog; + PDXGKDDI_CANCELQUEUEDFLIPS DxgkDdiCancelQueuedFlips; + PDXGKDDI_SETINTERRUPTTARGETPRESENTID DxgkDdiSetInterruptTargetPresentId; + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_9) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + PDXGKDDI_SETALLOCATIONBACKINGSTORE DxgkDdiSetAllocationBackingStore; + PDXGKDDI_CREATECPUEVENT DxgkDdiCreateCpuEvent; + PDXGKDDI_DESTROYCPUEVENT DxgkDdiDestroyCpuEvent; + PDXGKDDI_CANCELFLIPS DxgkDdiCancelFlips; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_0) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + PDXGKDDI_CREATENATIVEFENCE DxgkDdiCreateNativeFence; + PDXGKDDI_DESTROYNATIVEFENCE DxgkDdiDestroyNativeFence; + PDXGKDDI_UPDATEMONITOREDVALUES DxgkDdiUpdateMonitoredValues; + PDXGKDDI_NOTIFYCURRENTVALUEUPDATES DxgkDdiNotifyCurrentValueUpdates; + PDXGKDDI_CREATEDOORBELL DxgkDdiCreateDoorbell; + PDXGKDDI_CONNECTDOORBELL DxgkDdiConnectDoorbell; + PDXGKDDI_DISCONNECTDOORBELL DxgkDdiDisconnectDoorbell; + PDXGKDDI_DESTROYDOORBELL DxgkDdiDestroyDoorbell; + PDXGKDDI_NOTIFYWORKSUBMISSION DxgkDdiNotifyWorkSubmission; + PDXGKDDI_FLUSHHWQUEUE DxgkDdiFlushHwQueue; +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM3_1) + +} DRIVER_INITIALIZATION_DATA, *PDRIVER_INITIALIZATION_DATA; + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +typedef struct _KMDDOD_INITIALIZATION_DATA { + ULONG Version; + PDXGKDDI_ADD_DEVICE DxgkDdiAddDevice; + PDXGKDDI_START_DEVICE DxgkDdiStartDevice; + PDXGKDDI_STOP_DEVICE DxgkDdiStopDevice; + PDXGKDDI_REMOVE_DEVICE DxgkDdiRemoveDevice; + PDXGKDDI_DISPATCH_IO_REQUEST DxgkDdiDispatchIoRequest; + PDXGKDDI_INTERRUPT_ROUTINE DxgkDdiInterruptRoutine; + PDXGKDDI_DPC_ROUTINE DxgkDdiDpcRoutine; + PDXGKDDI_QUERY_CHILD_RELATIONS DxgkDdiQueryChildRelations; + PDXGKDDI_QUERY_CHILD_STATUS DxgkDdiQueryChildStatus; + PDXGKDDI_QUERY_DEVICE_DESCRIPTOR DxgkDdiQueryDeviceDescriptor; + PDXGKDDI_SET_POWER_STATE DxgkDdiSetPowerState; + PDXGKDDI_NOTIFY_ACPI_EVENT DxgkDdiNotifyAcpiEvent; + PDXGKDDI_RESET_DEVICE DxgkDdiResetDevice; + PDXGKDDI_UNLOAD DxgkDdiUnload; + PDXGKDDI_QUERY_INTERFACE DxgkDdiQueryInterface; + PDXGKDDI_CONTROL_ETW_LOGGING DxgkDdiControlEtwLogging; + PDXGKDDI_QUERYADAPTERINFO DxgkDdiQueryAdapterInfo; + PDXGKDDI_SETPALETTE DxgkDdiSetPalette; + PDXGKDDI_SETPOINTERPOSITION DxgkDdiSetPointerPosition; + PDXGKDDI_SETPOINTERSHAPE DxgkDdiSetPointerShape; + PDXGKDDI_ESCAPE DxgkDdiEscape; + PDXGKDDI_COLLECTDBGINFO DxgkDdiCollectDbgInfo; + PDXGKDDI_ISSUPPORTEDVIDPN DxgkDdiIsSupportedVidPn; + PDXGKDDI_RECOMMENDFUNCTIONALVIDPN DxgkDdiRecommendFunctionalVidPn; + PDXGKDDI_ENUMVIDPNCOFUNCMODALITY DxgkDdiEnumVidPnCofuncModality; + PDXGKDDI_SETVIDPNSOURCEVISIBILITY DxgkDdiSetVidPnSourceVisibility; + PDXGKDDI_COMMITVIDPN DxgkDdiCommitVidPn; + PDXGKDDI_UPDATEACTIVEVIDPNPRESENTPATH DxgkDdiUpdateActiveVidPnPresentPath; + PDXGKDDI_RECOMMENDMONITORMODES DxgkDdiRecommendMonitorModes; + PDXGKDDI_GETSCANLINE DxgkDdiGetScanLine; + PDXGKDDI_QUERYVIDPNHWCAPABILITY DxgkDdiQueryVidPnHWCapability; + + // + // New DDI for the PresentDisplayOnly function. + // + PDXGKDDI_PRESENTDISPLAYONLY DxgkDdiPresentDisplayOnly; + + // + // New DDIs for PnP stop/start support. + // + PDXGKDDI_STOP_DEVICE_AND_RELEASE_POST_DISPLAY_OWNERSHIP DxgkDdiStopDeviceAndReleasePostDisplayOwnership; + + // + // New DDIs for system display support. + // + PDXGKDDI_SYSTEM_DISPLAY_ENABLE DxgkDdiSystemDisplayEnable; + PDXGKDDI_SYSTEM_DISPLAY_WRITE DxgkDdiSystemDisplayWrite; + + // + // New DDI for the monitor container ID support. + // + PDXGKDDI_GET_CHILD_CONTAINER_ID DxgkDdiGetChildContainerId; + + // + // New DDI for HW VSync. + // + PDXGKDDI_CONTROLINTERRUPT DxgkDdiControlInterrupt; + + PDXGKDDISETPOWERCOMPONENTFSTATE DxgkDdiSetPowerComponentFState; + PDXGKDDIPOWERRUNTIMECONTROLREQUEST DxgkDdiPowerRuntimeControlRequest; + + // + // New DDI for the surprise removal support. + // + PDXGKDDI_NOTIFY_SURPRISE_REMOVAL DxgkDdiNotifySurpriseRemoval; + + // + // Display only drivers support P-State management. + // +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + PDXGKDDI_POWERRUNTIMESETDEVICEHANDLE DxgkDdiPowerRuntimeSetDeviceHandle; +#endif + +} KMDDOD_INITIALIZATION_DATA, *PKMDDOD_INITIALIZATION_DATA; + +#endif // DXGKDDI_INTERFACE_VERSION + + +// +// *** Displib definitions **************************************************** +// + +typedef enum _DEBUG_LEVEL { + DlDebugError, + DlDebugWarning, + DlDebugTrace, + DlDebugInfo +} DEBUG_LEVEL; + +// +// Functions exported by DispLib +// + +NTSTATUS +NTAPI +DxgkInitialize( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPath, + _In_ PDRIVER_INITIALIZATION_DATA DriverInitializationData); + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN8) + +NTSTATUS +NTAPI +DxgkInitializeDisplayOnlyDriver( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPath, + _In_ PKMDDOD_INITIALIZATION_DATA KmdDodInitializationData + ); + +#endif // DXGKDDI_INTERFACE_VERSION + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_0) + +NTSTATUS +DxgkUnInitialize( + _In_ PDRIVER_OBJECT DriverObject + ); + +#endif // DXGKDDI_INTERFACE_VERSION + +PVOID +DlAllocateCommonBuffer( + IN PVOID DeviceHandle, + IN PVP_DMA_ADAPTER DlpDmaAdapter, + IN ULONG DesiredLength, + OUT PPHYSICAL_ADDRESS LogicalAddress, + IN BOOLEAN CacheEnabled, + OUT PVOID Reserved + ); + +PVOID +DlAllocatePool( + IN PVOID DeviceHandle, + IN VP_POOL_TYPE PoolType, + IN SIZE_T NumberOfBytes, + IN ULONG Tag + ); + +VOID +DlClearEvent( + _In_ PVOID DeviceHandle, + _In_ PEVENT pEvent + ); + +VP_STATUS +DlCreateEvent( + IN PVOID DeviceHandle, + IN ULONG EventFlag, + PVOID Unused, + OUT PEVENT *ppEvent + ); + +VOID +DlDebugPrint( + _In_ DEBUG_LEVEL DebugPrintLevel, + _In_ PSTR DebugMessage, + ... + ); + +VP_STATUS +DlDeleteEvent( + IN PVOID DeviceHandle, + IN PEVENT pEvent + ); + +VP_STATUS +DlEnumerateChildren( + _In_ PVOID DeviceHandle, + _In_ PVOID Reserved + ); + +VOID +DlFreeDeviceBase( + IN PVOID DeviceHandle, + IN PVOID MappedAddress + ); + +VOID +DlFreePool( + IN PVOID DeviceHandle, + IN PVOID Ptr + ); + +NTSTATUS +DlGetAccessRanges( + PVOID DeviceHandle, + ULONG NumRequestedResources, + PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL, + ULONG NumAccessRanges, + PVIDEO_ACCESS_RANGE AccessRanges, + PVOID VendorId, + PVOID DeviceId, + PULONG Slot + ); + +PVOID +DlGetAssociatedDeviceExtension( + _In_ PVOID DeviceObject + ); + +PVOID +DlGetDeviceBase( + _In_ PVOID DeviceHandle, + _In_ PHYSICAL_ADDRESS IoAddress, + _In_ ULONG NumberOfUchars, + _In_ UCHAR InIoSpace + ); + +PVP_DMA_ADAPTER +DlGetDmaAdapter( + _In_ PVOID DeviceHandle, + _In_ PVP_DEVICE_DESCRIPTION DlpDeviceDescription + ); + +VP_STATUS +DlGetRegistryParameters( + _In_ PVOID DeviceHandle, + _In_ PWSTR ParameterName, + _In_ UCHAR IsParameterFileName, + _In_ PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine, + _In_ PVOID Context + ); + + +PVOID +DlGetRomImage( + _In_ PVOID DeviceHandle, + PVOID Unused1, + ULONG Unused2, + _In_ ULONG Length + ); + +VP_STATUS +DlGetVersion( + _In_ PVOID DeviceHandle, + _Out_ PVPOSVERSIONINFO pDlpOsVersionInfo + ); + +PVOID +DlLockBuffer( + _In_ PVOID DeviceHandle, + _In_reads_bytes_(Length) PVOID BaseAddress, + _In_ ULONG Length, + _In_ VP_LOCK_OPERATION Operation + ); + +VOID +DlLogError( + _In_ PVOID DeviceHandle, + _In_opt_ PVIDEO_REQUEST_PACKET Vrp, + _In_ VP_STATUS ErrorCode, + _In_ ULONG UniqueId + ); + +VP_STATUS +DlMapMemory( + IN PVOID DeviceHandle, + IN PHYSICAL_ADDRESS TranslatedAddress, + IN OUT PULONG Length, + IN PULONG InIoSpace, + IN OUT PVOID *VirtualAddress + ); + +LONGLONG +DlQueryPerformanceCounter( + _In_ PVOID pDeviceHandle, + _Out_opt_ PLONGLONG pllPerformanceFrequency + ); + +VOID +DlReleaseCommonBuffer( + IN PVOID DeviceHandle, + IN PVP_DMA_ADAPTER DlpDmaAdapter, + IN ULONG Length, + IN PHYSICAL_ADDRESS LogicalAddress, + IN PVOID VirtualAddress, + IN BOOLEAN CacheEnabled + ); + +BOOLEAN +DlScanRom( + _In_ PVOID DeviceHandle, + _In_reads_bytes_(RomLength) PUCHAR RomBase, + _In_ ULONG RomLength, + _In_z_ PUCHAR String + ); + +LONG +DlSetEvent( + _In_ PVOID DeviceHandle, + _In_ PEVENT pEvent + ); + +VP_STATUS +DlSetRegistryParameters( + _In_ PVOID DeviceHandle, + _In_ PWSTR ValueName, + _In_reads_bytes_(ValueLength) PVOID ValueData, + _In_ ULONG ValueLength + ); + +VP_STATUS +DlSetTrappedEmulatorPorts( + _In_ PVOID DeviceHandle, + _In_ ULONG NumAccessRanges, + _In_reads_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRange + ); + +VOID +DlStopTimer( + PVOID DeviceHandle + ); + +VOID +DlUnlockBuffer( + IN PVOID DeviceHandle, + IN PVOID Mdl + ); + +VP_STATUS +DlVerifyAccessRanges( + PVOID DeviceHandle, + ULONG NumAccessRanges, + PVIDEO_ACCESS_RANGE AccessRanges + ); + +VP_STATUS +DlWaitForSingleObject( + _In_ PVOID DeviceHandle, + _In_ PVOID pEvent, + _In_ PLARGE_INTEGER Timeout + ); + +VP_STATUS +DlDisableInterrupt( + _In_ PVOID DeviceHandle + ); + +VP_STATUS +DlEnableInterrupt( + _In_ PVOID DeviceHandle + ); + +NTSTATUS +DlEvalAcpiMethod( + _In_ HANDLE DeviceHandle, + _In_ ULONG DeviceUid, + _In_reads_bytes_(AcpiInputSize) PACPI_EVAL_INPUT_BUFFER_COMPLEX AcpiInputBuffer, + _In_range_(>=, sizeof(ACPI_EVAL_INPUT_BUFFER_COMPLEX)) ULONG AcpiInputSize, + _Out_writes_bytes_(AcpiOutputSize) PACPI_EVAL_OUTPUT_BUFFER AcpiOutputBuffer, + _In_range_(>=, sizeof(ACPI_EVAL_OUTPUT_BUFFER)) ULONG AcpiOutputSize + ); + +NTSTATUS +DlGetDeviceInformation( + _In_ PVOID DeviceHandle, + _Out_ PDXGK_DEVICE_INFO DeviceInfo + ); + +NTSTATUS +DlIndicateChildStatus( + _In_ PVOID DeviceHandle, + _In_ PDXGK_CHILD_STATUS ChildStatus + ); + +NTSTATUS +DlMapMemoryEx( + IN PVOID DeviceHandle, + IN PHYSICAL_ADDRESS TranslatedAddress, + IN OUT PULONG Length, + IN PULONG InIoSpace, + IN HANDLE ProcessHandle, + IN OUT PVOID *VirtualAddress, + IN BOOLEAN MapToUserMode + ); + +NTSTATUS +DlQueryServices( + _In_ PVOID DeviceHandle, + _In_ VIDEO_PORT_SERVICES ServicesType, + _Inout_ PINTERFACE Interface + ); + +BOOLEAN +DlQueueDpc( + _In_ PVOID DeviceHandle + ); + +ULONG +DlReadDeviceSpace( + _In_ PVOID DeviceHandle, + _In_ ULONG DataType, + _In_ ULONG SlotNumber, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length + ); + +ULONG +DlSetBusData( + _In_ PVOID DeviceHandle, + _In_ ULONG BusDataType, + _In_ ULONG SlotNumber, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length + ); + +BOOLEAN +DlSynchronizeExecution( + PVOID DeviceHandle, + VIDEO_SYNCHRONIZE_PRIORITY Priority, + PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, + PVOID Context, + ULONG MessageNumber + ); + +NTSTATUS +DlUnmapMemory( + PVOID DeviceHandle, + PVOID VirtualAddress, + HANDLE ProcessHandle + ); + +#endif // (NTDDI_VERSION >= NTDDI_LONGHORN) + +#if (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +/////////////////////////////////////////////////////////////////////////////// +// +// GPU virtualization interfaces. +// +// The interfaces are placed to dispmprt.w because they reference low level +// definitions, such as PCM_PARTIAL_RESOURCE_DESCRIPTOR and PINTERFACE_REFERENCE. +// +/////////////////////////////////////////////////////////////////////////////// + +//////////////// GUID_DXGKDDI_GPU_PARTITION_INTERFACE ///////////////////////// + +// {462BC153-40EB-484A-8168-9972E3CD5AEF} +DEFINE_GUID(GUID_DXGKDDI_GPU_PARTITION_INTERFACE, 0x462bc153, 0x40eb, 0x484a, 0x81, 0x68, 0x99, 0x72, 0xe3, 0xcd, 0x5a, 0xef); + +// must be the same as flexiov.h #define FIOV_FLAG_ACS_CAPABLE 0x080 +#define DXGK_VIRTUALIZED_ACS_CAPABLE 0x80 +// must be the same as flexiov.h #define FIOV_FLAG_UNIQUE_RID_PER_VF 0x100 +#define DXGK_VIRTUALIZED_UNIQUE_RID 0x100 +// must be the same as flexiov.h #define FIOV_FLAG_PARAVIRTUALIZED 0x400 +// This implies the host device is shared and virtualization is accomplished by software +#define DXGK_VIRTUALIZED_PARAVIRTUALIZED 0x400 +// must be the same as flexiov.h #define FIOV_FLAG_HOST_VIRTUAL_DEVICE 0x800 +// This implies the host device is a fully virtual device and no hardware is present +#define DXGK_VIRTUALIZED_HOST_VIRTUAL_DEVICE 0x800 + + +typedef struct _DXGKARG_GETGPUPARTITIONINFO +{ + _Inout_ ULONG NumGpuPartitionOptions; + _Out_writes_(NumGpuPartitionOptions) USHORT* pGpuPartitionOptions; + _Out_ USHORT CurrentGpuPartitionCount; +} DXGKARG_GETGPUPARTITIONINFO, *PDXGKARG_GETGPUPARTITIONINFO; + +typedef +_Function_class_(DXGKDDI_GETGPUPARTITIONINFO) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETGPUPARTITIONINFO( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETGPUPARTITIONINFO* pArgs + ); + +typedef DXGKDDI_GETGPUPARTITIONINFO *PDXGKDDI_GETGPUPARTITIONINFO; + +typedef enum _DXGK_VGPU_CAPABILITY_TYPE +{ + DXGK_VGPU_CAPABILITY_MEMORY = 0, + DXGK_VGPU_CAPABILITY_ENCODE = 1, + DXGK_VGPU_CAPABILITY_DECODE = 2, + DXGK_VGPU_CAPABILITY_COMPUTE = 3, + DXGK_VGPU_CAPABILITY_MAX, +} DXGK_VGPU_CAPABILITY_TYPE; + +typedef struct _DXGK_VGPU_PROFILE_CAPABILITY +{ + UINT64 TotalValue; + UINT64 AvailableValue; + UINT64 MinPartitionValue; + UINT64 MaxPartitionValue; + UINT64 OptimalPartitionValue; +} DXGK_VGPU_PROFILE_CAPABILITY, *PDXGK_VGPU_PROFILE_CAPABILITY; + +typedef struct _DXGKARG_GETVIRTUALGPUPROFILE +{ + ULONG PartitionCount; + ULONG VirtualizationFlags; + DXGK_VGPU_PROFILE_CAPABILITY ProfileCapability[DXGK_VGPU_CAPABILITY_MAX]; +} DXGKARG_GETVIRTUALGPUPROFILE, *PDXGKARG_GETVIRTUALGPUPROFILE; + +typedef +_Function_class_(DXGKDDI_GETVIRTUALGPUPROFILE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETVIRTUALGPUPROFILE( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETVIRTUALGPUPROFILE* pArgs + ); + +typedef DXGKDDI_GETVIRTUALGPUPROFILE *PDXGKDDI_GETVIRTUALGPUPROFILE; + +typedef struct _DXGK_GPUENGINE +{ + DXGK_ENGINE_TYPE EngineType; + WCHAR Name[DXGK_MAX_METADATA_NAME_LENGTH]; + ULONG NumPartitionUnits; +} DXGK_GPUENGINE, *PDXGK_GPUENGINE; + +typedef struct _DXGKARG_GETGPUENGINES +{ + _In_ ULONG NumEngines; + _Out_writes_(NumEngines)DXGK_GPUENGINE EngineInfo[1]; +} DXGKARG_GETGPUENGINES, *PDXGKARG_GETGPUENGINES; + +typedef +_Function_class_(DXGKDDI_GETGPUENGINES) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETGPUENGINES( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETGPUENGINES* pArgs + ); + +typedef DXGKDDI_GETGPUENGINES *PDXGKDDI_GETGPUENGINES; + +typedef struct _DXGKARG_SETGPUPARTITIONCOUNT +{ + _In_ ULONG PartitionCount; +} DXGKARG_SETGPUPARTITIONCOUNT, *PDXGKARG_SETGPUPARTITIONCOUNT; + +typedef +_Function_class_(DXGKDDI_SETGPUPARTITIONCOUNT) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_SETGPUPARTITIONCOUNT( + _In_ HANDLE Context, + _In_ DXGKARG_SETGPUPARTITIONCOUNT* pArgs + ); + +typedef DXGKDDI_SETGPUPARTITIONCOUNT *PDXGKDDI_SETGPUPARTITIONCOUNT; + +typedef struct _DXGK_VIRTUALGPUCAPABILITY +{ + UINT64 MinValue; + UINT64 MaxValue; + UINT64 OptimalValue; +} DXGK_VIRTUALGPUCAPABILITY, *PDXGK_VIRTUALGPUCAPABILITY; + +typedef struct _DXGK_VIRTUALGPUPROFILE +{ + DXGK_VIRTUALGPUCAPABILITY Capability[DXGK_VGPU_CAPABILITY_MAX]; +} DXGK_VIRTUALGPUPROFILE, *PDXGK_VIRTUALGPUPROFILE; + +typedef struct _DXGK_VIRTUALGPUENGINEINFO +{ + ULONG MinPartitionUnits; + ULONG MaxPartitionUnits; + ULONG EngineId; +} DXGK_VIRTUALGPUENGINEINFO, *PDXGK_VIRTUALGPUENGINEINFO; + +typedef struct _DXGK_VIRTUALGPUSEGMENTINFO +{ + ULONG DriverSegmentId; + UINT64 Size; + UINT Alignment; + UINT64 MinSegmentOffset; + UINT64 MaxSegmentOffset; + UINT PrivateDriverData; +} DXGK_VIRTUALGPUSEGMENTINFO, *PDXGK_VIRTUALGPUSEGMENTINFO; + +#define DXGK_MAX_VIRTUAL_GPU_ALLOCATIONS 32 + +typedef struct _DXGKARG_CREATEVIRTUALGPU +{ + _In_ ULONG PartitionId; + _In_ DXGK_VIRTUALGPUPROFILE Profile; + _Out_ CLSID UserModeVirtualDeviceProvider; + _Out_ LUID VirtualGpuLuid; + _Out_ ULONG NumMemorySegments; + _Out_ DXGK_VIRTUALGPUSEGMENTINFO SegmentInfo[DXGK_MAX_VIRTUAL_GPU_ALLOCATIONS]; + _Out_ ULONG NumEngines; + _Out_ DXGK_VIRTUALGPUENGINEINFO EngineInfo[DXGK_MAX_ASYMETRICAL_PROCESSING_NODES]; +} DXGKARG_CREATEVIRTUALGPU, *PDXGKARG_CREATEVIRTUALGPU; + +typedef +_Function_class_(DXGKDDI_CREATEVIRTUALGPU) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_CREATEVIRTUALGPU( + _In_ HANDLE Context, + _Inout_ DXGKARG_CREATEVIRTUALGPU* pArgs + ); + +typedef DXGKDDI_CREATEVIRTUALGPU *PDXGKDDI_CREATEVIRTUALGPU; + +typedef struct _DXGK_VGPU_CAPABILITY +{ + UINT64 MinValue; + UINT64 MaxValue; + UINT64 CurrentValue; +} DXGK_VGPU_CAPABILITY, *PDXGK_VGPU_CAPABILITY; + +typedef struct _DXGKARG_GETVIRTUALGPUINFO +{ + _In_ ULONG PartitionId; + _Out_ DXGK_VGPU_CAPABILITY Capability[DXGK_VGPU_CAPABILITY_MAX]; +} DXGKARG_GETVIRTUALGPUINFO, *PDXGKARG_GETVIRTUALGPUINFO; + +typedef +_Function_class_(DXGKDDI_GETVIRTUALGPUINFO) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETVIRTUALGPUINFO( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETVIRTUALGPUINFO* pArgs + ); + +typedef DXGKDDI_GETVIRTUALGPUINFO *PDXGKDDI_GETVIRTUALGPUINFO; + +typedef struct _DXGKARG_SETVIRTUALGPUVMBUS +{ + _In_ ULONG VirtualGpuIndex; + _In_ HANDLE VmBusHandle; +} DXGKARG_SETVIRTUALGPUVMBUS, *PDXGKARG_SETVIRTUALGPUVMBUS; + +typedef +_Function_class_(DXGKDDI_SETVIRTUALGPUVMBUS) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_SETVIRTUALGPUVMBUS( + _In_ HANDLE Context, + _Inout_ DXGKARG_SETVIRTUALGPUVMBUS* pArgs + ); + +typedef DXGKDDI_SETVIRTUALGPUVMBUS *PDXGKDDI_SETVIRTUALGPUVMBUS; + +typedef struct _DXGK_GPU_PHYSICAL_ADDRESS +{ + ULONG MemorySegmentId; + UINT64 MemorySegmentOffset; +} DXGK_GPU_PHYSICAL_ADDRESS, *PDXGK_GPU_PHYSICAL_ADDRESS; + +typedef struct _DXGK_VIRTUALGPUMEMORYRESOURCE +{ + _In_ HANDLE DriverAllocationHandle; + _In_ DXGK_GPU_PHYSICAL_ADDRESS AllocationAddress; + _In_ UINT64 AllocationSize; +} DXGK_VIRTUALGPUMEMORYRESOURCE, *PDXGK_VIRTUALGPUMEMORYRESOURCE; + +typedef struct _DXGKARG_SETVIRTUALGPURESOURCES +{ + _In_ ULONG PartitionId; + _In_ ULONG NumMemoryAllocations; + _In_reads_(NumMemoryAllocations) + DXGK_VIRTUALGPUMEMORYRESOURCE MemoryInfo[1]; +} DXGKARG_SETVIRTUALGPURESOURCES, *PDXGKARG_SETVIRTUALGPURESOURCES; + +typedef +_Function_class_(DXGKDDI_SETVIRTUALGPURESOURCES) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_SETVIRTUALGPURESOURCES( + _In_ HANDLE Context, + _In_ DXGKARG_SETVIRTUALGPURESOURCES* pArgs + ); + +typedef DXGKDDI_SETVIRTUALGPURESOURCES *PDXGKDDI_SETVIRTUALGPURESOURCES; + +typedef struct _DXGKARG_DESTROYVIRTUALGPU +{ + _In_ ULONG PartitionId; +} DXGKARG_DESTROYVIRTUALGPU, *PDXGKARG_DESTROYVIRTUALGPU; + +typedef +_Function_class_(DXGKDDI_DESTROYVIRTUALGPU) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DESTROYVIRTUALGPU( + _In_ HANDLE Context, + _In_ DXGKARG_DESTROYVIRTUALGPU* pArgs + ); + +typedef DXGKDDI_DESTROYVIRTUALGPU *PDXGKDDI_DESTROYVIRTUALGPU; + +typedef struct _DXGKARG_SUSPENDVIRTUALGPU +{ + _In_ ULONG PartitionId; +} DXGKARG_SUSPENDVIRTUALGPU, *PDXGKARG_SUSPENDVIRTUALGPU; + +typedef +_Function_class_(DXGKDDI_SUSPENDVIRTUALGPU) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_SUSPENDVIRTUALGPU( + _In_ HANDLE Context, + _In_ DXGKARG_SUSPENDVIRTUALGPU *pArgs + ); + +typedef DXGKDDI_SUSPENDVIRTUALGPU *PDXGKDDI_SUSPENDVIRTUALGPU; + +typedef struct _DXGKARG_RESUMEVIRTUALGPU +{ + _In_ ULONG PartitionId; +} DXGKARG_RESUMEVIRTUALGPU, *PDXGKARG_RESUMEVIRTUALGPU; + +typedef +_Function_class_(DXGKDDI_RESUMEVIRTUALGPU) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_RESUMEVIRTUALGPU( + _In_ HANDLE Context, + _In_ DXGKARG_RESUMEVIRTUALGPU*pArgs + ); + +typedef DXGKDDI_RESUMEVIRTUALGPU *PDXGKDDI_RESUMEVIRTUALGPU; + +typedef struct _DXGK_VIRTUALGPUDRIVERESCAPE +{ + _In_ ULONG PartitionId; + _In_ ULONG InputBufferSize; + _In_ ULONG OutputBufferSize; + _In_reads_bytes_(InputBufferSize) PVOID pInputBuffer; + _Out_writes_bytes_(OutputBufferSize) PVOID pOutputBuffer; +} DXGK_VIRTUALGPUDRIVERESCAPE, *PDXGK_VIRTUALGPUDRIVERESCAPE; + +typedef +_Function_class_(DXGKDDI_VIRTUALGPUDRIVERESCAPE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_VIRTUALGPUDRIVERESCAPE( + _In_ HANDLE Context, + _Inout_ PDXGK_VIRTUALGPUDRIVERESCAPE pArgs + ); + +typedef DXGKDDI_VIRTUALGPUDRIVERESCAPE *PDXGKDDI_VIRTUALGPUDRIVERESCAPE; + +typedef struct _DXGKDDI_GPU_PARTITION_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + OUT PDXGKDDI_GETGPUPARTITIONINFO DxgkDdiGetGpuPartitionInfo; + OUT PDXGKDDI_SETGPUPARTITIONCOUNT DxgkDdiSetGpuPartitionCount; + OUT PDXGKDDI_GETGPUENGINES DxgkDdiGetGpuEngines; + OUT PDXGKDDI_GETVIRTUALGPUPROFILE DxgkDdiGetVirtualGpuProfile; + OUT PDXGKDDI_CREATEVIRTUALGPU DxgkDdiCreateVirtualGpu; + OUT PDXGKDDI_GETVIRTUALGPUINFO DxgkDdiGetVirtualGpuInfo; + OUT PDXGKDDI_SETVIRTUALGPURESOURCES DxgkDdiSetVirtualGpuResources; + OUT PDXGKDDI_DESTROYVIRTUALGPU DxgkDdiDestroyVirtualGpu; + OUT PDXGKDDI_SUSPENDVIRTUALGPU DxgkDdiSuspendVirtualGpu; + OUT PDXGKDDI_RESUMEVIRTUALGPU DxgkDdiResumeVirtualGpu; + OUT PDXGKDDI_VIRTUALGPUDRIVERESCAPE DxgkDdiVirtualGpuDriverEscape; + OUT PDXGKDDI_SETVIRTUALGPUVMBUS DxgkDdiSetVirtualGpuVmBus; +} DXGKDDI_GPU_PARTITION_INTERFACE, *PDXGKDDI_GPU_PARTITION_INTERFACE; + +#define DXGKDDI_GPU_PARTITION_INTERFACE_VERSION 1 + +//////////////// DXGKDDI_SRIOV_INTERFACE ///////////////////////////////////// + +// {D7172248-F296-4C50-A6F5-D25D8073063A} +DEFINE_GUID(GUID_DXGKDDI_SRIOV_INTERFACE, 0xd7172248, 0xf296, 0x4c50, 0xa6, 0xf5, 0xd2, 0x5d, 0x80, 0x73, 0x6, 0x3a); + + +typedef struct _DXGKARG_READVIRTUALFUNCTIONCONFIG +{ + _Out_writes_bytes_(Length) PVOID Data; + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG Offset; + _In_ ULONG Length; +} DXGKARG_READVIRTUALFUNCTIONCONFIG, *PDXGKARG_READVIRTUALFUNCTIONCONFIG; + +typedef +_Function_class_(DXGKDDI_READVIRTUALFUNCTIONCONFIG) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_READVIRTUALFUNCTIONCONFIG( + _In_ HANDLE Context, + _Inout_ DXGKARG_READVIRTUALFUNCTIONCONFIG * pArgs + ); + +typedef DXGKDDI_READVIRTUALFUNCTIONCONFIG *PDXGKDDI_READVIRTUALFUNCTIONCONFIG; + +typedef struct _DXGKARG_WRITEVIRTUALFUNCTIONCONFIG +{ + _In_reads_bytes_(Length) PVOID Data; + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG Offset; + _In_ ULONG Length; +} DXGKARG_WRITEVIRTUALFUNCTIONCONFIG, *PDXGKARG_WRITEVIRTUALFUNCTIONCONFIG; + +typedef +_Function_class_(DXGKDDI_WRITEVIRTUALFUNCTIONCONFIG) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_WRITEVIRTUALFUNCTIONCONFIG( + _In_ HANDLE Context, + _Inout_ DXGKARG_WRITEVIRTUALFUNCTIONCONFIG * pArgs + ); + +typedef DXGKDDI_WRITEVIRTUALFUNCTIONCONFIG *PDXGKDDI_WRITEVIRTUALFUNCTIONCONFIG; + +typedef struct _DXGKARG_READVIRTUALFUNCTIONCONFIGBLOCK +{ + _Out_writes_bytes_(Length) PVOID Data; + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG BlockId; + _In_ ULONG Length; +} DXGKARG_READVIRTUALFUNCTIONCONFIGBLOCK, *PDXGKARG_READVIRTUALFUNCTIONCONFIGBLOCK; + +typedef +_Function_class_DXGK_(DXGKDDI_READVIRTUALFUNCTIONCONFIGBLOCK) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_READVIRTUALFUNCTIONCONFIGBLOCK( + _In_ HANDLE Context, + _Inout_ DXGKARG_READVIRTUALFUNCTIONCONFIGBLOCK * pArgs + ); + +typedef DXGKDDI_READVIRTUALFUNCTIONCONFIGBLOCK *PDXGKDDI_READVIRTUALFUNCTIONCONFIGBLOCK; + +typedef struct _DXGKARG_WRITEVIRTUALFUNCTIONCONFIGBLOCK +{ + _In_reads_bytes_(Length) PVOID Data; + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG BlockId; + _In_ ULONG Length; +} DXGKARG_WRITEVIRTUALFUNCTIONCONFIGBLOCK, *PDXGKARG_WRITEVIRTUALFUNCTIONCONFIGBLOCK; + +typedef +_Function_class_(DXGKDDI_WRITEVIRTUALFUNCTIONCONFIGBLOCK) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_WRITEVIRTUALFUNCTIONCONFIGBLOCK( + _In_ HANDLE Context, + _In_ DXGKARG_WRITEVIRTUALFUNCTIONCONFIGBLOCK * pArgs + ); + +typedef DXGKDDI_WRITEVIRTUALFUNCTIONCONFIGBLOCK *PDXGKDDI_WRITEVIRTUALFUNCTIONCONFIGBLOCK; + +#define DXGK_MAX_NUM_PCI_BARS 6 + +typedef struct _DXGKARG_QUERYPROBEDBARS +{ + _In_ ULONG VirtualFunctionIndex; + _Out_writes_(DXGK_MAX_NUM_PCI_BARS) PULONG BaseRegisterValues; +} DXGKARG_QUERYPROBEDBARS, *PDXGKARG_QUERYPROBEDBARS; + +typedef +_Function_class_(DXGKDDI_QUERYPROBEDBARS) +_IRQL_requires_(PASSIVE_LEVEL) +VOID +DXGKDDI_QUERYPROBEDBARS( + _In_ HANDLE Context, + _Inout_ DXGKARG_QUERYPROBEDBARS * pArgs + ); + +typedef DXGKDDI_QUERYPROBEDBARS *PDXGKDDI_QUERYPROBEDBARS; + +typedef struct _DXGKARG_QUERYVIRTUALFUNCTIONLUID +{ + _In_ ULONG VirtualFunctionIndex; + _Out_ PLUID pLuid; +} DXGKARG_QUERYVIRTUALFUNCTIONLUID, *PDXGKARG_QUERYVIRTUALFUNCTIONLUID; + +typedef +_Function_class_(DXGKDDI_QUERYVIRTUALFUNCTIONLUID) +_IRQL_requires_(PASSIVE_LEVEL) +VOID +DXGKDDI_QUERYVIRTUALFUNCTIONLUID( + _In_ HANDLE Context, + _Inout_ DXGKARG_QUERYVIRTUALFUNCTIONLUID* pArgs + ); + +typedef DXGKDDI_QUERYVIRTUALFUNCTIONLUID *PDXGKDDI_QUERYVIRTUALFUNCTIONLUID; + +typedef struct _DXGKARG_GETVENDORANDDEVICE +{ + _In_ ULONG VirtualFunctionIndex; + _Out_ USHORT VendorId; + _Out_ USHORT DeviceId; +} DXGKARG_GETVENDORANDDEVICE, *PDXGKARG_GETVENDORANDDEVICE; + +typedef +_Function_class_(DXGKDDI_GETVENDORANDDEVICE) +_IRQL_requires_(PASSIVE_LEVEL) +VOID +DXGKDDI_GETVENDORANDDEVICE( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETVENDORANDDEVICE* pArgs + ); + +typedef DXGKDDI_GETVENDORANDDEVICE *PDXGKDDI_GETVENDORANDDEVICE; + +typedef struct _DXGKARG_GETDEVICELOCATION +{ + _In_ ULONG VirtualFunctionIndex; + _Out_ ULONG SegmentNumber; + _Out_ ULONG BusNumber; + _Out_ ULONG FunctionNumber; +} DXGKARG_GETDEVICELOCATION, *PDXGKARG_GETDEVICELOCATION; + +typedef +_Function_class_(DXGKDDI_GETDEVICELOCATION) +_IRQL_requires_(PASSIVE_LEVEL) +VOID +DXGKDDI_GETDEVICELOCATION( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETDEVICELOCATION * pArgs + ); + +typedef DXGKDDI_GETDEVICELOCATION *PDXGKDDI_GETDEVICELOCATION; + +typedef struct _DXGKARG_RESETVIRTUALFUNCTION +{ + _In_ ULONG VirtualFunctionIndex; +} DXGKARG_RESETVIRTUALFUNCTION, *PDXGKARG_RESETVIRTUALFUNCTION; + +typedef +_Function_class_(DXGKDDI_RESETVIRTUALFUNCTION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_RESETVIRTUALFUNCTION( + _In_ HANDLE Context, + _Inout_ DXGKARG_RESETVIRTUALFUNCTION * pArgs + ); + +typedef DXGKDDI_RESETVIRTUALFUNCTION *PDXGKDDI_RESETVIRTUALFUNCTION; + +typedef struct _DXGKARG_SETVIRTUALFUNCTIONPOWERSTATE +{ + _In_ ULONG VirtualFunctionIndex; + _In_ DEVICE_POWER_STATE PowerState; + _In_ BOOLEAN Wake; +} DXGKARG_SETVIRTUALFUNCTIONPOWERSTATE, *PDXGKARG_SETVIRTUALFUNCTIONPOWERSTATE; + +typedef +_Function_class_(DXGKDDI_SETVIRTUALFUNCTIONPOWERSTATE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_SETVIRTUALFUNCTIONPOWERSTATE( + _In_ HANDLE Context, + _In_ DXGKARG_SETVIRTUALFUNCTIONPOWERSTATE * pArgs + ); + +typedef DXGKDDI_SETVIRTUALFUNCTIONPOWERSTATE *PDXGKDDI_SETVIRTUALFUNCTIONPOWERSTATE; + +typedef struct _DXGKARG_GETRESOURCEFORBAR +{ + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG BarIndex; + _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR pResource; +} DXGKARG_GETRESOURCEFORBAR, *PDXGKARG_GETRESOURCEFORBAR; + +typedef +_Function_class_(DXGKDDI_GETRESOURCEFORBAR) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETRESOURCEFORBAR( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETRESOURCEFORBAR * pArgs + ); + +typedef DXGKDDI_GETRESOURCEFORBAR *PDXGKDDI_GETRESOURCEFORBAR; + +typedef struct _DXGKDDI_SRIOV_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + + OUT PDXGKDDI_READVIRTUALFUNCTIONCONFIG DxgkDdiReadVirtualFunctionConfig; + OUT PDXGKDDI_WRITEVIRTUALFUNCTIONCONFIG DxgkDdiWriteVirtualFunctionConfig; + OUT PDXGKDDI_READVIRTUALFUNCTIONCONFIGBLOCK DxgkDdiReadVirtualFunctionConfigBlock; + OUT PDXGKDDI_WRITEVIRTUALFUNCTIONCONFIGBLOCK DxgkDdiWriteVirtualFunctionConfigBlock; + OUT PDXGKDDI_QUERYPROBEDBARS DxgkDdiQueryProbedBars; + OUT PDXGKDDI_GETVENDORANDDEVICE DxgkDdiGetVendorAndDevice; + OUT PDXGKDDI_GETDEVICELOCATION DxgkDdiGetDeviceLocation; + OUT PDXGKDDI_RESETVIRTUALFUNCTION DxgkDdiResetVirtualFunction; + OUT PDXGKDDI_SETVIRTUALFUNCTIONPOWERSTATE DxgkDdiSetVirtualFunctionPowerState; + OUT PDXGKDDI_GETRESOURCEFORBAR DxgkDdiGetResourceForBar; + OUT PDXGKDDI_QUERYVIRTUALFUNCTIONLUID DxgkDdiQueryVirtualFunctionLuid; +} DXGKDDI_SRIOV_INTERFACE, *PDXGKDDI_SRIOV_INTERFACE; + +#define DXGKDDI_SRIOV_INTERFACE_VERSION 1 + +//////////////// DXGKDDI_MITIGABLE_DEVICE_INTERFACE /////////////////////////////////// + +// {1387F270-121A-4A4A-B25E-3B1589976C61} +DEFINE_GUID(GUID_DXGKDDI_MITIGABLE_DEVICE_INTERFACE, 0x1387f270, 0x121a, 0x4a4a, 0xb2, 0x5e, 0x3b, 0x15, 0x89, 0x97, 0x6c, 0x61); + +typedef struct _DXGKARG_QUERYMITIGATEDRANGECOUNT +{ + _In_ ULONG VirtualFunctionIndex; + _Out_ ULONG RangeCount[DXGK_MAX_NUM_PCI_BARS]; +} DXGKARG_QUERYMITIGATEDRANGECOUNT, *PDXGKARG_QUERYMITIGATEDRANGECOUNT; + +typedef +_Function_class_(DXGKDDI_QUERYMITIGATEDRANGECOUNT) +_IRQL_requires_(PASSIVE_LEVEL) +VOID +DXGKDDI_QUERYMITIGATEDRANGECOUNT( + _In_ HANDLE Context, + _Inout_ DXGKARG_QUERYMITIGATEDRANGECOUNT* pArgs + ); + +typedef DXGKDDI_QUERYMITIGATEDRANGECOUNT *PDXGKDDI_QUERYMITIGATEDRANGECOUNT; + +typedef struct _DXGK_MITIGATEDRANGEINFO +{ + _Out_ ULONG64 BasePageNumber; + _Out_ ULONG PageCount; + _Out_ BOOLEAN InterceptReads; + _Out_ BOOLEAN InterceptWrites; +} DXGK_MITIGATEDRANGEINFO, *PDXGK_MITIGATEDRANGEINFO; + +typedef struct _DXGKARG_QUERYMITIGATEDRANGES +{ + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG BarIndex; + _In_ ULONG NumRanges; + _Out_writes_(NumRanges) PDXGK_MITIGATEDRANGEINFO pMitigatedRange; +} DXGKARG_QUERYMITIGATEDRANGES, *PDXGKARG_QUERYMITIGATEDRANGES; + +typedef +_Function_class_(DXGKDDI_QUERYMITIGATEDRANGES) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_QUERYMITIGATEDRANGES( + _In_ HANDLE Context, + _Inout_ DXGKARG_QUERYMITIGATEDRANGES* pArgs + ); + +typedef DXGKDDI_QUERYMITIGATEDRANGES *PDXGKDDI_QUERYMITIGATEDRANGES; + +typedef struct _DXGKDDI_MITIGABLE_DEVICE_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + + OUT PDXGKDDI_QUERYMITIGATEDRANGECOUNT DxgkDdiQueryMitigatedRangeCount; + OUT PDXGKDDI_QUERYMITIGATEDRANGES DxgkDdiQueryMitigatedRanges; +} DXGKDDI_MITIGABLE_DEVICE_INTERFACE, *PDXGKDDI_MITIGABLE_DEVICE_INTERFACE; + +#define DXGKDDI_MITIGABLE_DEVICE_INTERFACE_VERSION 1 + +//////////////// DXGKDDI_FLEXIOV_DEVICE_INTERFACE /////////////////////////////////// + +// {7B73A997-48E8-4CAB-9FAB-E0774B44F599} +DEFINE_GUID(GUID_DXGKDDI_FLEXIOV_DEVICE_INTERFACE, 0x7b73a997, 0x48e8, 0x4cab, 0x9f, 0xab, 0xe0, 0x77, 0x4b, 0x44, 0xf5, 0x99); + +#define DXGKDDI_MAX_FLEXIOV_RESOURCES 32 + +typedef struct _DXGKARG_GETBACKINGRESOURCE +{ + _In_ ULONG VirtualFunctionIndex; + _In_range_(0, DXGKDDI_MAX_FLEXIOV_RESOURCES) USHORT ResourceIndex; + _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Resource; + _Out_ PMDL pMdl; +} DXGKARG_GETBACKINGRESOURCE, *PDXGKARG_GETBACKINGRESOURCE; + +typedef +_Function_class_(DXGKDDI_GETBACKINGRESOURCE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETBACKINGRESOURCE ( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETBACKINGRESOURCE * pArgs + ); + +typedef DXGKDDI_GETBACKINGRESOURCE *PDXGKDDI_GETBACKINGRESOURCE; + +typedef struct _DXGKARG_GETMMIORANGECOUNT +{ + _In_ ULONG VirtualFunctionIndex; + _Out_ ULONG RangeCount[PCI_TYPE0_ADDRESSES]; +} DXGKARG_GETMMIORANGECOUNT, *PDXGKARG_GETMMIORANGECOUNT; + +typedef +_Function_class_(DXGKDDI_GETMMIORANGECOUNT) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETMMIORANGECOUNT( + _In_ HANDLE Context, + _Inout_ DXGKARG_GETMMIORANGECOUNT * pArgs + ); + +typedef DXGKDDI_GETMMIORANGECOUNT *PDXGKDDI_GETMMIORANGECOUNT; + +// +// if a range is fully mitigated (InterceptReads and InterceptWrites are TRUE), use this define +// for BasePhysicalPageNumber and set BasePhysicalResourceNumber to 0. +// +#define DXGK_MMIO_RANGES_EMULATED_PAGE 0xFFFFFFFFFFFFFFFF + +typedef struct _DXGK_MMIORANGEINFO +{ + _Out_ ULONG64 BasePageNumber; + _Out_ ULONG64 BasePhysicalPageNumber; + _Out_ UCHAR BasePhysicalResourceNumber; + _Out_ BOOLEAN InterceptReads; + _Out_ BOOLEAN InterceptWrites; + _Out_ ULONG PageCount; +} DXGK_MMIORANGEINFO, *PDXGK_MMIORANGEINFO; + +typedef struct _DXGKARG_GETMMIORANGES +{ + _In_ ULONG VirtualFunctionIndex; + _In_ ULONG BarIndex; + _In_ ULONG NumRanges; + _Out_writes_(NumRanges) DXGK_MMIORANGEINFO* pMmioRanges; +} DXGKARG_GETMMIORANGES, *PDXGKARG_GETMMIORANGES; + +typedef +_Function_class_(DXGKDDI_GETMMIORANGES) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETMMIORANGES ( + _In_ HANDLE Context, + _Inout_ PDXGKARG_GETMMIORANGES pArgs + ); + +typedef DXGKDDI_GETMMIORANGES *PDXGKDDI_GETMMIORANGES; + +typedef struct _DXGKDDI_FLEXIOV_DEVICE_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + + OUT PDXGKDDI_GETBACKINGRESOURCE DxgkDdiGetBackingResource; + OUT PDXGKDDI_GETMMIORANGECOUNT DxgkDdiGetMmioRangeCount; + OUT PDXGKDDI_GETMMIORANGES DxgkDdiGetMmioRanges; +} DXGKDDI_FLEXIOV_DEVICE_INTERFACE, *PDXGKDDI_FLEXIOV_DEVICE_INTERFACE; + +#define DXGKDDI_FLEXIOV_DEVICE_INTERFACE_VERSION 1 + +#endif // (DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WDDM2_1) + +///////////////////////////////// END OF GPU VIRTUALIZATION INTERFACES //////////////////////// + +//////////////// DXGK_MIPI_DSI_INTERFACE /////////////////////////////////// + +// {14F9DB8B-85E1-4AA5-8DAF-FF4A7806D5E9} +DEFINE_GUID(GUID_DXGK_MIPI_DSI_INTERFACE, 0x14f9db8b, 0x85e1, 0x4aa5, 0x8d, 0xaf, 0xff, 0x4a, 0x78, 0x6, 0xd5, 0xe9); + +#define DXGK_MIPI_DSI_INTERFACE_VERSION_1 0x1 + +typedef struct _DXGK_DSI_CAPS +{ + BYTE DSITypeMajor; + BYTE DSITypeMinor; + + BYTE SpecVersionMajor; + BYTE SpecVersionMinor; + BYTE SpecVersionPatch; + + WORD TargetMaximumReturnPacketSize; + + BYTE ResultCodeFlags; + BYTE ResultCodeStatus; + BYTE Revision; + BYTE Level; + + BYTE DeviceClassHi; + BYTE DeviceClassLo; + BYTE ManufacturerHi; + BYTE ManufacturerLo; + + BYTE ProductHi; + BYTE ProductLo; + BYTE LengthHi; + BYTE LengthLo; +} DXGK_DSI_CAPS, *PDXGK_DSI_CAPS; + +typedef +_Function_class_(DXGKDDI_DSICAPS) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DSICAPS( + _In_ HANDLE Context, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, + _Out_ PDXGK_DSI_CAPS pArgs + ); + +typedef DXGKDDI_DSICAPS *PDXGKDDI_DSICAPS; + +typedef enum _DXGK_DSI_CONTROL_TRANSMISSION_MODE +{ + DXGK_DCT_DEFAULT = 0, + DXGK_DCT_FORCE_LOW_POWER, + DXGK_DCT_FORCE_HIGH_SPEED, +} DXGK_DSI_CONTROL_TRANSMISSION_MODE; + +#define DXGK_DSI_PACKET_EMBEDDED_PAYLOAD_SIZE 8 + +typedef struct _DXGK_DSI_PACKET +{ + union + { + BYTE DataId; + struct + { + BYTE DataType :6; + BYTE VirtualChannel :2; + }; + }; + + union + { + struct + { + BYTE Data0; + BYTE Data1; + }; + WORD LongWriteWordCount; + }; + + BYTE EccFiller; + + BYTE Payload[DXGK_DSI_PACKET_EMBEDDED_PAYLOAD_SIZE]; +} DXGK_DSI_PACKET, *PDXGK_DSI_PACKET; + +typedef struct _DXGK_DSI_TRANSMISSION +{ + UINT TotalBufferSize; // in + BYTE PacketCount; // in + BYTE FailedPacket; // out + + struct + { + WORD TransmissionMode : 2; // in + WORD ReportMipiErrors : 1; // in + WORD ClearMipiErrors : 1; // in + WORD SecondaryPort : 1; // in + WORD ManufacturingMode : 1; // in + WORD Reserved :10; + }; + + WORD ReadWordCount; // out + WORD FinalCommandExtraPayload; // in + + WORD MipiErrors; // out + WORD HostErrors; // out + + _Field_size_(PacketCount) + DXGK_DSI_PACKET Packets[1]; // inout +} DXGK_DSI_TRANSMISSION, *PDXGK_DSI_TRANSMISSION; + +// +// Maximum PacketCount +// +#define DXGK_MAX_PACKET_COUNT 0x80 + +// +// If not known or there is no detected packet error, DXGK_DSI_INVALID_PACKET_INDEX +// is set to FailedPacket. +// +#define DXGK_DSI_INVALID_PACKET_INDEX 0xFF + +// +// MipiErrors reported by communication with the peripheral +// +#define DXGK_DSI_SOT_ERROR 0x0001 +#define DXGK_DSI_SOT_SYNC_ERROR 0x0002 +#define DXGK_DSI_EOT_SYNC_ERROR 0x0004 +#define DXGK_DSI_ESCAPE_MODE_ENTRY_COMMAND_ERROR 0x0008 +#define DXGK_DSI_LOW_POWER_TRANSMIT_SYNC_ERROR 0x0010 +#define DXGK_DSI_PERIPHERAL_TIMEOUT_ERROR 0x0020 +#define DXGK_DSI_FALSE_CONTROL_ERROR 0x0040 +#define DXGK_DSI_CONTENTION_DETECTED 0x0080 +#define DXGK_DSI_CHECKSUM_ERROR_CORRECTED 0x0100 +#define DXGK_DSI_CHECKSUM_ERROR_NOT_CORRECTED 0x0200 +#define DXGK_DSI_LONG_PACKET_PAYLOAD_CHECKSUM_ERROR 0x0400 +#define DXGK_DSI_DSI_DATA_TYPE_NOT_RECOGNIZED 0x0800 +#define DXGK_DSI_DSI_VC_ID_INVALID 0x1000 +#define DXGK_DSI_INVALID_TRANSMISSION_LENGTH 0x2000 +// RESERVED 0x4000 +#define DXGK_DSI_DSI_PROTOCOL_VIOLATION 0x8000 + +// +// HostErrors reported by the graphics driver or OS +// +#define DXGK_HOST_DSI_DEVICE_NOT_READY 0x0001 +#define DXGK_HOST_DSI_INTERFACE_RESET 0x0002 +#define DXGK_HOST_DSI_DEVICE_RESET 0x0004 +#define DXGK_HOST_DSI_TRANSMISSION_CANCELLED 0x0010 +#define DXGK_HOST_DSI_TRANSMISSION_DROPPED 0x0020 +#define DXGK_HOST_DSI_TRANSMISSION_TIMEOUT 0x0040 +#define DXGK_HOST_DSI_INVALID_TRANSMISSION 0x0100 +#define DXGK_HOST_DSI_OS_REJECTED_PACKET 0x0200 +#define DXGK_HOST_DSI_DRIVER_REJECTED_PACKET 0x0400 +#define DXGK_HOST_DSI_BAD_TRANSMISSION_MODE 0x1000 + +typedef +_Function_class_(DXGKDDI_DSITRANSMISSION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DSITRANSMISSION( + _In_ HANDLE Context, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, + _Inout_ PDXGK_DSI_TRANSMISSION pArgs + ); + +typedef DXGKDDI_DSITRANSMISSION *PDXGKDDI_DSITRANSMISSION; + +typedef struct _DXGK_DSI_RESET +{ + UINT Flags; // in + union + { + struct + { + UINT MipiErrors :16; // out + UINT ResetFailed : 1; // out + UINT NeedModeSet : 1; // out + }; + UINT Results; // out + }; +} DXGK_DSI_RESET, *PDXGK_DSI_RESET; + +typedef +_Function_class_(DXGKDDI_DSIRESET) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DSIRESET( + _In_ HANDLE Context, + _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, + _Inout_ PDXGK_DSI_RESET pArgs + ); + +typedef DXGKDDI_DSIRESET *PDXGKDDI_DSIRESET; + +typedef struct _DXGK_MIPI_DSI_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + + // Queries DSI caps of a target + OUT PDXGKDDI_DSICAPS DxgkDdiDsiCaps; + + // Sends and receives DSI data + OUT PDXGKDDI_DSITRANSMISSION DxgkDdiDsiTransmission; + + // Resets a MIPI device using a DSI reset command + OUT PDXGKDDI_DSIRESET DxgkDdiDsiReset; +} DXGK_MIPI_DSI_INTERFACE, *PDXGK_MIPI_DSI_INTERFACE; + +///////////////////// END OF DXGK_MIPI_DSI_INTERFACE //////////////////////// + +//////////////// DXGK_DISPLAY_DIAGNOSTICS_INTERFACE////////////////////////// + +// {962639F3-E9DC-42AB-94EB-06516DECA126} +DEFINE_GUID(GUID_DXGK_DISPLAY_DIAGNOSTICS_INTERFACE,0x962639f3, 0xe9dc, 0x42ab, 0x94, 0xeb, 0x6, 0x51, 0x6d, 0xec, 0xa1, 0x26); + +#define DXGK_DISPLAY_DIAGNOSTICS_INTERFACE_VERSION_1 0x1 + +typedef enum _DXGK_DIAG_DISPLAY_CONNECTIVITY +{ + DXGK_DIAG_DISPLAY_CONNECTIVITY_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_NOT_CONNECTED = 1, + DXGK_DIAG_DISPLAY_CONNECTED = 2, +} DXGK_DIAG_DISPLAY_CONNECTIVITY; + +typedef enum _DXGK_DIAG_BASIC_DISPLAY_TOPOLOGY +{ + DXGK_DIAG_BASIC_DISPLAY_TOPOLOGY_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_CONNECTED_DIRECTLY = 1, + DXGK_DIAG_DISPLAY_CONNECTED_INDIRECTLY_CONVERTOR = 2, + DXGK_DIAG_DISPLAY_CONNECTED_INDIRECTLY_HUB = 3, + DXGK_DIAG_DISPLAY_CONNECTED_INDIRECTLY = 4, + DXGK_DIAG_DISPLAY_CONNECTED_UNKNOWN = 5, +} DXGK_DIAG_BASIC_DISPLAY_TOPOLOGY; + +typedef enum _DXGK_DIAG_DISPLAY_LINK_STATE +{ + DXGK_DIAG_DISPLAY_LINK_STATE_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_LINK_STATE_NOTAPPLICABLE = 1, + DXGK_DIAG_DISPLAY_LINK_STATE_STABLE = 2, + DXGK_DIAG_DISPLAY_LINK_STATE_FAILED = 3, + DXGK_DIAG_DISPLAY_LINK_STATE_CONTINUOUS_TRAINING = 4, + DXGK_DIAG_DISPLAY_LINK_STATE_CONTINUOUS_TRAINING_STABLE = 5, + DXGK_DIAG_DISPLAY_LINK_STATE_CONTINUOUS_TRAINING_FAILED = 6, +} DXGK_DIAG_DISPLAY_LINK_STATE; + +typedef enum _DXGK_DIAG_DISPLAY_MODE_SET +{ + DXGK_DIAG_DISPLAY_MODE_SET_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_MODE_SET_NO = 1, + DXGK_DIAG_DISPLAY_MODE_SET_YES = 2, +} DXGK_DIAG_DISPLAY_MODE_SET; + +typedef enum _DXGK_DIAG_DISPLAY_LID_STATE +{ + DXGK_DIAG_DISPLAY_LID_STATE_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_LID_STATE_NOTAPPLICABLE = 1, + DXGK_DIAG_DISPLAY_LID_STATE_OPEN = 2, + DXGK_DIAG_DISPLAY_LID_STATE_CLOSE = 3, + DXGK_DIAG_DISPLAY_LID_STATE_UNKNOWN = 4, +} DXGK_DIAG_DISPLAY_LID_STATE; + +typedef enum _DXGK_DIAG_GETDISPLAYSTATE_SUBSTATUS_FLAGS +{ + DXGK_DIAG_GETDISPLAYSTATE_SUCCESS = 0x0, + DXGK_DIAG_GETDISPLAYSTATE_CAUSED_GLITCH = 0x1, + DXGK_DIAG_GETDISPLAYSTATE_CHANGED_DISPLAY_STATE = 0x2, + DXGK_DIAG_GETDISPLAYSTATE_MONITOR_NOT_CONNECTED = 0x4, + DXGK_DIAG_GETDISPLAYSTATE_TIMEOUT = 0x8, + DXGK_DIAG_GETDISPLAYSTATE_ERROR_HARDWARE = 0x10, + DXGK_DIAG_GETDISPLAYSTATE_ERROR_DRIVER = 0x20, + DXGK_DIAG_GETDISPLAYSTATE_VIDPNTARGETID_NOT_FOUND = 0x40, +} DXGK_DIAG_GETDISPLAYSTATE_SUBSTATUS_FLAGS; + +typedef struct _DXGK_DISPLAYSTATE_NONINTRUSIVE +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; // In + DXGK_DIAG_DISPLAY_CONNECTIVITY DisplayConnectivity; // Out + DXGK_DIAG_DISPLAY_LID_STATE DisplayLidState; // Out + DXGK_DIAG_BASIC_DISPLAY_TOPOLOGY DisplayTopology; // Out + DXGK_DIAG_DISPLAY_LINK_STATE DisplayLinkState; // Out + DXGK_DIAG_DISPLAY_MODE_SET DisplayModeSet; // Out + UINT ReturnSubStatus; // Out: DXGK_DIAG_GETDISPLAYSTATE_SUBSTATUS_FLAGS +} DXGK_DISPLAYSTATE_NONINTRUSIVE; + +typedef struct _DXGKARG_GETDISPLAYSTATE_NONINTRUSIVE +{ + UINT NumOfTargets; // In + UINT SizeOfDisplayStateNonIntrusiveElement; // In + + _Field_size_(NumOfTargets) + DXGK_DISPLAYSTATE_NONINTRUSIVE** ppDisplayStateNonIntrusive; // In/Out: Pointer to an array of pointers to DXGK_DISPLAYSTATE_NONINTRUSIVE +} DXGKARG_GETDISPLAYSTATENONINTRUSIVE, *PDXGKARG_GETDISPLAYSTATENONINTRUSIVE; + +typedef +_Function_class_(DXGKDDI_GETDISPLAYSTATENONINTRUSIVE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_GETDISPLAYSTATENONINTRUSIVE)( + _In_ HANDLE Context, + _Inout_ PDXGKARG_GETDISPLAYSTATENONINTRUSIVE pArgs +); + +typedef enum _DXGK_DIAG_MONITOR_STATE +{ + DXGK_DIAG_MONITOR_STATE_UNINITIALIZED = 0, + DXGK_DIAG_MONITOR_READY = 1, + DXGK_DIAG_MONITOR_NOT_READY = 2, + DXGK_DIAG_MONITOR_READY_NOTAPPLICABLE = 3, +} DXGK_DIAG_MONITOR_STATE; + +typedef enum _DXGK_DIAG_DISPLAY_SCANOUT_STATE +{ + DXGK_DIAG_DISPLAY_SCANOUT_STATE_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_SCANOUT_DISABLED = 1, + DXGK_DIAG_DISPLAY_SCANOUT_ACTIVE = 2, + DXGK_DIAG_DISPLAY_SCANOUT_ACTIVE_BLACK = 3, +} DXGK_DIAG_DISPLAY_SCANOUT_STATE; + +#define MAX_NUM_OF_GAMMA_SAMPLES_FOR_DIAGNOSTICS 16 + +typedef struct _DXGK_DIAG_DISPLAY_SAMPLED_GAMMA +{ + float Red[MAX_NUM_OF_GAMMA_SAMPLES_FOR_DIAGNOSTICS]; // Out + float Green[MAX_NUM_OF_GAMMA_SAMPLES_FOR_DIAGNOSTICS]; // Out + float Blue[MAX_NUM_OF_GAMMA_SAMPLES_FOR_DIAGNOSTICS]; // Out + float ColorMatrix[3][3]; // Out +} DXGK_DIAG_DISPLAY_SAMPLED_GAMMA; + +typedef enum _DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC +{ + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC_BLACK = 1, + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC_NON_BLACK = 2, + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC_ERROR = 3, + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC_UNKNOWN = 4, +} DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC; + +typedef struct _DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_HISTOGRAM +{ + INT MinPixelValue; // Out + INT MaxPixelValue; // Out +} DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_HISTOGRAM; + +typedef struct _DXGK_DIAG_SCANOUT_BUFFER_CONTENT +{ + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_CRC ScanoutBufferCrc; // Out + DXGK_DIAG_DISPLAY_SCANOUT_BUFFER_HISTOGRAM ScanoutBufferHistogram; // Out +} DXGK_DIAG_SCANOUT_BUFFER_CONTENT; + +typedef enum _DXGK_DIAG_DISPLAY_HARDWARE_ERROR_STATE +{ + DXGK_DIAG_DISPLAY_HARDWARE_ERROR_STATE_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_HARDWARE_ERROR_NONE = 1, + DXGK_DIAG_DISPLAY_HARDWARE_ERROR_SCANOUT_UNDERFLOW = 2, + DXGK_DIAG_DISPLAY_HARDWARE_ERROR_TDRNORECOVERY = 3, + DXGK_DIAG_DISPLAY_HARDWARE_ERROR_UNSPECIFIED = 4, +} DXGK_DIAG_DISPLAY_HARDWARE_ERROR_STATE; + +typedef enum _DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH +{ + DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH_UNINITIALIZED = 0, + DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH_SUFFICIENT = 1, + DXGK_DIAG_DISPLAY_HARDWARE_LINK_BANDWIDTH_LIMITED = 2, + DXGK_DIAG_DISPLAY_HARDWARE_SOC_BANDWIDTH_LIMITED = 3, + DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH_ERROR = 4, + DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH_UNKNOWN = 5, +} DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH; + +typedef struct _DXGKARG_DISPLAYSTATE_INTRUSIVE +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId; // In + DXGK_DIAG_MONITOR_STATE MonitorState; // Out + DXGK_DIAG_DISPLAY_SCANOUT_STATE DisplayScanoutState; // Out + DXGK_DIAG_DISPLAY_SAMPLED_GAMMA DisplaySampledGamma; // Out + DXGK_DIAG_SCANOUT_BUFFER_CONTENT DisplayBufferContent; // Out + DXGK_DIAG_DISPLAY_HARDWARE_ERROR_STATE DisplayErrorState; // Out + DXGK_DIAG_DISPLAY_HARDWARE_BANDWIDTH DisplayBandwidth; // Out + UINT ReturnSubStatus; // Out: DXGK_DIAG_GETDISPLAYSTATE_SUBSTATUS_FLAGS +} DXGK_DISPLAYSTATE_INTRUSIVE; + +typedef struct _DXGKARG_GETDISPLAYSTATE_INTRUSIVE +{ + UINT NumOfTargets; // In + UINT SizeOfDisplayStateIntrusiveElement; // In + + _Field_size_(NumOfTargets) + DXGK_DISPLAYSTATE_INTRUSIVE** ppDisplayStateIntrusive; // In/Out Pointer to an array of pointers to DXGKARG_DISPLAYSTATE_INTRUSIVE +} DXGKARG_GETDISPLAYSTATEINTRUSIVE, *PDXGKARG_GETDISPLAYSTATEINTRUSIVE; + +typedef +_Function_class_(DXGKDDI_GETDISPLAYSTATEINTRUSIVE) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +(*DXGKDDI_GETDISPLAYSTATEINTRUSIVE)( + _In_ HANDLE Context, + _Inout_ PDXGKARG_GETDISPLAYSTATEINTRUSIVE pArgs +); + +typedef struct _DXGK_DISPLAY_DIAGNOSTICS_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + + OUT DXGKDDI_GETDISPLAYSTATENONINTRUSIVE DxgkDdiGetDisplayStateNonIntrusive; + OUT DXGKDDI_GETDISPLAYSTATEINTRUSIVE DxgkDdiGetDisplayStateIntrusive; +} DXGK_DISPLAY_DIAGNOSTICS_INTERFACE, *PDXGK_DISPLAY_DIAGNOSTICS_INTERFACE; + +//////////////// END OF DXGK_DISPLAY_DIAGNOSTICS_INTERFACE //////////////////////////////// + +//////////////// DXGK_DP_INTERFACE /////////////////////////////////// + +// {2d09818e-dfeb-4173-b5e9-aefd66b202f3} +DEFINE_GUID(GUID_DXGK_DP_INTERFACE,0x2d09818e, 0xdfeb, 0x4173, 0xb5, 0xe9, 0xae, 0xfd, 0x66, 0xb2, 0x02, 0xf3); + +#define DXGK_DP_INTERFACE_VERSION_1 0x1 + +typedef struct _DXGKARG_QUERYDPCAPS +{ + UINT NumRootPorts; + BYTE DPVersionMajor; + BYTE DPVersionMinor; +}DXGKARG_QUERYDPCAPS, *PDXGKARG_QUERYDPCAPS; + +typedef +_Function_class_(DXGKDDI_QUERYDPCAPS) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_QUERYDPCAPS( + _In_ HANDLE Context, + _Out_ PDXGKARG_QUERYDPCAPS pArgs + ); + +typedef DXGKDDI_QUERYDPCAPS *PDXGKDDI_QUERYDPCAPS; + +// Per DP spec, the max level of links is 15 +#define MAX_DP_ADDRESS_SIZE 15 + +typedef struct _DXGKARG_GETDPADDRESS +{ + D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId; // in + UINT DPNativeError; // out + UINT RootPortIndex; // out + BYTE NumLinks; // out + BYTE RelAddress[MAX_DP_ADDRESS_SIZE]; // out +} DXGKARG_GETDPADDRESS, *PDXGKARG_GETDPADDRESS; + +typedef +_Function_class_(DXGKDDI_GETDPADDRESS) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_GETDPADDRESS( + _In_ HANDLE Context, + _Inout_ PDXGKARG_GETDPADDRESS pArgs + ); + +typedef DXGKDDI_GETDPADDRESS *PDXGKDDI_GETDPADDRESS; + +#define MAX_DP_NATIVE_AUX_IO_SIZE 16 + +typedef struct _DXGKARG_DPAUXIOTRANSMISSION +{ + struct // in + { + UINT Write : 1; + UINT CanUseCachedData: 1; + UINT Reserved : 30; + }; + + UINT RootPortIndex; // in + UINT DPCDAddress; // in + BYTE NumBytesRequested; // in + UINT DPNativeError; // out + BYTE NumBytesDone; // out + BYTE Data[MAX_DP_NATIVE_AUX_IO_SIZE]; // inout +}DXGKARG_DPAUXIOTRANSMISSION, *PDXGKARG_DPAUXIOTRANSMISSION; + +typedef +_Function_class_(DXGKDDI_DPAUXIOTRANSMISSION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DPAUXIOTRANSMISSION( + _In_ HANDLE Context, + _Inout_ PDXGKARG_DPAUXIOTRANSMISSION pArgs + ); + +typedef DXGKDDI_DPAUXIOTRANSMISSION *PDXGKDDI_DPAUXIOTRANSMISSION; + +typedef enum _DXGK_I2C_ADDRESS_TYPE +{ + DXGK_I2C_ADDRESS_EDDC_SEGMENT_POINT = 0x60, + DXGK_I2C_ADDRESS_MCCS = 0x6E, + DXGK_I2C_ADDRESS_DDC = 0xA0, + DXGK_I2C_ADDRESS_MAX = 0x7F +} DXGK_I2C_ADDRESS_TYPE; + +typedef struct _DXGKARG_DPI2CIOTRANSMISSION +{ + struct // in + { + UINT Read : 1; + UINT Write : 1; + UINT EDDCMode : 1; + UINT OffsetSizeInBytes: 3; + UINT CanUseCachedData : 1; + UINT Reserved : 25; + }; + + UINT RootPortIndex; // in + UINT I2CAddress; // in + + union // in + { + struct + { + UINT WordOffset : 8; + UINT SegmentPointer : 7; + UINT Reserved1 : 17; + }; + UINT Offset; + }; + + UINT BufferSizeSupplied; // in + UINT BytesToWrite; // in + UINT BytesToRead; // in + UINT DPNativeError; // out + UINT BytesWritten; // out + UINT BytesRead; // out + _Field_size_bytes_DXGK_(BufferSizeSupplied) + BYTE Data[1]; // inout +}DXGKARG_DPI2CIOTRANSMISSION, *PDXGKARG_DPI2CIOTRANSMISSION; + +typedef +_Function_class_(PDXGKDDI_DPI2CIOTRANSMISSION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DPI2CIOTRANSMISSION( + _In_ HANDLE Context, + _Inout_ PDXGKARG_DPI2CIOTRANSMISSION pArgs + ); + +typedef DXGKDDI_DPI2CIOTRANSMISSION *PDXGKDDI_DPI2CIOTRANSMISSION; + +typedef struct _DXGKARG_DPSBMTRANSMISSION +{ + struct // in + { + UINT CanUseCachedData: 1; + UINT Reserved : 31; + }; + + UINT RootPortIndex; // in + UINT BufferSizeSupplied; // in + UINT RequestLength; // in + UINT MaxReplyLength; // in + UINT DPNativeError; // out + UINT ActualReplyLength; // out + _Field_size_bytes_DXGK_(BufferSizeSupplied) + BYTE Data[1]; // inout +}DXGKARG_DPSBMTRANSMISSION, *PDXGKARG_DPSBMTRANSMISSION; + +typedef +_Function_class_(DXGKDDI_DPSBMTRANSMISSION) +_IRQL_requires_(PASSIVE_LEVEL) +NTSTATUS +DXGKDDI_DPSBMTRANSMISSION( + _In_ HANDLE Context, + _Inout_ PDXGKARG_DPSBMTRANSMISSION pArgs + ); + +typedef DXGKDDI_DPSBMTRANSMISSION *PDXGKDDI_DPSBMTRANSMISSION; + +typedef struct _DXGK_DP_INTERFACE +{ + IN USHORT Size; + IN USHORT Version; + OUT PVOID Context; + OUT PINTERFACE_REFERENCE InterfaceReference; + OUT PINTERFACE_DEREFERENCE InterfaceDereference; + OUT PDXGKDDI_QUERYDPCAPS DxgkDdiQueryDPCaps; + OUT PDXGKDDI_GETDPADDRESS DxgkDdiGetDPAddress; + OUT PDXGKDDI_DPAUXIOTRANSMISSION DxgkDdiDPAuxIoTransmission; + OUT PDXGKDDI_DPI2CIOTRANSMISSION DxgkDdiDPI2CIoTransmission; + OUT PDXGKDDI_DPSBMTRANSMISSION DxgkDdiDPSBMTransmission; +} DXGK_DP_INTERFACE, *PDXGK_DP_INTERFACE; + +#if defined (_MSC_VER) +#pragma warning(pop) +#endif + +#endif // _DISPMPRT_H_