Home | History | Annotate | Line # | Download | only in drm
      1  1.1  riastrad /*	$NetBSD: vc4_drm.h,v 1.2 2021/12/18 23:45:46 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright  2014-2015 Broadcom
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice (including the next
     14  1.1  riastrad  * paragraph) shall be included in all copies or substantial portions of the
     15  1.1  riastrad  * Software.
     16  1.1  riastrad  *
     17  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     20  1.1  riastrad  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21  1.1  riastrad  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     22  1.1  riastrad  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     23  1.1  riastrad  * IN THE SOFTWARE.
     24  1.1  riastrad  */
     25  1.1  riastrad 
     26  1.1  riastrad #ifndef _UAPI_VC4_DRM_H_
     27  1.1  riastrad #define _UAPI_VC4_DRM_H_
     28  1.1  riastrad 
     29  1.1  riastrad #include "drm.h"
     30  1.1  riastrad 
     31  1.1  riastrad #if defined(__cplusplus)
     32  1.1  riastrad extern "C" {
     33  1.1  riastrad #endif
     34  1.1  riastrad 
     35  1.1  riastrad #define DRM_VC4_SUBMIT_CL                         0x00
     36  1.1  riastrad #define DRM_VC4_WAIT_SEQNO                        0x01
     37  1.1  riastrad #define DRM_VC4_WAIT_BO                           0x02
     38  1.1  riastrad #define DRM_VC4_CREATE_BO                         0x03
     39  1.1  riastrad #define DRM_VC4_MMAP_BO                           0x04
     40  1.1  riastrad #define DRM_VC4_CREATE_SHADER_BO                  0x05
     41  1.1  riastrad #define DRM_VC4_GET_HANG_STATE                    0x06
     42  1.1  riastrad #define DRM_VC4_GET_PARAM                         0x07
     43  1.1  riastrad #define DRM_VC4_SET_TILING                        0x08
     44  1.1  riastrad #define DRM_VC4_GET_TILING                        0x09
     45  1.1  riastrad #define DRM_VC4_LABEL_BO                          0x0a
     46  1.1  riastrad #define DRM_VC4_GEM_MADVISE                       0x0b
     47  1.1  riastrad #define DRM_VC4_PERFMON_CREATE                    0x0c
     48  1.1  riastrad #define DRM_VC4_PERFMON_DESTROY                   0x0d
     49  1.1  riastrad #define DRM_VC4_PERFMON_GET_VALUES                0x0e
     50  1.1  riastrad 
     51  1.1  riastrad #define DRM_IOCTL_VC4_SUBMIT_CL           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl)
     52  1.1  riastrad #define DRM_IOCTL_VC4_WAIT_SEQNO          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno)
     53  1.1  riastrad #define DRM_IOCTL_VC4_WAIT_BO             DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo)
     54  1.1  riastrad #define DRM_IOCTL_VC4_CREATE_BO           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo)
     55  1.1  riastrad #define DRM_IOCTL_VC4_MMAP_BO             DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo)
     56  1.1  riastrad #define DRM_IOCTL_VC4_CREATE_SHADER_BO    DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo)
     57  1.1  riastrad #define DRM_IOCTL_VC4_GET_HANG_STATE      DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state)
     58  1.1  riastrad #define DRM_IOCTL_VC4_GET_PARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param)
     59  1.1  riastrad #define DRM_IOCTL_VC4_SET_TILING          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling)
     60  1.1  riastrad #define DRM_IOCTL_VC4_GET_TILING          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling)
     61  1.1  riastrad #define DRM_IOCTL_VC4_LABEL_BO            DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo)
     62  1.1  riastrad #define DRM_IOCTL_VC4_GEM_MADVISE         DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise)
     63  1.1  riastrad #define DRM_IOCTL_VC4_PERFMON_CREATE      DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create)
     64  1.1  riastrad #define DRM_IOCTL_VC4_PERFMON_DESTROY     DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy)
     65  1.1  riastrad #define DRM_IOCTL_VC4_PERFMON_GET_VALUES  DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values)
     66  1.1  riastrad 
     67  1.1  riastrad struct drm_vc4_submit_rcl_surface {
     68  1.1  riastrad 	__u32 hindex; /* Handle index, or ~0 if not present. */
     69  1.1  riastrad 	__u32 offset; /* Offset to start of buffer. */
     70  1.1  riastrad 	/*
     71  1.1  riastrad 	 * Bits for either render config (color_write) or load/store packet.
     72  1.1  riastrad 	 * Bits should all be 0 for MSAA load/stores.
     73  1.1  riastrad 	 */
     74  1.1  riastrad 	__u16 bits;
     75  1.1  riastrad 
     76  1.1  riastrad #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES		(1 << 0)
     77  1.1  riastrad 	__u16 flags;
     78  1.1  riastrad };
     79  1.1  riastrad 
     80  1.1  riastrad /**
     81  1.1  riastrad  * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D
     82  1.1  riastrad  * engine.
     83  1.1  riastrad  *
     84  1.1  riastrad  * Drivers typically use GPU BOs to store batchbuffers / command lists and
     85  1.1  riastrad  * their associated state.  However, because the VC4 lacks an MMU, we have to
     86  1.1  riastrad  * do validation of memory accesses by the GPU commands.  If we were to store
     87  1.1  riastrad  * our commands in BOs, we'd need to do uncached readback from them to do the
     88  1.1  riastrad  * validation process, which is too expensive.  Instead, userspace accumulates
     89  1.1  riastrad  * commands and associated state in plain memory, then the kernel copies the
     90  1.1  riastrad  * data to its own address space, and then validates and stores it in a GPU
     91  1.1  riastrad  * BO.
     92  1.1  riastrad  */
     93  1.1  riastrad struct drm_vc4_submit_cl {
     94  1.1  riastrad 	/* Pointer to the binner command list.
     95  1.1  riastrad 	 *
     96  1.1  riastrad 	 * This is the first set of commands executed, which runs the
     97  1.1  riastrad 	 * coordinate shader to determine where primitives land on the screen,
     98  1.1  riastrad 	 * then writes out the state updates and draw calls necessary per tile
     99  1.1  riastrad 	 * to the tile allocation BO.
    100  1.1  riastrad 	 */
    101  1.1  riastrad 	__u64 bin_cl;
    102  1.1  riastrad 
    103  1.1  riastrad 	/* Pointer to the shader records.
    104  1.1  riastrad 	 *
    105  1.1  riastrad 	 * Shader records are the structures read by the hardware that contain
    106  1.1  riastrad 	 * pointers to uniforms, shaders, and vertex attributes.  The
    107  1.1  riastrad 	 * reference to the shader record has enough information to determine
    108  1.1  riastrad 	 * how many pointers are necessary (fixed number for shaders/uniforms,
    109  1.1  riastrad 	 * and an attribute count), so those BO indices into bo_handles are
    110  1.1  riastrad 	 * just stored as __u32s before each shader record passed in.
    111  1.1  riastrad 	 */
    112  1.1  riastrad 	__u64 shader_rec;
    113  1.1  riastrad 
    114  1.1  riastrad 	/* Pointer to uniform data and texture handles for the textures
    115  1.1  riastrad 	 * referenced by the shader.
    116  1.1  riastrad 	 *
    117  1.1  riastrad 	 * For each shader state record, there is a set of uniform data in the
    118  1.1  riastrad 	 * order referenced by the record (FS, VS, then CS).  Each set of
    119  1.1  riastrad 	 * uniform data has a __u32 index into bo_handles per texture
    120  1.1  riastrad 	 * sample operation, in the order the QPU_W_TMUn_S writes appear in
    121  1.1  riastrad 	 * the program.  Following the texture BO handle indices is the actual
    122  1.1  riastrad 	 * uniform data.
    123  1.1  riastrad 	 *
    124  1.1  riastrad 	 * The individual uniform state blocks don't have sizes passed in,
    125  1.1  riastrad 	 * because the kernel has to determine the sizes anyway during shader
    126  1.1  riastrad 	 * code validation.
    127  1.1  riastrad 	 */
    128  1.1  riastrad 	__u64 uniforms;
    129  1.1  riastrad 	__u64 bo_handles;
    130  1.1  riastrad 
    131  1.1  riastrad 	/* Size in bytes of the binner command list. */
    132  1.1  riastrad 	__u32 bin_cl_size;
    133  1.1  riastrad 	/* Size in bytes of the set of shader records. */
    134  1.1  riastrad 	__u32 shader_rec_size;
    135  1.1  riastrad 	/* Number of shader records.
    136  1.1  riastrad 	 *
    137  1.1  riastrad 	 * This could just be computed from the contents of shader_records and
    138  1.1  riastrad 	 * the address bits of references to them from the bin CL, but it
    139  1.1  riastrad 	 * keeps the kernel from having to resize some allocations it makes.
    140  1.1  riastrad 	 */
    141  1.1  riastrad 	__u32 shader_rec_count;
    142  1.1  riastrad 	/* Size in bytes of the uniform state. */
    143  1.1  riastrad 	__u32 uniforms_size;
    144  1.1  riastrad 
    145  1.1  riastrad 	/* Number of BO handles passed in (size is that times 4). */
    146  1.1  riastrad 	__u32 bo_handle_count;
    147  1.1  riastrad 
    148  1.1  riastrad 	/* RCL setup: */
    149  1.1  riastrad 	__u16 width;
    150  1.1  riastrad 	__u16 height;
    151  1.1  riastrad 	__u8 min_x_tile;
    152  1.1  riastrad 	__u8 min_y_tile;
    153  1.1  riastrad 	__u8 max_x_tile;
    154  1.1  riastrad 	__u8 max_y_tile;
    155  1.1  riastrad 	struct drm_vc4_submit_rcl_surface color_read;
    156  1.1  riastrad 	struct drm_vc4_submit_rcl_surface color_write;
    157  1.1  riastrad 	struct drm_vc4_submit_rcl_surface zs_read;
    158  1.1  riastrad 	struct drm_vc4_submit_rcl_surface zs_write;
    159  1.1  riastrad 	struct drm_vc4_submit_rcl_surface msaa_color_write;
    160  1.1  riastrad 	struct drm_vc4_submit_rcl_surface msaa_zs_write;
    161  1.1  riastrad 	__u32 clear_color[2];
    162  1.1  riastrad 	__u32 clear_z;
    163  1.1  riastrad 	__u8 clear_s;
    164  1.1  riastrad 
    165  1.1  riastrad 	__u32 pad:24;
    166  1.1  riastrad 
    167  1.1  riastrad #define VC4_SUBMIT_CL_USE_CLEAR_COLOR			(1 << 0)
    168  1.1  riastrad /* By default, the kernel gets to choose the order that the tiles are
    169  1.1  riastrad  * rendered in.  If this is set, then the tiles will be rendered in a
    170  1.1  riastrad  * raster order, with the right-to-left vs left-to-right and
    171  1.1  riastrad  * top-to-bottom vs bottom-to-top dictated by
    172  1.1  riastrad  * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*.  This allows overlapping
    173  1.1  riastrad  * blits to be implemented using the 3D engine.
    174  1.1  riastrad  */
    175  1.1  riastrad #define VC4_SUBMIT_CL_FIXED_RCL_ORDER			(1 << 1)
    176  1.1  riastrad #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X		(1 << 2)
    177  1.1  riastrad #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y		(1 << 3)
    178  1.1  riastrad 	__u32 flags;
    179  1.1  riastrad 
    180  1.1  riastrad 	/* Returned value of the seqno of this render job (for the
    181  1.1  riastrad 	 * wait ioctl).
    182  1.1  riastrad 	 */
    183  1.1  riastrad 	__u64 seqno;
    184  1.1  riastrad 
    185  1.1  riastrad 	/* ID of the perfmon to attach to this job. 0 means no perfmon. */
    186  1.1  riastrad 	__u32 perfmonid;
    187  1.1  riastrad 
    188  1.1  riastrad 	/* Syncobj handle to wait on. If set, processing of this render job
    189  1.1  riastrad 	 * will not start until the syncobj is signaled. 0 means ignore.
    190  1.1  riastrad 	 */
    191  1.1  riastrad 	__u32 in_sync;
    192  1.1  riastrad 
    193  1.1  riastrad 	/* Syncobj handle to export fence to. If set, the fence in the syncobj
    194  1.1  riastrad 	 * will be replaced with a fence that signals upon completion of this
    195  1.1  riastrad 	 * render job. 0 means ignore.
    196  1.1  riastrad 	 */
    197  1.1  riastrad 	__u32 out_sync;
    198  1.1  riastrad 
    199  1.1  riastrad 	__u32 pad2;
    200  1.1  riastrad };
    201  1.1  riastrad 
    202  1.1  riastrad /**
    203  1.1  riastrad  * struct drm_vc4_wait_seqno - ioctl argument for waiting for
    204  1.1  riastrad  * DRM_VC4_SUBMIT_CL completion using its returned seqno.
    205  1.1  riastrad  *
    206  1.1  riastrad  * timeout_ns is the timeout in nanoseconds, where "0" means "don't
    207  1.1  riastrad  * block, just return the status."
    208  1.1  riastrad  */
    209  1.1  riastrad struct drm_vc4_wait_seqno {
    210  1.1  riastrad 	__u64 seqno;
    211  1.1  riastrad 	__u64 timeout_ns;
    212  1.1  riastrad };
    213  1.1  riastrad 
    214  1.1  riastrad /**
    215  1.1  riastrad  * struct drm_vc4_wait_bo - ioctl argument for waiting for
    216  1.1  riastrad  * completion of the last DRM_VC4_SUBMIT_CL on a BO.
    217  1.1  riastrad  *
    218  1.1  riastrad  * This is useful for cases where multiple processes might be
    219  1.1  riastrad  * rendering to a BO and you want to wait for all rendering to be
    220  1.1  riastrad  * completed.
    221  1.1  riastrad  */
    222  1.1  riastrad struct drm_vc4_wait_bo {
    223  1.1  riastrad 	__u32 handle;
    224  1.1  riastrad 	__u32 pad;
    225  1.1  riastrad 	__u64 timeout_ns;
    226  1.1  riastrad };
    227  1.1  riastrad 
    228  1.1  riastrad /**
    229  1.1  riastrad  * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs.
    230  1.1  riastrad  *
    231  1.1  riastrad  * There are currently no values for the flags argument, but it may be
    232  1.1  riastrad  * used in a future extension.
    233  1.1  riastrad  */
    234  1.1  riastrad struct drm_vc4_create_bo {
    235  1.1  riastrad 	__u32 size;
    236  1.1  riastrad 	__u32 flags;
    237  1.1  riastrad 	/** Returned GEM handle for the BO. */
    238  1.1  riastrad 	__u32 handle;
    239  1.1  riastrad 	__u32 pad;
    240  1.1  riastrad };
    241  1.1  riastrad 
    242  1.1  riastrad /**
    243  1.1  riastrad  * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs.
    244  1.1  riastrad  *
    245  1.1  riastrad  * This doesn't actually perform an mmap.  Instead, it returns the
    246  1.1  riastrad  * offset you need to use in an mmap on the DRM device node.  This
    247  1.1  riastrad  * means that tools like valgrind end up knowing about the mapped
    248  1.1  riastrad  * memory.
    249  1.1  riastrad  *
    250  1.1  riastrad  * There are currently no values for the flags argument, but it may be
    251  1.1  riastrad  * used in a future extension.
    252  1.1  riastrad  */
    253  1.1  riastrad struct drm_vc4_mmap_bo {
    254  1.1  riastrad 	/** Handle for the object being mapped. */
    255  1.1  riastrad 	__u32 handle;
    256  1.1  riastrad 	__u32 flags;
    257  1.1  riastrad 	/** offset into the drm node to use for subsequent mmap call. */
    258  1.1  riastrad 	__u64 offset;
    259  1.1  riastrad };
    260  1.1  riastrad 
    261  1.1  riastrad /**
    262  1.1  riastrad  * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4
    263  1.1  riastrad  * shader BOs.
    264  1.1  riastrad  *
    265  1.1  riastrad  * Since allowing a shader to be overwritten while it's also being
    266  1.1  riastrad  * executed from would allow privlege escalation, shaders must be
    267  1.1  riastrad  * created using this ioctl, and they can't be mmapped later.
    268  1.1  riastrad  */
    269  1.1  riastrad struct drm_vc4_create_shader_bo {
    270  1.1  riastrad 	/* Size of the data argument. */
    271  1.1  riastrad 	__u32 size;
    272  1.1  riastrad 	/* Flags, currently must be 0. */
    273  1.1  riastrad 	__u32 flags;
    274  1.1  riastrad 
    275  1.1  riastrad 	/* Pointer to the data. */
    276  1.1  riastrad 	__u64 data;
    277  1.1  riastrad 
    278  1.1  riastrad 	/** Returned GEM handle for the BO. */
    279  1.1  riastrad 	__u32 handle;
    280  1.1  riastrad 	/* Pad, must be 0. */
    281  1.1  riastrad 	__u32 pad;
    282  1.1  riastrad };
    283  1.1  riastrad 
    284  1.1  riastrad struct drm_vc4_get_hang_state_bo {
    285  1.1  riastrad 	__u32 handle;
    286  1.1  riastrad 	__u32 paddr;
    287  1.1  riastrad 	__u32 size;
    288  1.1  riastrad 	__u32 pad;
    289  1.1  riastrad };
    290  1.1  riastrad 
    291  1.1  riastrad /**
    292  1.1  riastrad  * struct drm_vc4_hang_state - ioctl argument for collecting state
    293  1.1  riastrad  * from a GPU hang for analysis.
    294  1.1  riastrad */
    295  1.1  riastrad struct drm_vc4_get_hang_state {
    296  1.1  riastrad 	/** Pointer to array of struct drm_vc4_get_hang_state_bo. */
    297  1.1  riastrad 	__u64 bo;
    298  1.1  riastrad 	/**
    299  1.1  riastrad 	 * On input, the size of the bo array.  Output is the number
    300  1.1  riastrad 	 * of bos to be returned.
    301  1.1  riastrad 	 */
    302  1.1  riastrad 	__u32 bo_count;
    303  1.1  riastrad 
    304  1.1  riastrad 	__u32 start_bin, start_render;
    305  1.1  riastrad 
    306  1.1  riastrad 	__u32 ct0ca, ct0ea;
    307  1.1  riastrad 	__u32 ct1ca, ct1ea;
    308  1.1  riastrad 	__u32 ct0cs, ct1cs;
    309  1.1  riastrad 	__u32 ct0ra0, ct1ra0;
    310  1.1  riastrad 
    311  1.1  riastrad 	__u32 bpca, bpcs;
    312  1.1  riastrad 	__u32 bpoa, bpos;
    313  1.1  riastrad 
    314  1.1  riastrad 	__u32 vpmbase;
    315  1.1  riastrad 
    316  1.1  riastrad 	__u32 dbge;
    317  1.1  riastrad 	__u32 fdbgo;
    318  1.1  riastrad 	__u32 fdbgb;
    319  1.1  riastrad 	__u32 fdbgr;
    320  1.1  riastrad 	__u32 fdbgs;
    321  1.1  riastrad 	__u32 errstat;
    322  1.1  riastrad 
    323  1.1  riastrad 	/* Pad that we may save more registers into in the future. */
    324  1.1  riastrad 	__u32 pad[16];
    325  1.1  riastrad };
    326  1.1  riastrad 
    327  1.1  riastrad #define DRM_VC4_PARAM_V3D_IDENT0		0
    328  1.1  riastrad #define DRM_VC4_PARAM_V3D_IDENT1		1
    329  1.1  riastrad #define DRM_VC4_PARAM_V3D_IDENT2		2
    330  1.1  riastrad #define DRM_VC4_PARAM_SUPPORTS_BRANCHES		3
    331  1.1  riastrad #define DRM_VC4_PARAM_SUPPORTS_ETC1		4
    332  1.1  riastrad #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS	5
    333  1.1  riastrad #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER	6
    334  1.1  riastrad #define DRM_VC4_PARAM_SUPPORTS_MADVISE		7
    335  1.1  riastrad #define DRM_VC4_PARAM_SUPPORTS_PERFMON		8
    336  1.1  riastrad 
    337  1.1  riastrad struct drm_vc4_get_param {
    338  1.1  riastrad 	__u32 param;
    339  1.1  riastrad 	__u32 pad;
    340  1.1  riastrad 	__u64 value;
    341  1.1  riastrad };
    342  1.1  riastrad 
    343  1.1  riastrad struct drm_vc4_get_tiling {
    344  1.1  riastrad 	__u32 handle;
    345  1.1  riastrad 	__u32 flags;
    346  1.1  riastrad 	__u64 modifier;
    347  1.1  riastrad };
    348  1.1  riastrad 
    349  1.1  riastrad struct drm_vc4_set_tiling {
    350  1.1  riastrad 	__u32 handle;
    351  1.1  riastrad 	__u32 flags;
    352  1.1  riastrad 	__u64 modifier;
    353  1.1  riastrad };
    354  1.1  riastrad 
    355  1.1  riastrad /**
    356  1.1  riastrad  * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes.
    357  1.1  riastrad  */
    358  1.1  riastrad struct drm_vc4_label_bo {
    359  1.1  riastrad 	__u32 handle;
    360  1.1  riastrad 	__u32 len;
    361  1.1  riastrad 	__u64 name;
    362  1.1  riastrad };
    363  1.1  riastrad 
    364  1.1  riastrad /*
    365  1.1  riastrad  * States prefixed with '__' are internal states and cannot be passed to the
    366  1.1  riastrad  * DRM_IOCTL_VC4_GEM_MADVISE ioctl.
    367  1.1  riastrad  */
    368  1.1  riastrad #define VC4_MADV_WILLNEED			0
    369  1.1  riastrad #define VC4_MADV_DONTNEED			1
    370  1.1  riastrad #define __VC4_MADV_PURGED			2
    371  1.1  riastrad #define __VC4_MADV_NOTSUPP			3
    372  1.1  riastrad 
    373  1.1  riastrad struct drm_vc4_gem_madvise {
    374  1.1  riastrad 	__u32 handle;
    375  1.1  riastrad 	__u32 madv;
    376  1.1  riastrad 	__u32 retained;
    377  1.1  riastrad 	__u32 pad;
    378  1.1  riastrad };
    379  1.1  riastrad 
    380  1.1  riastrad enum {
    381  1.1  riastrad 	VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER,
    382  1.1  riastrad 	VC4_PERFCNT_FEP_VALID_PRIMS_RENDER,
    383  1.1  riastrad 	VC4_PERFCNT_FEP_CLIPPED_QUADS,
    384  1.1  riastrad 	VC4_PERFCNT_FEP_VALID_QUADS,
    385  1.1  riastrad 	VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL,
    386  1.1  riastrad 	VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL,
    387  1.1  riastrad 	VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL,
    388  1.1  riastrad 	VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE,
    389  1.1  riastrad 	VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE,
    390  1.1  riastrad 	VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF,
    391  1.1  riastrad 	VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT,
    392  1.1  riastrad 	VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING,
    393  1.1  riastrad 	VC4_PERFCNT_PSE_PRIMS_REVERSED,
    394  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES,
    395  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING,
    396  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING,
    397  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST,
    398  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS,
    399  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD,
    400  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS,
    401  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT,
    402  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS,
    403  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT,
    404  1.1  riastrad 	VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS,
    405  1.1  riastrad 	VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED,
    406  1.1  riastrad 	VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS,
    407  1.1  riastrad 	VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED,
    408  1.1  riastrad 	VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED,
    409  1.1  riastrad 	VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT,
    410  1.1  riastrad 	VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS,
    411  1.1  riastrad 	VC4_PERFCNT_NUM_EVENTS,
    412  1.1  riastrad };
    413  1.1  riastrad 
    414  1.1  riastrad #define DRM_VC4_MAX_PERF_COUNTERS	16
    415  1.1  riastrad 
    416  1.1  riastrad struct drm_vc4_perfmon_create {
    417  1.1  riastrad 	__u32 id;
    418  1.1  riastrad 	__u32 ncounters;
    419  1.1  riastrad 	__u8 events[DRM_VC4_MAX_PERF_COUNTERS];
    420  1.1  riastrad };
    421  1.1  riastrad 
    422  1.1  riastrad struct drm_vc4_perfmon_destroy {
    423  1.1  riastrad 	__u32 id;
    424  1.1  riastrad };
    425  1.1  riastrad 
    426  1.1  riastrad /*
    427  1.1  riastrad  * Returns the values of the performance counters tracked by this
    428  1.1  riastrad  * perfmon (as an array of ncounters u64 values).
    429  1.1  riastrad  *
    430  1.1  riastrad  * No implicit synchronization is performed, so the user has to
    431  1.1  riastrad  * guarantee that any jobs using this perfmon have already been
    432  1.1  riastrad  * completed  (probably by blocking on the seqno returned by the
    433  1.1  riastrad  * last exec that used the perfmon).
    434  1.1  riastrad  */
    435  1.1  riastrad struct drm_vc4_perfmon_get_values {
    436  1.1  riastrad 	__u32 id;
    437  1.1  riastrad 	__u64 values_ptr;
    438  1.1  riastrad };
    439  1.1  riastrad 
    440  1.1  riastrad #if defined(__cplusplus)
    441  1.1  riastrad }
    442  1.1  riastrad #endif
    443  1.1  riastrad 
    444  1.1  riastrad #endif /* _UAPI_VC4_DRM_H_ */
    445