blob: 59f5260ba607e9ca4a5eb85035e97586fdec7fe9 [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 Ferris1308ad32017-11-14 17:32:13 -080037#define DRM_AMDGPU_VM 0x13
Christopher Ferris934ec942018-01-31 15:29:16 -080038#define DRM_AMDGPU_FENCE_TO_HANDLE 0x14
39#define DRM_AMDGPU_SCHED 0x15
Christopher Ferris05d08e92016-02-04 13:16:38 -080040#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 -080041#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 -080042#define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx)
Christopher Ferris05d08e92016-02-04 13:16:38 -080043#define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list)
44#define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs)
Christopher Ferris05d08e92016-02-04 13:16:38 -080045#define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080046#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 -080047#define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle)
48#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 -080049#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 -080050#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 -080051#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 -080052#define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
Christopher Ferris1308ad32017-11-14 17:32:13 -080053#define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm)
Christopher Ferris934ec942018-01-31 15:29:16 -080054#define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle)
55#define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched)
Christopher Ferris05d08e92016-02-04 13:16:38 -080056#define AMDGPU_GEM_DOMAIN_CPU 0x1
Christopher Ferris05d08e92016-02-04 13:16:38 -080057#define AMDGPU_GEM_DOMAIN_GTT 0x2
58#define AMDGPU_GEM_DOMAIN_VRAM 0x4
59#define AMDGPU_GEM_DOMAIN_GDS 0x8
60#define AMDGPU_GEM_DOMAIN_GWS 0x10
Christopher Ferris05d08e92016-02-04 13:16:38 -080061#define AMDGPU_GEM_DOMAIN_OA 0x20
62#define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
63#define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1)
64#define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -080065#define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3)
66#define AMDGPU_GEM_CREATE_SHADOW (1 << 4)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080067#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5)
Christopher Ferris934ec942018-01-31 15:29:16 -080068#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
69#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7)
Christopher Ferris05d08e92016-02-04 13:16:38 -080070struct drm_amdgpu_gem_create_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -070071 __u64 bo_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -070072 __u64 alignment;
73 __u64 domains;
74 __u64 domain_flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080075};
76struct drm_amdgpu_gem_create_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -070077 __u32 handle;
78 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -080079};
80union drm_amdgpu_gem_create {
81 struct drm_amdgpu_gem_create_in in;
Christopher Ferris05d08e92016-02-04 13:16:38 -080082 struct drm_amdgpu_gem_create_out out;
83};
84#define AMDGPU_BO_LIST_OP_CREATE 0
85#define AMDGPU_BO_LIST_OP_DESTROY 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080086#define AMDGPU_BO_LIST_OP_UPDATE 2
87struct drm_amdgpu_bo_list_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -070088 __u32 operation;
89 __u32 list_handle;
90 __u32 bo_number;
91 __u32 bo_info_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -070092 __u64 bo_info_ptr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080093};
Christopher Ferris05d08e92016-02-04 13:16:38 -080094struct drm_amdgpu_bo_list_entry {
Christopher Ferris106b3a82016-08-24 12:15:38 -070095 __u32 bo_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -070096 __u32 bo_priority;
97};
Christopher Ferris05d08e92016-02-04 13:16:38 -080098struct drm_amdgpu_bo_list_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -070099 __u32 list_handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700100 __u32 _pad;
101};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800102union drm_amdgpu_bo_list {
103 struct drm_amdgpu_bo_list_in in;
104 struct drm_amdgpu_bo_list_out out;
105};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106#define AMDGPU_CTX_OP_ALLOC_CTX 1
107#define AMDGPU_CTX_OP_FREE_CTX 2
108#define AMDGPU_CTX_OP_QUERY_STATE 3
Christopher Ferris76a1d452018-06-27 14:12:29 -0700109#define AMDGPU_CTX_OP_QUERY_STATE2 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110#define AMDGPU_CTX_NO_RESET 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111#define AMDGPU_CTX_GUILTY_RESET 1
112#define AMDGPU_CTX_INNOCENT_RESET 2
113#define AMDGPU_CTX_UNKNOWN_RESET 3
Christopher Ferris76a1d452018-06-27 14:12:29 -0700114#define AMDGPU_CTX_QUERY2_FLAGS_RESET (1 << 0)
115#define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1 << 1)
116#define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1 << 2)
Christopher Ferris934ec942018-01-31 15:29:16 -0800117#define AMDGPU_CTX_PRIORITY_UNSET - 2048
118#define AMDGPU_CTX_PRIORITY_VERY_LOW - 1023
119#define AMDGPU_CTX_PRIORITY_LOW - 512
120#define AMDGPU_CTX_PRIORITY_NORMAL 0
121#define AMDGPU_CTX_PRIORITY_HIGH 512
122#define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123struct drm_amdgpu_ctx_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700124 __u32 op;
125 __u32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126 __u32 ctx_id;
Christopher Ferris934ec942018-01-31 15:29:16 -0800127 __s32 priority;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800128};
129union drm_amdgpu_ctx_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130 struct {
131 __u32 ctx_id;
132 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800133 } alloc;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700134 struct {
135 __u64 flags;
136 __u32 hangs;
137 __u32 reset_status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800138 } state;
139};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800140union drm_amdgpu_ctx {
141 struct drm_amdgpu_ctx_in in;
142 union drm_amdgpu_ctx_out out;
143};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800144#define AMDGPU_VM_OP_RESERVE_VMID 1
145#define AMDGPU_VM_OP_UNRESERVE_VMID 2
146struct drm_amdgpu_vm_in {
147 __u32 op;
148 __u32 flags;
149};
150struct drm_amdgpu_vm_out {
151 __u64 flags;
152};
153union drm_amdgpu_vm {
154 struct drm_amdgpu_vm_in in;
155 struct drm_amdgpu_vm_out out;
156};
Christopher Ferris934ec942018-01-31 15:29:16 -0800157#define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1
158struct drm_amdgpu_sched_in {
159 __u32 op;
160 __u32 fd;
161 __s32 priority;
162 __u32 flags;
163};
164union drm_amdgpu_sched {
165 struct drm_amdgpu_sched_in in;
166};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800167#define AMDGPU_GEM_USERPTR_READONLY (1 << 0)
168#define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1)
169#define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2)
170#define AMDGPU_GEM_USERPTR_REGISTER (1 << 3)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800171struct drm_amdgpu_gem_userptr {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700172 __u64 addr;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700173 __u64 size;
174 __u32 flags;
175 __u32 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800176};
177#define AMDGPU_TILING_ARRAY_MODE_SHIFT 0
178#define AMDGPU_TILING_ARRAY_MODE_MASK 0xf
Christopher Ferris05d08e92016-02-04 13:16:38 -0800179#define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4
180#define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f
181#define AMDGPU_TILING_TILE_SPLIT_SHIFT 9
182#define AMDGPU_TILING_TILE_SPLIT_MASK 0x7
Christopher Ferris05d08e92016-02-04 13:16:38 -0800183#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12
184#define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7
185#define AMDGPU_TILING_BANK_WIDTH_SHIFT 15
186#define AMDGPU_TILING_BANK_WIDTH_MASK 0x3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800187#define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17
188#define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3
189#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19
190#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800191#define AMDGPU_TILING_NUM_BANKS_SHIFT 21
192#define AMDGPU_TILING_NUM_BANKS_MASK 0x3
Christopher Ferris525ce912017-07-26 13:12:53 -0700193#define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0
194#define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f
195#define AMDGPU_TILING_SET(field,value) (((__u64) (value) & AMDGPU_TILING_ ##field ##_MASK) << AMDGPU_TILING_ ##field ##_SHIFT)
196#define AMDGPU_TILING_GET(value,field) (((__u64) (value) >> AMDGPU_TILING_ ##field ##_SHIFT) & AMDGPU_TILING_ ##field ##_MASK)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800197#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
198#define AMDGPU_GEM_METADATA_OP_GET_METADATA 2
199struct drm_amdgpu_gem_metadata {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700200 __u32 handle;
201 __u32 op;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800202 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700203 __u64 flags;
204 __u64 tiling_info;
205 __u32 data_size_bytes;
206 __u32 data[64];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800207 } data;
208};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800209struct drm_amdgpu_gem_mmap_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700210 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700211 __u32 _pad;
212};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800213struct drm_amdgpu_gem_mmap_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700214 __u64 addr_ptr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800215};
216union drm_amdgpu_gem_mmap {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800217 struct drm_amdgpu_gem_mmap_in in;
218 struct drm_amdgpu_gem_mmap_out out;
219};
220struct drm_amdgpu_gem_wait_idle_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700221 __u32 handle;
222 __u32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700223 __u64 timeout;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800224};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800225struct drm_amdgpu_gem_wait_idle_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700226 __u32 status;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700227 __u32 domain;
228};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800229union drm_amdgpu_gem_wait_idle {
230 struct drm_amdgpu_gem_wait_idle_in in;
231 struct drm_amdgpu_gem_wait_idle_out out;
232};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800233struct drm_amdgpu_wait_cs_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700234 __u64 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700235 __u64 timeout;
236 __u32 ip_type;
237 __u32 ip_instance;
238 __u32 ring;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700239 __u32 ctx_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800240};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800241struct drm_amdgpu_wait_cs_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700242 __u64 status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800243};
244union drm_amdgpu_wait_cs {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800245 struct drm_amdgpu_wait_cs_in in;
246 struct drm_amdgpu_wait_cs_out out;
247};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800248struct drm_amdgpu_fence {
249 __u32 ctx_id;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800250 __u32 ip_type;
251 __u32 ip_instance;
252 __u32 ring;
253 __u64 seq_no;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800254};
255struct drm_amdgpu_wait_fences_in {
256 __u64 fences;
257 __u32 fence_count;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800258 __u32 wait_all;
259 __u64 timeout_ns;
260};
261struct drm_amdgpu_wait_fences_out {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800262 __u32 status;
263 __u32 first_signaled;
264};
265union drm_amdgpu_wait_fences {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800266 struct drm_amdgpu_wait_fences_in in;
267 struct drm_amdgpu_wait_fences_out out;
268};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800269#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800270#define AMDGPU_GEM_OP_SET_PLACEMENT 1
271struct drm_amdgpu_gem_op {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700272 __u32 handle;
273 __u32 op;
274 __u64 value;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800275};
276#define AMDGPU_VA_OP_MAP 1
277#define AMDGPU_VA_OP_UNMAP 2
Christopher Ferris525ce912017-07-26 13:12:53 -0700278#define AMDGPU_VA_OP_CLEAR 3
279#define AMDGPU_VA_OP_REPLACE 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800280#define AMDGPU_VM_DELAY_UPDATE (1 << 0)
281#define AMDGPU_VM_PAGE_READABLE (1 << 1)
282#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
283#define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
Christopher Ferris525ce912017-07-26 13:12:53 -0700284#define AMDGPU_VM_PAGE_PRT (1 << 4)
285#define AMDGPU_VM_MTYPE_MASK (0xf << 5)
286#define AMDGPU_VM_MTYPE_DEFAULT (0 << 5)
287#define AMDGPU_VM_MTYPE_NC (1 << 5)
288#define AMDGPU_VM_MTYPE_WC (2 << 5)
289#define AMDGPU_VM_MTYPE_CC (3 << 5)
290#define AMDGPU_VM_MTYPE_UC (4 << 5)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800291struct drm_amdgpu_gem_va {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700292 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700293 __u32 _pad;
294 __u32 operation;
295 __u32 flags;
296 __u64 va_address;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700297 __u64 offset_in_bo;
298 __u64 map_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800299};
300#define AMDGPU_HW_IP_GFX 0
301#define AMDGPU_HW_IP_COMPUTE 1
302#define AMDGPU_HW_IP_DMA 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800303#define AMDGPU_HW_IP_UVD 3
304#define AMDGPU_HW_IP_VCE 4
Christopher Ferris525ce912017-07-26 13:12:53 -0700305#define AMDGPU_HW_IP_UVD_ENC 5
Christopher Ferris1308ad32017-11-14 17:32:13 -0800306#define AMDGPU_HW_IP_VCN_DEC 6
307#define AMDGPU_HW_IP_VCN_ENC 7
308#define AMDGPU_HW_IP_NUM 8
Christopher Ferris05d08e92016-02-04 13:16:38 -0800309#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800310#define AMDGPU_CHUNK_ID_IB 0x01
311#define AMDGPU_CHUNK_ID_FENCE 0x02
312#define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03
Christopher Ferris1308ad32017-11-14 17:32:13 -0800313#define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04
314#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05
Christopher Ferris05d08e92016-02-04 13:16:38 -0800315struct drm_amdgpu_cs_chunk {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700316 __u32 chunk_id;
317 __u32 length_dw;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700318 __u64 chunk_data;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800319};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800320struct drm_amdgpu_cs_in {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700321 __u32 ctx_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700322 __u32 bo_list_handle;
323 __u32 num_chunks;
324 __u32 _pad;
325 __u64 chunks;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800326};
327struct drm_amdgpu_cs_out {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700328 __u64 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800329};
330union drm_amdgpu_cs {
331 struct drm_amdgpu_cs_in in;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800332 struct drm_amdgpu_cs_out out;
333};
334#define AMDGPU_IB_FLAG_CE (1 << 0)
335#define AMDGPU_IB_FLAG_PREAMBLE (1 << 1)
Christopher Ferris525ce912017-07-26 13:12:53 -0700336#define AMDGPU_IB_FLAG_PREEMPT (1 << 2)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800337struct drm_amdgpu_cs_chunk_ib {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700338 __u32 _pad;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700339 __u32 flags;
340 __u64 va_start;
341 __u32 ib_bytes;
342 __u32 ip_type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700343 __u32 ip_instance;
344 __u32 ring;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800345};
346struct drm_amdgpu_cs_chunk_dep {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700347 __u32 ip_type;
348 __u32 ip_instance;
349 __u32 ring;
350 __u32 ctx_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700351 __u64 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800352};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800353struct drm_amdgpu_cs_chunk_fence {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700354 __u32 handle;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700355 __u32 offset;
356};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800357struct drm_amdgpu_cs_chunk_sem {
358 __u32 handle;
359};
Christopher Ferris934ec942018-01-31 15:29:16 -0800360#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0
361#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1
362#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2
363union drm_amdgpu_fence_to_handle {
364 struct {
365 struct drm_amdgpu_fence fence;
366 __u32 what;
367 __u32 pad;
368 } in;
369 struct {
370 __u32 handle;
371 } out;
372};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800373struct drm_amdgpu_cs_chunk_data {
374 union {
375 struct drm_amdgpu_cs_chunk_ib ib_data;
376 struct drm_amdgpu_cs_chunk_fence fence_data;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800377 };
378};
379#define AMDGPU_IDS_FLAGS_FUSION 0x1
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800380#define AMDGPU_IDS_FLAGS_PREEMPTION 0x2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800381#define AMDGPU_INFO_ACCEL_WORKING 0x00
Christopher Ferris05d08e92016-02-04 13:16:38 -0800382#define AMDGPU_INFO_CRTC_FROM_ID 0x01
383#define AMDGPU_INFO_HW_IP_INFO 0x02
384#define AMDGPU_INFO_HW_IP_COUNT 0x03
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800385#define AMDGPU_INFO_TIMESTAMP 0x05
Christopher Ferris05d08e92016-02-04 13:16:38 -0800386#define AMDGPU_INFO_FW_VERSION 0x0e
387#define AMDGPU_INFO_FW_VCE 0x1
388#define AMDGPU_INFO_FW_UVD 0x2
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800389#define AMDGPU_INFO_FW_GMC 0x03
Christopher Ferris05d08e92016-02-04 13:16:38 -0800390#define AMDGPU_INFO_FW_GFX_ME 0x04
391#define AMDGPU_INFO_FW_GFX_PFP 0x05
392#define AMDGPU_INFO_FW_GFX_CE 0x06
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800393#define AMDGPU_INFO_FW_GFX_RLC 0x07
Christopher Ferris05d08e92016-02-04 13:16:38 -0800394#define AMDGPU_INFO_FW_GFX_MEC 0x08
395#define AMDGPU_INFO_FW_SMC 0x0a
396#define AMDGPU_INFO_FW_SDMA 0x0b
Christopher Ferris525ce912017-07-26 13:12:53 -0700397#define AMDGPU_INFO_FW_SOS 0x0c
398#define AMDGPU_INFO_FW_ASD 0x0d
Christopher Ferris76a1d452018-06-27 14:12:29 -0700399#define AMDGPU_INFO_FW_VCN 0x0e
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800400#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
Christopher Ferris05d08e92016-02-04 13:16:38 -0800401#define AMDGPU_INFO_VRAM_USAGE 0x10
402#define AMDGPU_INFO_GTT_USAGE 0x11
403#define AMDGPU_INFO_GDS_CONFIG 0x13
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800404#define AMDGPU_INFO_VRAM_GTT 0x14
Christopher Ferris05d08e92016-02-04 13:16:38 -0800405#define AMDGPU_INFO_READ_MMR_REG 0x15
406#define AMDGPU_INFO_DEV_INFO 0x16
407#define AMDGPU_INFO_VIS_VRAM_USAGE 0x17
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800408#define AMDGPU_INFO_NUM_EVICTIONS 0x18
409#define AMDGPU_INFO_MEMORY 0x19
410#define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A
411#define AMDGPU_INFO_VBIOS 0x1B
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800412#define AMDGPU_INFO_VBIOS_SIZE 0x1
413#define AMDGPU_INFO_VBIOS_IMAGE 0x2
Christopher Ferris525ce912017-07-26 13:12:53 -0700414#define AMDGPU_INFO_NUM_HANDLES 0x1C
415#define AMDGPU_INFO_SENSOR 0x1D
416#define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1
417#define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2
418#define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3
419#define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4
420#define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5
421#define AMDGPU_INFO_SENSOR_VDDNB 0x6
422#define AMDGPU_INFO_SENSOR_VDDGFX 0x7
Christopher Ferris76a1d452018-06-27 14:12:29 -0700423#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8
424#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9
Christopher Ferris1308ad32017-11-14 17:32:13 -0800425#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E
Christopher Ferris934ec942018-01-31 15:29:16 -0800426#define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F
Christopher Ferris05d08e92016-02-04 13:16:38 -0800427#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800428#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
429#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
430#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff
Christopher Ferris49f525c2016-12-12 14:55:36 -0800431struct drm_amdgpu_query_fw {
432 __u32 fw_type;
433 __u32 ip_instance;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800434 __u32 index;
435 __u32 _pad;
436};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800437struct drm_amdgpu_info {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700438 __u64 return_pointer;
439 __u32 return_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700440 __u32 query;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800441 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800442 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700443 __u32 id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700444 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800445 } mode_crtc;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800446 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700447 __u32 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700448 __u32 ip_instance;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800449 } query_hw_ip;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800450 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700451 __u32 dword_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700452 __u32 count;
453 __u32 instance;
454 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800455 } read_mmr_reg;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800456 struct drm_amdgpu_query_fw query_fw;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800457 struct {
458 __u32 type;
459 __u32 offset;
460 } vbios_info;
Christopher Ferris525ce912017-07-26 13:12:53 -0700461 struct {
462 __u32 type;
463 } sensor_info;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800464 };
Christopher Ferris49f525c2016-12-12 14:55:36 -0800465};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800466struct drm_amdgpu_info_gds {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700467 __u32 gds_gfx_partition_size;
468 __u32 compute_partition_size;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800469 __u32 gds_total_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700470 __u32 gws_per_gfx_partition;
471 __u32 gws_per_compute_partition;
472 __u32 oa_per_gfx_partition;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800473 __u32 oa_per_compute_partition;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700474 __u32 _pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800475};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800476struct drm_amdgpu_info_vram_gtt {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800477 __u64 vram_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700478 __u64 vram_cpu_accessible_size;
479 __u64 gtt_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800480};
481struct drm_amdgpu_heap_info {
482 __u64 total_heap_size;
483 __u64 usable_heap_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800484 __u64 heap_usage;
485 __u64 max_allocation;
486};
487struct drm_amdgpu_memory_info {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800488 struct drm_amdgpu_heap_info vram;
489 struct drm_amdgpu_heap_info cpu_accessible_vram;
490 struct drm_amdgpu_heap_info gtt;
491};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800492struct drm_amdgpu_info_firmware {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700493 __u32 ver;
494 __u32 feature;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800495};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800496#define AMDGPU_VRAM_TYPE_UNKNOWN 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800497#define AMDGPU_VRAM_TYPE_GDDR1 1
498#define AMDGPU_VRAM_TYPE_DDR2 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800499#define AMDGPU_VRAM_TYPE_GDDR3 3
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800500#define AMDGPU_VRAM_TYPE_GDDR4 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800501#define AMDGPU_VRAM_TYPE_GDDR5 5
502#define AMDGPU_VRAM_TYPE_HBM 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800503#define AMDGPU_VRAM_TYPE_DDR3 7
Christopher Ferris76a1d452018-06-27 14:12:29 -0700504#define AMDGPU_VRAM_TYPE_DDR4 8
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800505struct drm_amdgpu_info_device {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700506 __u32 device_id;
507 __u32 chip_rev;
508 __u32 external_rev;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800509 __u32 pci_rev;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700510 __u32 family;
511 __u32 num_shader_engines;
512 __u32 num_shader_arrays_per_engine;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800513 __u32 gpu_counter_freq;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700514 __u64 max_engine_clock;
515 __u64 max_memory_clock;
516 __u32 cu_active_number;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800517 __u32 cu_ao_mask;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700518 __u32 cu_bitmap[4][4];
519 __u32 enabled_rb_pipes_mask;
520 __u32 num_rb_pipes;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800521 __u32 num_hw_gfx_contexts;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700522 __u32 _pad;
523 __u64 ids_flags;
524 __u64 virtual_address_offset;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800525 __u64 virtual_address_max;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700526 __u32 virtual_address_alignment;
527 __u32 pte_fragment_size;
528 __u32 gart_page_size;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800529 __u32 ce_ram_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700530 __u32 vram_type;
531 __u32 vram_bit_width;
532 __u32 vce_harvest_config;
Christopher Ferris525ce912017-07-26 13:12:53 -0700533 __u32 gc_double_offchip_lds_buf;
534 __u64 prim_buf_gpu_addr;
535 __u64 pos_buf_gpu_addr;
536 __u64 cntl_sb_buf_gpu_addr;
537 __u64 param_buf_gpu_addr;
538 __u32 prim_buf_size;
539 __u32 pos_buf_size;
540 __u32 cntl_sb_buf_size;
541 __u32 param_buf_size;
542 __u32 wave_front_size;
543 __u32 num_shader_visible_vgprs;
544 __u32 num_cu_per_sh;
545 __u32 num_tcc_blocks;
546 __u32 gs_vgt_table_depth;
547 __u32 gs_prim_buffer_depth;
548 __u32 max_gs_waves_per_vgt;
549 __u32 _pad1;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800550 __u32 cu_ao_bitmap[4][4];
Christopher Ferris76a1d452018-06-27 14:12:29 -0700551 __u64 high_va_offset;
552 __u64 high_va_max;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800553};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800554struct drm_amdgpu_info_hw_ip {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700555 __u32 hw_ip_version_major;
556 __u32 hw_ip_version_minor;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800557 __u64 capabilities_flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700558 __u32 ib_start_alignment;
559 __u32 ib_size_alignment;
560 __u32 available_rings;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800561 __u32 _pad;
562};
Christopher Ferris525ce912017-07-26 13:12:53 -0700563struct drm_amdgpu_info_num_handles {
564 __u32 uvd_max_handles;
565 __u32 uvd_used_handles;
566};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800567#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6
568struct drm_amdgpu_info_vce_clock_table_entry {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800569 __u32 sclk;
570 __u32 mclk;
571 __u32 eclk;
572 __u32 pad;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800573};
574struct drm_amdgpu_info_vce_clock_table {
575 struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
576 __u32 num_valid_entries;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800577 __u32 pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800578};
579#define AMDGPU_FAMILY_UNKNOWN 0
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800580#define AMDGPU_FAMILY_SI 110
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800581#define AMDGPU_FAMILY_CI 120
Christopher Ferris49f525c2016-12-12 14:55:36 -0800582#define AMDGPU_FAMILY_KV 125
Christopher Ferris05d08e92016-02-04 13:16:38 -0800583#define AMDGPU_FAMILY_VI 130
584#define AMDGPU_FAMILY_CZ 135
Christopher Ferris525ce912017-07-26 13:12:53 -0700585#define AMDGPU_FAMILY_AI 141
Christopher Ferris1308ad32017-11-14 17:32:13 -0800586#define AMDGPU_FAMILY_RV 142
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800587#ifdef __cplusplus
Christopher Ferris05d08e92016-02-04 13:16:38 -0800588#endif
Christopher Ferris49f525c2016-12-12 14:55:36 -0800589#endif