122851890Sopenharmony_ci/*
222851890Sopenharmony_ci * This header was generated from the Linux kernel headers by update_headers.py,
322851890Sopenharmony_ci * to provide necessary information from kernel to userspace, such as constants,
422851890Sopenharmony_ci * structures, and macros, and thus, contains no copyrightable information.
522851890Sopenharmony_ci */
622851890Sopenharmony_ci#ifndef _UAPI_VC4_DRM_H_
722851890Sopenharmony_ci#define _UAPI_VC4_DRM_H_
822851890Sopenharmony_ci#include "drm.h"
922851890Sopenharmony_ci#if defined(__cplusplus)
1022851890Sopenharmony_ciextern "C" {
1122851890Sopenharmony_ci#endif
1222851890Sopenharmony_ci#define DRM_VC4_SUBMIT_CL                         0x00
1322851890Sopenharmony_ci#define DRM_VC4_WAIT_SEQNO                        0x01
1422851890Sopenharmony_ci#define DRM_VC4_WAIT_BO                           0x02
1522851890Sopenharmony_ci#define DRM_VC4_CREATE_BO                         0x03
1622851890Sopenharmony_ci#define DRM_VC4_MMAP_BO                           0x04
1722851890Sopenharmony_ci#define DRM_VC4_CREATE_SHADER_BO                  0x05
1822851890Sopenharmony_ci#define DRM_VC4_GET_HANG_STATE                    0x06
1922851890Sopenharmony_ci#define DRM_VC4_GET_PARAM                         0x07
2022851890Sopenharmony_ci#define DRM_VC4_SET_TILING                        0x08
2122851890Sopenharmony_ci#define DRM_VC4_GET_TILING                        0x09
2222851890Sopenharmony_ci#define DRM_VC4_LABEL_BO                          0x0a
2322851890Sopenharmony_ci#define DRM_VC4_GEM_MADVISE                       0x0b
2422851890Sopenharmony_ci#define DRM_VC4_PERFMON_CREATE                    0x0c
2522851890Sopenharmony_ci#define DRM_VC4_PERFMON_DESTROY                   0x0d
2622851890Sopenharmony_ci#define DRM_VC4_PERFMON_GET_VALUES                0x0e
2722851890Sopenharmony_ci#define DRM_IOCTL_VC4_SUBMIT_CL           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl)
2822851890Sopenharmony_ci#define DRM_IOCTL_VC4_WAIT_SEQNO          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno)
2922851890Sopenharmony_ci#define DRM_IOCTL_VC4_WAIT_BO             DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo)
3022851890Sopenharmony_ci#define DRM_IOCTL_VC4_CREATE_BO           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo)
3122851890Sopenharmony_ci#define DRM_IOCTL_VC4_MMAP_BO             DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo)
3222851890Sopenharmony_ci#define DRM_IOCTL_VC4_CREATE_SHADER_BO    DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo)
3322851890Sopenharmony_ci#define DRM_IOCTL_VC4_GET_HANG_STATE      DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state)
3422851890Sopenharmony_ci#define DRM_IOCTL_VC4_GET_PARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param)
3522851890Sopenharmony_ci#define DRM_IOCTL_VC4_SET_TILING          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling)
3622851890Sopenharmony_ci#define DRM_IOCTL_VC4_GET_TILING          DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling)
3722851890Sopenharmony_ci#define DRM_IOCTL_VC4_LABEL_BO            DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo)
3822851890Sopenharmony_ci#define DRM_IOCTL_VC4_GEM_MADVISE         DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise)
3922851890Sopenharmony_ci#define DRM_IOCTL_VC4_PERFMON_CREATE      DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create)
4022851890Sopenharmony_ci#define DRM_IOCTL_VC4_PERFMON_DESTROY     DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy)
4122851890Sopenharmony_ci#define DRM_IOCTL_VC4_PERFMON_GET_VALUES  DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values)
4222851890Sopenharmony_cistruct drm_vc4_submit_rcl_surface {
4322851890Sopenharmony_ci	__u32 hindex;
4422851890Sopenharmony_ci	__u32 offset;
4522851890Sopenharmony_ci
4622851890Sopenharmony_ci	__u16 bits;
4722851890Sopenharmony_ci#define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES		(1 << 0)
4822851890Sopenharmony_ci	__u16 flags;
4922851890Sopenharmony_ci};
5022851890Sopenharmony_cistruct drm_vc4_submit_cl {
5122851890Sopenharmony_ci
5222851890Sopenharmony_ci	__u64 bin_cl;
5322851890Sopenharmony_ci
5422851890Sopenharmony_ci	__u64 shader_rec;
5522851890Sopenharmony_ci
5622851890Sopenharmony_ci	__u64 uniforms;
5722851890Sopenharmony_ci	__u64 bo_handles;
5822851890Sopenharmony_ci
5922851890Sopenharmony_ci	__u32 bin_cl_size;
6022851890Sopenharmony_ci
6122851890Sopenharmony_ci	__u32 shader_rec_size;
6222851890Sopenharmony_ci
6322851890Sopenharmony_ci	__u32 shader_rec_count;
6422851890Sopenharmony_ci
6522851890Sopenharmony_ci	__u32 uniforms_size;
6622851890Sopenharmony_ci
6722851890Sopenharmony_ci	__u32 bo_handle_count;
6822851890Sopenharmony_ci
6922851890Sopenharmony_ci	__u16 width;
7022851890Sopenharmony_ci	__u16 height;
7122851890Sopenharmony_ci	__u8 min_x_tile;
7222851890Sopenharmony_ci	__u8 min_y_tile;
7322851890Sopenharmony_ci	__u8 max_x_tile;
7422851890Sopenharmony_ci	__u8 max_y_tile;
7522851890Sopenharmony_ci	struct drm_vc4_submit_rcl_surface color_read;
7622851890Sopenharmony_ci	struct drm_vc4_submit_rcl_surface color_write;
7722851890Sopenharmony_ci	struct drm_vc4_submit_rcl_surface zs_read;
7822851890Sopenharmony_ci	struct drm_vc4_submit_rcl_surface zs_write;
7922851890Sopenharmony_ci	struct drm_vc4_submit_rcl_surface msaa_color_write;
8022851890Sopenharmony_ci	struct drm_vc4_submit_rcl_surface msaa_zs_write;
8122851890Sopenharmony_ci	__u32 clear_color[2];
8222851890Sopenharmony_ci	__u32 clear_z;
8322851890Sopenharmony_ci	__u8 clear_s;
8422851890Sopenharmony_ci	__u32 pad:24;
8522851890Sopenharmony_ci#define VC4_SUBMIT_CL_USE_CLEAR_COLOR			(1 << 0)
8622851890Sopenharmony_ci#define VC4_SUBMIT_CL_FIXED_RCL_ORDER			(1 << 1)
8722851890Sopenharmony_ci#define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X		(1 << 2)
8822851890Sopenharmony_ci#define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y		(1 << 3)
8922851890Sopenharmony_ci	__u32 flags;
9022851890Sopenharmony_ci
9122851890Sopenharmony_ci	__u64 seqno;
9222851890Sopenharmony_ci
9322851890Sopenharmony_ci	__u32 perfmonid;
9422851890Sopenharmony_ci
9522851890Sopenharmony_ci	__u32 in_sync;
9622851890Sopenharmony_ci
9722851890Sopenharmony_ci	__u32 out_sync;
9822851890Sopenharmony_ci	__u32 pad2;
9922851890Sopenharmony_ci};
10022851890Sopenharmony_cistruct drm_vc4_wait_seqno {
10122851890Sopenharmony_ci	__u64 seqno;
10222851890Sopenharmony_ci	__u64 timeout_ns;
10322851890Sopenharmony_ci};
10422851890Sopenharmony_cistruct drm_vc4_wait_bo {
10522851890Sopenharmony_ci	__u32 handle;
10622851890Sopenharmony_ci	__u32 pad;
10722851890Sopenharmony_ci	__u64 timeout_ns;
10822851890Sopenharmony_ci};
10922851890Sopenharmony_cistruct drm_vc4_create_bo {
11022851890Sopenharmony_ci	__u32 size;
11122851890Sopenharmony_ci	__u32 flags;
11222851890Sopenharmony_ci
11322851890Sopenharmony_ci	__u32 handle;
11422851890Sopenharmony_ci	__u32 pad;
11522851890Sopenharmony_ci};
11622851890Sopenharmony_cistruct drm_vc4_mmap_bo {
11722851890Sopenharmony_ci
11822851890Sopenharmony_ci	__u32 handle;
11922851890Sopenharmony_ci	__u32 flags;
12022851890Sopenharmony_ci
12122851890Sopenharmony_ci	__u64 offset;
12222851890Sopenharmony_ci};
12322851890Sopenharmony_cistruct drm_vc4_create_shader_bo {
12422851890Sopenharmony_ci
12522851890Sopenharmony_ci	__u32 size;
12622851890Sopenharmony_ci
12722851890Sopenharmony_ci	__u32 flags;
12822851890Sopenharmony_ci
12922851890Sopenharmony_ci	__u64 data;
13022851890Sopenharmony_ci
13122851890Sopenharmony_ci	__u32 handle;
13222851890Sopenharmony_ci
13322851890Sopenharmony_ci	__u32 pad;
13422851890Sopenharmony_ci};
13522851890Sopenharmony_cistruct drm_vc4_get_hang_state_bo {
13622851890Sopenharmony_ci	__u32 handle;
13722851890Sopenharmony_ci	__u32 paddr;
13822851890Sopenharmony_ci	__u32 size;
13922851890Sopenharmony_ci	__u32 pad;
14022851890Sopenharmony_ci};
14122851890Sopenharmony_cistruct drm_vc4_get_hang_state {
14222851890Sopenharmony_ci
14322851890Sopenharmony_ci	__u64 bo;
14422851890Sopenharmony_ci
14522851890Sopenharmony_ci	__u32 bo_count;
14622851890Sopenharmony_ci	__u32 start_bin, start_render;
14722851890Sopenharmony_ci	__u32 ct0ca, ct0ea;
14822851890Sopenharmony_ci	__u32 ct1ca, ct1ea;
14922851890Sopenharmony_ci	__u32 ct0cs, ct1cs;
15022851890Sopenharmony_ci	__u32 ct0ra0, ct1ra0;
15122851890Sopenharmony_ci	__u32 bpca, bpcs;
15222851890Sopenharmony_ci	__u32 bpoa, bpos;
15322851890Sopenharmony_ci	__u32 vpmbase;
15422851890Sopenharmony_ci	__u32 dbge;
15522851890Sopenharmony_ci	__u32 fdbgo;
15622851890Sopenharmony_ci	__u32 fdbgb;
15722851890Sopenharmony_ci	__u32 fdbgr;
15822851890Sopenharmony_ci	__u32 fdbgs;
15922851890Sopenharmony_ci	__u32 errstat;
16022851890Sopenharmony_ci
16122851890Sopenharmony_ci	__u32 pad[16];
16222851890Sopenharmony_ci};
16322851890Sopenharmony_ci#define DRM_VC4_PARAM_V3D_IDENT0		0
16422851890Sopenharmony_ci#define DRM_VC4_PARAM_V3D_IDENT1		1
16522851890Sopenharmony_ci#define DRM_VC4_PARAM_V3D_IDENT2		2
16622851890Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_BRANCHES		3
16722851890Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_ETC1		4
16822851890Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_THREADED_FS	5
16922851890Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER	6
17022851890Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_MADVISE		7
17122851890Sopenharmony_ci#define DRM_VC4_PARAM_SUPPORTS_PERFMON		8
17222851890Sopenharmony_cistruct drm_vc4_get_param {
17322851890Sopenharmony_ci	__u32 param;
17422851890Sopenharmony_ci	__u32 pad;
17522851890Sopenharmony_ci	__u64 value;
17622851890Sopenharmony_ci};
17722851890Sopenharmony_cistruct drm_vc4_get_tiling {
17822851890Sopenharmony_ci	__u32 handle;
17922851890Sopenharmony_ci	__u32 flags;
18022851890Sopenharmony_ci	__u64 modifier;
18122851890Sopenharmony_ci};
18222851890Sopenharmony_cistruct drm_vc4_set_tiling {
18322851890Sopenharmony_ci	__u32 handle;
18422851890Sopenharmony_ci	__u32 flags;
18522851890Sopenharmony_ci	__u64 modifier;
18622851890Sopenharmony_ci};
18722851890Sopenharmony_cistruct drm_vc4_label_bo {
18822851890Sopenharmony_ci	__u32 handle;
18922851890Sopenharmony_ci	__u32 len;
19022851890Sopenharmony_ci	__u64 name;
19122851890Sopenharmony_ci};
19222851890Sopenharmony_ci#define VC4_MADV_WILLNEED			0
19322851890Sopenharmony_ci#define VC4_MADV_DONTNEED			1
19422851890Sopenharmony_ci#define __VC4_MADV_PURGED			2
19522851890Sopenharmony_ci#define __VC4_MADV_NOTSUPP			3
19622851890Sopenharmony_cistruct drm_vc4_gem_madvise {
19722851890Sopenharmony_ci	__u32 handle;
19822851890Sopenharmony_ci	__u32 madv;
19922851890Sopenharmony_ci	__u32 retained;
20022851890Sopenharmony_ci	__u32 pad;
20122851890Sopenharmony_ci};
20222851890Sopenharmony_cienum {
20322851890Sopenharmony_ci	VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER,
20422851890Sopenharmony_ci	VC4_PERFCNT_FEP_VALID_PRIMS_RENDER,
20522851890Sopenharmony_ci	VC4_PERFCNT_FEP_CLIPPED_QUADS,
20622851890Sopenharmony_ci	VC4_PERFCNT_FEP_VALID_QUADS,
20722851890Sopenharmony_ci	VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL,
20822851890Sopenharmony_ci	VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL,
20922851890Sopenharmony_ci	VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL,
21022851890Sopenharmony_ci	VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE,
21122851890Sopenharmony_ci	VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE,
21222851890Sopenharmony_ci	VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF,
21322851890Sopenharmony_ci	VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT,
21422851890Sopenharmony_ci	VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING,
21522851890Sopenharmony_ci	VC4_PERFCNT_PSE_PRIMS_REVERSED,
21622851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES,
21722851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING,
21822851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING,
21922851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST,
22022851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS,
22122851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD,
22222851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS,
22322851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT,
22422851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS,
22522851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT,
22622851890Sopenharmony_ci	VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS,
22722851890Sopenharmony_ci	VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED,
22822851890Sopenharmony_ci	VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS,
22922851890Sopenharmony_ci	VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED,
23022851890Sopenharmony_ci	VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED,
23122851890Sopenharmony_ci	VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT,
23222851890Sopenharmony_ci	VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS,
23322851890Sopenharmony_ci	VC4_PERFCNT_NUM_EVENTS,
23422851890Sopenharmony_ci};
23522851890Sopenharmony_ci#define DRM_VC4_MAX_PERF_COUNTERS	16
23622851890Sopenharmony_cistruct drm_vc4_perfmon_create {
23722851890Sopenharmony_ci	__u32 id;
23822851890Sopenharmony_ci	__u32 ncounters;
23922851890Sopenharmony_ci	__u8 events[DRM_VC4_MAX_PERF_COUNTERS];
24022851890Sopenharmony_ci};
24122851890Sopenharmony_cistruct drm_vc4_perfmon_destroy {
24222851890Sopenharmony_ci	__u32 id;
24322851890Sopenharmony_ci};
24422851890Sopenharmony_cistruct drm_vc4_perfmon_get_values {
24522851890Sopenharmony_ci	__u32 id;
24622851890Sopenharmony_ci	__u64 values_ptr;
24722851890Sopenharmony_ci};
24822851890Sopenharmony_ci#if defined(__cplusplus)
24922851890Sopenharmony_ci}
25022851890Sopenharmony_ci#endif
25122851890Sopenharmony_ci#endif
252