18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright © 2014-2015 Broadcom 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 138c2ecf20Sopenharmony_ci * Software. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 188c2ecf20Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 198c2ecf20Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 208c2ecf20Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 218c2ecf20Sopenharmony_ci * IN THE SOFTWARE. 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef _UAPI_VC4_DRM_H_ 258c2ecf20Sopenharmony_ci#define _UAPI_VC4_DRM_H_ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include "drm.h" 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#if defined(__cplusplus) 308c2ecf20Sopenharmony_ciextern "C" { 318c2ecf20Sopenharmony_ci#endif 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define DRM_VC4_SUBMIT_CL 0x00 348c2ecf20Sopenharmony_ci#define DRM_VC4_WAIT_SEQNO 0x01 358c2ecf20Sopenharmony_ci#define DRM_VC4_WAIT_BO 0x02 368c2ecf20Sopenharmony_ci#define DRM_VC4_CREATE_BO 0x03 378c2ecf20Sopenharmony_ci#define DRM_VC4_MMAP_BO 0x04 388c2ecf20Sopenharmony_ci#define DRM_VC4_CREATE_SHADER_BO 0x05 398c2ecf20Sopenharmony_ci#define DRM_VC4_GET_HANG_STATE 0x06 408c2ecf20Sopenharmony_ci#define DRM_VC4_GET_PARAM 0x07 418c2ecf20Sopenharmony_ci#define DRM_VC4_SET_TILING 0x08 428c2ecf20Sopenharmony_ci#define DRM_VC4_GET_TILING 0x09 438c2ecf20Sopenharmony_ci#define DRM_VC4_LABEL_BO 0x0a 448c2ecf20Sopenharmony_ci#define DRM_VC4_GEM_MADVISE 0x0b 458c2ecf20Sopenharmony_ci#define DRM_VC4_PERFMON_CREATE 0x0c 468c2ecf20Sopenharmony_ci#define DRM_VC4_PERFMON_DESTROY 0x0d 478c2ecf20Sopenharmony_ci#define DRM_VC4_PERFMON_GET_VALUES 0x0e 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) 508c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) 518c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) 528c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) 538c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) 548c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) 558c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) 568c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) 578c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) 588c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) 598c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) 608c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise) 618c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create) 628c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy) 638c2ecf20Sopenharmony_ci#define DRM_IOCTL_VC4_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values) 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistruct drm_vc4_submit_rcl_surface { 668c2ecf20Sopenharmony_ci __u32 hindex; /* Handle index, or ~0 if not present. */ 678c2ecf20Sopenharmony_ci __u32 offset; /* Offset to start of buffer. */ 688c2ecf20Sopenharmony_ci /* 698c2ecf20Sopenharmony_ci * Bits for either render config (color_write) or load/store packet. 708c2ecf20Sopenharmony_ci * Bits should all be 0 for MSAA load/stores. 718c2ecf20Sopenharmony_ci */ 728c2ecf20Sopenharmony_ci __u16 bits; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) 758c2ecf20Sopenharmony_ci __u16 flags; 768c2ecf20Sopenharmony_ci}; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci/** 798c2ecf20Sopenharmony_ci * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D 808c2ecf20Sopenharmony_ci * engine. 818c2ecf20Sopenharmony_ci * 828c2ecf20Sopenharmony_ci * Drivers typically use GPU BOs to store batchbuffers / command lists and 838c2ecf20Sopenharmony_ci * their associated state. However, because the VC4 lacks an MMU, we have to 848c2ecf20Sopenharmony_ci * do validation of memory accesses by the GPU commands. If we were to store 858c2ecf20Sopenharmony_ci * our commands in BOs, we'd need to do uncached readback from them to do the 868c2ecf20Sopenharmony_ci * validation process, which is too expensive. Instead, userspace accumulates 878c2ecf20Sopenharmony_ci * commands and associated state in plain memory, then the kernel copies the 888c2ecf20Sopenharmony_ci * data to its own address space, and then validates and stores it in a GPU 898c2ecf20Sopenharmony_ci * BO. 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_cistruct drm_vc4_submit_cl { 928c2ecf20Sopenharmony_ci /* Pointer to the binner command list. 938c2ecf20Sopenharmony_ci * 948c2ecf20Sopenharmony_ci * This is the first set of commands executed, which runs the 958c2ecf20Sopenharmony_ci * coordinate shader to determine where primitives land on the screen, 968c2ecf20Sopenharmony_ci * then writes out the state updates and draw calls necessary per tile 978c2ecf20Sopenharmony_ci * to the tile allocation BO. 988c2ecf20Sopenharmony_ci */ 998c2ecf20Sopenharmony_ci __u64 bin_cl; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci /* Pointer to the shader records. 1028c2ecf20Sopenharmony_ci * 1038c2ecf20Sopenharmony_ci * Shader records are the structures read by the hardware that contain 1048c2ecf20Sopenharmony_ci * pointers to uniforms, shaders, and vertex attributes. The 1058c2ecf20Sopenharmony_ci * reference to the shader record has enough information to determine 1068c2ecf20Sopenharmony_ci * how many pointers are necessary (fixed number for shaders/uniforms, 1078c2ecf20Sopenharmony_ci * and an attribute count), so those BO indices into bo_handles are 1088c2ecf20Sopenharmony_ci * just stored as __u32s before each shader record passed in. 1098c2ecf20Sopenharmony_ci */ 1108c2ecf20Sopenharmony_ci __u64 shader_rec; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci /* Pointer to uniform data and texture handles for the textures 1138c2ecf20Sopenharmony_ci * referenced by the shader. 1148c2ecf20Sopenharmony_ci * 1158c2ecf20Sopenharmony_ci * For each shader state record, there is a set of uniform data in the 1168c2ecf20Sopenharmony_ci * order referenced by the record (FS, VS, then CS). Each set of 1178c2ecf20Sopenharmony_ci * uniform data has a __u32 index into bo_handles per texture 1188c2ecf20Sopenharmony_ci * sample operation, in the order the QPU_W_TMUn_S writes appear in 1198c2ecf20Sopenharmony_ci * the program. Following the texture BO handle indices is the actual 1208c2ecf20Sopenharmony_ci * uniform data. 1218c2ecf20Sopenharmony_ci * 1228c2ecf20Sopenharmony_ci * The individual uniform state blocks don't have sizes passed in, 1238c2ecf20Sopenharmony_ci * because the kernel has to determine the sizes anyway during shader 1248c2ecf20Sopenharmony_ci * code validation. 1258c2ecf20Sopenharmony_ci */ 1268c2ecf20Sopenharmony_ci __u64 uniforms; 1278c2ecf20Sopenharmony_ci __u64 bo_handles; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci /* Size in bytes of the binner command list. */ 1308c2ecf20Sopenharmony_ci __u32 bin_cl_size; 1318c2ecf20Sopenharmony_ci /* Size in bytes of the set of shader records. */ 1328c2ecf20Sopenharmony_ci __u32 shader_rec_size; 1338c2ecf20Sopenharmony_ci /* Number of shader records. 1348c2ecf20Sopenharmony_ci * 1358c2ecf20Sopenharmony_ci * This could just be computed from the contents of shader_records and 1368c2ecf20Sopenharmony_ci * the address bits of references to them from the bin CL, but it 1378c2ecf20Sopenharmony_ci * keeps the kernel from having to resize some allocations it makes. 1388c2ecf20Sopenharmony_ci */ 1398c2ecf20Sopenharmony_ci __u32 shader_rec_count; 1408c2ecf20Sopenharmony_ci /* Size in bytes of the uniform state. */ 1418c2ecf20Sopenharmony_ci __u32 uniforms_size; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci /* Number of BO handles passed in (size is that times 4). */ 1448c2ecf20Sopenharmony_ci __u32 bo_handle_count; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* RCL setup: */ 1478c2ecf20Sopenharmony_ci __u16 width; 1488c2ecf20Sopenharmony_ci __u16 height; 1498c2ecf20Sopenharmony_ci __u8 min_x_tile; 1508c2ecf20Sopenharmony_ci __u8 min_y_tile; 1518c2ecf20Sopenharmony_ci __u8 max_x_tile; 1528c2ecf20Sopenharmony_ci __u8 max_y_tile; 1538c2ecf20Sopenharmony_ci struct drm_vc4_submit_rcl_surface color_read; 1548c2ecf20Sopenharmony_ci struct drm_vc4_submit_rcl_surface color_write; 1558c2ecf20Sopenharmony_ci struct drm_vc4_submit_rcl_surface zs_read; 1568c2ecf20Sopenharmony_ci struct drm_vc4_submit_rcl_surface zs_write; 1578c2ecf20Sopenharmony_ci struct drm_vc4_submit_rcl_surface msaa_color_write; 1588c2ecf20Sopenharmony_ci struct drm_vc4_submit_rcl_surface msaa_zs_write; 1598c2ecf20Sopenharmony_ci __u32 clear_color[2]; 1608c2ecf20Sopenharmony_ci __u32 clear_z; 1618c2ecf20Sopenharmony_ci __u8 clear_s; 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci __u32 pad:24; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci#define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) 1668c2ecf20Sopenharmony_ci/* By default, the kernel gets to choose the order that the tiles are 1678c2ecf20Sopenharmony_ci * rendered in. If this is set, then the tiles will be rendered in a 1688c2ecf20Sopenharmony_ci * raster order, with the right-to-left vs left-to-right and 1698c2ecf20Sopenharmony_ci * top-to-bottom vs bottom-to-top dictated by 1708c2ecf20Sopenharmony_ci * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping 1718c2ecf20Sopenharmony_ci * blits to be implemented using the 3D engine. 1728c2ecf20Sopenharmony_ci */ 1738c2ecf20Sopenharmony_ci#define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1) 1748c2ecf20Sopenharmony_ci#define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2) 1758c2ecf20Sopenharmony_ci#define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3) 1768c2ecf20Sopenharmony_ci __u32 flags; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci /* Returned value of the seqno of this render job (for the 1798c2ecf20Sopenharmony_ci * wait ioctl). 1808c2ecf20Sopenharmony_ci */ 1818c2ecf20Sopenharmony_ci __u64 seqno; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci /* ID of the perfmon to attach to this job. 0 means no perfmon. */ 1848c2ecf20Sopenharmony_ci __u32 perfmonid; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci /* Syncobj handle to wait on. If set, processing of this render job 1878c2ecf20Sopenharmony_ci * will not start until the syncobj is signaled. 0 means ignore. 1888c2ecf20Sopenharmony_ci */ 1898c2ecf20Sopenharmony_ci __u32 in_sync; 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci /* Syncobj handle to export fence to. If set, the fence in the syncobj 1928c2ecf20Sopenharmony_ci * will be replaced with a fence that signals upon completion of this 1938c2ecf20Sopenharmony_ci * render job. 0 means ignore. 1948c2ecf20Sopenharmony_ci */ 1958c2ecf20Sopenharmony_ci __u32 out_sync; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci __u32 pad2; 1988c2ecf20Sopenharmony_ci}; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci/** 2018c2ecf20Sopenharmony_ci * struct drm_vc4_wait_seqno - ioctl argument for waiting for 2028c2ecf20Sopenharmony_ci * DRM_VC4_SUBMIT_CL completion using its returned seqno. 2038c2ecf20Sopenharmony_ci * 2048c2ecf20Sopenharmony_ci * timeout_ns is the timeout in nanoseconds, where "0" means "don't 2058c2ecf20Sopenharmony_ci * block, just return the status." 2068c2ecf20Sopenharmony_ci */ 2078c2ecf20Sopenharmony_cistruct drm_vc4_wait_seqno { 2088c2ecf20Sopenharmony_ci __u64 seqno; 2098c2ecf20Sopenharmony_ci __u64 timeout_ns; 2108c2ecf20Sopenharmony_ci}; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci/** 2138c2ecf20Sopenharmony_ci * struct drm_vc4_wait_bo - ioctl argument for waiting for 2148c2ecf20Sopenharmony_ci * completion of the last DRM_VC4_SUBMIT_CL on a BO. 2158c2ecf20Sopenharmony_ci * 2168c2ecf20Sopenharmony_ci * This is useful for cases where multiple processes might be 2178c2ecf20Sopenharmony_ci * rendering to a BO and you want to wait for all rendering to be 2188c2ecf20Sopenharmony_ci * completed. 2198c2ecf20Sopenharmony_ci */ 2208c2ecf20Sopenharmony_cistruct drm_vc4_wait_bo { 2218c2ecf20Sopenharmony_ci __u32 handle; 2228c2ecf20Sopenharmony_ci __u32 pad; 2238c2ecf20Sopenharmony_ci __u64 timeout_ns; 2248c2ecf20Sopenharmony_ci}; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci/** 2278c2ecf20Sopenharmony_ci * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. 2288c2ecf20Sopenharmony_ci * 2298c2ecf20Sopenharmony_ci * There are currently no values for the flags argument, but it may be 2308c2ecf20Sopenharmony_ci * used in a future extension. 2318c2ecf20Sopenharmony_ci */ 2328c2ecf20Sopenharmony_cistruct drm_vc4_create_bo { 2338c2ecf20Sopenharmony_ci __u32 size; 2348c2ecf20Sopenharmony_ci __u32 flags; 2358c2ecf20Sopenharmony_ci /** Returned GEM handle for the BO. */ 2368c2ecf20Sopenharmony_ci __u32 handle; 2378c2ecf20Sopenharmony_ci __u32 pad; 2388c2ecf20Sopenharmony_ci}; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci/** 2418c2ecf20Sopenharmony_ci * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. 2428c2ecf20Sopenharmony_ci * 2438c2ecf20Sopenharmony_ci * This doesn't actually perform an mmap. Instead, it returns the 2448c2ecf20Sopenharmony_ci * offset you need to use in an mmap on the DRM device node. This 2458c2ecf20Sopenharmony_ci * means that tools like valgrind end up knowing about the mapped 2468c2ecf20Sopenharmony_ci * memory. 2478c2ecf20Sopenharmony_ci * 2488c2ecf20Sopenharmony_ci * There are currently no values for the flags argument, but it may be 2498c2ecf20Sopenharmony_ci * used in a future extension. 2508c2ecf20Sopenharmony_ci */ 2518c2ecf20Sopenharmony_cistruct drm_vc4_mmap_bo { 2528c2ecf20Sopenharmony_ci /** Handle for the object being mapped. */ 2538c2ecf20Sopenharmony_ci __u32 handle; 2548c2ecf20Sopenharmony_ci __u32 flags; 2558c2ecf20Sopenharmony_ci /** offset into the drm node to use for subsequent mmap call. */ 2568c2ecf20Sopenharmony_ci __u64 offset; 2578c2ecf20Sopenharmony_ci}; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci/** 2608c2ecf20Sopenharmony_ci * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 2618c2ecf20Sopenharmony_ci * shader BOs. 2628c2ecf20Sopenharmony_ci * 2638c2ecf20Sopenharmony_ci * Since allowing a shader to be overwritten while it's also being 2648c2ecf20Sopenharmony_ci * executed from would allow privlege escalation, shaders must be 2658c2ecf20Sopenharmony_ci * created using this ioctl, and they can't be mmapped later. 2668c2ecf20Sopenharmony_ci */ 2678c2ecf20Sopenharmony_cistruct drm_vc4_create_shader_bo { 2688c2ecf20Sopenharmony_ci /* Size of the data argument. */ 2698c2ecf20Sopenharmony_ci __u32 size; 2708c2ecf20Sopenharmony_ci /* Flags, currently must be 0. */ 2718c2ecf20Sopenharmony_ci __u32 flags; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci /* Pointer to the data. */ 2748c2ecf20Sopenharmony_ci __u64 data; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci /** Returned GEM handle for the BO. */ 2778c2ecf20Sopenharmony_ci __u32 handle; 2788c2ecf20Sopenharmony_ci /* Pad, must be 0. */ 2798c2ecf20Sopenharmony_ci __u32 pad; 2808c2ecf20Sopenharmony_ci}; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistruct drm_vc4_get_hang_state_bo { 2838c2ecf20Sopenharmony_ci __u32 handle; 2848c2ecf20Sopenharmony_ci __u32 paddr; 2858c2ecf20Sopenharmony_ci __u32 size; 2868c2ecf20Sopenharmony_ci __u32 pad; 2878c2ecf20Sopenharmony_ci}; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/** 2908c2ecf20Sopenharmony_ci * struct drm_vc4_hang_state - ioctl argument for collecting state 2918c2ecf20Sopenharmony_ci * from a GPU hang for analysis. 2928c2ecf20Sopenharmony_ci*/ 2938c2ecf20Sopenharmony_cistruct drm_vc4_get_hang_state { 2948c2ecf20Sopenharmony_ci /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ 2958c2ecf20Sopenharmony_ci __u64 bo; 2968c2ecf20Sopenharmony_ci /** 2978c2ecf20Sopenharmony_ci * On input, the size of the bo array. Output is the number 2988c2ecf20Sopenharmony_ci * of bos to be returned. 2998c2ecf20Sopenharmony_ci */ 3008c2ecf20Sopenharmony_ci __u32 bo_count; 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci __u32 start_bin, start_render; 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci __u32 ct0ca, ct0ea; 3058c2ecf20Sopenharmony_ci __u32 ct1ca, ct1ea; 3068c2ecf20Sopenharmony_ci __u32 ct0cs, ct1cs; 3078c2ecf20Sopenharmony_ci __u32 ct0ra0, ct1ra0; 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci __u32 bpca, bpcs; 3108c2ecf20Sopenharmony_ci __u32 bpoa, bpos; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci __u32 vpmbase; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci __u32 dbge; 3158c2ecf20Sopenharmony_ci __u32 fdbgo; 3168c2ecf20Sopenharmony_ci __u32 fdbgb; 3178c2ecf20Sopenharmony_ci __u32 fdbgr; 3188c2ecf20Sopenharmony_ci __u32 fdbgs; 3198c2ecf20Sopenharmony_ci __u32 errstat; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci /* Pad that we may save more registers into in the future. */ 3228c2ecf20Sopenharmony_ci __u32 pad[16]; 3238c2ecf20Sopenharmony_ci}; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_V3D_IDENT0 0 3268c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_V3D_IDENT1 1 3278c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_V3D_IDENT2 2 3288c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 3298c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_ETC1 4 3308c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 3318c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6 3328c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_MADVISE 7 3338c2ecf20Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_PERFMON 8 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_cistruct drm_vc4_get_param { 3368c2ecf20Sopenharmony_ci __u32 param; 3378c2ecf20Sopenharmony_ci __u32 pad; 3388c2ecf20Sopenharmony_ci __u64 value; 3398c2ecf20Sopenharmony_ci}; 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_cistruct drm_vc4_get_tiling { 3428c2ecf20Sopenharmony_ci __u32 handle; 3438c2ecf20Sopenharmony_ci __u32 flags; 3448c2ecf20Sopenharmony_ci __u64 modifier; 3458c2ecf20Sopenharmony_ci}; 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_cistruct drm_vc4_set_tiling { 3488c2ecf20Sopenharmony_ci __u32 handle; 3498c2ecf20Sopenharmony_ci __u32 flags; 3508c2ecf20Sopenharmony_ci __u64 modifier; 3518c2ecf20Sopenharmony_ci}; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci/** 3548c2ecf20Sopenharmony_ci * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. 3558c2ecf20Sopenharmony_ci */ 3568c2ecf20Sopenharmony_cistruct drm_vc4_label_bo { 3578c2ecf20Sopenharmony_ci __u32 handle; 3588c2ecf20Sopenharmony_ci __u32 len; 3598c2ecf20Sopenharmony_ci __u64 name; 3608c2ecf20Sopenharmony_ci}; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/* 3638c2ecf20Sopenharmony_ci * States prefixed with '__' are internal states and cannot be passed to the 3648c2ecf20Sopenharmony_ci * DRM_IOCTL_VC4_GEM_MADVISE ioctl. 3658c2ecf20Sopenharmony_ci */ 3668c2ecf20Sopenharmony_ci#define VC4_MADV_WILLNEED 0 3678c2ecf20Sopenharmony_ci#define VC4_MADV_DONTNEED 1 3688c2ecf20Sopenharmony_ci#define __VC4_MADV_PURGED 2 3698c2ecf20Sopenharmony_ci#define __VC4_MADV_NOTSUPP 3 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_cistruct drm_vc4_gem_madvise { 3728c2ecf20Sopenharmony_ci __u32 handle; 3738c2ecf20Sopenharmony_ci __u32 madv; 3748c2ecf20Sopenharmony_ci __u32 retained; 3758c2ecf20Sopenharmony_ci __u32 pad; 3768c2ecf20Sopenharmony_ci}; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_cienum { 3798c2ecf20Sopenharmony_ci VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER, 3808c2ecf20Sopenharmony_ci VC4_PERFCNT_FEP_VALID_PRIMS_RENDER, 3818c2ecf20Sopenharmony_ci VC4_PERFCNT_FEP_CLIPPED_QUADS, 3828c2ecf20Sopenharmony_ci VC4_PERFCNT_FEP_VALID_QUADS, 3838c2ecf20Sopenharmony_ci VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL, 3848c2ecf20Sopenharmony_ci VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL, 3858c2ecf20Sopenharmony_ci VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL, 3868c2ecf20Sopenharmony_ci VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE, 3878c2ecf20Sopenharmony_ci VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE, 3888c2ecf20Sopenharmony_ci VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF, 3898c2ecf20Sopenharmony_ci VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT, 3908c2ecf20Sopenharmony_ci VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING, 3918c2ecf20Sopenharmony_ci VC4_PERFCNT_PSE_PRIMS_REVERSED, 3928c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES, 3938c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING, 3948c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING, 3958c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST, 3968c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS, 3978c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD, 3988c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS, 3998c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT, 4008c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS, 4018c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT, 4028c2ecf20Sopenharmony_ci VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS, 4038c2ecf20Sopenharmony_ci VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED, 4048c2ecf20Sopenharmony_ci VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS, 4058c2ecf20Sopenharmony_ci VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED, 4068c2ecf20Sopenharmony_ci VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED, 4078c2ecf20Sopenharmony_ci VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT, 4088c2ecf20Sopenharmony_ci VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS, 4098c2ecf20Sopenharmony_ci VC4_PERFCNT_NUM_EVENTS, 4108c2ecf20Sopenharmony_ci}; 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci#define DRM_VC4_MAX_PERF_COUNTERS 16 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_cistruct drm_vc4_perfmon_create { 4158c2ecf20Sopenharmony_ci __u32 id; 4168c2ecf20Sopenharmony_ci __u32 ncounters; 4178c2ecf20Sopenharmony_ci __u8 events[DRM_VC4_MAX_PERF_COUNTERS]; 4188c2ecf20Sopenharmony_ci}; 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_cistruct drm_vc4_perfmon_destroy { 4218c2ecf20Sopenharmony_ci __u32 id; 4228c2ecf20Sopenharmony_ci}; 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci/* 4258c2ecf20Sopenharmony_ci * Returns the values of the performance counters tracked by this 4268c2ecf20Sopenharmony_ci * perfmon (as an array of ncounters u64 values). 4278c2ecf20Sopenharmony_ci * 4288c2ecf20Sopenharmony_ci * No implicit synchronization is performed, so the user has to 4298c2ecf20Sopenharmony_ci * guarantee that any jobs using this perfmon have already been 4308c2ecf20Sopenharmony_ci * completed (probably by blocking on the seqno returned by the 4318c2ecf20Sopenharmony_ci * last exec that used the perfmon). 4328c2ecf20Sopenharmony_ci */ 4338c2ecf20Sopenharmony_cistruct drm_vc4_perfmon_get_values { 4348c2ecf20Sopenharmony_ci __u32 id; 4358c2ecf20Sopenharmony_ci __u64 values_ptr; 4368c2ecf20Sopenharmony_ci}; 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci#if defined(__cplusplus) 4398c2ecf20Sopenharmony_ci} 4408c2ecf20Sopenharmony_ci#endif 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci#endif /* _UAPI_VC4_DRM_H_ */ 443