blob: d9b9b6f8de2bbb3d8c7231eb147f0f119f0db0f7 [file] [log] [blame]
Alex Deucher81629cb2015-04-20 16:42:01 -04001/* 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/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)
Alex Deucher81629cb2015-04-20 16:42:01 -040076/* Flag that USWC attributes should be used for GTT */
Jammy Zhou88671282015-05-06 18:44:29 +080077#define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2)
Alex Deucher81629cb2015-04-20 16:42:01 -040078
79/* Flag mask for GTT domain_flags */
80#define AMDGPU_GEM_CREATE_CPU_GTT_MASK \
Jammy Zhou88671282015-05-06 18:44:29 +080081 (AMDGPU_GEM_CREATE_CPU_GTT_USWC | \
Alex Deucher81629cb2015-04-20 16:42:01 -040082 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | \
83 AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
84
85struct drm_amdgpu_gem_create_in {
86 /** the requested memory size */
87 uint64_t bo_size;
88 /** physical start_addr alignment in bytes for some HW requirements */
89 uint64_t alignment;
90 /** the requested memory domains */
91 uint64_t domains;
92 /** allocation flags */
93 uint64_t domain_flags;
94};
95
96struct drm_amdgpu_gem_create_out {
97 /** returned GEM object handle */
98 uint32_t handle;
99 uint32_t _pad;
100};
101
102union drm_amdgpu_gem_create {
103 struct drm_amdgpu_gem_create_in in;
104 struct drm_amdgpu_gem_create_out out;
105};
106
107/** Opcode to create new residency list. */
108#define AMDGPU_BO_LIST_OP_CREATE 0
109/** Opcode to destroy previously created residency list */
110#define AMDGPU_BO_LIST_OP_DESTROY 1
111/** Opcode to update resource information in the list */
112#define AMDGPU_BO_LIST_OP_UPDATE 2
113
114struct drm_amdgpu_bo_list_in {
115 /** Type of operation */
116 uint32_t operation;
117 /** Handle of list or 0 if we want to create one */
118 uint32_t list_handle;
119 /** Number of BOs in list */
120 uint32_t bo_number;
121 /** Size of each element describing BO */
122 uint32_t bo_info_size;
123 /** Pointer to array describing BOs */
124 uint64_t bo_info_ptr;
125};
126
127struct drm_amdgpu_bo_list_entry {
128 /** Handle of BO */
129 uint32_t bo_handle;
130 /** New (if specified) BO priority to be used during migration */
131 uint32_t bo_priority;
132};
133
134struct drm_amdgpu_bo_list_out {
135 /** Handle of resource list */
136 uint32_t list_handle;
137 uint32_t _pad;
138};
139
140union drm_amdgpu_bo_list {
141 struct drm_amdgpu_bo_list_in in;
142 struct drm_amdgpu_bo_list_out out;
143};
144
145/* context related */
146#define AMDGPU_CTX_OP_ALLOC_CTX 1
147#define AMDGPU_CTX_OP_FREE_CTX 2
148#define AMDGPU_CTX_OP_QUERY_STATE 3
149
150#define AMDGPU_CTX_OP_STATE_RUNNING 1
151
Marek Olšákd94aed52015-05-05 21:13:49 +0200152/* GPU reset status */
153#define AMDGPU_CTX_NO_RESET 0
154#define AMDGPU_CTX_GUILTY_RESET 1 /* this the context caused it */
155#define AMDGPU_CTX_INNOCENT_RESET 2 /* some other context caused it */
156#define AMDGPU_CTX_UNKNOWN_RESET 3 /* unknown cause */
157
Alex Deucher81629cb2015-04-20 16:42:01 -0400158struct drm_amdgpu_ctx_in {
159 uint32_t op;
160 uint32_t flags;
161 uint32_t ctx_id;
162 uint32_t _pad;
163};
164
165union drm_amdgpu_ctx_out {
166 struct {
167 uint32_t ctx_id;
168 uint32_t _pad;
169 } alloc;
170
171 struct {
172 uint64_t flags;
Marek Olšákd94aed52015-05-05 21:13:49 +0200173 /** Number of resets caused by this context so far. */
174 uint32_t hangs;
175 /** Reset status since the last call of the ioctl. */
176 uint32_t reset_status;
Alex Deucher81629cb2015-04-20 16:42:01 -0400177 } state;
178};
179
180union drm_amdgpu_ctx {
181 struct drm_amdgpu_ctx_in in;
182 union drm_amdgpu_ctx_out out;
183};
184
185/*
186 * This is not a reliable API and you should expect it to fail for any
187 * number of reasons and have fallback path that do not use userptr to
188 * perform any operation.
189 */
190#define AMDGPU_GEM_USERPTR_READONLY (1 << 0)
191#define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1)
192#define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2)
193#define AMDGPU_GEM_USERPTR_REGISTER (1 << 3)
194
195struct drm_amdgpu_gem_userptr {
196 uint64_t addr;
197 uint64_t size;
198 uint32_t flags;
199 uint32_t handle;
200};
201
Marek Olšákfbd76d52015-05-14 23:48:26 +0200202/* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */
203#define AMDGPU_TILING_ARRAY_MODE_SHIFT 0
204#define AMDGPU_TILING_ARRAY_MODE_MASK 0xf
205#define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4
206#define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f
207#define AMDGPU_TILING_TILE_SPLIT_SHIFT 9
208#define AMDGPU_TILING_TILE_SPLIT_MASK 0x7
209#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12
210#define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7
211#define AMDGPU_TILING_BANK_WIDTH_SHIFT 15
212#define AMDGPU_TILING_BANK_WIDTH_MASK 0x3
213#define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17
214#define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3
215#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19
216#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3
217#define AMDGPU_TILING_NUM_BANKS_SHIFT 21
218#define AMDGPU_TILING_NUM_BANKS_MASK 0x3
219
220#define AMDGPU_TILING_SET(field, value) \
221 (((value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT)
222#define AMDGPU_TILING_GET(value, field) \
223 (((value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK)
Alex Deucher81629cb2015-04-20 16:42:01 -0400224
225#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
226#define AMDGPU_GEM_METADATA_OP_GET_METADATA 2
227
228/** The same structure is shared for input/output */
229struct drm_amdgpu_gem_metadata {
230 uint32_t handle; /* GEM Object handle */
231 uint32_t op; /** Do we want get or set metadata */
232 struct {
233 uint64_t flags;
234 uint64_t tiling_info; /* family specific tiling info */
235 uint32_t data_size_bytes;
236 uint32_t data[64];
237 } data;
238};
239
240struct drm_amdgpu_gem_mmap_in {
241 uint32_t handle; /** the GEM object handle */
242 uint32_t _pad;
243};
244
245struct drm_amdgpu_gem_mmap_out {
246 uint64_t addr_ptr; /** mmap offset from the vma offset manager */
247};
248
249union drm_amdgpu_gem_mmap {
250 struct drm_amdgpu_gem_mmap_in in;
251 struct drm_amdgpu_gem_mmap_out out;
252};
253
254struct drm_amdgpu_gem_wait_idle_in {
255 uint32_t handle; /* GEM object handle */
256 uint32_t flags;
257 uint64_t timeout; /* Timeout to wait. If 0 then returned immediately with the status */
258};
259
260struct drm_amdgpu_gem_wait_idle_out {
261 uint32_t status; /* BO status: 0 - BO is idle, 1 - BO is busy */
262 uint32_t domain; /* Returned current memory domain */
263};
264
265union drm_amdgpu_gem_wait_idle {
266 struct drm_amdgpu_gem_wait_idle_in in;
267 struct drm_amdgpu_gem_wait_idle_out out;
268};
269
270struct drm_amdgpu_wait_cs_in {
271 uint64_t handle;
272 uint64_t timeout;
273 uint32_t ip_type;
274 uint32_t ip_instance;
275 uint32_t ring;
Jammy Zhou66b3cf22015-05-08 17:29:40 +0800276 uint32_t ctx_id;
Alex Deucher81629cb2015-04-20 16:42:01 -0400277};
278
279struct drm_amdgpu_wait_cs_out {
280 uint64_t status;
281};
282
283union drm_amdgpu_wait_cs {
284 struct drm_amdgpu_wait_cs_in in;
285 struct drm_amdgpu_wait_cs_out out;
286};
287
288/* Sets or returns a value associated with a buffer. */
289struct drm_amdgpu_gem_op {
290 uint32_t handle; /* buffer */
291 uint32_t op; /* AMDGPU_GEM_OP_* */
292 uint64_t value; /* input or return value */
293};
294
295#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
296#define AMDGPU_GEM_OP_SET_INITIAL_DOMAIN 1
297
298#define AMDGPU_VA_OP_MAP 1
299#define AMDGPU_VA_OP_UNMAP 2
300
301#define AMDGPU_VA_RESULT_OK 0
302#define AMDGPU_VA_RESULT_ERROR 1
303#define AMDGPU_VA_RESULT_VA_INVALID_ALIGNMENT 2
304
305/* Mapping flags */
306/* readable mapping */
307#define AMDGPU_VM_PAGE_READABLE (1 << 1)
308/* writable mapping */
309#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
310/* executable mapping, new for VI */
311#define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
312
313struct drm_amdgpu_gem_va_in {
314 /* GEM object handle */
315 uint32_t handle;
316 uint32_t _pad;
317 /* map or unmap*/
318 uint32_t operation;
319 /* specify mapping flags */
320 uint32_t flags;
321 /* va address to assign . Must be correctly aligned.*/
322 uint64_t va_address;
323 /* Specify offset inside of BO to assign. Must be correctly aligned.*/
324 uint64_t offset_in_bo;
325 /* Specify mapping size. If 0 and offset is 0 then map the whole BO.*/
326 /* Must be correctly aligned. */
327 uint64_t map_size;
328};
329
330struct drm_amdgpu_gem_va_out {
331 uint32_t result;
332 uint32_t _pad;
333};
334
335union drm_amdgpu_gem_va {
336 struct drm_amdgpu_gem_va_in in;
337 struct drm_amdgpu_gem_va_out out;
338};
339
340#define AMDGPU_HW_IP_GFX 0
341#define AMDGPU_HW_IP_COMPUTE 1
342#define AMDGPU_HW_IP_DMA 2
343#define AMDGPU_HW_IP_UVD 3
344#define AMDGPU_HW_IP_VCE 4
345#define AMDGPU_HW_IP_NUM 5
346
347#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
348
349#define AMDGPU_CHUNK_ID_IB 0x01
350#define AMDGPU_CHUNK_ID_FENCE 0x02
351struct drm_amdgpu_cs_chunk {
352 uint32_t chunk_id;
353 uint32_t length_dw;
354 uint64_t chunk_data;
355};
356
357struct drm_amdgpu_cs_in {
358 /** Rendering context id */
359 uint32_t ctx_id;
360 /** Handle of resource list associated with CS */
361 uint32_t bo_list_handle;
362 uint32_t num_chunks;
363 uint32_t _pad;
364 /* this points to uint64_t * which point to cs chunks */
365 uint64_t chunks;
366};
367
368struct drm_amdgpu_cs_out {
369 uint64_t handle;
370};
371
372union drm_amdgpu_cs {
373 struct drm_amdgpu_cs_in in;
374 struct drm_amdgpu_cs_out out;
375};
376
377/* Specify flags to be used for IB */
378
379/* This IB should be submitted to CE */
380#define AMDGPU_IB_FLAG_CE (1<<0)
381
382/* GDS is used by this IB */
383#define AMDGPU_IB_FLAG_GDS (1<<1)
384
Jammy Zhouaa2bdb242015-05-11 23:49:34 +0800385/* CE Preamble */
386#define AMDGPU_IB_FLAG_PREAMBLE (1<<2)
387
Alex Deucher81629cb2015-04-20 16:42:01 -0400388struct drm_amdgpu_cs_chunk_ib {
389 /**
390 * Handle of GEM object to be used as IB or 0 if it is already in
391 * residency list.
392 */
393 uint32_t handle;
394 uint32_t flags; /* IB Flags */
395 uint64_t va_start; /* Virtual address to begin IB execution */
396 uint32_t ib_bytes; /* Size of submission */
397 uint32_t ip_type; /* HW IP to submit to */
398 uint32_t ip_instance; /* HW IP index of the same type to submit to */
399 uint32_t ring; /* Ring index to submit to */
400};
401
402struct drm_amdgpu_cs_chunk_fence {
403 uint32_t handle;
404 uint32_t offset;
405};
406
407struct drm_amdgpu_cs_chunk_data {
408 union {
409 struct drm_amdgpu_cs_chunk_ib ib_data;
410 struct drm_amdgpu_cs_chunk_fence fence_data;
411 };
412};
413
414/**
415 * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU
416 *
417 */
418#define AMDGPU_IDS_FLAGS_FUSION 0x1
419
420/* indicate if acceleration can be working */
421#define AMDGPU_INFO_ACCEL_WORKING 0x00
422/* get the crtc_id from the mode object id? */
423#define AMDGPU_INFO_CRTC_FROM_ID 0x01
424/* query hw IP info */
425#define AMDGPU_INFO_HW_IP_INFO 0x02
426/* query hw IP instance count for the specified type */
427#define AMDGPU_INFO_HW_IP_COUNT 0x03
428/* timestamp for GL_ARB_timer_query */
429#define AMDGPU_INFO_TIMESTAMP 0x05
430/* Query the firmware version */
431#define AMDGPU_INFO_FW_VERSION 0x0e
432 /* Subquery id: Query VCE firmware version */
433 #define AMDGPU_INFO_FW_VCE 0x1
434 /* Subquery id: Query UVD firmware version */
435 #define AMDGPU_INFO_FW_UVD 0x2
436 /* Subquery id: Query GMC firmware version */
437 #define AMDGPU_INFO_FW_GMC 0x03
438 /* Subquery id: Query GFX ME firmware version */
439 #define AMDGPU_INFO_FW_GFX_ME 0x04
440 /* Subquery id: Query GFX PFP firmware version */
441 #define AMDGPU_INFO_FW_GFX_PFP 0x05
442 /* Subquery id: Query GFX CE firmware version */
443 #define AMDGPU_INFO_FW_GFX_CE 0x06
444 /* Subquery id: Query GFX RLC firmware version */
445 #define AMDGPU_INFO_FW_GFX_RLC 0x07
446 /* Subquery id: Query GFX MEC firmware version */
447 #define AMDGPU_INFO_FW_GFX_MEC 0x08
448 /* Subquery id: Query SMC firmware version */
449 #define AMDGPU_INFO_FW_SMC 0x0a
450 /* Subquery id: Query SDMA firmware version */
451 #define AMDGPU_INFO_FW_SDMA 0x0b
452/* number of bytes moved for TTM migration */
453#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
454/* the used VRAM size */
455#define AMDGPU_INFO_VRAM_USAGE 0x10
456/* the used GTT size */
457#define AMDGPU_INFO_GTT_USAGE 0x11
458/* Information about GDS, etc. resource configuration */
459#define AMDGPU_INFO_GDS_CONFIG 0x13
460/* Query information about VRAM and GTT domains */
461#define AMDGPU_INFO_VRAM_GTT 0x14
462/* Query information about register in MMR address space*/
463#define AMDGPU_INFO_READ_MMR_REG 0x15
464/* Query information about device: rev id, family, etc. */
465#define AMDGPU_INFO_DEV_INFO 0x16
466/* visible vram usage */
467#define AMDGPU_INFO_VIS_VRAM_USAGE 0x17
468
469#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
470#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
471#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
472#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff
473
474/* Input structure for the INFO ioctl */
475struct drm_amdgpu_info {
476 /* Where the return value will be stored */
477 uint64_t return_pointer;
478 /* The size of the return value. Just like "size" in "snprintf",
479 * it limits how many bytes the kernel can write. */
480 uint32_t return_size;
481 /* The query request id. */
482 uint32_t query;
483
484 union {
485 struct {
486 uint32_t id;
487 uint32_t _pad;
488 } mode_crtc;
489
490 struct {
491 /** AMDGPU_HW_IP_* */
492 uint32_t type;
493 /**
494 * Index of the IP if there are more IPs of the same type.
495 * Ignored by AMDGPU_INFO_HW_IP_COUNT.
496 */
497 uint32_t ip_instance;
498 } query_hw_ip;
499
500 struct {
501 uint32_t dword_offset;
502 uint32_t count; /* number of registers to read */
503 uint32_t instance;
504 uint32_t flags;
505 } read_mmr_reg;
506
507 struct {
508 /** AMDGPU_INFO_FW_* */
509 uint32_t fw_type;
510 /** Index of the IP if there are more IPs of the same type. */
511 uint32_t ip_instance;
512 /**
513 * Index of the engine. Whether this is used depends
514 * on the firmware type. (e.g. MEC, SDMA)
515 */
516 uint32_t index;
517 uint32_t _pad;
518 } query_fw;
519 };
520};
521
522struct drm_amdgpu_info_gds {
523 /** GDS GFX partition size */
524 uint32_t gds_gfx_partition_size;
525 /** GDS compute partition size */
526 uint32_t compute_partition_size;
527 /** total GDS memory size */
528 uint32_t gds_total_size;
529 /** GWS size per GFX partition */
530 uint32_t gws_per_gfx_partition;
531 /** GSW size per compute partition */
532 uint32_t gws_per_compute_partition;
533 /** OA size per GFX partition */
534 uint32_t oa_per_gfx_partition;
535 /** OA size per compute partition */
536 uint32_t oa_per_compute_partition;
537 uint32_t _pad;
538};
539
540struct drm_amdgpu_info_vram_gtt {
541 uint64_t vram_size;
542 uint64_t vram_cpu_accessible_size;
543 uint64_t gtt_size;
544};
545
546struct drm_amdgpu_info_firmware {
547 uint32_t ver;
548 uint32_t feature;
549};
550
551struct drm_amdgpu_info_device {
552 /** PCI Device ID */
553 uint32_t device_id;
554 /** Internal chip revision: A0, A1, etc.) */
555 uint32_t chip_rev;
556 uint32_t external_rev;
557 /** Revision id in PCI Config space */
558 uint32_t pci_rev;
559 uint32_t family;
560 uint32_t num_shader_engines;
561 uint32_t num_shader_arrays_per_engine;
562 uint32_t gpu_counter_freq; /* in KHz */
563 uint64_t max_engine_clock; /* in KHz */
564 /* cu information */
565 uint32_t cu_active_number;
566 uint32_t cu_ao_mask;
567 uint32_t cu_bitmap[4][4];
568 /** Render backend pipe mask. One render backend is CB+DB. */
569 uint32_t enabled_rb_pipes_mask;
570 uint32_t num_rb_pipes;
571 uint32_t num_hw_gfx_contexts;
572 uint32_t _pad;
573 uint64_t ids_flags;
574 /** Starting virtual address for UMDs. */
575 uint64_t virtual_address_offset;
Jammy Zhou02b70c82015-05-12 22:46:45 +0800576 /** The maximum virtual address */
577 uint64_t virtual_address_max;
Alex Deucher81629cb2015-04-20 16:42:01 -0400578 /** Required alignment of virtual addresses. */
579 uint32_t virtual_address_alignment;
580 /** Page table entry - fragment size */
581 uint32_t pte_fragment_size;
582 uint32_t gart_page_size;
583};
584
585struct drm_amdgpu_info_hw_ip {
586 /** Version of h/w IP */
587 uint32_t hw_ip_version_major;
588 uint32_t hw_ip_version_minor;
589 /** Capabilities */
590 uint64_t capabilities_flags;
591 /** Bitmask of available rings. Bit 0 means ring 0, etc. */
592 uint32_t available_rings;
593 uint32_t _pad;
594};
595
596/*
597 * Supported GPU families
598 */
599#define AMDGPU_FAMILY_UNKNOWN 0
600#define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */
601#define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */
602#define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */
603#define AMDGPU_FAMILY_CZ 135 /* Carrizo */
604
605#endif