Skip to content

i915 perf stream format

Robert Bragg edited this page Jan 26, 2016 · 1 revision

The stream is made of records that all have the same header:

struct i915_perf_record_header {
	uint32_t type;
	uint16_t pad;
	uint16_t size;
};

Most records are of type DRM_I915_PERF_RECORD_SAMPLE and contain the metrics we're interested in capturing. Other record types are DRM_I915_PERF_RECORD_OA_REPORT_LOST - signalling that the hardware had to drop an OA report and DRM_I915_PERF_RECORD_OA_BUFFER_OVERFLOW - signalling that the circular OA buffer that the hardware writes OA reports into has filled.

header->size is the total size of the record, including the size of the struct i915_perf_record_header.

The contents of sample records, following the header, are configurable via the properties given to the DRM_IOCTL_I915_PERF_OPEN ioctl when opening a stream. The boolean DRM_I915_PERF_PROP_SAMPLE_xyz properties control what's included in a stream's sample records. The relative order of data within a sample is predefined and documented in the i915_drm.h header. DRM_I915_PERF_PROP_SAMPLE_OA_REPORT requests i915 perf to forward raw OA snapshots as part of the sample payload. Each optional sub record of data that can be added to a sample payload can be expected to be 8 byte aligned.

The hardware can write raw OA counter snapshots in a number of formats with different sizes. Currently we're mostly just using the largest, 256 byte, formats I915_OA_FORMAT_A45_B8_C8 on Haswell or I915_OA_FORMAT_A32u40_A4u32_B8_C8 on Broadwell+

I915_OA_FORMAT_A45_B8_C8

Byte Offset Counter
0 Report ID / Reason
4 Timestamp
8 Undefined
12 Aggregate Counter 0
16 Aggregate Counter 1
20 Aggregate Counter 2
24 Aggregate Counter 3
28 Aggregate Counter 4
32 Aggregate Counter 5
36 Aggregate Counter 6
40 Aggregate Counter 7
44 Aggregate Counter 8
48 Aggregate Counter 9
52 Aggregate Counter 10
56 Aggregate Counter 11
60 Aggregate Counter 12
64 Aggregate Counter 13
68 Aggregate Counter 14
72 Aggregate Counter 15
76 Aggregate Counter 16
80 Aggregate Counter 17
84 Aggregate Counter 18
88 Aggregate Counter 19
92 Aggregate Counter 20
96 Aggregate Counter 21
100 Aggregate Counter 22
104 Aggregate Counter 23
108 Aggregate Counter 24
112 Aggregate Counter 25
116 Aggregate Counter 26
120 Aggregate Counter 27
124 Aggregate Counter 28
128 Aggregate Counter 29
132 Aggregate Counter 30
136 Aggregate Counter 31
140 Aggregate Counter 32
144 Aggregate Counter 33
148 Aggregate Counter 34
152 Aggregate Counter 35
156 Aggregate Counter 36
160 Aggregate Counter 37
164 Aggregate Counter 38
168 Aggregate Counter 39
172 Aggregate Counter 40
176 Aggregate Counter 41
180 Aggregate Counter 42
184 Aggregate Counter 43
188 Aggregate Counter 44
192 Boolean Counter 0
196 Boolean Counter 1
200 Boolean Counter 2
204 Boolean Counter 3
208 Boolean Counter 4
212 Boolean Counter 5
216 Boolean Counter 6
220 Boolean Counter 7
224 Custom Counter 0
228 Custom Counter 1
232 Custom Counter 2
236 Custom Counter 3
240 Custom Counter 4
244 Custom Counter 5
248 Custom Counter 6
252 Custom Counter 7

I915_OA_FORMAT_A32u40_A4u32_B8_C8

Byte Offset Counter
0 Report ID / Reason
4 Timestamp
8 Context ID
12 GPU Clock Ticks
16 40 bit Aggregate Counter 0 least significant 32 bits
20 40 bit Aggregate Counter 1 least significant 32 bits
24 40 bit Aggregate Counter 2 least significant 32 bits
28 40 bit Aggregate Counter 3 least significant 32 bits
32 40 bit Aggregate Counter 4 least significant 32 bits
36 40 bit Aggregate Counter 5 least significant 32 bits
40 40 bit Aggregate Counter 6 least significant 32 bits
44 40 bit Aggregate Counter 7 least significant 32 bits
48 40 bit Aggregate Counter 8 least significant 32 bits
52 40 bit Aggregate Counter 9 least significant 32 bits
56 40 bit Aggregate Counter 10 least significant 32 bits
60 40 bit Aggregate Counter 11 least significant 32 bits
64 40 bit Aggregate Counter 12 least significant 32 bits
68 40 bit Aggregate Counter 13 least significant 32 bits
72 40 bit Aggregate Counter 14 least significant 32 bits
76 40 bit Aggregate Counter 15 least significant 32 bits
80 40 bit Aggregate Counter 16 least significant 32 bits
84 40 bit Aggregate Counter 17 least significant 32 bits
88 40 bit Aggregate Counter 18 least significant 32 bits
92 40 bit Aggregate Counter 19 least significant 32 bits
96 40 bit Aggregate Counter 20 least significant 32 bits
100 40 bit Aggregate Counter 21 least significant 32 bits
104 40 bit Aggregate Counter 22 least significant 32 bits
108 40 bit Aggregate Counter 23 least significant 32 bits
112 40 bit Aggregate Counter 24 least significant 32 bits
116 40 bit Aggregate Counter 25 least significant 32 bits
120 40 bit Aggregate Counter 26 least significant 32 bits
124 40 bit Aggregate Counter 27 least significant 32 bits
128 40 bit Aggregate Counter 28 least significant 32 bits
132 40 bit Aggregate Counter 29 least significant 32 bits
136 40 bit Aggregate Counter 30 least significant 32 bits
140 40 bit Aggregate Counter 31 least significant 32 bits
144 32 bit Aggregate Counter 32
148 32 bit Aggregate Counter 33
152 32 bit Aggregate Counter 34
156 32 bit Aggregate Counter 35
160 40 bit Aggregate Counter 0 most significant 8 bits
161 40 bit Aggregate Counter 1 most significant 8 bits
162 40 bit Aggregate Counter 2 most significant 8 bits
163 40 bit Aggregate Counter 3 most significant 8 bits
164 40 bit Aggregate Counter 4 most significant 8 bits
165 40 bit Aggregate Counter 5 most significant 8 bits
166 40 bit Aggregate Counter 6 most significant 8 bits
167 40 bit Flexible, Aggregate EU Counter 7 most significant 8 bits
168 40 bit Flexible, Aggregate EU Counter 8 most significant 8 bits
169 40 bit Flexible, Aggregate EU Counter 9 most significant 8 bits
170 40 bit Flexible, Aggregate EU Counter 10 most significant 8 bits
171 40 bit Flexible, Aggregate EU Counter 11 most significant 8 bits
172 40 bit Flexible, Aggregate EU Counter 12 most significant 8 bits
173 40 bit Flexible, Aggregate EU Counter 13 most significant 8 bits
174 40 bit Flexible, Aggregate EU Counter 14 most significant 8 bits
175 40 bit Flexible, Aggregate EU Counter 15 most significant 8 bits
176 40 bit Flexible, Aggregate EU Counter 16 most significant 8 bits
177 40 bit Flexible, Aggregate EU Counter 17 most significant 8 bits
178 40 bit Flexible, Aggregate EU Counter 18 most significant 8 bits
179 40 bit Flexible, Aggregate EU Counter 19 most significant 8 bits
180 40 bit Flexible, Aggregate EU Counter 20 most significant 8 bits
181 40 bit Aggregate Counter 21 most significant 8 bits
182 40 bit Aggregate Counter 22 most significant 8 bits
183 40 bit Aggregate Counter 23 most significant 8 bits
184 40 bit Aggregate Counter 24 most significant 8 bits
185 40 bit Aggregate Counter 25 most significant 8 bits
186 40 bit Aggregate Counter 26 most significant 8 bits
187 40 bit Aggregate Counter 27 most significant 8 bits
188 40 bit Aggregate Counter 28 most significant 8 bits
189 40 bit Aggregate Counter 29 most significant 8 bits
190 40 bit Aggregate Counter 30 most significant 8 bits
191 40 bit Aggregate Counter 31 most significant 8 bits
192 Boolean Counter 0
196 Boolean Counter 1
200 Boolean Counter 2
204 Boolean Counter 3
208 Boolean Counter 4
212 Boolean Counter 5
216 Boolean Counter 6
220 Boolean Counter 7
224 Custom Counter 0
228 Custom Counter 1
232 Custom Counter 2
236 Custom Counter 3
240 Custom Counter 4
244 Custom Counter 5
248 Custom Counter 6
252 Custom Counter 7

On Broadwell+ the 32 bit Reason field bits 24:19 represent what triggered the report. This reason is represented with mutually exclusive flags:

Flag Bit Reason
0 Timer triggered sample
1 Internal report trigger 1
2 Internal report trigger 2
3 Context switch
4 GO transition from 1 to 0
5 Clock ratio change between squashed Slice Clock frequency and squashed Unslice clock frequency
Clone this wiki locally