1d5bc60f6SEric Anholt /* 2d5bc60f6SEric Anholt * Copyright © 2014-2015 Broadcom 3d5bc60f6SEric Anholt * 4d5bc60f6SEric Anholt * Permission is hereby granted, free of charge, to any person obtaining a 5d5bc60f6SEric Anholt * copy of this software and associated documentation files (the "Software"), 6d5bc60f6SEric Anholt * to deal in the Software without restriction, including without limitation 7d5bc60f6SEric Anholt * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8d5bc60f6SEric Anholt * and/or sell copies of the Software, and to permit persons to whom the 9d5bc60f6SEric Anholt * Software is furnished to do so, subject to the following conditions: 10d5bc60f6SEric Anholt * 11d5bc60f6SEric Anholt * The above copyright notice and this permission notice (including the next 12d5bc60f6SEric Anholt * paragraph) shall be included in all copies or substantial portions of the 13d5bc60f6SEric Anholt * Software. 14d5bc60f6SEric Anholt * 15d5bc60f6SEric Anholt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16d5bc60f6SEric Anholt * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17d5bc60f6SEric Anholt * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18d5bc60f6SEric Anholt * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19d5bc60f6SEric Anholt * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20d5bc60f6SEric Anholt * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21d5bc60f6SEric Anholt * IN THE SOFTWARE. 22d5bc60f6SEric Anholt */ 23d5bc60f6SEric Anholt 24d5bc60f6SEric Anholt #ifndef _UAPI_VC4_DRM_H_ 25d5bc60f6SEric Anholt #define _UAPI_VC4_DRM_H_ 26d5bc60f6SEric Anholt 27d5bc60f6SEric Anholt #include "drm.h" 28d5bc60f6SEric Anholt 296a982350SEmil Velikov #if defined(__cplusplus) 306a982350SEmil Velikov extern "C" { 316a982350SEmil Velikov #endif 326a982350SEmil Velikov 33d5b1a78aSEric Anholt #define DRM_VC4_SUBMIT_CL 0x00 34d5b1a78aSEric Anholt #define DRM_VC4_WAIT_SEQNO 0x01 35d5b1a78aSEric Anholt #define DRM_VC4_WAIT_BO 0x02 36d5bc60f6SEric Anholt #define DRM_VC4_CREATE_BO 0x03 37d5bc60f6SEric Anholt #define DRM_VC4_MMAP_BO 0x04 38463873d5SEric Anholt #define DRM_VC4_CREATE_SHADER_BO 0x05 3921461365SEric Anholt #define DRM_VC4_GET_HANG_STATE 0x06 40af713795SEric Anholt #define DRM_VC4_GET_PARAM 0x07 4183753117SEric Anholt #define DRM_VC4_SET_TILING 0x08 4283753117SEric Anholt #define DRM_VC4_GET_TILING 0x09 43f3099462SEric Anholt #define DRM_VC4_LABEL_BO 0x0a 44b9f19259SBoris Brezillon #define DRM_VC4_GEM_MADVISE 0x0b 4565101d8cSBoris Brezillon #define DRM_VC4_PERFMON_CREATE 0x0c 4665101d8cSBoris Brezillon #define DRM_VC4_PERFMON_DESTROY 0x0d 4765101d8cSBoris Brezillon #define DRM_VC4_PERFMON_GET_VALUES 0x0e 48d5bc60f6SEric Anholt 49d5b1a78aSEric Anholt #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) 50d5b1a78aSEric Anholt #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) 51d5b1a78aSEric Anholt #define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) 52d5bc60f6SEric Anholt #define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) 53d5bc60f6SEric Anholt #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) 54463873d5SEric Anholt #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) 5521461365SEric Anholt #define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) 56af713795SEric Anholt #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) 5783753117SEric Anholt #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) 5883753117SEric Anholt #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) 59f3099462SEric Anholt #define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) 60b9f19259SBoris Brezillon #define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise) 6165101d8cSBoris Brezillon #define DRM_IOCTL_VC4_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create) 6265101d8cSBoris Brezillon #define DRM_IOCTL_VC4_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy) 6365101d8cSBoris Brezillon #define DRM_IOCTL_VC4_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values) 64d5bc60f6SEric Anholt 65d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface { 66d5b1a78aSEric Anholt __u32 hindex; /* Handle index, or ~0 if not present. */ 67d5b1a78aSEric Anholt __u32 offset; /* Offset to start of buffer. */ 68d5b1a78aSEric Anholt /* 69d5b1a78aSEric Anholt * Bits for either render config (color_write) or load/store packet. 70d5b1a78aSEric Anholt * Bits should all be 0 for MSAA load/stores. 71d5b1a78aSEric Anholt */ 72d5b1a78aSEric Anholt __u16 bits; 73d5b1a78aSEric Anholt 74d5b1a78aSEric Anholt #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) 75d5b1a78aSEric Anholt __u16 flags; 76d5b1a78aSEric Anholt }; 77d5b1a78aSEric Anholt 78d5b1a78aSEric Anholt /** 79d5b1a78aSEric Anholt * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D 80d5b1a78aSEric Anholt * engine. 81d5b1a78aSEric Anholt * 82d5b1a78aSEric Anholt * Drivers typically use GPU BOs to store batchbuffers / command lists and 83d5b1a78aSEric Anholt * their associated state. However, because the VC4 lacks an MMU, we have to 84d5b1a78aSEric Anholt * do validation of memory accesses by the GPU commands. If we were to store 85d5b1a78aSEric Anholt * our commands in BOs, we'd need to do uncached readback from them to do the 86d5b1a78aSEric Anholt * validation process, which is too expensive. Instead, userspace accumulates 87d5b1a78aSEric Anholt * commands and associated state in plain memory, then the kernel copies the 88d5b1a78aSEric Anholt * data to its own address space, and then validates and stores it in a GPU 89d5b1a78aSEric Anholt * BO. 90d5b1a78aSEric Anholt */ 91d5b1a78aSEric Anholt struct drm_vc4_submit_cl { 92d5b1a78aSEric Anholt /* Pointer to the binner command list. 93d5b1a78aSEric Anholt * 94d5b1a78aSEric Anholt * This is the first set of commands executed, which runs the 95d5b1a78aSEric Anholt * coordinate shader to determine where primitives land on the screen, 96d5b1a78aSEric Anholt * then writes out the state updates and draw calls necessary per tile 97d5b1a78aSEric Anholt * to the tile allocation BO. 98d5b1a78aSEric Anholt */ 99d5b1a78aSEric Anholt __u64 bin_cl; 100d5b1a78aSEric Anholt 101d5b1a78aSEric Anholt /* Pointer to the shader records. 102d5b1a78aSEric Anholt * 103d5b1a78aSEric Anholt * Shader records are the structures read by the hardware that contain 104d5b1a78aSEric Anholt * pointers to uniforms, shaders, and vertex attributes. The 105d5b1a78aSEric Anholt * reference to the shader record has enough information to determine 106d5b1a78aSEric Anholt * how many pointers are necessary (fixed number for shaders/uniforms, 107d5b1a78aSEric Anholt * and an attribute count), so those BO indices into bo_handles are 108d5b1a78aSEric Anholt * just stored as __u32s before each shader record passed in. 109d5b1a78aSEric Anholt */ 110d5b1a78aSEric Anholt __u64 shader_rec; 111d5b1a78aSEric Anholt 112d5b1a78aSEric Anholt /* Pointer to uniform data and texture handles for the textures 113d5b1a78aSEric Anholt * referenced by the shader. 114d5b1a78aSEric Anholt * 115d5b1a78aSEric Anholt * For each shader state record, there is a set of uniform data in the 116d5b1a78aSEric Anholt * order referenced by the record (FS, VS, then CS). Each set of 117d5b1a78aSEric Anholt * uniform data has a __u32 index into bo_handles per texture 118d5b1a78aSEric Anholt * sample operation, in the order the QPU_W_TMUn_S writes appear in 119d5b1a78aSEric Anholt * the program. Following the texture BO handle indices is the actual 120d5b1a78aSEric Anholt * uniform data. 121d5b1a78aSEric Anholt * 122d5b1a78aSEric Anholt * The individual uniform state blocks don't have sizes passed in, 123d5b1a78aSEric Anholt * because the kernel has to determine the sizes anyway during shader 124d5b1a78aSEric Anholt * code validation. 125d5b1a78aSEric Anholt */ 126d5b1a78aSEric Anholt __u64 uniforms; 127d5b1a78aSEric Anholt __u64 bo_handles; 128d5b1a78aSEric Anholt 129d5b1a78aSEric Anholt /* Size in bytes of the binner command list. */ 130d5b1a78aSEric Anholt __u32 bin_cl_size; 131d5b1a78aSEric Anholt /* Size in bytes of the set of shader records. */ 132d5b1a78aSEric Anholt __u32 shader_rec_size; 133d5b1a78aSEric Anholt /* Number of shader records. 134d5b1a78aSEric Anholt * 135d5b1a78aSEric Anholt * This could just be computed from the contents of shader_records and 136d5b1a78aSEric Anholt * the address bits of references to them from the bin CL, but it 137d5b1a78aSEric Anholt * keeps the kernel from having to resize some allocations it makes. 138d5b1a78aSEric Anholt */ 139d5b1a78aSEric Anholt __u32 shader_rec_count; 140d5b1a78aSEric Anholt /* Size in bytes of the uniform state. */ 141d5b1a78aSEric Anholt __u32 uniforms_size; 142d5b1a78aSEric Anholt 143d5b1a78aSEric Anholt /* Number of BO handles passed in (size is that times 4). */ 144d5b1a78aSEric Anholt __u32 bo_handle_count; 145d5b1a78aSEric Anholt 146d5b1a78aSEric Anholt /* RCL setup: */ 147d5b1a78aSEric Anholt __u16 width; 148d5b1a78aSEric Anholt __u16 height; 149d5b1a78aSEric Anholt __u8 min_x_tile; 150d5b1a78aSEric Anholt __u8 min_y_tile; 151d5b1a78aSEric Anholt __u8 max_x_tile; 152d5b1a78aSEric Anholt __u8 max_y_tile; 153d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface color_read; 154d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface color_write; 155d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface zs_read; 156d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface zs_write; 157d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface msaa_color_write; 158d5b1a78aSEric Anholt struct drm_vc4_submit_rcl_surface msaa_zs_write; 159d5b1a78aSEric Anholt __u32 clear_color[2]; 160d5b1a78aSEric Anholt __u32 clear_z; 161d5b1a78aSEric Anholt __u8 clear_s; 162d5b1a78aSEric Anholt 163d5b1a78aSEric Anholt __u32 pad:24; 164d5b1a78aSEric Anholt 165d5b1a78aSEric Anholt #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) 1663be8edddSEric Anholt /* By default, the kernel gets to choose the order that the tiles are 1673be8edddSEric Anholt * rendered in. If this is set, then the tiles will be rendered in a 1683be8edddSEric Anholt * raster order, with the right-to-left vs left-to-right and 1693be8edddSEric Anholt * top-to-bottom vs bottom-to-top dictated by 1703be8edddSEric Anholt * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping 1713be8edddSEric Anholt * blits to be implemented using the 3D engine. 1723be8edddSEric Anholt */ 1733be8edddSEric Anholt #define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1) 1743be8edddSEric Anholt #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2) 1753be8edddSEric Anholt #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3) 176d5b1a78aSEric Anholt __u32 flags; 177d5b1a78aSEric Anholt 178d5b1a78aSEric Anholt /* Returned value of the seqno of this render job (for the 179d5b1a78aSEric Anholt * wait ioctl). 180d5b1a78aSEric Anholt */ 181d5b1a78aSEric Anholt __u64 seqno; 18265101d8cSBoris Brezillon 18365101d8cSBoris Brezillon /* ID of the perfmon to attach to this job. 0 means no perfmon. */ 18465101d8cSBoris Brezillon __u32 perfmonid; 18565101d8cSBoris Brezillon 186818f5c8fSStefan Schake /* Syncobj handle to wait on. If set, processing of this render job 187818f5c8fSStefan Schake * will not start until the syncobj is signaled. 0 means ignore. 18865101d8cSBoris Brezillon */ 189818f5c8fSStefan Schake __u32 in_sync; 190e84fcb95SStefan Schake 191e84fcb95SStefan Schake /* Syncobj handle to export fence to. If set, the fence in the syncobj 192e84fcb95SStefan Schake * will be replaced with a fence that signals upon completion of this 193e84fcb95SStefan Schake * render job. 0 means ignore. 194e84fcb95SStefan Schake */ 195e84fcb95SStefan Schake __u32 out_sync; 196*4c70ac76SEric Anholt 197*4c70ac76SEric Anholt __u32 pad2; 198d5b1a78aSEric Anholt }; 199d5b1a78aSEric Anholt 200d5b1a78aSEric Anholt /** 201d5b1a78aSEric Anholt * struct drm_vc4_wait_seqno - ioctl argument for waiting for 202d5b1a78aSEric Anholt * DRM_VC4_SUBMIT_CL completion using its returned seqno. 203d5b1a78aSEric Anholt * 204d5b1a78aSEric Anholt * timeout_ns is the timeout in nanoseconds, where "0" means "don't 205d5b1a78aSEric Anholt * block, just return the status." 206d5b1a78aSEric Anholt */ 207d5b1a78aSEric Anholt struct drm_vc4_wait_seqno { 208d5b1a78aSEric Anholt __u64 seqno; 209d5b1a78aSEric Anholt __u64 timeout_ns; 210d5b1a78aSEric Anholt }; 211d5b1a78aSEric Anholt 212d5b1a78aSEric Anholt /** 213d5b1a78aSEric Anholt * struct drm_vc4_wait_bo - ioctl argument for waiting for 214d5b1a78aSEric Anholt * completion of the last DRM_VC4_SUBMIT_CL on a BO. 215d5b1a78aSEric Anholt * 216d5b1a78aSEric Anholt * This is useful for cases where multiple processes might be 217d5b1a78aSEric Anholt * rendering to a BO and you want to wait for all rendering to be 218d5b1a78aSEric Anholt * completed. 219d5b1a78aSEric Anholt */ 220d5b1a78aSEric Anholt struct drm_vc4_wait_bo { 221d5b1a78aSEric Anholt __u32 handle; 222d5b1a78aSEric Anholt __u32 pad; 223d5b1a78aSEric Anholt __u64 timeout_ns; 224d5b1a78aSEric Anholt }; 225d5b1a78aSEric Anholt 226d5bc60f6SEric Anholt /** 227d5bc60f6SEric Anholt * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. 228d5bc60f6SEric Anholt * 229d5bc60f6SEric Anholt * There are currently no values for the flags argument, but it may be 230d5bc60f6SEric Anholt * used in a future extension. 231d5bc60f6SEric Anholt */ 232d5bc60f6SEric Anholt struct drm_vc4_create_bo { 233d5bc60f6SEric Anholt __u32 size; 234d5bc60f6SEric Anholt __u32 flags; 235d5bc60f6SEric Anholt /** Returned GEM handle for the BO. */ 236d5bc60f6SEric Anholt __u32 handle; 237d5bc60f6SEric Anholt __u32 pad; 238d5bc60f6SEric Anholt }; 239d5bc60f6SEric Anholt 240d5bc60f6SEric Anholt /** 241d5bc60f6SEric Anholt * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. 242d5bc60f6SEric Anholt * 243d5bc60f6SEric Anholt * This doesn't actually perform an mmap. Instead, it returns the 244d5bc60f6SEric Anholt * offset you need to use in an mmap on the DRM device node. This 245d5bc60f6SEric Anholt * means that tools like valgrind end up knowing about the mapped 246d5bc60f6SEric Anholt * memory. 247d5bc60f6SEric Anholt * 248d5bc60f6SEric Anholt * There are currently no values for the flags argument, but it may be 249d5bc60f6SEric Anholt * used in a future extension. 250d5bc60f6SEric Anholt */ 251d5bc60f6SEric Anholt struct drm_vc4_mmap_bo { 252d5bc60f6SEric Anholt /** Handle for the object being mapped. */ 253d5bc60f6SEric Anholt __u32 handle; 254d5bc60f6SEric Anholt __u32 flags; 255d5bc60f6SEric Anholt /** offset into the drm node to use for subsequent mmap call. */ 256d5bc60f6SEric Anholt __u64 offset; 257d5bc60f6SEric Anholt }; 258d5bc60f6SEric Anholt 259463873d5SEric Anholt /** 260463873d5SEric Anholt * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 261463873d5SEric Anholt * shader BOs. 262463873d5SEric Anholt * 263463873d5SEric Anholt * Since allowing a shader to be overwritten while it's also being 264463873d5SEric Anholt * executed from would allow privlege escalation, shaders must be 265463873d5SEric Anholt * created using this ioctl, and they can't be mmapped later. 266463873d5SEric Anholt */ 267463873d5SEric Anholt struct drm_vc4_create_shader_bo { 268463873d5SEric Anholt /* Size of the data argument. */ 269463873d5SEric Anholt __u32 size; 270463873d5SEric Anholt /* Flags, currently must be 0. */ 271463873d5SEric Anholt __u32 flags; 272463873d5SEric Anholt 273463873d5SEric Anholt /* Pointer to the data. */ 274463873d5SEric Anholt __u64 data; 275463873d5SEric Anholt 276463873d5SEric Anholt /** Returned GEM handle for the BO. */ 277463873d5SEric Anholt __u32 handle; 278463873d5SEric Anholt /* Pad, must be 0. */ 279463873d5SEric Anholt __u32 pad; 280463873d5SEric Anholt }; 281463873d5SEric Anholt 28221461365SEric Anholt struct drm_vc4_get_hang_state_bo { 28321461365SEric Anholt __u32 handle; 28421461365SEric Anholt __u32 paddr; 28521461365SEric Anholt __u32 size; 28621461365SEric Anholt __u32 pad; 28721461365SEric Anholt }; 28821461365SEric Anholt 28921461365SEric Anholt /** 29021461365SEric Anholt * struct drm_vc4_hang_state - ioctl argument for collecting state 29121461365SEric Anholt * from a GPU hang for analysis. 29221461365SEric Anholt */ 29321461365SEric Anholt struct drm_vc4_get_hang_state { 29421461365SEric Anholt /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ 29521461365SEric Anholt __u64 bo; 29621461365SEric Anholt /** 29721461365SEric Anholt * On input, the size of the bo array. Output is the number 29821461365SEric Anholt * of bos to be returned. 29921461365SEric Anholt */ 30021461365SEric Anholt __u32 bo_count; 30121461365SEric Anholt 30221461365SEric Anholt __u32 start_bin, start_render; 30321461365SEric Anholt 30421461365SEric Anholt __u32 ct0ca, ct0ea; 30521461365SEric Anholt __u32 ct1ca, ct1ea; 30621461365SEric Anholt __u32 ct0cs, ct1cs; 30721461365SEric Anholt __u32 ct0ra0, ct1ra0; 30821461365SEric Anholt 30921461365SEric Anholt __u32 bpca, bpcs; 31021461365SEric Anholt __u32 bpoa, bpos; 31121461365SEric Anholt 31221461365SEric Anholt __u32 vpmbase; 31321461365SEric Anholt 31421461365SEric Anholt __u32 dbge; 31521461365SEric Anholt __u32 fdbgo; 31621461365SEric Anholt __u32 fdbgb; 31721461365SEric Anholt __u32 fdbgr; 31821461365SEric Anholt __u32 fdbgs; 31921461365SEric Anholt __u32 errstat; 32021461365SEric Anholt 32121461365SEric Anholt /* Pad that we may save more registers into in the future. */ 32221461365SEric Anholt __u32 pad[16]; 32321461365SEric Anholt }; 32421461365SEric Anholt 325af713795SEric Anholt #define DRM_VC4_PARAM_V3D_IDENT0 0 326af713795SEric Anholt #define DRM_VC4_PARAM_V3D_IDENT1 1 327af713795SEric Anholt #define DRM_VC4_PARAM_V3D_IDENT2 2 3287363cee5SEric Anholt #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 3297154d76fSEric Anholt #define DRM_VC4_PARAM_SUPPORTS_ETC1 4 330c778cc5dSJonas Pfeil #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 3313be8edddSEric Anholt #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6 332b9f19259SBoris Brezillon #define DRM_VC4_PARAM_SUPPORTS_MADVISE 7 33365101d8cSBoris Brezillon #define DRM_VC4_PARAM_SUPPORTS_PERFMON 8 334af713795SEric Anholt 335af713795SEric Anholt struct drm_vc4_get_param { 336af713795SEric Anholt __u32 param; 337af713795SEric Anholt __u32 pad; 338af713795SEric Anholt __u64 value; 339af713795SEric Anholt }; 340af713795SEric Anholt 34183753117SEric Anholt struct drm_vc4_get_tiling { 34283753117SEric Anholt __u32 handle; 34383753117SEric Anholt __u32 flags; 34483753117SEric Anholt __u64 modifier; 34583753117SEric Anholt }; 34683753117SEric Anholt 34783753117SEric Anholt struct drm_vc4_set_tiling { 34883753117SEric Anholt __u32 handle; 34983753117SEric Anholt __u32 flags; 35083753117SEric Anholt __u64 modifier; 35183753117SEric Anholt }; 35283753117SEric Anholt 353f3099462SEric Anholt /** 354f3099462SEric Anholt * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. 355f3099462SEric Anholt */ 356f3099462SEric Anholt struct drm_vc4_label_bo { 357f3099462SEric Anholt __u32 handle; 358f3099462SEric Anholt __u32 len; 359f3099462SEric Anholt __u64 name; 360f3099462SEric Anholt }; 361f3099462SEric Anholt 362b9f19259SBoris Brezillon /* 363b9f19259SBoris Brezillon * States prefixed with '__' are internal states and cannot be passed to the 364b9f19259SBoris Brezillon * DRM_IOCTL_VC4_GEM_MADVISE ioctl. 365b9f19259SBoris Brezillon */ 366b9f19259SBoris Brezillon #define VC4_MADV_WILLNEED 0 367b9f19259SBoris Brezillon #define VC4_MADV_DONTNEED 1 368b9f19259SBoris Brezillon #define __VC4_MADV_PURGED 2 369b9f19259SBoris Brezillon #define __VC4_MADV_NOTSUPP 3 370b9f19259SBoris Brezillon 371b9f19259SBoris Brezillon struct drm_vc4_gem_madvise { 372b9f19259SBoris Brezillon __u32 handle; 373b9f19259SBoris Brezillon __u32 madv; 374b9f19259SBoris Brezillon __u32 retained; 375b9f19259SBoris Brezillon __u32 pad; 376b9f19259SBoris Brezillon }; 377b9f19259SBoris Brezillon 37865101d8cSBoris Brezillon enum { 37965101d8cSBoris Brezillon VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER, 38065101d8cSBoris Brezillon VC4_PERFCNT_FEP_VALID_PRIMS_RENDER, 38165101d8cSBoris Brezillon VC4_PERFCNT_FEP_CLIPPED_QUADS, 38265101d8cSBoris Brezillon VC4_PERFCNT_FEP_VALID_QUADS, 38365101d8cSBoris Brezillon VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL, 38465101d8cSBoris Brezillon VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL, 38565101d8cSBoris Brezillon VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL, 38665101d8cSBoris Brezillon VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE, 38765101d8cSBoris Brezillon VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE, 38865101d8cSBoris Brezillon VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF, 38965101d8cSBoris Brezillon VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT, 39065101d8cSBoris Brezillon VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING, 39165101d8cSBoris Brezillon VC4_PERFCNT_PSE_PRIMS_REVERSED, 39265101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES, 39365101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING, 39465101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING, 39565101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST, 39665101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS, 39765101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD, 39865101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS, 39965101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT, 40065101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS, 40165101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT, 40265101d8cSBoris Brezillon VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS, 40365101d8cSBoris Brezillon VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED, 40465101d8cSBoris Brezillon VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS, 40565101d8cSBoris Brezillon VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED, 40665101d8cSBoris Brezillon VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED, 40765101d8cSBoris Brezillon VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT, 40865101d8cSBoris Brezillon VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS, 40965101d8cSBoris Brezillon VC4_PERFCNT_NUM_EVENTS, 41065101d8cSBoris Brezillon }; 41165101d8cSBoris Brezillon 41265101d8cSBoris Brezillon #define DRM_VC4_MAX_PERF_COUNTERS 16 41365101d8cSBoris Brezillon 41465101d8cSBoris Brezillon struct drm_vc4_perfmon_create { 41565101d8cSBoris Brezillon __u32 id; 41665101d8cSBoris Brezillon __u32 ncounters; 41765101d8cSBoris Brezillon __u8 events[DRM_VC4_MAX_PERF_COUNTERS]; 41865101d8cSBoris Brezillon }; 41965101d8cSBoris Brezillon 42065101d8cSBoris Brezillon struct drm_vc4_perfmon_destroy { 42165101d8cSBoris Brezillon __u32 id; 42265101d8cSBoris Brezillon }; 42365101d8cSBoris Brezillon 42465101d8cSBoris Brezillon /* 42565101d8cSBoris Brezillon * Returns the values of the performance counters tracked by this 42665101d8cSBoris Brezillon * perfmon (as an array of ncounters u64 values). 42765101d8cSBoris Brezillon * 42865101d8cSBoris Brezillon * No implicit synchronization is performed, so the user has to 42965101d8cSBoris Brezillon * guarantee that any jobs using this perfmon have already been 43065101d8cSBoris Brezillon * completed (probably by blocking on the seqno returned by the 43165101d8cSBoris Brezillon * last exec that used the perfmon). 43265101d8cSBoris Brezillon */ 43365101d8cSBoris Brezillon struct drm_vc4_perfmon_get_values { 43465101d8cSBoris Brezillon __u32 id; 43565101d8cSBoris Brezillon __u64 values_ptr; 43665101d8cSBoris Brezillon }; 43765101d8cSBoris Brezillon 4386a982350SEmil Velikov #if defined(__cplusplus) 4396a982350SEmil Velikov } 4406a982350SEmil Velikov #endif 4416a982350SEmil Velikov 442d5bc60f6SEric Anholt #endif /* _UAPI_VC4_DRM_H_ */ 443