1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef _UAPI_VC4_DRM_H_
25 #define _UAPI_VC4_DRM_H_
26
27 #include "drm.h"
28
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32
33 #define DRM_VC4_SUBMIT_CL 0x00
34 #define DRM_VC4_WAIT_SEQNO 0x01
35 #define DRM_VC4_WAIT_BO 0x02
36 #define DRM_VC4_CREATE_BO 0x03
37 #define DRM_VC4_MMAP_BO 0x04
38 #define DRM_VC4_CREATE_SHADER_BO 0x05
39 #define DRM_VC4_GET_HANG_STATE 0x06
40 #define DRM_VC4_GET_PARAM 0x07
41 #define DRM_VC4_SET_TILING 0x08
42 #define DRM_VC4_GET_TILING 0x09
43 #define DRM_VC4_LABEL_BO 0x0a
44 #define DRM_VC4_GEM_MADVISE 0x0b
45 #define DRM_VC4_PERFMON_CREATE 0x0c
46 #define DRM_VC4_PERFMON_DESTROY 0x0d
47 #define DRM_VC4_PERFMON_GET_VALUES 0x0e
48
49 #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl)
50 #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno)
51 #define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo)
52 #define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo)
53 #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo)
54 #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo)
55 #define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state)
56 #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param)
57 #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling)
58 #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling)
59 #define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo)
60 #define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise)
61 #define DRM_IOCTL_VC4_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create)
62 #define DRM_IOCTL_VC4_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy)
63 #define DRM_IOCTL_VC4_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values)
64
65 struct drm_vc4_submit_rcl_surface {
66 __u32 hindex;
67 __u32 offset;
68
69
70
71
72 __u16 bits;
73
74 #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0)
75 __u16 flags;
76 };
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 struct drm_vc4_submit_cl {
92
93
94
95
96
97
98
99 __u64 bin_cl;
100
101
102
103
104
105
106
107
108
109
110 __u64 shader_rec;
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126 __u64 uniforms;
127 __u64 bo_handles;
128
129
130 __u32 bin_cl_size;
131
132 __u32 shader_rec_size;
133
134
135
136
137
138
139 __u32 shader_rec_count;
140
141 __u32 uniforms_size;
142
143
144 __u32 bo_handle_count;
145
146
147 __u16 width;
148 __u16 height;
149 __u8 min_x_tile;
150 __u8 min_y_tile;
151 __u8 max_x_tile;
152 __u8 max_y_tile;
153 struct drm_vc4_submit_rcl_surface color_read;
154 struct drm_vc4_submit_rcl_surface color_write;
155 struct drm_vc4_submit_rcl_surface zs_read;
156 struct drm_vc4_submit_rcl_surface zs_write;
157 struct drm_vc4_submit_rcl_surface msaa_color_write;
158 struct drm_vc4_submit_rcl_surface msaa_zs_write;
159 __u32 clear_color[2];
160 __u32 clear_z;
161 __u8 clear_s;
162
163 __u32 pad:24;
164
165 #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0)
166
167
168
169
170
171
172
173 #define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1)
174 #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2)
175 #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3)
176 __u32 flags;
177
178
179
180
181 __u64 seqno;
182
183
184 __u32 perfmonid;
185
186
187
188
189 __u32 in_sync;
190
191
192
193
194
195 __u32 out_sync;
196
197 __u32 pad2;
198 };
199
200
201
202
203
204
205
206
207 struct drm_vc4_wait_seqno {
208 __u64 seqno;
209 __u64 timeout_ns;
210 };
211
212
213
214
215
216
217
218
219
220 struct drm_vc4_wait_bo {
221 __u32 handle;
222 __u32 pad;
223 __u64 timeout_ns;
224 };
225
226
227
228
229
230
231
232 struct drm_vc4_create_bo {
233 __u32 size;
234 __u32 flags;
235
236 __u32 handle;
237 __u32 pad;
238 };
239
240
241
242
243
244
245
246
247
248
249
250
251 struct drm_vc4_mmap_bo {
252
253 __u32 handle;
254 __u32 flags;
255
256 __u64 offset;
257 };
258
259
260
261
262
263
264
265
266
267 struct drm_vc4_create_shader_bo {
268
269 __u32 size;
270
271 __u32 flags;
272
273
274 __u64 data;
275
276
277 __u32 handle;
278
279 __u32 pad;
280 };
281
282 struct drm_vc4_get_hang_state_bo {
283 __u32 handle;
284 __u32 paddr;
285 __u32 size;
286 __u32 pad;
287 };
288
289
290
291
292
293 struct drm_vc4_get_hang_state {
294
295 __u64 bo;
296
297
298
299
300 __u32 bo_count;
301
302 __u32 start_bin, start_render;
303
304 __u32 ct0ca, ct0ea;
305 __u32 ct1ca, ct1ea;
306 __u32 ct0cs, ct1cs;
307 __u32 ct0ra0, ct1ra0;
308
309 __u32 bpca, bpcs;
310 __u32 bpoa, bpos;
311
312 __u32 vpmbase;
313
314 __u32 dbge;
315 __u32 fdbgo;
316 __u32 fdbgb;
317 __u32 fdbgr;
318 __u32 fdbgs;
319 __u32 errstat;
320
321
322 __u32 pad[16];
323 };
324
325 #define DRM_VC4_PARAM_V3D_IDENT0 0
326 #define DRM_VC4_PARAM_V3D_IDENT1 1
327 #define DRM_VC4_PARAM_V3D_IDENT2 2
328 #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3
329 #define DRM_VC4_PARAM_SUPPORTS_ETC1 4
330 #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5
331 #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6
332 #define DRM_VC4_PARAM_SUPPORTS_MADVISE 7
333 #define DRM_VC4_PARAM_SUPPORTS_PERFMON 8
334
335 struct drm_vc4_get_param {
336 __u32 param;
337 __u32 pad;
338 __u64 value;
339 };
340
341 struct drm_vc4_get_tiling {
342 __u32 handle;
343 __u32 flags;
344 __u64 modifier;
345 };
346
347 struct drm_vc4_set_tiling {
348 __u32 handle;
349 __u32 flags;
350 __u64 modifier;
351 };
352
353
354
355
356 struct drm_vc4_label_bo {
357 __u32 handle;
358 __u32 len;
359 __u64 name;
360 };
361
362
363
364
365
366 #define VC4_MADV_WILLNEED 0
367 #define VC4_MADV_DONTNEED 1
368 #define __VC4_MADV_PURGED 2
369 #define __VC4_MADV_NOTSUPP 3
370
371 struct drm_vc4_gem_madvise {
372 __u32 handle;
373 __u32 madv;
374 __u32 retained;
375 __u32 pad;
376 };
377
378 enum {
379 VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER,
380 VC4_PERFCNT_FEP_VALID_PRIMS_RENDER,
381 VC4_PERFCNT_FEP_CLIPPED_QUADS,
382 VC4_PERFCNT_FEP_VALID_QUADS,
383 VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL,
384 VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL,
385 VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL,
386 VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE,
387 VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE,
388 VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF,
389 VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT,
390 VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING,
391 VC4_PERFCNT_PSE_PRIMS_REVERSED,
392 VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES,
393 VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING,
394 VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING,
395 VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST,
396 VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS,
397 VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD,
398 VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS,
399 VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT,
400 VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS,
401 VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT,
402 VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS,
403 VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED,
404 VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS,
405 VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED,
406 VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED,
407 VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT,
408 VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS,
409 VC4_PERFCNT_NUM_EVENTS,
410 };
411
412 #define DRM_VC4_MAX_PERF_COUNTERS 16
413
414 struct drm_vc4_perfmon_create {
415 __u32 id;
416 __u32 ncounters;
417 __u8 events[DRM_VC4_MAX_PERF_COUNTERS];
418 };
419
420 struct drm_vc4_perfmon_destroy {
421 __u32 id;
422 };
423
424
425
426
427
428
429
430
431
432
433 struct drm_vc4_perfmon_get_values {
434 __u32 id;
435 __u64 values_ptr;
436 };
437
438 #if defined(__cplusplus)
439 }
440 #endif
441
442 #endif