1b8e80941Smrg/* 2b8e80941Smrg * Copyright © 2014-2015 Broadcom 3b8e80941Smrg * 4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5b8e80941Smrg * copy of this software and associated documentation files (the "Software"), 6b8e80941Smrg * to deal in the Software without restriction, including without limitation 7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the 9b8e80941Smrg * Software is furnished to do so, subject to the following conditions: 10b8e80941Smrg * 11b8e80941Smrg * The above copyright notice and this permission notice (including the next 12b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the 13b8e80941Smrg * Software. 14b8e80941Smrg * 15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21b8e80941Smrg * IN THE SOFTWARE. 22b8e80941Smrg */ 23b8e80941Smrg 24b8e80941Smrg#ifndef _VC4_DRM_H_ 25b8e80941Smrg#define _VC4_DRM_H_ 26b8e80941Smrg 27b8e80941Smrg#include "drm.h" 28b8e80941Smrg 29b8e80941Smrg#if defined(__cplusplus) 30b8e80941Smrgextern "C" { 31b8e80941Smrg#endif 32b8e80941Smrg 33b8e80941Smrg#define DRM_VC4_SUBMIT_CL 0x00 34b8e80941Smrg#define DRM_VC4_WAIT_SEQNO 0x01 35b8e80941Smrg#define DRM_VC4_WAIT_BO 0x02 36b8e80941Smrg#define DRM_VC4_CREATE_BO 0x03 37b8e80941Smrg#define DRM_VC4_MMAP_BO 0x04 38b8e80941Smrg#define DRM_VC4_CREATE_SHADER_BO 0x05 39b8e80941Smrg#define DRM_VC4_GET_HANG_STATE 0x06 40b8e80941Smrg#define DRM_VC4_GET_PARAM 0x07 41b8e80941Smrg#define DRM_VC4_SET_TILING 0x08 42b8e80941Smrg#define DRM_VC4_GET_TILING 0x09 43b8e80941Smrg#define DRM_VC4_LABEL_BO 0x0a 44b8e80941Smrg#define DRM_VC4_GEM_MADVISE 0x0b 45b8e80941Smrg#define DRM_VC4_PERFMON_CREATE 0x0c 46b8e80941Smrg#define DRM_VC4_PERFMON_DESTROY 0x0d 47b8e80941Smrg#define DRM_VC4_PERFMON_GET_VALUES 0x0e 48b8e80941Smrg 49b8e80941Smrg#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) 50b8e80941Smrg#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) 51b8e80941Smrg#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) 52b8e80941Smrg#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) 53b8e80941Smrg#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) 54b8e80941Smrg#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) 55b8e80941Smrg#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) 56b8e80941Smrg#define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) 57b8e80941Smrg#define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) 58b8e80941Smrg#define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) 59b8e80941Smrg#define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) 60b8e80941Smrg#define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise) 61b8e80941Smrg#define DRM_IOCTL_VC4_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create) 62b8e80941Smrg#define DRM_IOCTL_VC4_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy) 63b8e80941Smrg#define DRM_IOCTL_VC4_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values) 64b8e80941Smrg 65b8e80941Smrgstruct drm_vc4_submit_rcl_surface { 66b8e80941Smrg __u32 hindex; /* Handle index, or ~0 if not present. */ 67b8e80941Smrg __u32 offset; /* Offset to start of buffer. */ 68b8e80941Smrg /* 69b8e80941Smrg * Bits for either render config (color_write) or load/store packet. 70b8e80941Smrg * Bits should all be 0 for MSAA load/stores. 71b8e80941Smrg */ 72b8e80941Smrg __u16 bits; 73b8e80941Smrg 74b8e80941Smrg#define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) 75b8e80941Smrg __u16 flags; 76b8e80941Smrg}; 77b8e80941Smrg 78b8e80941Smrg/** 79b8e80941Smrg * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D 80b8e80941Smrg * engine. 81b8e80941Smrg * 82b8e80941Smrg * Drivers typically use GPU BOs to store batchbuffers / command lists and 83b8e80941Smrg * their associated state. However, because the VC4 lacks an MMU, we have to 84b8e80941Smrg * do validation of memory accesses by the GPU commands. If we were to store 85b8e80941Smrg * our commands in BOs, we'd need to do uncached readback from them to do the 86b8e80941Smrg * validation process, which is too expensive. Instead, userspace accumulates 87b8e80941Smrg * commands and associated state in plain memory, then the kernel copies the 88b8e80941Smrg * data to its own address space, and then validates and stores it in a GPU 89b8e80941Smrg * BO. 90b8e80941Smrg */ 91b8e80941Smrgstruct drm_vc4_submit_cl { 92b8e80941Smrg /* Pointer to the binner command list. 93b8e80941Smrg * 94b8e80941Smrg * This is the first set of commands executed, which runs the 95b8e80941Smrg * coordinate shader to determine where primitives land on the screen, 96b8e80941Smrg * then writes out the state updates and draw calls necessary per tile 97b8e80941Smrg * to the tile allocation BO. 98b8e80941Smrg */ 99b8e80941Smrg __u64 bin_cl; 100b8e80941Smrg 101b8e80941Smrg /* Pointer to the shader records. 102b8e80941Smrg * 103b8e80941Smrg * Shader records are the structures read by the hardware that contain 104b8e80941Smrg * pointers to uniforms, shaders, and vertex attributes. The 105b8e80941Smrg * reference to the shader record has enough information to determine 106b8e80941Smrg * how many pointers are necessary (fixed number for shaders/uniforms, 107b8e80941Smrg * and an attribute count), so those BO indices into bo_handles are 108b8e80941Smrg * just stored as __u32s before each shader record passed in. 109b8e80941Smrg */ 110b8e80941Smrg __u64 shader_rec; 111b8e80941Smrg 112b8e80941Smrg /* Pointer to uniform data and texture handles for the textures 113b8e80941Smrg * referenced by the shader. 114b8e80941Smrg * 115b8e80941Smrg * For each shader state record, there is a set of uniform data in the 116b8e80941Smrg * order referenced by the record (FS, VS, then CS). Each set of 117b8e80941Smrg * uniform data has a __u32 index into bo_handles per texture 118b8e80941Smrg * sample operation, in the order the QPU_W_TMUn_S writes appear in 119b8e80941Smrg * the program. Following the texture BO handle indices is the actual 120b8e80941Smrg * uniform data. 121b8e80941Smrg * 122b8e80941Smrg * The individual uniform state blocks don't have sizes passed in, 123b8e80941Smrg * because the kernel has to determine the sizes anyway during shader 124b8e80941Smrg * code validation. 125b8e80941Smrg */ 126b8e80941Smrg __u64 uniforms; 127b8e80941Smrg __u64 bo_handles; 128b8e80941Smrg 129b8e80941Smrg /* Size in bytes of the binner command list. */ 130b8e80941Smrg __u32 bin_cl_size; 131b8e80941Smrg /* Size in bytes of the set of shader records. */ 132b8e80941Smrg __u32 shader_rec_size; 133b8e80941Smrg /* Number of shader records. 134b8e80941Smrg * 135b8e80941Smrg * This could just be computed from the contents of shader_records and 136b8e80941Smrg * the address bits of references to them from the bin CL, but it 137b8e80941Smrg * keeps the kernel from having to resize some allocations it makes. 138b8e80941Smrg */ 139b8e80941Smrg __u32 shader_rec_count; 140b8e80941Smrg /* Size in bytes of the uniform state. */ 141b8e80941Smrg __u32 uniforms_size; 142b8e80941Smrg 143b8e80941Smrg /* Number of BO handles passed in (size is that times 4). */ 144b8e80941Smrg __u32 bo_handle_count; 145b8e80941Smrg 146b8e80941Smrg /* RCL setup: */ 147b8e80941Smrg __u16 width; 148b8e80941Smrg __u16 height; 149b8e80941Smrg __u8 min_x_tile; 150b8e80941Smrg __u8 min_y_tile; 151b8e80941Smrg __u8 max_x_tile; 152b8e80941Smrg __u8 max_y_tile; 153b8e80941Smrg struct drm_vc4_submit_rcl_surface color_read; 154b8e80941Smrg struct drm_vc4_submit_rcl_surface color_write; 155b8e80941Smrg struct drm_vc4_submit_rcl_surface zs_read; 156b8e80941Smrg struct drm_vc4_submit_rcl_surface zs_write; 157b8e80941Smrg struct drm_vc4_submit_rcl_surface msaa_color_write; 158b8e80941Smrg struct drm_vc4_submit_rcl_surface msaa_zs_write; 159b8e80941Smrg __u32 clear_color[2]; 160b8e80941Smrg __u32 clear_z; 161b8e80941Smrg __u8 clear_s; 162b8e80941Smrg 163b8e80941Smrg __u32 pad:24; 164b8e80941Smrg 165b8e80941Smrg#define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) 166b8e80941Smrg/* By default, the kernel gets to choose the order that the tiles are 167b8e80941Smrg * rendered in. If this is set, then the tiles will be rendered in a 168b8e80941Smrg * raster order, with the right-to-left vs left-to-right and 169b8e80941Smrg * top-to-bottom vs bottom-to-top dictated by 170b8e80941Smrg * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping 171b8e80941Smrg * blits to be implemented using the 3D engine. 172b8e80941Smrg */ 173b8e80941Smrg#define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1) 174b8e80941Smrg#define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2) 175b8e80941Smrg#define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3) 176b8e80941Smrg __u32 flags; 177b8e80941Smrg 178b8e80941Smrg /* Returned value of the seqno of this render job (for the 179b8e80941Smrg * wait ioctl). 180b8e80941Smrg */ 181b8e80941Smrg __u64 seqno; 182b8e80941Smrg 183b8e80941Smrg /* ID of the perfmon to attach to this job. 0 means no perfmon. */ 184b8e80941Smrg __u32 perfmonid; 185b8e80941Smrg 186b8e80941Smrg /* Syncobj handle to wait on. If set, processing of this render job 187b8e80941Smrg * will not start until the syncobj is signaled. 0 means ignore. 188b8e80941Smrg */ 189b8e80941Smrg __u32 in_sync; 190b8e80941Smrg 191b8e80941Smrg /* Syncobj handle to export fence to. If set, the fence in the syncobj 192b8e80941Smrg * will be replaced with a fence that signals upon completion of this 193b8e80941Smrg * render job. 0 means ignore. 194b8e80941Smrg */ 195b8e80941Smrg __u32 out_sync; 196b8e80941Smrg 197b8e80941Smrg __u32 pad2; 198b8e80941Smrg}; 199b8e80941Smrg 200b8e80941Smrg/** 201b8e80941Smrg * struct drm_vc4_wait_seqno - ioctl argument for waiting for 202b8e80941Smrg * DRM_VC4_SUBMIT_CL completion using its returned seqno. 203b8e80941Smrg * 204b8e80941Smrg * timeout_ns is the timeout in nanoseconds, where "0" means "don't 205b8e80941Smrg * block, just return the status." 206b8e80941Smrg */ 207b8e80941Smrgstruct drm_vc4_wait_seqno { 208b8e80941Smrg __u64 seqno; 209b8e80941Smrg __u64 timeout_ns; 210b8e80941Smrg}; 211b8e80941Smrg 212b8e80941Smrg/** 213b8e80941Smrg * struct drm_vc4_wait_bo - ioctl argument for waiting for 214b8e80941Smrg * completion of the last DRM_VC4_SUBMIT_CL on a BO. 215b8e80941Smrg * 216b8e80941Smrg * This is useful for cases where multiple processes might be 217b8e80941Smrg * rendering to a BO and you want to wait for all rendering to be 218b8e80941Smrg * completed. 219b8e80941Smrg */ 220b8e80941Smrgstruct drm_vc4_wait_bo { 221b8e80941Smrg __u32 handle; 222b8e80941Smrg __u32 pad; 223b8e80941Smrg __u64 timeout_ns; 224b8e80941Smrg}; 225b8e80941Smrg 226b8e80941Smrg/** 227b8e80941Smrg * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. 228b8e80941Smrg * 229b8e80941Smrg * There are currently no values for the flags argument, but it may be 230b8e80941Smrg * used in a future extension. 231b8e80941Smrg */ 232b8e80941Smrgstruct drm_vc4_create_bo { 233b8e80941Smrg __u32 size; 234b8e80941Smrg __u32 flags; 235b8e80941Smrg /** Returned GEM handle for the BO. */ 236b8e80941Smrg __u32 handle; 237b8e80941Smrg __u32 pad; 238b8e80941Smrg}; 239b8e80941Smrg 240b8e80941Smrg/** 241b8e80941Smrg * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. 242b8e80941Smrg * 243b8e80941Smrg * This doesn't actually perform an mmap. Instead, it returns the 244b8e80941Smrg * offset you need to use in an mmap on the DRM device node. This 245b8e80941Smrg * means that tools like valgrind end up knowing about the mapped 246b8e80941Smrg * memory. 247b8e80941Smrg * 248b8e80941Smrg * There are currently no values for the flags argument, but it may be 249b8e80941Smrg * used in a future extension. 250b8e80941Smrg */ 251b8e80941Smrgstruct drm_vc4_mmap_bo { 252b8e80941Smrg /** Handle for the object being mapped. */ 253b8e80941Smrg __u32 handle; 254b8e80941Smrg __u32 flags; 255b8e80941Smrg /** offset into the drm node to use for subsequent mmap call. */ 256b8e80941Smrg __u64 offset; 257b8e80941Smrg}; 258b8e80941Smrg 259b8e80941Smrg/** 260b8e80941Smrg * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 261b8e80941Smrg * shader BOs. 262b8e80941Smrg * 263b8e80941Smrg * Since allowing a shader to be overwritten while it's also being 264b8e80941Smrg * executed from would allow privlege escalation, shaders must be 265b8e80941Smrg * created using this ioctl, and they can't be mmapped later. 266b8e80941Smrg */ 267b8e80941Smrgstruct drm_vc4_create_shader_bo { 268b8e80941Smrg /* Size of the data argument. */ 269b8e80941Smrg __u32 size; 270b8e80941Smrg /* Flags, currently must be 0. */ 271b8e80941Smrg __u32 flags; 272b8e80941Smrg 273b8e80941Smrg /* Pointer to the data. */ 274b8e80941Smrg __u64 data; 275b8e80941Smrg 276b8e80941Smrg /** Returned GEM handle for the BO. */ 277b8e80941Smrg __u32 handle; 278b8e80941Smrg /* Pad, must be 0. */ 279b8e80941Smrg __u32 pad; 280b8e80941Smrg}; 281b8e80941Smrg 282b8e80941Smrgstruct drm_vc4_get_hang_state_bo { 283b8e80941Smrg __u32 handle; 284b8e80941Smrg __u32 paddr; 285b8e80941Smrg __u32 size; 286b8e80941Smrg __u32 pad; 287b8e80941Smrg}; 288b8e80941Smrg 289b8e80941Smrg/** 290b8e80941Smrg * struct drm_vc4_hang_state - ioctl argument for collecting state 291b8e80941Smrg * from a GPU hang for analysis. 292b8e80941Smrg*/ 293b8e80941Smrgstruct drm_vc4_get_hang_state { 294b8e80941Smrg /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ 295b8e80941Smrg __u64 bo; 296b8e80941Smrg /** 297b8e80941Smrg * On input, the size of the bo array. Output is the number 298b8e80941Smrg * of bos to be returned. 299b8e80941Smrg */ 300b8e80941Smrg __u32 bo_count; 301b8e80941Smrg 302b8e80941Smrg __u32 start_bin, start_render; 303b8e80941Smrg 304b8e80941Smrg __u32 ct0ca, ct0ea; 305b8e80941Smrg __u32 ct1ca, ct1ea; 306b8e80941Smrg __u32 ct0cs, ct1cs; 307b8e80941Smrg __u32 ct0ra0, ct1ra0; 308b8e80941Smrg 309b8e80941Smrg __u32 bpca, bpcs; 310b8e80941Smrg __u32 bpoa, bpos; 311b8e80941Smrg 312b8e80941Smrg __u32 vpmbase; 313b8e80941Smrg 314b8e80941Smrg __u32 dbge; 315b8e80941Smrg __u32 fdbgo; 316b8e80941Smrg __u32 fdbgb; 317b8e80941Smrg __u32 fdbgr; 318b8e80941Smrg __u32 fdbgs; 319b8e80941Smrg __u32 errstat; 320b8e80941Smrg 321b8e80941Smrg /* Pad that we may save more registers into in the future. */ 322b8e80941Smrg __u32 pad[16]; 323b8e80941Smrg}; 324b8e80941Smrg 325b8e80941Smrg#define DRM_VC4_PARAM_V3D_IDENT0 0 326b8e80941Smrg#define DRM_VC4_PARAM_V3D_IDENT1 1 327b8e80941Smrg#define DRM_VC4_PARAM_V3D_IDENT2 2 328b8e80941Smrg#define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 329b8e80941Smrg#define DRM_VC4_PARAM_SUPPORTS_ETC1 4 330b8e80941Smrg#define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 331b8e80941Smrg#define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6 332b8e80941Smrg#define DRM_VC4_PARAM_SUPPORTS_MADVISE 7 333b8e80941Smrg#define DRM_VC4_PARAM_SUPPORTS_PERFMON 8 334b8e80941Smrg 335b8e80941Smrgstruct drm_vc4_get_param { 336b8e80941Smrg __u32 param; 337b8e80941Smrg __u32 pad; 338b8e80941Smrg __u64 value; 339b8e80941Smrg}; 340b8e80941Smrg 341b8e80941Smrgstruct drm_vc4_get_tiling { 342b8e80941Smrg __u32 handle; 343b8e80941Smrg __u32 flags; 344b8e80941Smrg __u64 modifier; 345b8e80941Smrg}; 346b8e80941Smrg 347b8e80941Smrgstruct drm_vc4_set_tiling { 348b8e80941Smrg __u32 handle; 349b8e80941Smrg __u32 flags; 350b8e80941Smrg __u64 modifier; 351b8e80941Smrg}; 352b8e80941Smrg 353b8e80941Smrg/** 354b8e80941Smrg * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. 355b8e80941Smrg */ 356b8e80941Smrgstruct drm_vc4_label_bo { 357b8e80941Smrg __u32 handle; 358b8e80941Smrg __u32 len; 359b8e80941Smrg __u64 name; 360b8e80941Smrg}; 361b8e80941Smrg 362b8e80941Smrg/* 363b8e80941Smrg * States prefixed with '__' are internal states and cannot be passed to the 364b8e80941Smrg * DRM_IOCTL_VC4_GEM_MADVISE ioctl. 365b8e80941Smrg */ 366b8e80941Smrg#define VC4_MADV_WILLNEED 0 367b8e80941Smrg#define VC4_MADV_DONTNEED 1 368b8e80941Smrg#define __VC4_MADV_PURGED 2 369b8e80941Smrg#define __VC4_MADV_NOTSUPP 3 370b8e80941Smrg 371b8e80941Smrgstruct drm_vc4_gem_madvise { 372b8e80941Smrg __u32 handle; 373b8e80941Smrg __u32 madv; 374b8e80941Smrg __u32 retained; 375b8e80941Smrg __u32 pad; 376b8e80941Smrg}; 377b8e80941Smrg 378b8e80941Smrgenum { 379b8e80941Smrg VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER, 380b8e80941Smrg VC4_PERFCNT_FEP_VALID_PRIMS_RENDER, 381b8e80941Smrg VC4_PERFCNT_FEP_CLIPPED_QUADS, 382b8e80941Smrg VC4_PERFCNT_FEP_VALID_QUADS, 383b8e80941Smrg VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL, 384b8e80941Smrg VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL, 385b8e80941Smrg VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL, 386b8e80941Smrg VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE, 387b8e80941Smrg VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE, 388b8e80941Smrg VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF, 389b8e80941Smrg VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT, 390b8e80941Smrg VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING, 391b8e80941Smrg VC4_PERFCNT_PSE_PRIMS_REVERSED, 392b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES, 393b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING, 394b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING, 395b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST, 396b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS, 397b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD, 398b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS, 399b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT, 400b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS, 401b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT, 402b8e80941Smrg VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS, 403b8e80941Smrg VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED, 404b8e80941Smrg VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS, 405b8e80941Smrg VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED, 406b8e80941Smrg VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED, 407b8e80941Smrg VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT, 408b8e80941Smrg VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS, 409b8e80941Smrg VC4_PERFCNT_NUM_EVENTS, 410b8e80941Smrg}; 411b8e80941Smrg 412b8e80941Smrg#define DRM_VC4_MAX_PERF_COUNTERS 16 413b8e80941Smrg 414b8e80941Smrgstruct drm_vc4_perfmon_create { 415b8e80941Smrg __u32 id; 416b8e80941Smrg __u32 ncounters; 417b8e80941Smrg __u8 events[DRM_VC4_MAX_PERF_COUNTERS]; 418b8e80941Smrg}; 419b8e80941Smrg 420b8e80941Smrgstruct drm_vc4_perfmon_destroy { 421b8e80941Smrg __u32 id; 422b8e80941Smrg}; 423b8e80941Smrg 424b8e80941Smrg/* 425b8e80941Smrg * Returns the values of the performance counters tracked by this 426b8e80941Smrg * perfmon (as an array of ncounters u64 values). 427b8e80941Smrg * 428b8e80941Smrg * No implicit synchronization is performed, so the user has to 429b8e80941Smrg * guarantee that any jobs using this perfmon have already been 430b8e80941Smrg * completed (probably by blocking on the seqno returned by the 431b8e80941Smrg * last exec that used the perfmon). 432b8e80941Smrg */ 433b8e80941Smrgstruct drm_vc4_perfmon_get_values { 434b8e80941Smrg __u32 id; 435b8e80941Smrg __u64 values_ptr; 436b8e80941Smrg}; 437b8e80941Smrg 438b8e80941Smrg#if defined(__cplusplus) 439b8e80941Smrg} 440b8e80941Smrg#endif 441b8e80941Smrg 442b8e80941Smrg#endif /* _VC4_DRM_H_ */ 443