diff options
author | Alex Deucher | 2015-04-20 11:04:22 -0500 |
---|---|---|
committer | Alex Deucher | 2015-08-05 12:47:48 -0500 |
commit | 09361395363805b5892d48d7bc10cf717e4d2927 (patch) | |
tree | c81192a93843d2f9af16df2b9ec71a66579314d5 /include/drm/amdgpu_drm.h | |
parent | a3c89dda5b519f6b217bebe97f6795b820931b78 (diff) | |
download | external-libgbm-09361395363805b5892d48d7bc10cf717e4d2927.tar.gz external-libgbm-09361395363805b5892d48d7bc10cf717e4d2927.tar.xz external-libgbm-09361395363805b5892d48d7bc10cf717e4d2927.zip |
drm: add libdrm_amdgpu (v7)
This is the new ioctl wrapper used by the new admgpu driver.
It's primarily used by xf86-video-amdgpu and mesa.
v2: fix amdgpu_drm.h install
v3: Integrate some of the sugestions from Emil:
clean up Makefile.am, configure.ac
capitalize header guards
fix _FILE_OFFSET_BITS with config.h
use drm_mmap/drm_munmap
Remove unused ARRAY_SIZE macro
use shared list implementation
use shared math implementation
use drmGetNodeTypeFromFd helper
v4: remove unused tiling defines
v5: include amdgpu.h in Makefile.am
v6: update amdgpu_drm.h
v7: libdrm.h -> libdrm_macros.h
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'include/drm/amdgpu_drm.h')
-rw-r--r-- | include/drm/amdgpu_drm.h | 590 |
1 files changed, 590 insertions, 0 deletions
diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h new file mode 100644 index 00000000..566eb072 --- /dev/null +++ b/include/drm/amdgpu_drm.h | |||
@@ -0,0 +1,590 @@ | |||
1 | /* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*- | ||
2 | * | ||
3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | ||
4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | ||
5 | * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. | ||
6 | * Copyright 2014 Advanced Micro Devices, Inc. | ||
7 | * | ||
8 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
9 | * copy of this software and associated documentation files (the "Software"), | ||
10 | * to deal in the Software without restriction, including without limitation | ||
11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
12 | * and/or sell copies of the Software, and to permit persons to whom the | ||
13 | * Software is furnished to do so, subject to the following conditions: | ||
14 | * | ||
15 | * The above copyright notice and this permission notice shall be included in | ||
16 | * all copies or substantial portions of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
24 | * OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | * Authors: | ||
27 | * Kevin E. Martin <martin@valinux.com> | ||
28 | * Gareth Hughes <gareth@valinux.com> | ||
29 | * Keith Whitwell <keith@tungstengraphics.com> | ||
30 | */ | ||
31 | |||
32 | #ifndef __AMDGPU_DRM_H__ | ||
33 | #define __AMDGPU_DRM_H__ | ||
34 | |||
35 | #include <drm.h> | ||
36 | |||
37 | #define DRM_AMDGPU_GEM_CREATE 0x00 | ||
38 | #define DRM_AMDGPU_GEM_MMAP 0x01 | ||
39 | #define DRM_AMDGPU_CTX 0x02 | ||
40 | #define DRM_AMDGPU_BO_LIST 0x03 | ||
41 | #define DRM_AMDGPU_CS 0x04 | ||
42 | #define DRM_AMDGPU_INFO 0x05 | ||
43 | #define DRM_AMDGPU_GEM_METADATA 0x06 | ||
44 | #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 | ||
45 | #define DRM_AMDGPU_GEM_VA 0x08 | ||
46 | #define DRM_AMDGPU_WAIT_CS 0x09 | ||
47 | #define DRM_AMDGPU_GEM_OP 0x10 | ||
48 | #define DRM_AMDGPU_GEM_USERPTR 0x11 | ||
49 | |||
50 | #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) | ||
51 | #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) | ||
52 | #define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx) | ||
53 | #define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list) | ||
54 | #define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs) | ||
55 | #define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info) | ||
56 | #define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata) | ||
57 | #define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle) | ||
58 | #define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, union drm_amdgpu_gem_va) | ||
59 | #define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) | ||
60 | #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) | ||
61 | #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) | ||
62 | |||
63 | #define AMDGPU_GEM_DOMAIN_CPU 0x1 | ||
64 | #define AMDGPU_GEM_DOMAIN_GTT 0x2 | ||
65 | #define AMDGPU_GEM_DOMAIN_VRAM 0x4 | ||
66 | #define AMDGPU_GEM_DOMAIN_GDS 0x8 | ||
67 | #define AMDGPU_GEM_DOMAIN_GWS 0x10 | ||
68 | #define AMDGPU_GEM_DOMAIN_OA 0x20 | ||
69 | |||
70 | #define AMDGPU_GEM_DOMAIN_MASK 0x3F | ||
71 | |||
72 | /* Flag that CPU access will be required for the case of VRAM domain */ | ||
73 | #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0) | ||
74 | /* Flag that CPU access will not work, this VRAM domain is invisible */ | ||
75 | #define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1) | ||
76 | /* Flag that un-cached attributes should be used for GTT */ | ||
77 | #define AMDGPU_GEM_CREATE_CPU_GTT_UC (1 << 2) | ||
78 | /* Flag that USWC attributes should be used for GTT */ | ||
79 | #define AMDGPU_GEM_CREATE_CPU_GTT_WC (1 << 3) | ||
80 | |||
81 | /* Flag mask for GTT domain_flags */ | ||
82 | #define AMDGPU_GEM_CREATE_CPU_GTT_MASK \ | ||
83 | (AMDGPU_GEM_CREATE_CPU_GTT_WC | \ | ||
84 | AMDGPU_GEM_CREATE_CPU_GTT_UC | \ | ||
85 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | \ | ||
86 | AMDGPU_GEM_CREATE_NO_CPU_ACCESS) | ||
87 | |||
88 | struct drm_amdgpu_gem_create_in { | ||
89 | /** the requested memory size */ | ||
90 | uint64_t bo_size; | ||
91 | /** physical start_addr alignment in bytes for some HW requirements */ | ||
92 | uint64_t alignment; | ||
93 | /** the requested memory domains */ | ||
94 | uint64_t domains; | ||
95 | /** allocation flags */ | ||
96 | uint64_t domain_flags; | ||
97 | }; | ||
98 | |||
99 | struct drm_amdgpu_gem_create_out { | ||
100 | /** returned GEM object handle */ | ||
101 | uint32_t handle; | ||
102 | uint32_t _pad; | ||
103 | }; | ||
104 | |||
105 | union drm_amdgpu_gem_create { | ||
106 | struct drm_amdgpu_gem_create_in in; | ||
107 | struct drm_amdgpu_gem_create_out out; | ||
108 | }; | ||
109 | |||
110 | /** Opcode to create new residency list. */ | ||
111 | #define AMDGPU_BO_LIST_OP_CREATE 0 | ||
112 | /** Opcode to destroy previously created residency list */ | ||
113 | #define AMDGPU_BO_LIST_OP_DESTROY 1 | ||
114 | /** Opcode to update resource information in the list */ | ||
115 | #define AMDGPU_BO_LIST_OP_UPDATE 2 | ||
116 | |||
117 | struct drm_amdgpu_bo_list_in { | ||
118 | /** Type of operation */ | ||
119 | uint32_t operation; | ||
120 | /** Handle of list or 0 if we want to create one */ | ||
121 | uint32_t list_handle; | ||
122 | /** Number of BOs in list */ | ||
123 | uint32_t bo_number; | ||
124 | /** Size of each element describing BO */ | ||
125 | uint32_t bo_info_size; | ||
126 | /** Pointer to array describing BOs */ | ||
127 | uint64_t bo_info_ptr; | ||
128 | }; | ||
129 | |||
130 | struct drm_amdgpu_bo_list_entry { | ||
131 | /** Handle of BO */ | ||
132 | uint32_t bo_handle; | ||
133 | /** New (if specified) BO priority to be used during migration */ | ||
134 | uint32_t bo_priority; | ||
135 | }; | ||
136 | |||
137 | struct drm_amdgpu_bo_list_out { | ||
138 | /** Handle of resource list */ | ||
139 | uint32_t list_handle; | ||
140 | uint32_t _pad; | ||
141 | }; | ||
142 | |||
143 | union drm_amdgpu_bo_list { | ||
144 | struct drm_amdgpu_bo_list_in in; | ||
145 | struct drm_amdgpu_bo_list_out out; | ||
146 | }; | ||
147 | |||
148 | /* context related */ | ||
149 | #define AMDGPU_CTX_OP_ALLOC_CTX 1 | ||
150 | #define AMDGPU_CTX_OP_FREE_CTX 2 | ||
151 | #define AMDGPU_CTX_OP_QUERY_STATE 3 | ||
152 | |||
153 | #define AMDGPU_CTX_OP_STATE_RUNNING 1 | ||
154 | |||
155 | struct drm_amdgpu_ctx_in { | ||
156 | uint32_t op; | ||
157 | uint32_t flags; | ||
158 | uint32_t ctx_id; | ||
159 | uint32_t _pad; | ||
160 | }; | ||
161 | |||
162 | union drm_amdgpu_ctx_out { | ||
163 | struct { | ||
164 | uint32_t ctx_id; | ||
165 | uint32_t _pad; | ||
166 | } alloc; | ||
167 | |||
168 | struct { | ||
169 | uint64_t flags; | ||
170 | uint64_t hangs; | ||
171 | } state; | ||
172 | }; | ||
173 | |||
174 | union drm_amdgpu_ctx { | ||
175 | struct drm_amdgpu_ctx_in in; | ||
176 | union drm_amdgpu_ctx_out out; | ||
177 | }; | ||
178 | |||
179 | /* | ||
180 | * This is not a reliable API and you should expect it to fail for any | ||
181 | * number of reasons and have fallback path that do not use userptr to | ||
182 | * perform any operation. | ||
183 | */ | ||
184 | #define AMDGPU_GEM_USERPTR_READONLY (1 << 0) | ||
185 | #define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1) | ||
186 | #define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2) | ||
187 | #define AMDGPU_GEM_USERPTR_REGISTER (1 << 3) | ||
188 | |||
189 | struct drm_amdgpu_gem_userptr { | ||
190 | uint64_t addr; | ||
191 | uint64_t size; | ||
192 | uint32_t flags; | ||
193 | uint32_t handle; | ||
194 | }; | ||
195 | |||
196 | #define AMDGPU_TILING_MACRO 0x1 | ||
197 | #define AMDGPU_TILING_MICRO 0x2 | ||
198 | #define AMDGPU_TILING_SWAP_16BIT 0x4 | ||
199 | #define AMDGPU_TILING_R600_NO_SCANOUT AMDGPU_TILING_SWAP_16BIT | ||
200 | #define AMDGPU_TILING_SWAP_32BIT 0x8 | ||
201 | /* this object requires a surface when mapped - i.e. front buffer */ | ||
202 | #define AMDGPU_TILING_SURFACE 0x10 | ||
203 | #define AMDGPU_TILING_MICRO_SQUARE 0x20 | ||
204 | #define AMDGPU_TILING_EG_BANKW_SHIFT 8 | ||
205 | #define AMDGPU_TILING_EG_BANKW_MASK 0xf | ||
206 | #define AMDGPU_TILING_EG_BANKH_SHIFT 12 | ||
207 | #define AMDGPU_TILING_EG_BANKH_MASK 0xf | ||
208 | #define AMDGPU_TILING_EG_MACRO_TILE_ASPECT_SHIFT 16 | ||
209 | #define AMDGPU_TILING_EG_MACRO_TILE_ASPECT_MASK 0xf | ||
210 | #define AMDGPU_TILING_EG_TILE_SPLIT_SHIFT 24 | ||
211 | #define AMDGPU_TILING_EG_TILE_SPLIT_MASK 0xf | ||
212 | #define AMDGPU_TILING_EG_STENCIL_TILE_SPLIT_SHIFT 28 | ||
213 | #define AMDGPU_TILING_EG_STENCIL_TILE_SPLIT_MASK 0xf | ||
214 | |||
215 | #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1 | ||
216 | #define AMDGPU_GEM_METADATA_OP_GET_METADATA 2 | ||
217 | |||
218 | /** The same structure is shared for input/output */ | ||
219 | struct drm_amdgpu_gem_metadata { | ||
220 | uint32_t handle; /* GEM Object handle */ | ||
221 | uint32_t op; /** Do we want get or set metadata */ | ||
222 | struct { | ||
223 | uint64_t flags; | ||
224 | uint64_t tiling_info; /* family specific tiling info */ | ||
225 | uint32_t data_size_bytes; | ||
226 | uint32_t data[64]; | ||
227 | } data; | ||
228 | }; | ||
229 | |||
230 | struct drm_amdgpu_gem_mmap_in { | ||
231 | uint32_t handle; /** the GEM object handle */ | ||
232 | uint32_t _pad; | ||
233 | }; | ||
234 | |||
235 | struct drm_amdgpu_gem_mmap_out { | ||
236 | uint64_t addr_ptr; /** mmap offset from the vma offset manager */ | ||
237 | }; | ||
238 | |||
239 | union drm_amdgpu_gem_mmap { | ||
240 | struct drm_amdgpu_gem_mmap_in in; | ||
241 | struct drm_amdgpu_gem_mmap_out out; | ||
242 | }; | ||
243 | |||
244 | struct drm_amdgpu_gem_wait_idle_in { | ||
245 | uint32_t handle; /* GEM object handle */ | ||
246 | uint32_t flags; | ||
247 | uint64_t timeout; /* Timeout to wait. If 0 then returned immediately with the status */ | ||
248 | }; | ||
249 | |||
250 | struct drm_amdgpu_gem_wait_idle_out { | ||
251 | uint32_t status; /* BO status: 0 - BO is idle, 1 - BO is busy */ | ||
252 | uint32_t domain; /* Returned current memory domain */ | ||
253 | }; | ||
254 | |||
255 | union drm_amdgpu_gem_wait_idle { | ||
256 | struct drm_amdgpu_gem_wait_idle_in in; | ||
257 | struct drm_amdgpu_gem_wait_idle_out out; | ||
258 | }; | ||
259 | |||
260 | struct drm_amdgpu_wait_cs_in { | ||
261 | uint64_t handle; | ||
262 | uint64_t timeout; | ||
263 | uint32_t ip_type; | ||
264 | uint32_t ip_instance; | ||
265 | uint32_t ring; | ||
266 | uint32_t _pad; | ||
267 | }; | ||
268 | |||
269 | struct drm_amdgpu_wait_cs_out { | ||
270 | uint64_t status; | ||
271 | }; | ||
272 | |||
273 | union drm_amdgpu_wait_cs { | ||
274 | struct drm_amdgpu_wait_cs_in in; | ||
275 | struct drm_amdgpu_wait_cs_out out; | ||
276 | }; | ||
277 | |||
278 | /* Sets or returns a value associated with a buffer. */ | ||
279 | struct drm_amdgpu_gem_op { | ||
280 | uint32_t handle; /* buffer */ | ||
281 | uint32_t op; /* AMDGPU_GEM_OP_* */ | ||
282 | uint64_t value; /* input or return value */ | ||
283 | }; | ||
284 | |||
285 | #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 | ||
286 | #define AMDGPU_GEM_OP_SET_INITIAL_DOMAIN 1 | ||
287 | |||
288 | #define AMDGPU_VA_OP_MAP 1 | ||
289 | #define AMDGPU_VA_OP_UNMAP 2 | ||
290 | |||
291 | #define AMDGPU_VA_RESULT_OK 0 | ||
292 | #define AMDGPU_VA_RESULT_ERROR 1 | ||
293 | #define AMDGPU_VA_RESULT_VA_INVALID_ALIGNMENT 2 | ||
294 | |||
295 | /* Mapping flags */ | ||
296 | /* readable mapping */ | ||
297 | #define AMDGPU_VM_PAGE_READABLE (1 << 1) | ||
298 | /* writable mapping */ | ||
299 | #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) | ||
300 | /* executable mapping, new for VI */ | ||
301 | #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) | ||
302 | |||
303 | struct drm_amdgpu_gem_va_in { | ||
304 | /* GEM object handle */ | ||
305 | uint32_t handle; | ||
306 | uint32_t _pad; | ||
307 | /* map or unmap*/ | ||
308 | uint32_t operation; | ||
309 | /* specify mapping flags */ | ||
310 | uint32_t flags; | ||
311 | /* va address to assign . Must be correctly aligned.*/ | ||
312 | uint64_t va_address; | ||
313 | /* Specify offset inside of BO to assign. Must be correctly aligned.*/ | ||
314 | uint64_t offset_in_bo; | ||
315 | /* Specify mapping size. If 0 and offset is 0 then map the whole BO.*/ | ||
316 | /* Must be correctly aligned. */ | ||
317 | uint64_t map_size; | ||
318 | }; | ||
319 | |||
320 | struct drm_amdgpu_gem_va_out { | ||
321 | uint32_t result; | ||
322 | uint32_t _pad; | ||
323 | }; | ||
324 | |||
325 | union drm_amdgpu_gem_va { | ||
326 | struct drm_amdgpu_gem_va_in in; | ||
327 | struct drm_amdgpu_gem_va_out out; | ||
328 | }; | ||
329 | |||
330 | #define AMDGPU_HW_IP_GFX 0 | ||
331 | #define AMDGPU_HW_IP_COMPUTE 1 | ||
332 | #define AMDGPU_HW_IP_DMA 2 | ||
333 | #define AMDGPU_HW_IP_UVD 3 | ||
334 | #define AMDGPU_HW_IP_VCE 4 | ||
335 | #define AMDGPU_HW_IP_NUM 5 | ||
336 | |||
337 | #define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1 | ||
338 | |||
339 | #define AMDGPU_CHUNK_ID_IB 0x01 | ||
340 | #define AMDGPU_CHUNK_ID_FENCE 0x02 | ||
341 | struct drm_amdgpu_cs_chunk { | ||
342 | uint32_t chunk_id; | ||
343 | uint32_t length_dw; | ||
344 | uint64_t chunk_data; | ||
345 | }; | ||
346 | |||
347 | struct drm_amdgpu_cs_in { | ||
348 | /** Rendering context id */ | ||
349 | uint32_t ctx_id; | ||
350 | /** Handle of resource list associated with CS */ | ||
351 | uint32_t bo_list_handle; | ||
352 | uint32_t num_chunks; | ||
353 | uint32_t _pad; | ||
354 | /* this points to uint64_t * which point to cs chunks */ | ||
355 | uint64_t chunks; | ||
356 | }; | ||
357 | |||
358 | struct drm_amdgpu_cs_out { | ||
359 | uint64_t handle; | ||
360 | }; | ||
361 | |||
362 | union drm_amdgpu_cs { | ||
363 | struct drm_amdgpu_cs_in in; | ||
364 | struct drm_amdgpu_cs_out out; | ||
365 | }; | ||
366 | |||
367 | /* Specify flags to be used for IB */ | ||
368 | |||
369 | /* This IB should be submitted to CE */ | ||
370 | #define AMDGPU_IB_FLAG_CE (1<<0) | ||
371 | |||
372 | /* GDS is used by this IB */ | ||
373 | #define AMDGPU_IB_FLAG_GDS (1<<1) | ||
374 | |||
375 | struct drm_amdgpu_cs_chunk_ib { | ||
376 | /** | ||
377 | * Handle of GEM object to be used as IB or 0 if it is already in | ||
378 | * residency list. | ||
379 | */ | ||
380 | uint32_t handle; | ||
381 | uint32_t flags; /* IB Flags */ | ||
382 | uint64_t va_start; /* Virtual address to begin IB execution */ | ||
383 | uint32_t ib_bytes; /* Size of submission */ | ||
384 | uint32_t ip_type; /* HW IP to submit to */ | ||
385 | uint32_t ip_instance; /* HW IP index of the same type to submit to */ | ||
386 | uint32_t ring; /* Ring index to submit to */ | ||
387 | }; | ||
388 | |||
389 | struct drm_amdgpu_cs_chunk_fence { | ||
390 | uint32_t handle; | ||
391 | uint32_t offset; | ||
392 | }; | ||
393 | |||
394 | struct drm_amdgpu_cs_chunk_data { | ||
395 | union { | ||
396 | struct drm_amdgpu_cs_chunk_ib ib_data; | ||
397 | struct drm_amdgpu_cs_chunk_fence fence_data; | ||
398 | }; | ||
399 | }; | ||
400 | |||
401 | /** | ||
402 | * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU | ||
403 | * | ||
404 | */ | ||
405 | #define AMDGPU_IDS_FLAGS_FUSION 0x1 | ||
406 | |||
407 | /* indicate if acceleration can be working */ | ||
408 | #define AMDGPU_INFO_ACCEL_WORKING 0x00 | ||
409 | /* get the crtc_id from the mode object id? */ | ||
410 | #define AMDGPU_INFO_CRTC_FROM_ID 0x01 | ||
411 | /* query hw IP info */ | ||
412 | #define AMDGPU_INFO_HW_IP_INFO 0x02 | ||
413 | /* query hw IP instance count for the specified type */ | ||
414 | #define AMDGPU_INFO_HW_IP_COUNT 0x03 | ||
415 | /* timestamp for GL_ARB_timer_query */ | ||
416 | #define AMDGPU_INFO_TIMESTAMP 0x05 | ||
417 | /* Query the firmware version */ | ||
418 | #define AMDGPU_INFO_FW_VERSION 0x0e | ||
419 | /* Subquery id: Query VCE firmware version */ | ||
420 | #define AMDGPU_INFO_FW_VCE 0x1 | ||
421 | /* Subquery id: Query UVD firmware version */ | ||
422 | #define AMDGPU_INFO_FW_UVD 0x2 | ||
423 | /* Subquery id: Query GMC firmware version */ | ||
424 | #define AMDGPU_INFO_FW_GMC 0x03 | ||
425 | /* Subquery id: Query GFX ME firmware version */ | ||
426 | #define AMDGPU_INFO_FW_GFX_ME 0x04 | ||
427 | /* Subquery id: Query GFX PFP firmware version */ | ||
428 | #define AMDGPU_INFO_FW_GFX_PFP 0x05 | ||
429 | /* Subquery id: Query GFX CE firmware version */ | ||
430 | #define AMDGPU_INFO_FW_GFX_CE 0x06 | ||
431 | /* Subquery id: Query GFX RLC firmware version */ | ||
432 | #define AMDGPU_INFO_FW_GFX_RLC 0x07 | ||
433 | /* Subquery id: Query GFX MEC firmware version */ | ||
434 | #define AMDGPU_INFO_FW_GFX_MEC 0x08 | ||
435 | /* Subquery id: Query SMC firmware version */ | ||
436 | #define AMDGPU_INFO_FW_SMC 0x0a | ||
437 | /* Subquery id: Query SDMA firmware version */ | ||
438 | #define AMDGPU_INFO_FW_SDMA 0x0b | ||
439 | /* number of bytes moved for TTM migration */ | ||
440 | #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f | ||
441 | /* the used VRAM size */ | ||
442 | #define AMDGPU_INFO_VRAM_USAGE 0x10 | ||
443 | /* the used GTT size */ | ||
444 | #define AMDGPU_INFO_GTT_USAGE 0x11 | ||
445 | /* Information about GDS, etc. resource configuration */ | ||
446 | #define AMDGPU_INFO_GDS_CONFIG 0x13 | ||
447 | /* Query information about VRAM and GTT domains */ | ||
448 | #define AMDGPU_INFO_VRAM_GTT 0x14 | ||
449 | /* Query information about register in MMR address space*/ | ||
450 | #define AMDGPU_INFO_READ_MMR_REG 0x15 | ||
451 | /* Query information about device: rev id, family, etc. */ | ||
452 | #define AMDGPU_INFO_DEV_INFO 0x16 | ||
453 | /* visible vram usage */ | ||
454 | #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 | ||
455 | |||
456 | #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 | ||
457 | #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff | ||
458 | #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8 | ||
459 | #define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff | ||
460 | |||
461 | /* Input structure for the INFO ioctl */ | ||
462 | struct drm_amdgpu_info { | ||
463 | /* Where the return value will be stored */ | ||
464 | uint64_t return_pointer; | ||
465 | /* The size of the return value. Just like "size" in "snprintf", | ||
466 | * it limits how many bytes the kernel can write. */ | ||
467 | uint32_t return_size; | ||
468 | /* The query request id. */ | ||
469 | uint32_t query; | ||
470 | |||
471 | union { | ||
472 | struct { | ||
473 | uint32_t id; | ||
474 | uint32_t _pad; | ||
475 | } mode_crtc; | ||
476 | |||
477 | struct { | ||
478 | /** AMDGPU_HW_IP_* */ | ||
479 | uint32_t type; | ||
480 | /** | ||
481 | * Index of the IP if there are more IPs of the same type. | ||
482 | * Ignored by AMDGPU_INFO_HW_IP_COUNT. | ||
483 | */ | ||
484 | uint32_t ip_instance; | ||
485 | } query_hw_ip; | ||
486 | |||
487 | struct { | ||
488 | uint32_t dword_offset; | ||
489 | uint32_t count; /* number of registers to read */ | ||
490 | uint32_t instance; | ||
491 | uint32_t flags; | ||
492 | } read_mmr_reg; | ||
493 | |||
494 | struct { | ||
495 | /** AMDGPU_INFO_FW_* */ | ||
496 | uint32_t fw_type; | ||
497 | /** Index of the IP if there are more IPs of the same type. */ | ||
498 | uint32_t ip_instance; | ||
499 | /** | ||
500 | * Index of the engine. Whether this is used depends | ||
501 | * on the firmware type. (e.g. MEC, SDMA) | ||
502 | */ | ||
503 | uint32_t index; | ||
504 | uint32_t _pad; | ||
505 | } query_fw; | ||
506 | }; | ||
507 | }; | ||
508 | |||
509 | struct drm_amdgpu_info_gds { | ||
510 | /** GDS GFX partition size */ | ||
511 | uint32_t gds_gfx_partition_size; | ||
512 | /** GDS compute partition size */ | ||
513 | uint32_t compute_partition_size; | ||
514 | /** total GDS memory size */ | ||
515 | uint32_t gds_total_size; | ||
516 | /** GWS size per GFX partition */ | ||
517 | uint32_t gws_per_gfx_partition; | ||
518 | /** GSW size per compute partition */ | ||
519 | uint32_t gws_per_compute_partition; | ||
520 | /** OA size per GFX partition */ | ||
521 | uint32_t oa_per_gfx_partition; | ||
522 | /** OA size per compute partition */ | ||
523 | uint32_t oa_per_compute_partition; | ||
524 | uint32_t _pad; | ||
525 | }; | ||
526 | |||
527 | struct drm_amdgpu_info_vram_gtt { | ||
528 | uint64_t vram_size; | ||
529 | uint64_t vram_cpu_accessible_size; | ||
530 | uint64_t gtt_size; | ||
531 | }; | ||
532 | |||
533 | struct drm_amdgpu_info_firmware { | ||
534 | uint32_t ver; | ||
535 | uint32_t feature; | ||
536 | }; | ||
537 | |||
538 | struct drm_amdgpu_info_device { | ||
539 | /** PCI Device ID */ | ||
540 | uint32_t device_id; | ||
541 | /** Internal chip revision: A0, A1, etc.) */ | ||
542 | uint32_t chip_rev; | ||
543 | uint32_t external_rev; | ||
544 | /** Revision id in PCI Config space */ | ||
545 | uint32_t pci_rev; | ||
546 | uint32_t family; | ||
547 | uint32_t num_shader_engines; | ||
548 | uint32_t num_shader_arrays_per_engine; | ||
549 | uint32_t gpu_counter_freq; /* in KHz */ | ||
550 | uint64_t max_engine_clock; /* in KHz */ | ||
551 | /* cu information */ | ||
552 | uint32_t cu_active_number; | ||
553 | uint32_t cu_ao_mask; | ||
554 | uint32_t cu_bitmap[4][4]; | ||
555 | /** Render backend pipe mask. One render backend is CB+DB. */ | ||
556 | uint32_t enabled_rb_pipes_mask; | ||
557 | uint32_t num_rb_pipes; | ||
558 | uint32_t num_hw_gfx_contexts; | ||
559 | uint32_t _pad; | ||
560 | uint64_t ids_flags; | ||
561 | /** Starting virtual address for UMDs. */ | ||
562 | uint64_t virtual_address_offset; | ||
563 | /** Required alignment of virtual addresses. */ | ||
564 | uint32_t virtual_address_alignment; | ||
565 | /** Page table entry - fragment size */ | ||
566 | uint32_t pte_fragment_size; | ||
567 | uint32_t gart_page_size; | ||
568 | }; | ||
569 | |||
570 | struct drm_amdgpu_info_hw_ip { | ||
571 | /** Version of h/w IP */ | ||
572 | uint32_t hw_ip_version_major; | ||
573 | uint32_t hw_ip_version_minor; | ||
574 | /** Capabilities */ | ||
575 | uint64_t capabilities_flags; | ||
576 | /** Bitmask of available rings. Bit 0 means ring 0, etc. */ | ||
577 | uint32_t available_rings; | ||
578 | uint32_t _pad; | ||
579 | }; | ||
580 | |||
581 | /* | ||
582 | * Supported GPU families | ||
583 | */ | ||
584 | #define AMDGPU_FAMILY_UNKNOWN 0 | ||
585 | #define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */ | ||
586 | #define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */ | ||
587 | #define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */ | ||
588 | #define AMDGPU_FAMILY_CZ 135 /* Carrizo */ | ||
589 | |||
590 | #endif | ||