summaryrefslogtreecommitdiffstats
path: root/gfx/thebes/d3dkmtQueryStatistics.h
blob: 58ce2cd155d8499dfb16ed99ae17e63fb85cb8df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* This file is based on a header file that was briefly seen in the
 * Windows 8 RC SDK. The work for this file itself was based on the one in
 * ProcessHacker at
 * http://processhacker.svn.sourceforge.net/viewvc/processhacker/2.x/trunk/plugins/ExtendedTools/d3dkmt.h?revision=4758&view=markup
 * For more details see Mozilla Bug 689870.
 * [Bug 917496 indicates that some of these structs may not match reality, and
 * therefore should not be trusted.  See the reference to bug 917496 in
 * gfxWindowsPlatform.cpp.]
 */

typedef struct _D3DKMTQS_COUNTER {
  ULONG Count;
  ULONGLONG Bytes;
} D3DKMTQS_COUNTER;

typedef struct _D3DKMTQS_ADAPTER_INFO {
  ULONG NbSegments;
  ULONG NodeCount;

  ULONG Filler[3];
  ULONGLONG Filler2[2];  // Assumed sizeof(LONGLONG) = sizeof(ULONGLONG)
  struct {
    ULONG Filler[14];
  } Filler_RDMAB;
  struct {
    ULONG Filler[9];
  } Filler_R;
  struct {
    ULONG Filler[4];
    D3DKMTQS_COUNTER Filler2;
  } Filler_P;
  struct {
    D3DKMTQS_COUNTER Filler[16];
    ULONG Filler2[2];
  } Filler_PF;
  struct {
    ULONGLONG Filler[8];
  } Filler_PT;
  struct {
    ULONG Filler[2];
  } Filler_SR;
  struct {
    ULONG Filler[7];
  } Filler_L;
  struct {
    D3DKMTQS_COUNTER Filler[7];
  } Filler_A;
  struct {
    D3DKMTQS_COUNTER Filler[4];
  } Filler_T;
  ULONG64 Reserved[8];
} D3DKMTQS_ADAPTER_INFO;

typedef struct _D3DKMTQS_SEGMENT_INFO {
  ULONGLONG Filler[3];
  struct {
    ULONGLONG Filler;
    ULONG Filler2[2];
  } Filler_M;

  ULONG Aperture;

  ULONGLONG Filler3[5];
  ULONG64 Filler4[8];
} D3DKMTQS_SEGMENT_INFO;

typedef struct _D3DKMTQS_SYSTEM_MEMORY {
  ULONGLONG BytesAllocated;
  ULONG Filler[2];
  ULONGLONG Filler2[7];
} D3DKMTQS_SYSTEM_MEMORY;

typedef struct _D3DKMTQS_PROCESS_INFO {
  ULONG Filler[2];
  struct {
    ULONGLONG BytesAllocated;

    ULONG Filler[2];
    ULONGLONG Filler2[7];
  } SystemMemory;
  ULONG64 Reserved[8];
} D3DKMTQS_PROCESS_INFO;

typedef struct _D3DKMTQS_PROCESS_SEGMENT_INFO {
  ULONGLONG BytesCommitted;
  ULONGLONG Filler[2];
  ULONG Filler2;
  struct {
    ULONG Filler;
    D3DKMTQS_COUNTER Filler2[6];
    ULONGLONG Filler3;
  } Filler3;
  struct {
    ULONGLONG Filler;
  } Filler4;
  ULONG64 Reserved[8];
} D3DKMTQS_PROCESS_SEGMENT_INFO;

typedef struct _D3DKMTQS_PROCESS_NODE_INFO {
  LARGE_INTEGER RunningTime;  // 100ns
  ULONG ContextSwitch;
  ULONG PreemptionStatistics[16];
  ULONG PacketStatistics[32];
  ULONG64 Reserved[8];
} D3DKMTQS_PROCESS_NODE_INFO;

typedef enum _D3DKMTQS_TYPE {
  D3DKMTQS_ADAPTER = 0,
  D3DKMTQS_PROCESS = 1,
  D3DKMTQS_SEGMENT = 3,
  D3DKMTQS_PROCESS_SEGMENT = 4,
  D3DKMTQS_PROCESS_NODE = 6,
} D3DKMTQS_TYPE;

typedef union _D3DKMTQS_RESULT {
  D3DKMTQS_ADAPTER_INFO AdapterInfo;
  D3DKMTQS_SEGMENT_INFO SegmentInfo;
  D3DKMTQS_PROCESS_INFO ProcessInfo;
  D3DKMTQS_PROCESS_SEGMENT_INFO ProcessSegmentInfo;
  D3DKMTQS_PROCESS_NODE_INFO ProcessNodeInformation;
} D3DKMTQS_RESULT;

typedef struct _D3DKMTQS_QUERY_SEGMENT {
  ULONG SegmentId;
} D3DKMTQS_QUERY_SEGMENT;

typedef struct _D3DKMTQS_QUERY_NODE {
  ULONG NodeId;
} D3DKMTQS_QUERY_NODE;

typedef struct _D3DKMTQS {
  D3DKMTQS_TYPE Type;
  LUID AdapterLuid;
  HANDLE hProcess;
  D3DKMTQS_RESULT QueryResult;

  union {
    D3DKMTQS_QUERY_SEGMENT QuerySegment;
    D3DKMTQS_QUERY_SEGMENT QueryProcessSegment;
    D3DKMTQS_QUERY_NODE QueryProcessNode;
  };
} D3DKMTQS;

extern "C" {
typedef __checkReturn NTSTATUS(APIENTRY* PFND3DKMTQS)(const D3DKMTQS*);
}