101e04c3fSmrg/*
201e04c3fSmrg * Copyright © 2014-2018 Broadcom
301e04c3fSmrg *
401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
501e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
601e04c3fSmrg * to deal in the Software without restriction, including without limitation
701e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
801e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
901e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1001e04c3fSmrg *
1101e04c3fSmrg * The above copyright notice and this permission notice (including the next
1201e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
1301e04c3fSmrg * Software.
1401e04c3fSmrg *
1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1801e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1901e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2001e04c3fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2101e04c3fSmrg * IN THE SOFTWARE.
2201e04c3fSmrg */
2301e04c3fSmrg
2401e04c3fSmrg#ifndef _V3D_DRM_H_
2501e04c3fSmrg#define _V3D_DRM_H_
2601e04c3fSmrg
2701e04c3fSmrg#include "drm.h"
2801e04c3fSmrg
2901e04c3fSmrg#if defined(__cplusplus)
3001e04c3fSmrgextern "C" {
3101e04c3fSmrg#endif
3201e04c3fSmrg
3301e04c3fSmrg#define DRM_V3D_SUBMIT_CL                         0x00
3401e04c3fSmrg#define DRM_V3D_WAIT_BO                           0x01
3501e04c3fSmrg#define DRM_V3D_CREATE_BO                         0x02
3601e04c3fSmrg#define DRM_V3D_MMAP_BO                           0x03
3701e04c3fSmrg#define DRM_V3D_GET_PARAM                         0x04
3801e04c3fSmrg#define DRM_V3D_GET_BO_OFFSET                     0x05
3953c12917Smaya#define DRM_V3D_SUBMIT_TFU                        0x06
407ec681f3Smrg#define DRM_V3D_SUBMIT_CSD                        0x07
417ec681f3Smrg#define DRM_V3D_PERFMON_CREATE                    0x08
427ec681f3Smrg#define DRM_V3D_PERFMON_DESTROY                   0x09
437ec681f3Smrg#define DRM_V3D_PERFMON_GET_VALUES                0x0a
4401e04c3fSmrg
4501e04c3fSmrg#define DRM_IOCTL_V3D_SUBMIT_CL           DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)
4601e04c3fSmrg#define DRM_IOCTL_V3D_WAIT_BO             DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
4701e04c3fSmrg#define DRM_IOCTL_V3D_CREATE_BO           DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo)
4801e04c3fSmrg#define DRM_IOCTL_V3D_MMAP_BO             DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo)
4901e04c3fSmrg#define DRM_IOCTL_V3D_GET_PARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)
5001e04c3fSmrg#define DRM_IOCTL_V3D_GET_BO_OFFSET       DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)
5153c12917Smaya#define DRM_IOCTL_V3D_SUBMIT_TFU          DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
527ec681f3Smrg#define DRM_IOCTL_V3D_SUBMIT_CSD          DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
537ec681f3Smrg#define DRM_IOCTL_V3D_PERFMON_CREATE      DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_CREATE, \
547ec681f3Smrg						   struct drm_v3d_perfmon_create)
557ec681f3Smrg#define DRM_IOCTL_V3D_PERFMON_DESTROY     DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_DESTROY, \
567ec681f3Smrg						   struct drm_v3d_perfmon_destroy)
577ec681f3Smrg#define DRM_IOCTL_V3D_PERFMON_GET_VALUES  DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_VALUES, \
587ec681f3Smrg						   struct drm_v3d_perfmon_get_values)
597ec681f3Smrg
607ec681f3Smrg#define DRM_V3D_SUBMIT_CL_FLUSH_CACHE             0x01
6101e04c3fSmrg
6201e04c3fSmrg/**
6301e04c3fSmrg * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D
6401e04c3fSmrg * engine.
6501e04c3fSmrg *
6601e04c3fSmrg * This asks the kernel to have the GPU execute an optional binner
6701e04c3fSmrg * command list, and a render command list.
6853c12917Smaya *
6953c12917Smaya * The L1T, slice, L2C, L2T, and GCA caches will be flushed before
7053c12917Smaya * each CL executes.  The VCD cache should be flushed (if necessary)
7153c12917Smaya * by the submitted CLs.  The TLB writes are guaranteed to have been
7253c12917Smaya * flushed by the time the render done IRQ happens, which is the
7353c12917Smaya * trigger for out_sync.  Any dirtying of cachelines by the job (only
7453c12917Smaya * possible using TMU writes) must be flushed by the caller using the
757ec681f3Smrg * DRM_V3D_SUBMIT_CL_FLUSH_CACHE_FLAG flag.
7601e04c3fSmrg */
7701e04c3fSmrgstruct drm_v3d_submit_cl {
7801e04c3fSmrg	/* Pointer to the binner command list.
7901e04c3fSmrg	 *
8001e04c3fSmrg	 * This is the first set of commands executed, which runs the
8101e04c3fSmrg	 * coordinate shader to determine where primitives land on the screen,
8201e04c3fSmrg	 * then writes out the state updates and draw calls necessary per tile
8301e04c3fSmrg	 * to the tile allocation BO.
8453c12917Smaya	 *
8553c12917Smaya	 * This BCL will block on any previous BCL submitted on the
8653c12917Smaya	 * same FD, but not on any RCL or BCLs submitted by other
8753c12917Smaya	 * clients -- that is left up to the submitter to control
8853c12917Smaya	 * using in_sync_bcl if necessary.
8901e04c3fSmrg	 */
9001e04c3fSmrg	__u32 bcl_start;
9101e04c3fSmrg
9253c12917Smaya	/** End address of the BCL (first byte after the BCL) */
9301e04c3fSmrg	__u32 bcl_end;
9401e04c3fSmrg
9501e04c3fSmrg	/* Offset of the render command list.
9601e04c3fSmrg	 *
9701e04c3fSmrg	 * This is the second set of commands executed, which will either
9801e04c3fSmrg	 * execute the tiles that have been set up by the BCL, or a fixed set
9901e04c3fSmrg	 * of tiles (in the case of RCL-only blits).
10053c12917Smaya	 *
10153c12917Smaya	 * This RCL will block on this submit's BCL, and any previous
10253c12917Smaya	 * RCL submitted on the same FD, but not on any RCL or BCLs
10353c12917Smaya	 * submitted by other clients -- that is left up to the
10453c12917Smaya	 * submitter to control using in_sync_rcl if necessary.
10501e04c3fSmrg	 */
10601e04c3fSmrg	__u32 rcl_start;
10701e04c3fSmrg
10853c12917Smaya	/** End address of the RCL (first byte after the RCL) */
10901e04c3fSmrg	__u32 rcl_end;
11001e04c3fSmrg
11101e04c3fSmrg	/** An optional sync object to wait on before starting the BCL. */
11201e04c3fSmrg	__u32 in_sync_bcl;
11301e04c3fSmrg	/** An optional sync object to wait on before starting the RCL. */
11401e04c3fSmrg	__u32 in_sync_rcl;
11501e04c3fSmrg	/** An optional sync object to place the completion fence in. */
11601e04c3fSmrg	__u32 out_sync;
11701e04c3fSmrg
11801e04c3fSmrg	/* Offset of the tile alloc memory
11901e04c3fSmrg	 *
12001e04c3fSmrg	 * This is optional on V3D 3.3 (where the CL can set the value) but
12101e04c3fSmrg	 * required on V3D 4.1.
12201e04c3fSmrg	 */
12301e04c3fSmrg	__u32 qma;
12401e04c3fSmrg
12501e04c3fSmrg	/** Size of the tile alloc memory. */
12601e04c3fSmrg	__u32 qms;
12701e04c3fSmrg
12801e04c3fSmrg	/** Offset of the tile state data array. */
12901e04c3fSmrg	__u32 qts;
13001e04c3fSmrg
13101e04c3fSmrg	/* Pointer to a u32 array of the BOs that are referenced by the job.
13201e04c3fSmrg	 */
13301e04c3fSmrg	__u64 bo_handles;
13401e04c3fSmrg
13501e04c3fSmrg	/* Number of BO handles passed in (size is that times 4). */
13601e04c3fSmrg	__u32 bo_handle_count;
13701e04c3fSmrg
1387ec681f3Smrg	__u32 flags;
1397ec681f3Smrg
1407ec681f3Smrg	/* ID of the perfmon to attach to this job. 0 means no perfmon. */
1417ec681f3Smrg	__u32 perfmon_id;
1427ec681f3Smrg
14301e04c3fSmrg	__u32 pad;
14401e04c3fSmrg};
14501e04c3fSmrg
14601e04c3fSmrg/**
14701e04c3fSmrg * struct drm_v3d_wait_bo - ioctl argument for waiting for
14801e04c3fSmrg * completion of the last DRM_V3D_SUBMIT_CL on a BO.
14901e04c3fSmrg *
15001e04c3fSmrg * This is useful for cases where multiple processes might be
15101e04c3fSmrg * rendering to a BO and you want to wait for all rendering to be
15201e04c3fSmrg * completed.
15301e04c3fSmrg */
15401e04c3fSmrgstruct drm_v3d_wait_bo {
15501e04c3fSmrg	__u32 handle;
15601e04c3fSmrg	__u32 pad;
15701e04c3fSmrg	__u64 timeout_ns;
15801e04c3fSmrg};
15901e04c3fSmrg
16001e04c3fSmrg/**
16101e04c3fSmrg * struct drm_v3d_create_bo - ioctl argument for creating V3D BOs.
16201e04c3fSmrg *
16301e04c3fSmrg * There are currently no values for the flags argument, but it may be
16401e04c3fSmrg * used in a future extension.
16501e04c3fSmrg */
16601e04c3fSmrgstruct drm_v3d_create_bo {
16701e04c3fSmrg	__u32 size;
16801e04c3fSmrg	__u32 flags;
16901e04c3fSmrg	/** Returned GEM handle for the BO. */
17001e04c3fSmrg	__u32 handle;
17101e04c3fSmrg	/**
17201e04c3fSmrg	 * Returned offset for the BO in the V3D address space.  This offset
17301e04c3fSmrg	 * is private to the DRM fd and is valid for the lifetime of the GEM
17401e04c3fSmrg	 * handle.
17501e04c3fSmrg	 *
17601e04c3fSmrg	 * This offset value will always be nonzero, since various HW
17701e04c3fSmrg	 * units treat 0 specially.
17801e04c3fSmrg	 */
17901e04c3fSmrg	__u32 offset;
18001e04c3fSmrg};
18101e04c3fSmrg
18201e04c3fSmrg/**
18301e04c3fSmrg * struct drm_v3d_mmap_bo - ioctl argument for mapping V3D BOs.
18401e04c3fSmrg *
18501e04c3fSmrg * This doesn't actually perform an mmap.  Instead, it returns the
18601e04c3fSmrg * offset you need to use in an mmap on the DRM device node.  This
18701e04c3fSmrg * means that tools like valgrind end up knowing about the mapped
18801e04c3fSmrg * memory.
18901e04c3fSmrg *
19001e04c3fSmrg * There are currently no values for the flags argument, but it may be
19101e04c3fSmrg * used in a future extension.
19201e04c3fSmrg */
19301e04c3fSmrgstruct drm_v3d_mmap_bo {
19401e04c3fSmrg	/** Handle for the object being mapped. */
19501e04c3fSmrg	__u32 handle;
19601e04c3fSmrg	__u32 flags;
19701e04c3fSmrg	/** offset into the drm node to use for subsequent mmap call. */
19801e04c3fSmrg	__u64 offset;
19901e04c3fSmrg};
20001e04c3fSmrg
20101e04c3fSmrgenum drm_v3d_param {
20201e04c3fSmrg	DRM_V3D_PARAM_V3D_UIFCFG,
20301e04c3fSmrg	DRM_V3D_PARAM_V3D_HUB_IDENT1,
20401e04c3fSmrg	DRM_V3D_PARAM_V3D_HUB_IDENT2,
20501e04c3fSmrg	DRM_V3D_PARAM_V3D_HUB_IDENT3,
20601e04c3fSmrg	DRM_V3D_PARAM_V3D_CORE0_IDENT0,
20701e04c3fSmrg	DRM_V3D_PARAM_V3D_CORE0_IDENT1,
20801e04c3fSmrg	DRM_V3D_PARAM_V3D_CORE0_IDENT2,
20953c12917Smaya	DRM_V3D_PARAM_SUPPORTS_TFU,
2107ec681f3Smrg	DRM_V3D_PARAM_SUPPORTS_CSD,
2117ec681f3Smrg	DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,
2127ec681f3Smrg	DRM_V3D_PARAM_SUPPORTS_PERFMON,
21301e04c3fSmrg};
21401e04c3fSmrg
21501e04c3fSmrgstruct drm_v3d_get_param {
21601e04c3fSmrg	__u32 param;
21701e04c3fSmrg	__u32 pad;
21801e04c3fSmrg	__u64 value;
21901e04c3fSmrg};
22001e04c3fSmrg
22101e04c3fSmrg/**
22201e04c3fSmrg * Returns the offset for the BO in the V3D address space for this DRM fd.
22301e04c3fSmrg * This is the same value returned by drm_v3d_create_bo, if that was called
22401e04c3fSmrg * from this DRM fd.
22501e04c3fSmrg */
22601e04c3fSmrgstruct drm_v3d_get_bo_offset {
22701e04c3fSmrg	__u32 handle;
22801e04c3fSmrg	__u32 offset;
22901e04c3fSmrg};
23001e04c3fSmrg
23153c12917Smayastruct drm_v3d_submit_tfu {
23253c12917Smaya	__u32 icfg;
23353c12917Smaya	__u32 iia;
23453c12917Smaya	__u32 iis;
23553c12917Smaya	__u32 ica;
23653c12917Smaya	__u32 iua;
23753c12917Smaya	__u32 ioa;
23853c12917Smaya	__u32 ios;
23953c12917Smaya	__u32 coef[4];
24053c12917Smaya	/* First handle is the output BO, following are other inputs.
24153c12917Smaya	 * 0 for unused.
24253c12917Smaya	 */
24353c12917Smaya	__u32 bo_handles[4];
24453c12917Smaya	/* sync object to block on before running the TFU job.  Each TFU
24553c12917Smaya	 * job will execute in the order submitted to its FD.  Synchronization
24653c12917Smaya	 * against rendering jobs requires using sync objects.
24753c12917Smaya	 */
24853c12917Smaya	__u32 in_sync;
24953c12917Smaya	/* Sync object to signal when the TFU job is done. */
25053c12917Smaya	__u32 out_sync;
25153c12917Smaya};
25253c12917Smaya
2537ec681f3Smrg/* Submits a compute shader for dispatch.  This job will block on any
2547ec681f3Smrg * previous compute shaders submitted on this fd, and any other
2557ec681f3Smrg * synchronization must be performed with in_sync/out_sync.
2567ec681f3Smrg */
2577ec681f3Smrgstruct drm_v3d_submit_csd {
2587ec681f3Smrg	__u32 cfg[7];
2597ec681f3Smrg	__u32 coef[4];
2607ec681f3Smrg
2617ec681f3Smrg	/* Pointer to a u32 array of the BOs that are referenced by the job.
2627ec681f3Smrg	 */
2637ec681f3Smrg	__u64 bo_handles;
2647ec681f3Smrg
2657ec681f3Smrg	/* Number of BO handles passed in (size is that times 4). */
2667ec681f3Smrg	__u32 bo_handle_count;
2677ec681f3Smrg
2687ec681f3Smrg	/* sync object to block on before running the CSD job.  Each
2697ec681f3Smrg	 * CSD job will execute in the order submitted to its FD.
2707ec681f3Smrg	 * Synchronization against rendering/TFU jobs or CSD from
2717ec681f3Smrg	 * other fds requires using sync objects.
2727ec681f3Smrg	 */
2737ec681f3Smrg	__u32 in_sync;
2747ec681f3Smrg	/* Sync object to signal when the CSD job is done. */
2757ec681f3Smrg	__u32 out_sync;
2767ec681f3Smrg
2777ec681f3Smrg	/* ID of the perfmon to attach to this job. 0 means no perfmon. */
2787ec681f3Smrg	__u32 perfmon_id;
2797ec681f3Smrg};
2807ec681f3Smrg
2817ec681f3Smrgenum {
2827ec681f3Smrg	V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS,
2837ec681f3Smrg	V3D_PERFCNT_FEP_VALID_PRIMS,
2847ec681f3Smrg	V3D_PERFCNT_FEP_EZ_NFCLIP_QUADS,
2857ec681f3Smrg	V3D_PERFCNT_FEP_VALID_QUADS,
2867ec681f3Smrg	V3D_PERFCNT_TLB_QUADS_STENCIL_FAIL,
2877ec681f3Smrg	V3D_PERFCNT_TLB_QUADS_STENCILZ_FAIL,
2887ec681f3Smrg	V3D_PERFCNT_TLB_QUADS_STENCILZ_PASS,
2897ec681f3Smrg	V3D_PERFCNT_TLB_QUADS_ZERO_COV,
2907ec681f3Smrg	V3D_PERFCNT_TLB_QUADS_NONZERO_COV,
2917ec681f3Smrg	V3D_PERFCNT_TLB_QUADS_WRITTEN,
2927ec681f3Smrg	V3D_PERFCNT_PTB_PRIM_VIEWPOINT_DISCARD,
2937ec681f3Smrg	V3D_PERFCNT_PTB_PRIM_CLIP,
2947ec681f3Smrg	V3D_PERFCNT_PTB_PRIM_REV,
2957ec681f3Smrg	V3D_PERFCNT_QPU_IDLE_CYCLES,
2967ec681f3Smrg	V3D_PERFCNT_QPU_ACTIVE_CYCLES_VERTEX_COORD_USER,
2977ec681f3Smrg	V3D_PERFCNT_QPU_ACTIVE_CYCLES_FRAG,
2987ec681f3Smrg	V3D_PERFCNT_QPU_CYCLES_VALID_INSTR,
2997ec681f3Smrg	V3D_PERFCNT_QPU_CYCLES_TMU_STALL,
3007ec681f3Smrg	V3D_PERFCNT_QPU_CYCLES_SCOREBOARD_STALL,
3017ec681f3Smrg	V3D_PERFCNT_QPU_CYCLES_VARYINGS_STALL,
3027ec681f3Smrg	V3D_PERFCNT_QPU_IC_HIT,
3037ec681f3Smrg	V3D_PERFCNT_QPU_IC_MISS,
3047ec681f3Smrg	V3D_PERFCNT_QPU_UC_HIT,
3057ec681f3Smrg	V3D_PERFCNT_QPU_UC_MISS,
3067ec681f3Smrg	V3D_PERFCNT_TMU_TCACHE_ACCESS,
3077ec681f3Smrg	V3D_PERFCNT_TMU_TCACHE_MISS,
3087ec681f3Smrg	V3D_PERFCNT_VPM_VDW_STALL,
3097ec681f3Smrg	V3D_PERFCNT_VPM_VCD_STALL,
3107ec681f3Smrg	V3D_PERFCNT_BIN_ACTIVE,
3117ec681f3Smrg	V3D_PERFCNT_RDR_ACTIVE,
3127ec681f3Smrg	V3D_PERFCNT_L2T_HITS,
3137ec681f3Smrg	V3D_PERFCNT_L2T_MISSES,
3147ec681f3Smrg	V3D_PERFCNT_CYCLE_COUNT,
3157ec681f3Smrg	V3D_PERFCNT_QPU_CYCLES_STALLED_VERTEX_COORD_USER,
3167ec681f3Smrg	V3D_PERFCNT_QPU_CYCLES_STALLED_FRAGMENT,
3177ec681f3Smrg	V3D_PERFCNT_PTB_PRIMS_BINNED,
3187ec681f3Smrg	V3D_PERFCNT_AXI_WRITES_WATCH_0,
3197ec681f3Smrg	V3D_PERFCNT_AXI_READS_WATCH_0,
3207ec681f3Smrg	V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_0,
3217ec681f3Smrg	V3D_PERFCNT_AXI_READ_STALLS_WATCH_0,
3227ec681f3Smrg	V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_0,
3237ec681f3Smrg	V3D_PERFCNT_AXI_READ_BYTES_WATCH_0,
3247ec681f3Smrg	V3D_PERFCNT_AXI_WRITES_WATCH_1,
3257ec681f3Smrg	V3D_PERFCNT_AXI_READS_WATCH_1,
3267ec681f3Smrg	V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_1,
3277ec681f3Smrg	V3D_PERFCNT_AXI_READ_STALLS_WATCH_1,
3287ec681f3Smrg	V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_1,
3297ec681f3Smrg	V3D_PERFCNT_AXI_READ_BYTES_WATCH_1,
3307ec681f3Smrg	V3D_PERFCNT_TLB_PARTIAL_QUADS,
3317ec681f3Smrg	V3D_PERFCNT_TMU_CONFIG_ACCESSES,
3327ec681f3Smrg	V3D_PERFCNT_L2T_NO_ID_STALL,
3337ec681f3Smrg	V3D_PERFCNT_L2T_COM_QUE_STALL,
3347ec681f3Smrg	V3D_PERFCNT_L2T_TMU_WRITES,
3357ec681f3Smrg	V3D_PERFCNT_TMU_ACTIVE_CYCLES,
3367ec681f3Smrg	V3D_PERFCNT_TMU_STALLED_CYCLES,
3377ec681f3Smrg	V3D_PERFCNT_CLE_ACTIVE,
3387ec681f3Smrg	V3D_PERFCNT_L2T_TMU_READS,
3397ec681f3Smrg	V3D_PERFCNT_L2T_CLE_READS,
3407ec681f3Smrg	V3D_PERFCNT_L2T_VCD_READS,
3417ec681f3Smrg	V3D_PERFCNT_L2T_TMUCFG_READS,
3427ec681f3Smrg	V3D_PERFCNT_L2T_SLC0_READS,
3437ec681f3Smrg	V3D_PERFCNT_L2T_SLC1_READS,
3447ec681f3Smrg	V3D_PERFCNT_L2T_SLC2_READS,
3457ec681f3Smrg	V3D_PERFCNT_L2T_TMU_W_MISSES,
3467ec681f3Smrg	V3D_PERFCNT_L2T_TMU_R_MISSES,
3477ec681f3Smrg	V3D_PERFCNT_L2T_CLE_MISSES,
3487ec681f3Smrg	V3D_PERFCNT_L2T_VCD_MISSES,
3497ec681f3Smrg	V3D_PERFCNT_L2T_TMUCFG_MISSES,
3507ec681f3Smrg	V3D_PERFCNT_L2T_SLC0_MISSES,
3517ec681f3Smrg	V3D_PERFCNT_L2T_SLC1_MISSES,
3527ec681f3Smrg	V3D_PERFCNT_L2T_SLC2_MISSES,
3537ec681f3Smrg	V3D_PERFCNT_CORE_MEM_WRITES,
3547ec681f3Smrg	V3D_PERFCNT_L2T_MEM_WRITES,
3557ec681f3Smrg	V3D_PERFCNT_PTB_MEM_WRITES,
3567ec681f3Smrg	V3D_PERFCNT_TLB_MEM_WRITES,
3577ec681f3Smrg	V3D_PERFCNT_CORE_MEM_READS,
3587ec681f3Smrg	V3D_PERFCNT_L2T_MEM_READS,
3597ec681f3Smrg	V3D_PERFCNT_PTB_MEM_READS,
3607ec681f3Smrg	V3D_PERFCNT_PSE_MEM_READS,
3617ec681f3Smrg	V3D_PERFCNT_TLB_MEM_READS,
3627ec681f3Smrg	V3D_PERFCNT_GMP_MEM_READS,
3637ec681f3Smrg	V3D_PERFCNT_PTB_W_MEM_WORDS,
3647ec681f3Smrg	V3D_PERFCNT_TLB_W_MEM_WORDS,
3657ec681f3Smrg	V3D_PERFCNT_PSE_R_MEM_WORDS,
3667ec681f3Smrg	V3D_PERFCNT_TLB_R_MEM_WORDS,
3677ec681f3Smrg	V3D_PERFCNT_TMU_MRU_HITS,
3687ec681f3Smrg	V3D_PERFCNT_COMPUTE_ACTIVE,
3697ec681f3Smrg	V3D_PERFCNT_NUM,
3707ec681f3Smrg};
3717ec681f3Smrg
3727ec681f3Smrg#define DRM_V3D_MAX_PERF_COUNTERS                 32
3737ec681f3Smrg
3747ec681f3Smrgstruct drm_v3d_perfmon_create {
3757ec681f3Smrg	__u32 id;
3767ec681f3Smrg	__u32 ncounters;
3777ec681f3Smrg	__u8 counters[DRM_V3D_MAX_PERF_COUNTERS];
3787ec681f3Smrg};
3797ec681f3Smrg
3807ec681f3Smrgstruct drm_v3d_perfmon_destroy {
3817ec681f3Smrg	__u32 id;
3827ec681f3Smrg};
3837ec681f3Smrg
3847ec681f3Smrg/*
3857ec681f3Smrg * Returns the values of the performance counters tracked by this
3867ec681f3Smrg * perfmon (as an array of ncounters u64 values).
3877ec681f3Smrg *
3887ec681f3Smrg * No implicit synchronization is performed, so the user has to
3897ec681f3Smrg * guarantee that any jobs using this perfmon have already been
3907ec681f3Smrg * completed  (probably by blocking on the seqno returned by the
3917ec681f3Smrg * last exec that used the perfmon).
3927ec681f3Smrg */
3937ec681f3Smrgstruct drm_v3d_perfmon_get_values {
3947ec681f3Smrg	__u32 id;
3957ec681f3Smrg	__u32 pad;
3967ec681f3Smrg	__u64 values_ptr;
3977ec681f3Smrg};
3987ec681f3Smrg
39901e04c3fSmrg#if defined(__cplusplus)
40001e04c3fSmrg}
40101e04c3fSmrg#endif
40201e04c3fSmrg
40301e04c3fSmrg#endif /* _V3D_DRM_H_ */
404