XenevaOS
Loading...
Searching...
No Matches
vc4_drm.h
Go to the documentation of this file.
1/*
2 * Copyright © 2014-2015 Broadcom
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24#ifndef _UAPI_VC4_DRM_H_
25#define _UAPI_VC4_DRM_H_
26
27#include "drm.h"
28
29#if defined(__cplusplus)
30extern "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
66 __u32 hindex; /* Handle index, or ~0 if not present. */
67 __u32 offset; /* Offset to start of buffer. */
68 /*
69 * Bits for either render config (color_write) or load/store packet.
70 * Bits should all be 0 for MSAA load/stores.
71 */
73
74#define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0)
76};
77
92 /* Pointer to the binner command list.
93 *
94 * This is the first set of commands executed, which runs the
95 * coordinate shader to determine where primitives land on the screen,
96 * then writes out the state updates and draw calls necessary per tile
97 * to the tile allocation BO.
98 */
100
101 /* Pointer to the shader records.
102 *
103 * Shader records are the structures read by the hardware that contain
104 * pointers to uniforms, shaders, and vertex attributes. The
105 * reference to the shader record has enough information to determine
106 * how many pointers are necessary (fixed number for shaders/uniforms,
107 * and an attribute count), so those BO indices into bo_handles are
108 * just stored as __u32s before each shader record passed in.
109 */
111
112 /* Pointer to uniform data and texture handles for the textures
113 * referenced by the shader.
114 *
115 * For each shader state record, there is a set of uniform data in the
116 * order referenced by the record (FS, VS, then CS). Each set of
117 * uniform data has a __u32 index into bo_handles per texture
118 * sample operation, in the order the QPU_W_TMUn_S writes appear in
119 * the program. Following the texture BO handle indices is the actual
120 * uniform data.
121 *
122 * The individual uniform state blocks don't have sizes passed in,
123 * because the kernel has to determine the sizes anyway during shader
124 * code validation.
125 */
128
129 /* Size in bytes of the binner command list. */
131 /* Size in bytes of the set of shader records. */
133 /* Number of shader records.
134 *
135 * This could just be computed from the contents of shader_records and
136 * the address bits of references to them from the bin CL, but it
137 * keeps the kernel from having to resize some allocations it makes.
138 */
140 /* Size in bytes of the uniform state. */
142
143 /* Number of BO handles passed in (size is that times 4). */
145
146 /* RCL setup: */
162
164
165#define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0)
166/* By default, the kernel gets to choose the order that the tiles are
167 * rendered in. If this is set, then the tiles will be rendered in a
168 * raster order, with the right-to-left vs left-to-right and
169 * top-to-bottom vs bottom-to-top dictated by
170 * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping
171 * blits to be implemented using the 3D engine.
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)
177
178 /* Returned value of the seqno of this render job (for the
179 * wait ioctl).
180 */
182
183 /* ID of the perfmon to attach to this job. 0 means no perfmon. */
185
186 /* Syncobj handle to wait on. If set, processing of this render job
187 * will not start until the syncobj is signaled. 0 means ignore.
188 */
190
191 /* Syncobj handle to export fence to. If set, the fence in the syncobj
192 * will be replaced with a fence that signals upon completion of this
193 * render job. 0 means ignore.
194 */
196
198};
199
211
225
239
258
268 /* Size of the data argument. */
270 /* Flags, currently must be 0. */
272
273 /* Pointer to the data. */
275
278 /* Pad, must be 0. */
280};
281
288
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
340
346
352
361
362/*
363 * States prefixed with '__' are internal states and cannot be passed to the
364 * DRM_IOCTL_VC4_GEM_MADVISE ioctl.
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
377
378enum {
410};
411
412#define DRM_VC4_MAX_PERF_COUNTERS 16
413
419
423
424/*
425 * Returns the values of the performance counters tracked by this
426 * perfmon (as an array of ncounters u64 values).
427 *
428 * No implicit synchronization is performed, so the user has to
429 * guarantee that any jobs using this perfmon have already been
430 * completed (probably by blocking on the seqno returned by the
431 * last exec that used the perfmon).
432 */
437
438#if defined(__cplusplus)
439}
440#endif
441
442#endif /* _UAPI_VC4_DRM_H_ */
uint32_t __u32
Definition drm.h:42
uint8_t __u8
Definition drm.h:38
uint16_t __u16
Definition drm.h:40
uint64_t __u64
Definition drm.h:44
Definition vc4_drm.h:232
__u32 flags
Definition vc4_drm.h:234
__u32 size
Definition vc4_drm.h:233
__u32 handle
Definition vc4_drm.h:236
__u32 pad
Definition vc4_drm.h:237
Definition vc4_drm.h:267
__u32 flags
Definition vc4_drm.h:271
__u32 size
Definition vc4_drm.h:269
__u64 data
Definition vc4_drm.h:274
__u32 handle
Definition vc4_drm.h:277
__u32 pad
Definition vc4_drm.h:279
Definition vc4_drm.h:371
__u32 retained
Definition vc4_drm.h:374
__u32 madv
Definition vc4_drm.h:373
__u32 pad
Definition vc4_drm.h:375
__u32 handle
Definition vc4_drm.h:372
Definition vc4_drm.h:282
__u32 size
Definition vc4_drm.h:285
__u32 pad
Definition vc4_drm.h:286
__u32 paddr
Definition vc4_drm.h:284
__u32 handle
Definition vc4_drm.h:283
Definition vc4_drm.h:293
__u32 ct1cs
Definition vc4_drm.h:306
__u32 bpoa
Definition vc4_drm.h:310
__u64 bo
Definition vc4_drm.h:295
__u32 bo_count
Definition vc4_drm.h:300
__u32 bpca
Definition vc4_drm.h:309
__u32 errstat
Definition vc4_drm.h:319
__u32 ct1ra0
Definition vc4_drm.h:307
__u32 ct0cs
Definition vc4_drm.h:306
__u32 ct1ca
Definition vc4_drm.h:305
__u32 vpmbase
Definition vc4_drm.h:312
__u32 bpcs
Definition vc4_drm.h:309
__u32 dbge
Definition vc4_drm.h:314
__u32 bpos
Definition vc4_drm.h:310
__u32 ct0ra0
Definition vc4_drm.h:307
__u32 start_render
Definition vc4_drm.h:302
__u32 fdbgo
Definition vc4_drm.h:315
__u32 fdbgs
Definition vc4_drm.h:318
__u32 start_bin
Definition vc4_drm.h:302
__u32 ct0ca
Definition vc4_drm.h:304
__u32 ct1ea
Definition vc4_drm.h:305
__u32 ct0ea
Definition vc4_drm.h:304
__u32 fdbgr
Definition vc4_drm.h:317
__u32 fdbgb
Definition vc4_drm.h:316
__u32 pad[16]
Definition vc4_drm.h:322
Definition vc4_drm.h:335
__u32 param
Definition vc4_drm.h:336
__u64 value
Definition vc4_drm.h:338
__u32 pad
Definition vc4_drm.h:337
Definition vc4_drm.h:341
__u64 modifier
Definition vc4_drm.h:344
__u32 handle
Definition vc4_drm.h:342
__u32 flags
Definition vc4_drm.h:343
Definition vc4_drm.h:356
__u32 len
Definition vc4_drm.h:358
__u32 handle
Definition vc4_drm.h:357
__u64 name
Definition vc4_drm.h:359
Definition vc4_drm.h:251
__u32 handle
Definition vc4_drm.h:253
__u32 flags
Definition vc4_drm.h:254
__u64 offset
Definition vc4_drm.h:256
Definition vc4_drm.h:414
__u8 events[DRM_VC4_MAX_PERF_COUNTERS]
Definition vc4_drm.h:417
__u32 id
Definition vc4_drm.h:415
__u32 ncounters
Definition vc4_drm.h:416
Definition vc4_drm.h:420
__u32 id
Definition vc4_drm.h:421
Definition vc4_drm.h:433
__u32 id
Definition vc4_drm.h:434
__u64 values_ptr
Definition vc4_drm.h:435
Definition vc4_drm.h:347
__u32 handle
Definition vc4_drm.h:348
__u64 modifier
Definition vc4_drm.h:350
__u32 flags
Definition vc4_drm.h:349
Definition vc4_drm.h:91
struct drm_vc4_submit_rcl_surface msaa_zs_write
Definition vc4_drm.h:158
__u32 bo_handle_count
Definition vc4_drm.h:144
__u8 max_x_tile
Definition vc4_drm.h:151
__u8 clear_s
Definition vc4_drm.h:161
__u32 shader_rec_count
Definition vc4_drm.h:139
__u64 shader_rec
Definition vc4_drm.h:110
__u32 pad2
Definition vc4_drm.h:197
__u32 shader_rec_size
Definition vc4_drm.h:132
__u32 bin_cl_size
Definition vc4_drm.h:130
__u64 bin_cl
Definition vc4_drm.h:99
__u8 min_x_tile
Definition vc4_drm.h:149
struct drm_vc4_submit_rcl_surface msaa_color_write
Definition vc4_drm.h:157
__u16 width
Definition vc4_drm.h:147
struct drm_vc4_submit_rcl_surface color_read
Definition vc4_drm.h:153
__u8 max_y_tile
Definition vc4_drm.h:152
__u64 seqno
Definition vc4_drm.h:181
__u32 flags
Definition vc4_drm.h:176
__u64 bo_handles
Definition vc4_drm.h:127
struct drm_vc4_submit_rcl_surface zs_write
Definition vc4_drm.h:156
__u32 pad
Definition vc4_drm.h:163
__u16 height
Definition vc4_drm.h:148
struct drm_vc4_submit_rcl_surface color_write
Definition vc4_drm.h:154
__u32 out_sync
Definition vc4_drm.h:195
__u32 in_sync
Definition vc4_drm.h:189
__u8 min_y_tile
Definition vc4_drm.h:150
__u64 uniforms
Definition vc4_drm.h:126
__u32 clear_z
Definition vc4_drm.h:160
__u32 perfmonid
Definition vc4_drm.h:184
__u32 clear_color[2]
Definition vc4_drm.h:159
struct drm_vc4_submit_rcl_surface zs_read
Definition vc4_drm.h:155
__u32 uniforms_size
Definition vc4_drm.h:141
Definition vc4_drm.h:65
__u32 offset
Definition vc4_drm.h:67
__u16 flags
Definition vc4_drm.h:75
__u16 bits
Definition vc4_drm.h:72
__u32 hindex
Definition vc4_drm.h:66
Definition vc4_drm.h:220
__u32 handle
Definition vc4_drm.h:221
__u32 pad
Definition vc4_drm.h:222
__u64 timeout_ns
Definition vc4_drm.h:223
Definition vc4_drm.h:207
__u64 seqno
Definition vc4_drm.h:208
__u64 timeout_ns
Definition vc4_drm.h:209
@ VC4_PERFCNT_NUM_EVENTS
Definition vc4_drm.h:409
@ VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL
Definition vc4_drm.h:385
@ VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS
Definition vc4_drm.h:408
@ VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS
Definition vc4_drm.h:400
@ VC4_PERFCNT_FEP_VALID_PRIMS_RENDER
Definition vc4_drm.h:380
@ VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT
Definition vc4_drm.h:389
@ VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE
Definition vc4_drm.h:386
@ VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF
Definition vc4_drm.h:388
@ VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING
Definition vc4_drm.h:393
@ VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED
Definition vc4_drm.h:406
@ VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED
Definition vc4_drm.h:403
@ VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED
Definition vc4_drm.h:405
@ VC4_PERFCNT_FEP_CLIPPED_QUADS
Definition vc4_drm.h:381
@ VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL
Definition vc4_drm.h:384
@ VC4_PERFCNT_FEP_VALID_QUADS
Definition vc4_drm.h:382
@ VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS
Definition vc4_drm.h:398
@ VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING
Definition vc4_drm.h:394
@ VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES
Definition vc4_drm.h:392
@ VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS
Definition vc4_drm.h:396
@ VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER
Definition vc4_drm.h:379
@ VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD
Definition vc4_drm.h:397
@ VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST
Definition vc4_drm.h:395
@ VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT
Definition vc4_drm.h:399
@ VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT
Definition vc4_drm.h:401
@ VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS
Definition vc4_drm.h:402
@ VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL
Definition vc4_drm.h:383
@ VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING
Definition vc4_drm.h:390
@ VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT
Definition vc4_drm.h:407
@ VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE
Definition vc4_drm.h:387
@ VC4_PERFCNT_PSE_PRIMS_REVERSED
Definition vc4_drm.h:391
@ VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS
Definition vc4_drm.h:404
#define DRM_VC4_MAX_PERF_COUNTERS
Definition vc4_drm.h:412