/*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,296DRM_V3D_PARAM_GLOBAL_RESET_COUNTER,297DRM_V3D_PARAM_CONTEXT_RESET_COUNTER,298};299300struct drm_v3d_get_param {301__u32 param;302__u32 pad;303__u64 value;304};305306/**307* Returns the offset for the BO in the V3D address space for this DRM fd.308* This is the same value returned by drm_v3d_create_bo, if that was called309* from this DRM fd.310*/311struct drm_v3d_get_bo_offset {312__u32 handle;313__u32 offset;314};315316struct drm_v3d_submit_tfu {317__u32 icfg;318__u32 iia;319__u32 iis;320__u32 ica;321__u32 iua;322__u32 ioa;323__u32 ios;324__u32 coef[4];325/* First handle is the output BO, following are other inputs.326* 0 for unused.327*/328__u32 bo_handles[4];329/* sync object to block on before running the TFU job. Each TFU330* job will execute in the order submitted to its FD. Synchronization331* against rendering jobs requires using sync objects.332*/333__u32 in_sync;334/* Sync object to signal when the TFU job is done. */335__u32 out_sync;336337__u32 flags;338339/* Pointer to an array of ioctl extensions*/340__u64 extensions;341342struct {343__u32 ioc;344__u32 pad;345} v71;346};347348/* Submits a compute shader for dispatch. This job will block on any349* previous compute shaders submitted on this fd, and any other350* synchronization must be performed with in_sync/out_sync.351*/352struct drm_v3d_submit_csd {353__u32 cfg[7];354__u32 coef[4];355356/* Pointer to a u32 array of the BOs that are referenced by the job.357*/358__u64 bo_handles;359360/* Number of BO handles passed in (size is that times 4). */361__u32 bo_handle_count;362363/* sync object to block on before running the CSD job. Each364* CSD job will execute in the order submitted to its FD.365* Synchronization against rendering/TFU jobs or CSD from366* other fds requires using sync objects.367*/368__u32 in_sync;369/* Sync object to signal when the CSD job is done. */370__u32 out_sync;371372/* ID of the perfmon to attach to this job. 0 means no perfmon. */373__u32 perfmon_id;374375/* Pointer to an array of ioctl extensions*/376__u64 extensions;377378__u32 flags;379380__u32 pad;381};382383/**384* struct drm_v3d_indirect_csd - ioctl extension for the CPU job to create an385* indirect CSD386*387* When an extension of DRM_V3D_EXT_ID_CPU_INDIRECT_CSD id is defined, it388* points to this extension to define a indirect CSD submission. It creates a389* CPU job linked to a CSD job. The CPU job waits for the indirect CSD390* dependencies and, once they are signaled, it updates the CSD job config391* before allowing the CSD job execution.392*/393struct drm_v3d_indirect_csd {394struct drm_v3d_extension base;395396/* Indirect CSD */397struct drm_v3d_submit_csd submit;398399/* Handle of the indirect BO, that should be also attached to the400* indirect CSD.401*/402__u32 indirect;403404/* Offset within the BO where the workgroup counts are stored */405__u32 offset;406407/* Workgroups size */408__u32 wg_size;409410/* Indices of the uniforms with the workgroup dispatch counts411* in the uniform stream. If the uniform rewrite is not needed,412* the offset must be 0xffffffff.413*/414__u32 wg_uniform_offsets[3];415};416417/**418* struct drm_v3d_timestamp_query - ioctl extension for the CPU job to calculate419* a timestamp query420*421* When an extension DRM_V3D_EXT_ID_TIMESTAMP_QUERY is defined, it points to422* this extension to define a timestamp query submission. This CPU job will423* calculate the timestamp query and update the query value within the424* timestamp BO. Moreover, it will signal the timestamp syncobj to indicate425* query availability.426*/427struct drm_v3d_timestamp_query {428struct drm_v3d_extension base;429430/* Array of queries' offsets within the timestamp BO for their value */431__u64 offsets;432433/* Array of timestamp's syncobjs to indicate its availability */434__u64 syncs;435436/* Number of queries */437__u32 count;438439/* mbz */440__u32 pad;441};442443/**444* struct drm_v3d_reset_timestamp_query - ioctl extension for the CPU job to445* reset timestamp queries446*447* When an extension DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY is defined, it448* points to this extension to define a reset timestamp submission. This CPU449* job will reset the timestamp queries based on value offset of the first450* query. Moreover, it will reset the timestamp syncobj to reset query451* availability.452*/453struct drm_v3d_reset_timestamp_query {454struct drm_v3d_extension base;455456/* Array of timestamp's syncobjs to indicate its availability */457__u64 syncs;458459/* Offset of the first query within the timestamp BO for its value */460__u32 offset;461462/* Number of queries */463__u32 count;464};465466/**467* struct drm_v3d_copy_timestamp_query - ioctl extension for the CPU job to copy468* query results to a buffer469*470* When an extension DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY is defined, it471* points to this extension to define a copy timestamp query submission. This472* CPU job will copy the timestamp queries results to a BO with the offset473* and stride defined in the extension.474*/475struct drm_v3d_copy_timestamp_query {476struct drm_v3d_extension base;477478/* Define if should write to buffer using 64 or 32 bits */479__u8 do_64bit;480481/* Define if it can write to buffer even if the query is not available */482__u8 do_partial;483484/* Define if it should write availability bit to buffer */485__u8 availability_bit;486487/* mbz */488__u8 pad;489490/* Offset of the buffer in the BO */491__u32 offset;492493/* Stride of the buffer in the BO */494__u32 stride;495496/* Number of queries */497__u32 count;498499/* Array of queries' offsets within the timestamp BO for their value */500__u64 offsets;501502/* Array of timestamp's syncobjs to indicate its availability */503__u64 syncs;504};505506/**507* struct drm_v3d_reset_performance_query - ioctl extension for the CPU job to508* reset performance queries509*510* When an extension DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY is defined, it511* points to this extension to define a reset performance submission. This CPU512* job will reset the performance queries by resetting the values of the513* performance monitors. Moreover, it will reset the syncobj to reset query514* availability.515*/516struct drm_v3d_reset_performance_query {517struct drm_v3d_extension base;518519/* Array of performance queries's syncobjs to indicate its availability */520__u64 syncs;521522/* Number of queries */523__u32 count;524525/* Number of performance monitors */526__u32 nperfmons;527528/* Array of u64 user-pointers that point to an array of kperfmon_ids */529__u64 kperfmon_ids;530};531532/**533* struct drm_v3d_copy_performance_query - ioctl extension for the CPU job to copy534* performance query results to a buffer535*536* When an extension DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY is defined, it537* points to this extension to define a copy performance query submission. This538* CPU job will copy the performance queries results to a BO with the offset539* and stride defined in the extension.540*/541struct drm_v3d_copy_performance_query {542struct drm_v3d_extension base;543544/* Define if should write to buffer using 64 or 32 bits */545__u8 do_64bit;546547/* Define if it can write to buffer even if the query is not available */548__u8 do_partial;549550/* Define if it should write availability bit to buffer */551__u8 availability_bit;552553/* mbz */554__u8 pad;555556/* Offset of the buffer in the BO */557__u32 offset;558559/* Stride of the buffer in the BO */560__u32 stride;561562/* Number of performance monitors */563__u32 nperfmons;564565/* Number of performance counters related to this query pool */566__u32 ncounters;567568/* Number of queries */569__u32 count;570571/* Array of performance queries's syncobjs to indicate its availability */572__u64 syncs;573574/* Array of u64 user-pointers that point to an array of kperfmon_ids */575__u64 kperfmon_ids;576};577578struct drm_v3d_submit_cpu {579/* Pointer to a u32 array of the BOs that are referenced by the job.580*581* For DRM_V3D_EXT_ID_CPU_INDIRECT_CSD, it must contain only one BO,582* that contains the workgroup counts.583*584* For DRM_V3D_EXT_ID_TIMESTAMP_QUERY, it must contain only one BO,585* that will contain the timestamp.586*587* For DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY, it must contain only588* one BO, that contains the timestamp.589*590* For DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY, it must contain two591* BOs. The first is the BO where the timestamp queries will be written592* to. The second is the BO that contains the timestamp.593*594* For DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY, it must contain no595* BOs.596*597* For DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY, it must contain one598* BO, where the performance queries will be written.599*/600__u64 bo_handles;601602/* Number of BO handles passed in (size is that times 4). */603__u32 bo_handle_count;604605__u32 flags;606607/* Pointer to an array of ioctl extensions*/608__u64 extensions;609};610611/* The performance counters index represented by this enum are deprecated and612* must no longer be used. These counters are only valid for V3D 4.2.613*614* In order to check for performance counter information,615* use DRM_IOCTL_V3D_PERFMON_GET_COUNTER.616*617* Don't use V3D_PERFCNT_NUM to retrieve the maximum number of performance618* counters. You should use DRM_IOCTL_V3D_GET_PARAM with the following619* parameter: DRM_V3D_PARAM_MAX_PERF_COUNTERS.620*/621enum {622V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS,623V3D_PERFCNT_FEP_VALID_PRIMS,624V3D_PERFCNT_FEP_EZ_NFCLIP_QUADS,625V3D_PERFCNT_FEP_VALID_QUADS,626V3D_PERFCNT_TLB_QUADS_STENCIL_FAIL,627V3D_PERFCNT_TLB_QUADS_STENCILZ_FAIL,628V3D_PERFCNT_TLB_QUADS_STENCILZ_PASS,629V3D_PERFCNT_TLB_QUADS_ZERO_COV,630V3D_PERFCNT_TLB_QUADS_NONZERO_COV,631V3D_PERFCNT_TLB_QUADS_WRITTEN,632V3D_PERFCNT_PTB_PRIM_VIEWPOINT_DISCARD,633V3D_PERFCNT_PTB_PRIM_CLIP,634V3D_PERFCNT_PTB_PRIM_REV,635V3D_PERFCNT_QPU_IDLE_CYCLES,636V3D_PERFCNT_QPU_ACTIVE_CYCLES_VERTEX_COORD_USER,637V3D_PERFCNT_QPU_ACTIVE_CYCLES_FRAG,638V3D_PERFCNT_QPU_CYCLES_VALID_INSTR,639V3D_PERFCNT_QPU_CYCLES_TMU_STALL,640V3D_PERFCNT_QPU_CYCLES_SCOREBOARD_STALL,641V3D_PERFCNT_QPU_CYCLES_VARYINGS_STALL,642V3D_PERFCNT_QPU_IC_HIT,643V3D_PERFCNT_QPU_IC_MISS,644V3D_PERFCNT_QPU_UC_HIT,645V3D_PERFCNT_QPU_UC_MISS,646V3D_PERFCNT_TMU_TCACHE_ACCESS,647V3D_PERFCNT_TMU_TCACHE_MISS,648V3D_PERFCNT_VPM_VDW_STALL,649V3D_PERFCNT_VPM_VCD_STALL,650V3D_PERFCNT_BIN_ACTIVE,651V3D_PERFCNT_RDR_ACTIVE,652V3D_PERFCNT_L2T_HITS,653V3D_PERFCNT_L2T_MISSES,654V3D_PERFCNT_CYCLE_COUNT,655V3D_PERFCNT_QPU_CYCLES_STALLED_VERTEX_COORD_USER,656V3D_PERFCNT_QPU_CYCLES_STALLED_FRAGMENT,657V3D_PERFCNT_PTB_PRIMS_BINNED,658V3D_PERFCNT_AXI_WRITES_WATCH_0,659V3D_PERFCNT_AXI_READS_WATCH_0,660V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_0,661V3D_PERFCNT_AXI_READ_STALLS_WATCH_0,662V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_0,663V3D_PERFCNT_AXI_READ_BYTES_WATCH_0,664V3D_PERFCNT_AXI_WRITES_WATCH_1,665V3D_PERFCNT_AXI_READS_WATCH_1,666V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_1,667V3D_PERFCNT_AXI_READ_STALLS_WATCH_1,668V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_1,669V3D_PERFCNT_AXI_READ_BYTES_WATCH_1,670V3D_PERFCNT_TLB_PARTIAL_QUADS,671V3D_PERFCNT_TMU_CONFIG_ACCESSES,672V3D_PERFCNT_L2T_NO_ID_STALL,673V3D_PERFCNT_L2T_COM_QUE_STALL,674V3D_PERFCNT_L2T_TMU_WRITES,675V3D_PERFCNT_TMU_ACTIVE_CYCLES,676V3D_PERFCNT_TMU_STALLED_CYCLES,677V3D_PERFCNT_CLE_ACTIVE,678V3D_PERFCNT_L2T_TMU_READS,679V3D_PERFCNT_L2T_CLE_READS,680V3D_PERFCNT_L2T_VCD_READS,681V3D_PERFCNT_L2T_TMUCFG_READS,682V3D_PERFCNT_L2T_SLC0_READS,683V3D_PERFCNT_L2T_SLC1_READS,684V3D_PERFCNT_L2T_SLC2_READS,685V3D_PERFCNT_L2T_TMU_W_MISSES,686V3D_PERFCNT_L2T_TMU_R_MISSES,687V3D_PERFCNT_L2T_CLE_MISSES,688V3D_PERFCNT_L2T_VCD_MISSES,689V3D_PERFCNT_L2T_TMUCFG_MISSES,690V3D_PERFCNT_L2T_SLC0_MISSES,691V3D_PERFCNT_L2T_SLC1_MISSES,692V3D_PERFCNT_L2T_SLC2_MISSES,693V3D_PERFCNT_CORE_MEM_WRITES,694V3D_PERFCNT_L2T_MEM_WRITES,695V3D_PERFCNT_PTB_MEM_WRITES,696V3D_PERFCNT_TLB_MEM_WRITES,697V3D_PERFCNT_CORE_MEM_READS,698V3D_PERFCNT_L2T_MEM_READS,699V3D_PERFCNT_PTB_MEM_READS,700V3D_PERFCNT_PSE_MEM_READS,701V3D_PERFCNT_TLB_MEM_READS,702V3D_PERFCNT_GMP_MEM_READS,703V3D_PERFCNT_PTB_W_MEM_WORDS,704V3D_PERFCNT_TLB_W_MEM_WORDS,705V3D_PERFCNT_PSE_R_MEM_WORDS,706V3D_PERFCNT_TLB_R_MEM_WORDS,707V3D_PERFCNT_TMU_MRU_HITS,708V3D_PERFCNT_COMPUTE_ACTIVE,709V3D_PERFCNT_NUM,710};711712#define DRM_V3D_MAX_PERF_COUNTERS 32713714struct drm_v3d_perfmon_create {715__u32 id;716__u32 ncounters;717__u8 counters[DRM_V3D_MAX_PERF_COUNTERS];718};719720struct drm_v3d_perfmon_destroy {721__u32 id;722};723724/*725* Returns the values of the performance counters tracked by this726* perfmon (as an array of ncounters u64 values).727*728* No implicit synchronization is performed, so the user has to729* guarantee that any jobs using this perfmon have already been730* completed (probably by blocking on the seqno returned by the731* last exec that used the perfmon).732*/733struct drm_v3d_perfmon_get_values {734__u32 id;735__u32 pad;736__u64 values_ptr;737};738739#define DRM_V3D_PERFCNT_MAX_NAME 64740#define DRM_V3D_PERFCNT_MAX_CATEGORY 32741#define DRM_V3D_PERFCNT_MAX_DESCRIPTION 256742743/**744* struct drm_v3d_perfmon_get_counter - ioctl to get the description of a745* performance counter746*747* As userspace needs to retrieve information about the performance counters748* available, this IOCTL allows users to get information about a performance749* counter (name, category and description).750*/751struct drm_v3d_perfmon_get_counter {752/*753* Counter ID754*755* Must be smaller than the maximum number of performance counters, which756* can be retrieve through DRM_V3D_PARAM_MAX_PERF_COUNTERS.757*/758__u8 counter;759760/* Name of the counter */761__u8 name[DRM_V3D_PERFCNT_MAX_NAME];762763/* Category of the counter */764__u8 category[DRM_V3D_PERFCNT_MAX_CATEGORY];765766/* Description of the counter */767__u8 description[DRM_V3D_PERFCNT_MAX_DESCRIPTION];768769/* mbz */770__u8 reserved[7];771};772773#define DRM_V3D_PERFMON_CLEAR_GLOBAL 0x0001774775/**776* struct drm_v3d_perfmon_set_global - ioctl to define a global performance777* monitor778*779* The global performance monitor will be used for all jobs. If a global780* performance monitor is defined, jobs with a self-defined performance781* monitor won't be allowed.782*/783struct drm_v3d_perfmon_set_global {784__u32 flags;785__u32 id;786};787788#if defined(__cplusplus)789}790#endif791792#endif /* _V3D_DRM_H_ */793794795