blob: e1768c6d14ec66246a59e581bccb420abef0b940 [file] [log] [blame]
Christopher Ferris05d08e92016-02-04 13:16:38 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef __AMDGPU_DRM_H__
20#define __AMDGPU_DRM_H__
21#include "drm.h"
Christopher Ferris106b3a82016-08-24 12:15:38 -070022#ifdef __cplusplus
Christopher Ferris106b3a82016-08-24 12:15:38 -070023#endif
24#define DRM_AMDGPU_GEM_CREATE 0x00
Christopher Ferris05d08e92016-02-04 13:16:38 -080025#define DRM_AMDGPU_GEM_MMAP 0x01
26#define DRM_AMDGPU_CTX 0x02
27#define DRM_AMDGPU_BO_LIST 0x03
28#define DRM_AMDGPU_CS 0x04
Christopher Ferris05d08e92016-02-04 13:16:38 -080029#define DRM_AMDGPU_INFO 0x05
30#define DRM_AMDGPU_GEM_METADATA 0x06
31#define DRM_AMDGPU_GEM_WAIT_IDLE 0x07
32#define DRM_AMDGPU_GEM_VA 0x08
Christopher Ferris05d08e92016-02-04 13:16:38 -080033#define DRM_AMDGPU_WAIT_CS 0x09
34#define DRM_AMDGPU_GEM_OP 0x10
35#define DRM_AMDGPU_GEM_USERPTR 0x11
Christopher Ferris48af7cb2017-02-21 12:35:09 -080036#define DRM_AMDGPU_WAIT_FENCES 0x12
Christopher Ferris05d08e92016-02-04 13:16:38 -080037#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
Christopher Ferris05d08e92016-02-04 13:16:38 -080038#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080039#define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx)
Christopher Ferris05d08e92016-02-04 13:16:38 -080040#define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list)
41#define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs)
Christopher Ferris05d08e92016-02-04 13:16:38 -080042#define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080043#define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata)
Christopher Ferris05d08e92016-02-04 13:16:38 -080044#define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle)
45#define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va)
Christopher Ferris05d08e92016-02-04 13:16:38 -080046#define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080047#define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
Christopher Ferris05d08e92016-02-04 13:16:38 -080048#define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080049#define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
Christopher Ferris05d08e92016-02-04 13:16:38 -080050#define AMDGPU_GEM_DOMAIN_CPU 0x1
Christopher Ferris05d08e92016-02-04 13:16:38 -080051#define AMDGPU_GEM_DOMAIN_GTT 0x2
52#define AMDGPU_GEM_DOMAIN_VRAM 0x4
53#define AMDGPU_GEM_DOMAIN_GDS 0x8
54#define AMDGPU_GEM_DOMAIN_GWS 0x10
Christopher Ferris05d08e92016-02-04 13:16:38 -080055#define AMDGPU_GEM_DOMAIN_OA 0x20
56#define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
57#define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1)
58#define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -080059#define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3)
60#define AMDGPU_GEM_CREATE_SHADOW (1 << 4)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080061#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5)
Christopher Ferris05d08e92016-02-04 13:16:38 -080062struct drm_amdgpu_gem_create_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -070063 __u64 bo_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -070064 __u64 alignment;
65 __u64 domains;
66 __u64 domain_flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080067};
68struct drm_amdgpu_gem_create_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -070069 __u32 handle;
70 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -080071};
72union drm_amdgpu_gem_create {
73 struct drm_amdgpu_gem_create_in in;
Christopher Ferris05d08e92016-02-04 13:16:38 -080074 struct drm_amdgpu_gem_create_out out;
75};
76#define AMDGPU_BO_LIST_OP_CREATE 0
77#define AMDGPU_BO_LIST_OP_DESTROY 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080078#define AMDGPU_BO_LIST_OP_UPDATE 2
79struct drm_amdgpu_bo_list_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -070080 __u32 operation;
81 __u32 list_handle;
82 __u32 bo_number;
83 __u32 bo_info_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -070084 __u64 bo_info_ptr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080085};
Christopher Ferris05d08e92016-02-04 13:16:38 -080086struct drm_amdgpu_bo_list_entry {
Christopher Ferris106b3a82016-08-24 12:15:38 -070087 __u32 bo_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070088 __u32 bo_priority;
89};
Christopher Ferris05d08e92016-02-04 13:16:38 -080090struct drm_amdgpu_bo_list_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -070091 __u32 list_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070092 __u32 _pad;
93};
Christopher Ferris05d08e92016-02-04 13:16:38 -080094union drm_amdgpu_bo_list {
95 struct drm_amdgpu_bo_list_in in;
96 struct drm_amdgpu_bo_list_out out;
97};
Christopher Ferris05d08e92016-02-04 13:16:38 -080098#define AMDGPU_CTX_OP_ALLOC_CTX 1
99#define AMDGPU_CTX_OP_FREE_CTX 2
100#define AMDGPU_CTX_OP_QUERY_STATE 3
101#define AMDGPU_CTX_NO_RESET 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800102#define AMDGPU_CTX_GUILTY_RESET 1
103#define AMDGPU_CTX_INNOCENT_RESET 2
104#define AMDGPU_CTX_UNKNOWN_RESET 3
105struct drm_amdgpu_ctx_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106 __u32 op;
107 __u32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700108 __u32 ctx_id;
109 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110};
111union drm_amdgpu_ctx_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700112 struct {
113 __u32 ctx_id;
114 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 } alloc;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700116 struct {
117 __u64 flags;
118 __u32 hangs;
119 __u32 reset_status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800120 } state;
121};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800122union drm_amdgpu_ctx {
123 struct drm_amdgpu_ctx_in in;
124 union drm_amdgpu_ctx_out out;
125};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800126#define AMDGPU_GEM_USERPTR_READONLY (1 << 0)
127#define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1)
128#define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2)
129#define AMDGPU_GEM_USERPTR_REGISTER (1 << 3)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800130struct drm_amdgpu_gem_userptr {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700131 __u64 addr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700132 __u64 size;
133 __u32 flags;
134 __u32 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135};
136#define AMDGPU_TILING_ARRAY_MODE_SHIFT 0
137#define AMDGPU_TILING_ARRAY_MODE_MASK 0xf
Christopher Ferris05d08e92016-02-04 13:16:38 -0800138#define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4
139#define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f
140#define AMDGPU_TILING_TILE_SPLIT_SHIFT 9
141#define AMDGPU_TILING_TILE_SPLIT_MASK 0x7
Christopher Ferris05d08e92016-02-04 13:16:38 -0800142#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12
143#define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7
144#define AMDGPU_TILING_BANK_WIDTH_SHIFT 15
145#define AMDGPU_TILING_BANK_WIDTH_MASK 0x3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800146#define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17
147#define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3
148#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19
149#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800150#define AMDGPU_TILING_NUM_BANKS_SHIFT 21
151#define AMDGPU_TILING_NUM_BANKS_MASK 0x3
152#define AMDGPU_TILING_SET(field,value) (((value) & AMDGPU_TILING_ ##field ##_MASK) << AMDGPU_TILING_ ##field ##_SHIFT)
153#define AMDGPU_TILING_GET(value,field) (((value) >> AMDGPU_TILING_ ##field ##_SHIFT) & AMDGPU_TILING_ ##field ##_MASK)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800154#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
155#define AMDGPU_GEM_METADATA_OP_GET_METADATA 2
156struct drm_amdgpu_gem_metadata {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700157 __u32 handle;
158 __u32 op;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800159 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700160 __u64 flags;
161 __u64 tiling_info;
162 __u32 data_size_bytes;
163 __u32 data[64];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800164 } data;
165};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800166struct drm_amdgpu_gem_mmap_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700167 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700168 __u32 _pad;
169};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800170struct drm_amdgpu_gem_mmap_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700171 __u64 addr_ptr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800172};
173union drm_amdgpu_gem_mmap {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800174 struct drm_amdgpu_gem_mmap_in in;
175 struct drm_amdgpu_gem_mmap_out out;
176};
177struct drm_amdgpu_gem_wait_idle_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700178 __u32 handle;
179 __u32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700180 __u64 timeout;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800181};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800182struct drm_amdgpu_gem_wait_idle_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700183 __u32 status;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700184 __u32 domain;
185};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800186union drm_amdgpu_gem_wait_idle {
187 struct drm_amdgpu_gem_wait_idle_in in;
188 struct drm_amdgpu_gem_wait_idle_out out;
189};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800190struct drm_amdgpu_wait_cs_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700191 __u64 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700192 __u64 timeout;
193 __u32 ip_type;
194 __u32 ip_instance;
195 __u32 ring;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700196 __u32 ctx_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800197};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800198struct drm_amdgpu_wait_cs_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700199 __u64 status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800200};
201union drm_amdgpu_wait_cs {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800202 struct drm_amdgpu_wait_cs_in in;
203 struct drm_amdgpu_wait_cs_out out;
204};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800205struct drm_amdgpu_fence {
206 __u32 ctx_id;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800207 __u32 ip_type;
208 __u32 ip_instance;
209 __u32 ring;
210 __u64 seq_no;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800211};
212struct drm_amdgpu_wait_fences_in {
213 __u64 fences;
214 __u32 fence_count;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800215 __u32 wait_all;
216 __u64 timeout_ns;
217};
218struct drm_amdgpu_wait_fences_out {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800219 __u32 status;
220 __u32 first_signaled;
221};
222union drm_amdgpu_wait_fences {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800223 struct drm_amdgpu_wait_fences_in in;
224 struct drm_amdgpu_wait_fences_out out;
225};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800226#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800227#define AMDGPU_GEM_OP_SET_PLACEMENT 1
228struct drm_amdgpu_gem_op {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700229 __u32 handle;
230 __u32 op;
231 __u64 value;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800232};
233#define AMDGPU_VA_OP_MAP 1
234#define AMDGPU_VA_OP_UNMAP 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800235#define AMDGPU_VM_DELAY_UPDATE (1 << 0)
236#define AMDGPU_VM_PAGE_READABLE (1 << 1)
237#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
238#define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800239struct drm_amdgpu_gem_va {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700240 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700241 __u32 _pad;
242 __u32 operation;
243 __u32 flags;
244 __u64 va_address;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700245 __u64 offset_in_bo;
246 __u64 map_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800247};
248#define AMDGPU_HW_IP_GFX 0
249#define AMDGPU_HW_IP_COMPUTE 1
250#define AMDGPU_HW_IP_DMA 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800251#define AMDGPU_HW_IP_UVD 3
252#define AMDGPU_HW_IP_VCE 4
253#define AMDGPU_HW_IP_NUM 5
254#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800255#define AMDGPU_CHUNK_ID_IB 0x01
256#define AMDGPU_CHUNK_ID_FENCE 0x02
257#define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03
258struct drm_amdgpu_cs_chunk {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700259 __u32 chunk_id;
260 __u32 length_dw;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700261 __u64 chunk_data;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800262};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800263struct drm_amdgpu_cs_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700264 __u32 ctx_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700265 __u32 bo_list_handle;
266 __u32 num_chunks;
267 __u32 _pad;
268 __u64 chunks;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800269};
270struct drm_amdgpu_cs_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700271 __u64 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800272};
273union drm_amdgpu_cs {
274 struct drm_amdgpu_cs_in in;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800275 struct drm_amdgpu_cs_out out;
276};
277#define AMDGPU_IB_FLAG_CE (1 << 0)
278#define AMDGPU_IB_FLAG_PREAMBLE (1 << 1)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800279struct drm_amdgpu_cs_chunk_ib {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700280 __u32 _pad;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700281 __u32 flags;
282 __u64 va_start;
283 __u32 ib_bytes;
284 __u32 ip_type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700285 __u32 ip_instance;
286 __u32 ring;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800287};
288struct drm_amdgpu_cs_chunk_dep {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700289 __u32 ip_type;
290 __u32 ip_instance;
291 __u32 ring;
292 __u32 ctx_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700293 __u64 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800294};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800295struct drm_amdgpu_cs_chunk_fence {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700296 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700297 __u32 offset;
298};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800299struct drm_amdgpu_cs_chunk_data {
300 union {
301 struct drm_amdgpu_cs_chunk_ib ib_data;
302 struct drm_amdgpu_cs_chunk_fence fence_data;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800303 };
304};
305#define AMDGPU_IDS_FLAGS_FUSION 0x1
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800306#define AMDGPU_IDS_FLAGS_PREEMPTION 0x2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800307#define AMDGPU_INFO_ACCEL_WORKING 0x00
Christopher Ferris05d08e92016-02-04 13:16:38 -0800308#define AMDGPU_INFO_CRTC_FROM_ID 0x01
309#define AMDGPU_INFO_HW_IP_INFO 0x02
310#define AMDGPU_INFO_HW_IP_COUNT 0x03
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800311#define AMDGPU_INFO_TIMESTAMP 0x05
Christopher Ferris05d08e92016-02-04 13:16:38 -0800312#define AMDGPU_INFO_FW_VERSION 0x0e
313#define AMDGPU_INFO_FW_VCE 0x1
314#define AMDGPU_INFO_FW_UVD 0x2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800315#define AMDGPU_INFO_FW_GMC 0x03
Christopher Ferris05d08e92016-02-04 13:16:38 -0800316#define AMDGPU_INFO_FW_GFX_ME 0x04
317#define AMDGPU_INFO_FW_GFX_PFP 0x05
318#define AMDGPU_INFO_FW_GFX_CE 0x06
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800319#define AMDGPU_INFO_FW_GFX_RLC 0x07
Christopher Ferris05d08e92016-02-04 13:16:38 -0800320#define AMDGPU_INFO_FW_GFX_MEC 0x08
321#define AMDGPU_INFO_FW_SMC 0x0a
322#define AMDGPU_INFO_FW_SDMA 0x0b
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800323#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
Christopher Ferris05d08e92016-02-04 13:16:38 -0800324#define AMDGPU_INFO_VRAM_USAGE 0x10
325#define AMDGPU_INFO_GTT_USAGE 0x11
326#define AMDGPU_INFO_GDS_CONFIG 0x13
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800327#define AMDGPU_INFO_VRAM_GTT 0x14
Christopher Ferris05d08e92016-02-04 13:16:38 -0800328#define AMDGPU_INFO_READ_MMR_REG 0x15
329#define AMDGPU_INFO_DEV_INFO 0x16
330#define AMDGPU_INFO_VIS_VRAM_USAGE 0x17
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800331#define AMDGPU_INFO_NUM_EVICTIONS 0x18
332#define AMDGPU_INFO_MEMORY 0x19
333#define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A
334#define AMDGPU_INFO_VBIOS 0x1B
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800335#define AMDGPU_INFO_VBIOS_SIZE 0x1
336#define AMDGPU_INFO_VBIOS_IMAGE 0x2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800337#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800338#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
339#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
340#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff
Christopher Ferris49f525c2016-12-12 14:55:36 -0800341struct drm_amdgpu_query_fw {
342 __u32 fw_type;
343 __u32 ip_instance;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800344 __u32 index;
345 __u32 _pad;
346};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800347struct drm_amdgpu_info {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700348 __u64 return_pointer;
349 __u32 return_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700350 __u32 query;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800351 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800352 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700353 __u32 id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700354 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800355 } mode_crtc;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800356 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700357 __u32 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700358 __u32 ip_instance;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800359 } query_hw_ip;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800360 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700361 __u32 dword_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700362 __u32 count;
363 __u32 instance;
364 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800365 } read_mmr_reg;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800366 struct drm_amdgpu_query_fw query_fw;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800367 struct {
368 __u32 type;
369 __u32 offset;
370 } vbios_info;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800371 };
Christopher Ferris49f525c2016-12-12 14:55:36 -0800372};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800373struct drm_amdgpu_info_gds {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700374 __u32 gds_gfx_partition_size;
375 __u32 compute_partition_size;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800376 __u32 gds_total_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700377 __u32 gws_per_gfx_partition;
378 __u32 gws_per_compute_partition;
379 __u32 oa_per_gfx_partition;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800380 __u32 oa_per_compute_partition;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700381 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800382};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800383struct drm_amdgpu_info_vram_gtt {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800384 __u64 vram_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700385 __u64 vram_cpu_accessible_size;
386 __u64 gtt_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800387};
388struct drm_amdgpu_heap_info {
389 __u64 total_heap_size;
390 __u64 usable_heap_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800391 __u64 heap_usage;
392 __u64 max_allocation;
393};
394struct drm_amdgpu_memory_info {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800395 struct drm_amdgpu_heap_info vram;
396 struct drm_amdgpu_heap_info cpu_accessible_vram;
397 struct drm_amdgpu_heap_info gtt;
398};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800399struct drm_amdgpu_info_firmware {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700400 __u32 ver;
401 __u32 feature;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800402};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800403#define AMDGPU_VRAM_TYPE_UNKNOWN 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800404#define AMDGPU_VRAM_TYPE_GDDR1 1
405#define AMDGPU_VRAM_TYPE_DDR2 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800406#define AMDGPU_VRAM_TYPE_GDDR3 3
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800407#define AMDGPU_VRAM_TYPE_GDDR4 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800408#define AMDGPU_VRAM_TYPE_GDDR5 5
409#define AMDGPU_VRAM_TYPE_HBM 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800410#define AMDGPU_VRAM_TYPE_DDR3 7
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800411struct drm_amdgpu_info_device {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700412 __u32 device_id;
413 __u32 chip_rev;
414 __u32 external_rev;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800415 __u32 pci_rev;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700416 __u32 family;
417 __u32 num_shader_engines;
418 __u32 num_shader_arrays_per_engine;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800419 __u32 gpu_counter_freq;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700420 __u64 max_engine_clock;
421 __u64 max_memory_clock;
422 __u32 cu_active_number;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800423 __u32 cu_ao_mask;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700424 __u32 cu_bitmap[4][4];
425 __u32 enabled_rb_pipes_mask;
426 __u32 num_rb_pipes;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800427 __u32 num_hw_gfx_contexts;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700428 __u32 _pad;
429 __u64 ids_flags;
430 __u64 virtual_address_offset;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800431 __u64 virtual_address_max;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700432 __u32 virtual_address_alignment;
433 __u32 pte_fragment_size;
434 __u32 gart_page_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800435 __u32 ce_ram_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700436 __u32 vram_type;
437 __u32 vram_bit_width;
438 __u32 vce_harvest_config;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800439};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800440struct drm_amdgpu_info_hw_ip {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700441 __u32 hw_ip_version_major;
442 __u32 hw_ip_version_minor;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800443 __u64 capabilities_flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700444 __u32 ib_start_alignment;
445 __u32 ib_size_alignment;
446 __u32 available_rings;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800447 __u32 _pad;
448};
449#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6
450struct drm_amdgpu_info_vce_clock_table_entry {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800451 __u32 sclk;
452 __u32 mclk;
453 __u32 eclk;
454 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800455};
456struct drm_amdgpu_info_vce_clock_table {
457 struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
458 __u32 num_valid_entries;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800459 __u32 pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800460};
461#define AMDGPU_FAMILY_UNKNOWN 0
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800462#define AMDGPU_FAMILY_SI 110
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800463#define AMDGPU_FAMILY_CI 120
Christopher Ferris49f525c2016-12-12 14:55:36 -0800464#define AMDGPU_FAMILY_KV 125
Christopher Ferris05d08e92016-02-04 13:16:38 -0800465#define AMDGPU_FAMILY_VI 130
466#define AMDGPU_FAMILY_CZ 135
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800467#ifdef __cplusplus
Christopher Ferris05d08e92016-02-04 13:16:38 -0800468#endif
Christopher Ferris49f525c2016-12-12 14:55:36 -0800469#endif