/*1* Copyright © 2014-2018 Broadcom2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef _V3D_DRM_H_24#define _V3D_DRM_H_2526#include "drm.h"2728#if defined(__cplusplus)29extern "C" {30#endif3132#define DRM_V3D_SUBMIT_CL 0x0033#define DRM_V3D_WAIT_BO 0x0134#define DRM_V3D_CREATE_BO 0x0235#define DRM_V3D_MMAP_BO 0x0336#define DRM_V3D_GET_PARAM 0x0437#define DRM_V3D_GET_BO_OFFSET 0x0538#define DRM_V3D_SUBMIT_TFU 0x0639#define DRM_V3D_SUBMIT_CSD 0x0740#define DRM_V3D_PERFMON_CREATE 0x0841#define DRM_V3D_PERFMON_DESTROY 0x0942#define DRM_V3D_PERFMON_GET_VALUES 0x0a43#define DRM_V3D_SUBMIT_CPU 0x0b44#define DRM_V3D_PERFMON_GET_COUNTER 0x0c45#define DRM_V3D_PERFMON_SET_GLOBAL 0x0d4647#define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)48#define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)49#define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo)50#define DRM_IOCTL_V3D_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo)51#define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)52#define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)53#define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)54#define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)55#define DRM_IOCTL_V3D_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_CREATE, \56struct drm_v3d_perfmon_create)57#define DRM_IOCTL_V3D_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_DESTROY, \58struct drm_v3d_perfmon_destroy)59#define DRM_IOCTL_V3D_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_VALUES, \60struct drm_v3d_perfmon_get_values)61#define DRM_IOCTL_V3D_SUBMIT_CPU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CPU, struct drm_v3d_submit_cpu)62#define DRM_IOCTL_V3D_PERFMON_GET_COUNTER DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_COUNTER, \63struct drm_v3d_perfmon_get_counter)64#define DRM_IOCTL_V3D_PERFMON_SET_GLOBAL DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_PERFMON_SET_GLOBAL, \65struct drm_v3d_perfmon_set_global)6667#define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x0168#define DRM_V3D_SUBMIT_EXTENSION 0x026970/* struct drm_v3d_extension - ioctl extensions71*72* Linked-list of generic extensions where the id identify which struct is73* pointed by ext_data. Therefore, DRM_V3D_EXT_ID_* is used on id to identify74* the extension type.75*/76struct drm_v3d_extension {77__u64 next;78__u32 id;79#define DRM_V3D_EXT_ID_MULTI_SYNC 0x0180#define DRM_V3D_EXT_ID_CPU_INDIRECT_CSD 0x0281#define DRM_V3D_EXT_ID_CPU_TIMESTAMP_QUERY 0x0382#define DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY 0x0483#define DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY 0x0584#define DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY 0x0685#define DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY 0x0786__u32 flags; /* mbz */87};8889/* struct drm_v3d_sem - wait/signal semaphore90*91* If binary semaphore, it only takes syncobj handle and ignores flags and92* point fields. Point is defined for timeline syncobj feature.93*/94struct drm_v3d_sem {95__u32 handle; /* syncobj */96/* rsv below, for future uses */97__u32 flags;98__u64 point; /* for timeline sem support */99__u64 mbz[2]; /* must be zero, rsv */100};101102/* Enum for each of the V3D queues. */103enum v3d_queue {104V3D_BIN,105V3D_RENDER,106V3D_TFU,107V3D_CSD,108V3D_CACHE_CLEAN,109V3D_CPU,110};111112/**113* struct drm_v3d_multi_sync - ioctl extension to add support multiples114* syncobjs for commands submission.115*116* When an extension of DRM_V3D_EXT_ID_MULTI_SYNC id is defined, it points to117* this extension to define wait and signal dependencies, instead of single118* in/out sync entries on submitting commands. The field flags is used to119* determine the stage to set wait dependencies.120*/121struct drm_v3d_multi_sync {122struct drm_v3d_extension base;123/* Array of wait and signal semaphores */124__u64 in_syncs;125__u64 out_syncs;126127/* Number of entries */128__u32 in_sync_count;129__u32 out_sync_count;130131/* set the stage (v3d_queue) to sync */132__u32 wait_stage;133134__u32 pad; /* mbz */135};136137/**138* struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D139* engine.140*141* This asks the kernel to have the GPU execute an optional binner142* command list, and a render command list.143*144* The L1T, slice, L2C, L2T, and GCA caches will be flushed before145* each CL executes. The VCD cache should be flushed (if necessary)146* by the submitted CLs. The TLB writes are guaranteed to have been147* flushed by the time the render done IRQ happens, which is the148* trigger for out_sync. Any dirtying of cachelines by the job (only149* possible using TMU writes) must be flushed by the caller using the150* DRM_V3D_SUBMIT_CL_FLUSH_CACHE_FLAG flag.151*/152struct drm_v3d_submit_cl {153/* Pointer to the binner command list.154*155* This is the first set of commands executed, which runs the156* coordinate shader to determine where primitives land on the screen,157* then writes out the state updates and draw calls necessary per tile158* to the tile allocation BO.159*160* This BCL will block on any previous BCL submitted on the161* same FD, but not on any RCL or BCLs submitted by other162* clients -- that is left up to the submitter to control163* using in_sync_bcl if necessary.164*/165__u32 bcl_start;166167/** End address of the BCL (first byte after the BCL) */168__u32 bcl_end;169170/* Offset of the render command list.171*172* This is the second set of commands executed, which will either173* execute the tiles that have been set up by the BCL, or a fixed set174* of tiles (in the case of RCL-only blits).175*176* This RCL will block on this submit's BCL, and any previous177* RCL submitted on the same FD, but not on any RCL or BCLs178* submitted by other clients -- that is left up to the179* submitter to control using in_sync_rcl if necessary.180*/181__u32 rcl_start;182183/** End address of the RCL (first byte after the RCL) */184__u32 rcl_end;185186/** An optional sync object to wait on before starting the BCL. */187__u32 in_sync_bcl;188/** An optional sync object to wait on before starting the RCL. */189__u32 in_sync_rcl;190/** An optional sync object to place the completion fence in. */191__u32 out_sync;192193/* Offset of the tile alloc memory194*195* This is optional on V3D 3.3 (where the CL can set the value) but196* required on V3D 4.1.197*/198__u32 qma;199200/** Size of the tile alloc memory. */201__u32 qms;202203/** Offset of the tile state data array. */204__u32 qts;205206/* Pointer to a u32 array of the BOs that are referenced by the job.207*/208__u64 bo_handles;209210/* Number of BO handles passed in (size is that times 4). */211__u32 bo_handle_count;212213/* DRM_V3D_SUBMIT_* properties */214__u32 flags;215216/* ID of the perfmon to attach to this job. 0 means no perfmon. */217__u32 perfmon_id;218219__u32 pad;220221/* Pointer to an array of ioctl extensions*/222__u64 extensions;223};224225/**226* struct drm_v3d_wait_bo - ioctl argument for waiting for227* completion of the last DRM_V3D_SUBMIT_CL on a BO.228*229* This is useful for cases where multiple processes might be230* rendering to a BO and you want to wait for all rendering to be231* completed.232*/233struct drm_v3d_wait_bo {234__u32 handle;235__u32 pad;236__u64 timeout_ns;237};238239/**240* struct drm_v3d_create_bo - ioctl argument for creating V3D BOs.241*242* There are currently no values for the flags argument, but it may be243* used in a future extension.244*/245struct drm_v3d_create_bo {246__u32 size;247__u32 flags;248/** Returned GEM handle for the BO. */249__u32 handle;250/**251* Returned offset for the BO in the V3D address space. This offset252* is private to the DRM fd and is valid for the lifetime of the GEM253* handle.254*255* This offset value will always be nonzero, since various HW256* units treat 0 specially.257*/258__u32 offset;259};260261/**262* struct drm_v3d_mmap_bo - ioctl argument for mapping V3D BOs.263*264* This doesn't actually perform an mmap. Instead, it returns the265* offset you need to use in an mmap on the DRM device node. This266* means that tools like valgrind end up knowing about the mapped267* memory.268*269* There are currently no values for the flags argument, but it may be270* used in a future extension.271*/272struct drm_v3d_mmap_bo {273/** Handle for the object being mapped. */274__u32 handle;275__u32 flags;276/** offset into the drm node to use for subsequent mmap call. */277__u64 offset;278};279280enum drm_v3d_param {281DRM_V3D_PARAM_V3D_UIFCFG,282DRM_V3D_PARAM_V3D_HUB_IDENT1,283DRM_V3D_PARAM_V3D_HUB_IDENT2,284DRM_V3D_PARAM_V3D_HUB_IDENT3,285DRM_V3D_PARAM_V3D_CORE0_IDENT0,286DRM_V3D_PARAM_V3D_CORE0_IDENT1,287DRM_V3D_PARAM_V3D_CORE0_IDENT2,288DRM_V3D_PARAM_SUPPORTS_TFU,289DRM_V3D_PARAM_SUPPORTS_CSD,290DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,291DRM_V3D_PARAM_SUPPORTS_PERFMON,292DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT,293DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE,294DRM_V3D_PARAM_MAX_PERF_COUNTERS,295DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES,296};297298struct drm_v3d_get_param {299__u32 param;300__u32 pad;301__u64 value;302};303304/**305* Returns the offset for the BO in the V3D address space for this DRM fd.306* This is the same value returned by drm_v3d_create_bo, if that was called307* from this DRM fd.308*/309struct drm_v3d_get_bo_offset {310__u32 handle;311__u32 offset;312};313314struct drm_v3d_submit_tfu {315__u32 icfg;316__u32 iia;317__u32 iis;318__u32 ica;319__u32 iua;320__u32 ioa;321__u32 ios;322__u32 coef[4];323/* First handle is the output BO, following are other inputs.324* 0 for unused.325*/326__u32 bo_handles[4];327/* sync object to block on before running the TFU job. Each TFU328* job will execute in the order submitted to its FD. Synchronization329* against rendering jobs requires using sync objects.330*/331__u32 in_sync;332/* Sync object to signal when the TFU job is done. */333__u32 out_sync;334335__u32 flags;336337/* Pointer to an array of ioctl extensions*/338__u64 extensions;339340struct {341__u32 ioc;342__u32 pad;343} v71;344};345346/* Submits a compute shader for dispatch. This job will block on any347* previous compute shaders submitted on this fd, and any other348* synchronization must be performed with in_sync/out_sync.349*/350struct drm_v3d_submit_csd {351__u32 cfg[7];352__u32 coef[4];353354/* Pointer to a u32 array of the BOs that are referenced by the job.355*/356__u64 bo_handles;357358/* Number of BO handles passed in (size is that times 4). */359__u32 bo_handle_count;360361/* sync object to block on before running the CSD job. Each362* CSD job will execute in the order submitted to its FD.363* Synchronization against rendering/TFU jobs or CSD from364* other fds requires using sync objects.365*/366__u32 in_sync;367/* Sync object to signal when the CSD job is done. */368__u32 out_sync;369370/* ID of the perfmon to attach to this job. 0 means no perfmon. */371__u32 perfmon_id;372373/* Pointer to an array of ioctl extensions*/374__u64 extensions;375376__u32 flags;377378__u32 pad;379};380381/**382* struct drm_v3d_indirect_csd - ioctl extension for the CPU job to create an383* indirect CSD384*385* When an extension of DRM_V3D_EXT_ID_CPU_INDIRECT_CSD id is defined, it386* points to this extension to define a indirect CSD submission. It creates a387* CPU job linked to a CSD job. The CPU job waits for the indirect CSD388* dependencies and, once they are signaled, it updates the CSD job config389* before allowing the CSD job execution.390*/391struct drm_v3d_indirect_csd {392struct drm_v3d_extension base;393394/* Indirect CSD */395struct drm_v3d_submit_csd submit;396397/* Handle of the indirect BO, that should be also attached to the398* indirect CSD.399*/400__u32 indirect;401402/* Offset within the BO where the workgroup counts are stored */403__u32 offset;404405/* Workgroups size */406__u32 wg_size;407408/* Indices of the uniforms with the workgroup dispatch counts409* in the uniform stream. If the uniform rewrite is not needed,410* the offset must be 0xffffffff.411*/412__u32 wg_uniform_offsets[3];413};414415/**416* struct drm_v3d_timestamp_query - ioctl extension for the CPU job to calculate417* a timestamp query418*419* When an extension DRM_V3D_EXT_ID_TIMESTAMP_QUERY is defined, it points to420* this extension to define a timestamp query submission. This CPU job will421* calculate the timestamp query and update the query value within the422* timestamp BO. Moreover, it will signal the timestamp syncobj to indicate423* query availability.424*/425struct drm_v3d_timestamp_query {426struct drm_v3d_extension base;427428/* Array of queries' offsets within the timestamp BO for their value */429__u64 offsets;430431/* Array of timestamp's syncobjs to indicate its availability */432__u64 syncs;433434/* Number of queries */435__u32 count;436437/* mbz */438__u32 pad;439};440441/**442* struct drm_v3d_reset_timestamp_query - ioctl extension for the CPU job to443* reset timestamp queries444*445* When an extension DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY is defined, it446* points to this extension to define a reset timestamp submission. This CPU447* job will reset the timestamp queries based on value offset of the first448* query. Moreover, it will reset the timestamp syncobj to reset query449* availability.450*/451struct drm_v3d_reset_timestamp_query {452struct drm_v3d_extension base;453454/* Array of timestamp's syncobjs to indicate its availability */455__u64 syncs;456457/* Offset of the first query within the timestamp BO for its value */458__u32 offset;459460/* Number of queries */461__u32 count;462};463464/**465* struct drm_v3d_copy_timestamp_query - ioctl extension for the CPU job to copy466* query results to a buffer467*468* When an extension DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY is defined, it469* points to this extension to define a copy timestamp query submission. This470* CPU job will copy the timestamp queries results to a BO with the offset471* and stride defined in the extension.472*/473struct drm_v3d_copy_timestamp_query {474struct drm_v3d_extension base;475476/* Define if should write to buffer using 64 or 32 bits */477__u8 do_64bit;478479/* Define if it can write to buffer even if the query is not available */480__u8 do_partial;481482/* Define if it should write availability bit to buffer */483__u8 availability_bit;484485/* mbz */486__u8 pad;487488/* Offset of the buffer in the BO */489__u32 offset;490491/* Stride of the buffer in the BO */492__u32 stride;493494/* Number of queries */495__u32 count;496497/* Array of queries' offsets within the timestamp BO for their value */498__u64 offsets;499500/* Array of timestamp's syncobjs to indicate its availability */501__u64 syncs;502};503504/**505* struct drm_v3d_reset_performance_query - ioctl extension for the CPU job to506* reset performance queries507*508* When an extension DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY is defined, it509* points to this extension to define a reset performance submission. This CPU510* job will reset the performance queries by resetting the values of the511* performance monitors. Moreover, it will reset the syncobj to reset query512* availability.513*/514struct drm_v3d_reset_performance_query {515struct drm_v3d_extension base;516517/* Array of performance queries's syncobjs to indicate its availability */518__u64 syncs;519520/* Number of queries */521__u32 count;522523/* Number of performance monitors */524__u32 nperfmons;525526/* Array of u64 user-pointers that point to an array of kperfmon_ids */527__u64 kperfmon_ids;528};529530/**531* struct drm_v3d_copy_performance_query - ioctl extension for the CPU job to copy532* performance query results to a buffer533*534* When an extension DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY is defined, it535* points to this extension to define a copy performance query submission. This536* CPU job will copy the performance queries results to a BO with the offset537* and stride defined in the extension.538*/539struct drm_v3d_copy_performance_query {540struct drm_v3d_extension base;541542/* Define if should write to buffer using 64 or 32 bits */543__u8 do_64bit;544545/* Define if it can write to buffer even if the query is not available */546__u8 do_partial;547548/* Define if it should write availability bit to buffer */549__u8 availability_bit;550551/* mbz */552__u8 pad;553554/* Offset of the buffer in the BO */555__u32 offset;556557/* Stride of the buffer in the BO */558__u32 stride;559560/* Number of performance monitors */561__u32 nperfmons;562563/* Number of performance counters related to this query pool */564__u32 ncounters;565566/* Number of queries */567__u32 count;568569/* Array of performance queries's syncobjs to indicate its availability */570__u64 syncs;571572/* Array of u64 user-pointers that point to an array of kperfmon_ids */573__u64 kperfmon_ids;574};575576struct drm_v3d_submit_cpu {577/* Pointer to a u32 array of the BOs that are referenced by the job.578*579* For DRM_V3D_EXT_ID_CPU_INDIRECT_CSD, it must contain only one BO,580* that contains the workgroup counts.581*582* For DRM_V3D_EXT_ID_TIMESTAMP_QUERY, it must contain only one BO,583* that will contain the timestamp.584*585* For DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY, it must contain only586* one BO, that contains the timestamp.587*588* For DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY, it must contain two589* BOs. The first is the BO where the timestamp queries will be written590* to. The second is the BO that contains the timestamp.591*592* For DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY, it must contain no593* BOs.594*595* For DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY, it must contain one596* BO, where the performance queries will be written.597*/598__u64 bo_handles;599600/* Number of BO handles passed in (size is that times 4). */601__u32 bo_handle_count;602603__u32 flags;604605/* Pointer to an array of ioctl extensions*/606__u64 extensions;607};608609/* The performance counters index represented by this enum are deprecated and610* must no longer be used. These counters are only valid for V3D 4.2.611*612* In order to check for performance counter information,613* use DRM_IOCTL_V3D_PERFMON_GET_COUNTER.614*615* Don't use V3D_PERFCNT_NUM to retrieve the maximum number of performance616* counters. You should use DRM_IOCTL_V3D_GET_PARAM with the following617* parameter: DRM_V3D_PARAM_MAX_PERF_COUNTERS.618*/619enum {620V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS,621V3D_PERFCNT_FEP_VALID_PRIMS,622V3D_PERFCNT_FEP_EZ_NFCLIP_QUADS,623V3D_PERFCNT_FEP_VALID_QUADS,624V3D_PERFCNT_TLB_QUADS_STENCIL_FAIL,625V3D_PERFCNT_TLB_QUADS_STENCILZ_FAIL,626V3D_PERFCNT_TLB_QUADS_STENCILZ_PASS,627V3D_PERFCNT_TLB_QUADS_ZERO_COV,628V3D_PERFCNT_TLB_QUADS_NONZERO_COV,629V3D_PERFCNT_TLB_QUADS_WRITTEN,630V3D_PERFCNT_PTB_PRIM_VIEWPOINT_DISCARD,631V3D_PERFCNT_PTB_PRIM_CLIP,632V3D_PERFCNT_PTB_PRIM_REV,633V3D_PERFCNT_QPU_IDLE_CYCLES,634V3D_PERFCNT_QPU_ACTIVE_CYCLES_VERTEX_COORD_USER,635V3D_PERFCNT_QPU_ACTIVE_CYCLES_FRAG,636V3D_PERFCNT_QPU_CYCLES_VALID_INSTR,637V3D_PERFCNT_QPU_CYCLES_TMU_STALL,638V3D_PERFCNT_QPU_CYCLES_SCOREBOARD_STALL,639V3D_PERFCNT_QPU_CYCLES_VARYINGS_STALL,640V3D_PERFCNT_QPU_IC_HIT,641V3D_PERFCNT_QPU_IC_MISS,642V3D_PERFCNT_QPU_UC_HIT,643V3D_PERFCNT_QPU_UC_MISS,644V3D_PERFCNT_TMU_TCACHE_ACCESS,645V3D_PERFCNT_TMU_TCACHE_MISS,646V3D_PERFCNT_VPM_VDW_STALL,647V3D_PERFCNT_VPM_VCD_STALL,648V3D_PERFCNT_BIN_ACTIVE,649V3D_PERFCNT_RDR_ACTIVE,650V3D_PERFCNT_L2T_HITS,651V3D_PERFCNT_L2T_MISSES,652V3D_PERFCNT_CYCLE_COUNT,653V3D_PERFCNT_QPU_CYCLES_STALLED_VERTEX_COORD_USER,654V3D_PERFCNT_QPU_CYCLES_STALLED_FRAGMENT,655V3D_PERFCNT_PTB_PRIMS_BINNED,656V3D_PERFCNT_AXI_WRITES_WATCH_0,657V3D_PERFCNT_AXI_READS_WATCH_0,658V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_0,659V3D_PERFCNT_AXI_READ_STALLS_WATCH_0,660V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_0,661V3D_PERFCNT_AXI_READ_BYTES_WATCH_0,662V3D_PERFCNT_AXI_WRITES_WATCH_1,663V3D_PERFCNT_AXI_READS_WATCH_1,664V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_1,665V3D_PERFCNT_AXI_READ_STALLS_WATCH_1,666V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_1,667V3D_PERFCNT_AXI_READ_BYTES_WATCH_1,668V3D_PERFCNT_TLB_PARTIAL_QUADS,669V3D_PERFCNT_TMU_CONFIG_ACCESSES,670V3D_PERFCNT_L2T_NO_ID_STALL,671V3D_PERFCNT_L2T_COM_QUE_STALL,672V3D_PERFCNT_L2T_TMU_WRITES,673V3D_PERFCNT_TMU_ACTIVE_CYCLES,674V3D_PERFCNT_TMU_STALLED_CYCLES,675V3D_PERFCNT_CLE_ACTIVE,676V3D_PERFCNT_L2T_TMU_READS,677V3D_PERFCNT_L2T_CLE_READS,678V3D_PERFCNT_L2T_VCD_READS,679V3D_PERFCNT_L2T_TMUCFG_READS,680V3D_PERFCNT_L2T_SLC0_READS,681V3D_PERFCNT_L2T_SLC1_READS,682V3D_PERFCNT_L2T_SLC2_READS,683V3D_PERFCNT_L2T_TMU_W_MISSES,684V3D_PERFCNT_L2T_TMU_R_MISSES,685V3D_PERFCNT_L2T_CLE_MISSES,686V3D_PERFCNT_L2T_VCD_MISSES,687V3D_PERFCNT_L2T_TMUCFG_MISSES,688V3D_PERFCNT_L2T_SLC0_MISSES,689V3D_PERFCNT_L2T_SLC1_MISSES,690V3D_PERFCNT_L2T_SLC2_MISSES,691V3D_PERFCNT_CORE_MEM_WRITES,692V3D_PERFCNT_L2T_MEM_WRITES,693V3D_PERFCNT_PTB_MEM_WRITES,694V3D_PERFCNT_TLB_MEM_WRITES,695V3D_PERFCNT_CORE_MEM_READS,696V3D_PERFCNT_L2T_MEM_READS,697V3D_PERFCNT_PTB_MEM_READS,698V3D_PERFCNT_PSE_MEM_READS,699V3D_PERFCNT_TLB_MEM_READS,700V3D_PERFCNT_GMP_MEM_READS,701V3D_PERFCNT_PTB_W_MEM_WORDS,702V3D_PERFCNT_TLB_W_MEM_WORDS,703V3D_PERFCNT_PSE_R_MEM_WORDS,704V3D_PERFCNT_TLB_R_MEM_WORDS,705V3D_PERFCNT_TMU_MRU_HITS,706V3D_PERFCNT_COMPUTE_ACTIVE,707V3D_PERFCNT_NUM,708};709710#define DRM_V3D_MAX_PERF_COUNTERS 32711712struct drm_v3d_perfmon_create {713__u32 id;714__u32 ncounters;715__u8 counters[DRM_V3D_MAX_PERF_COUNTERS];716};717718struct drm_v3d_perfmon_destroy {719__u32 id;720};721722/*723* Returns the values of the performance counters tracked by this724* perfmon (as an array of ncounters u64 values).725*726* No implicit synchronization is performed, so the user has to727* guarantee that any jobs using this perfmon have already been728* completed (probably by blocking on the seqno returned by the729* last exec that used the perfmon).730*/731struct drm_v3d_perfmon_get_values {732__u32 id;733__u32 pad;734__u64 values_ptr;735};736737#define DRM_V3D_PERFCNT_MAX_NAME 64738#define DRM_V3D_PERFCNT_MAX_CATEGORY 32739#define DRM_V3D_PERFCNT_MAX_DESCRIPTION 256740741/**742* struct drm_v3d_perfmon_get_counter - ioctl to get the description of a743* performance counter744*745* As userspace needs to retrieve information about the performance counters746* available, this IOCTL allows users to get information about a performance747* counter (name, category and description).748*/749struct drm_v3d_perfmon_get_counter {750/*751* Counter ID752*753* Must be smaller than the maximum number of performance counters, which754* can be retrieve through DRM_V3D_PARAM_MAX_PERF_COUNTERS.755*/756__u8 counter;757758/* Name of the counter */759__u8 name[DRM_V3D_PERFCNT_MAX_NAME];760761/* Category of the counter */762__u8 category[DRM_V3D_PERFCNT_MAX_CATEGORY];763764/* Description of the counter */765__u8 description[DRM_V3D_PERFCNT_MAX_DESCRIPTION];766767/* mbz */768__u8 reserved[7];769};770771#define DRM_V3D_PERFMON_CLEAR_GLOBAL 0x0001772773/**774* struct drm_v3d_perfmon_set_global - ioctl to define a global performance775* monitor776*777* The global performance monitor will be used for all jobs. If a global778* performance monitor is defined, jobs with a self-defined performance779* monitor won't be allowed.780*/781struct drm_v3d_perfmon_set_global {782__u32 flags;783__u32 id;784};785786#if defined(__cplusplus)787}788#endif789790#endif /* _V3D_DRM_H_ */791792793