blob: bc6751ae5039fea31bc1c30862ab168d2784fc54 [file] [log] [blame]
Alex Deucher09361392015-04-20 12:04:22 -04001/*
2 * Copyright 2014 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22*/
23
24/**
25 * \file amdgpu.h
26 *
27 * Declare public libdrm_amdgpu API
28 *
29 * This file define API exposed by libdrm_amdgpu library.
30 * User wanted to use libdrm_amdgpu functionality must include
31 * this file.
32 *
33 */
34#ifndef _AMDGPU_H_
35#define _AMDGPU_H_
36
37#include <stdint.h>
38#include <stdbool.h>
39
40struct drm_amdgpu_info_hw_ip;
41
42/*--------------------------------------------------------------------------*/
43/* --------------------------- Defines ------------------------------------ */
44/*--------------------------------------------------------------------------*/
45
46/**
47 * Define max. number of Command Buffers (IB) which could be sent to the single
48 * hardware IP to accommodate CE/DE requirements
49 *
50 * \sa amdgpu_cs_ib_info
51*/
52#define AMDGPU_CS_MAX_IBS_PER_SUBMIT 4
53
54/**
Marek Olšák67c994f2015-06-26 21:58:17 +020055 * Special timeout value meaning that the timeout is infinite.
Alex Deucher09361392015-04-20 12:04:22 -040056 */
57#define AMDGPU_TIMEOUT_INFINITE 0xffffffffffffffffull
58
Marek Olšák67c994f2015-06-26 21:58:17 +020059/**
Christian König5463d2e2015-07-09 11:48:32 +020060 * Used in amdgpu_cs_query_fence_status(), meaning that the given timeout
Marek Olšák67c994f2015-06-26 21:58:17 +020061 * is absolute.
62 */
63#define AMDGPU_QUERY_FENCE_TIMEOUT_IS_ABSOLUTE (1 << 0)
Alex Deucher09361392015-04-20 12:04:22 -040064
Alex Deucher09361392015-04-20 12:04:22 -040065/*--------------------------------------------------------------------------*/
66/* ----------------------------- Enums ------------------------------------ */
67/*--------------------------------------------------------------------------*/
68
69/**
70 * Enum describing possible handle types
71 *
72 * \sa amdgpu_bo_import, amdgpu_bo_export
73 *
74*/
75enum amdgpu_bo_handle_type {
76 /** GEM flink name (needs DRM authentication, used by DRI2) */
77 amdgpu_bo_handle_type_gem_flink_name = 0,
78
79 /** KMS handle which is used by all driver ioctls */
80 amdgpu_bo_handle_type_kms = 1,
81
82 /** DMA-buf fd handle */
83 amdgpu_bo_handle_type_dma_buf_fd = 2
84};
85
Sabre Shao23fab592015-07-09 13:50:36 +080086/** Define known types of GPU VM VA ranges */
87enum amdgpu_gpu_va_range
88{
89 /** Allocate from "normal"/general range */
90 amdgpu_gpu_va_range_general = 0
91};
Alex Deucher09361392015-04-20 12:04:22 -040092
93/*--------------------------------------------------------------------------*/
94/* -------------------------- Datatypes ----------------------------------- */
95/*--------------------------------------------------------------------------*/
96
97/**
98 * Define opaque pointer to context associated with fd.
99 * This context will be returned as the result of
100 * "initialize" function and should be pass as the first
101 * parameter to any API call
102 */
103typedef struct amdgpu_device *amdgpu_device_handle;
104
105/**
106 * Define GPU Context type as pointer to opaque structure
107 * Example of GPU Context is the "rendering" context associated
108 * with OpenGL context (glCreateContext)
109 */
110typedef struct amdgpu_context *amdgpu_context_handle;
111
112/**
113 * Define handle for amdgpu resources: buffer, GDS, etc.
114 */
115typedef struct amdgpu_bo *amdgpu_bo_handle;
116
117/**
Christian König6dc2eaf2015-04-22 14:52:34 +0200118 * Define handle for list of BOs
119 */
120typedef struct amdgpu_bo_list *amdgpu_bo_list_handle;
121
Sabre Shao23fab592015-07-09 13:50:36 +0800122/**
123 * Define handle to be used to work with VA allocated ranges
124 */
125typedef struct amdgpu_va *amdgpu_va_handle;
Alex Deucher09361392015-04-20 12:04:22 -0400126
127/*--------------------------------------------------------------------------*/
128/* -------------------------- Structures ---------------------------------- */
129/*--------------------------------------------------------------------------*/
130
131/**
132 * Structure describing memory allocation request
133 *
134 * \sa amdgpu_bo_alloc()
135 *
136*/
137struct amdgpu_bo_alloc_request {
138 /** Allocation request. It must be aligned correctly. */
139 uint64_t alloc_size;
140
141 /**
142 * It may be required to have some specific alignment requirements
143 * for physical back-up storage (e.g. for displayable surface).
144 * If 0 there is no special alignment requirement
145 */
146 uint64_t phys_alignment;
147
148 /**
149 * UMD should specify where to allocate memory and how it
150 * will be accessed by the CPU.
151 */
152 uint32_t preferred_heap;
153
154 /** Additional flags passed on allocation */
155 uint64_t flags;
156};
157
158/**
159 * Structure describing memory allocation request
160 *
161 * \sa amdgpu_bo_alloc()
162*/
163struct amdgpu_bo_alloc_result {
164 /** Assigned virtual MC Base Address */
165 uint64_t virtual_mc_base_address;
166
167 /** Handle of allocated memory to be used by the given process only. */
168 amdgpu_bo_handle buf_handle;
169};
170
171/**
172 * Special UMD specific information associated with buffer.
173 *
174 * It may be need to pass some buffer charactersitic as part
175 * of buffer sharing. Such information are defined UMD and
176 * opaque for libdrm_amdgpu as well for kernel driver.
177 *
178 * \sa amdgpu_bo_set_metadata(), amdgpu_bo_query_info,
179 * amdgpu_bo_import(), amdgpu_bo_export
180 *
181*/
182struct amdgpu_bo_metadata {
183 /** Special flag associated with surface */
184 uint64_t flags;
185
186 /**
187 * ASIC-specific tiling information (also used by DCE).
188 * The encoding is defined by the AMDGPU_TILING_* definitions.
189 */
190 uint64_t tiling_info;
191
192 /** Size of metadata associated with the buffer, in bytes. */
193 uint32_t size_metadata;
194
195 /** UMD specific metadata. Opaque for kernel */
196 uint32_t umd_metadata[64];
197};
198
199/**
200 * Structure describing allocated buffer. Client may need
201 * to query such information as part of 'sharing' buffers mechanism
202 *
203 * \sa amdgpu_bo_set_metadata(), amdgpu_bo_query_info(),
204 * amdgpu_bo_import(), amdgpu_bo_export()
205*/
206struct amdgpu_bo_info {
207 /** Allocated memory size */
208 uint64_t alloc_size;
209
210 /**
211 * It may be required to have some specific alignment requirements
212 * for physical back-up storage.
213 */
214 uint64_t phys_alignment;
215
216 /**
217 * Assigned virtual MC Base Address.
218 * \note This information will be returned only if this buffer was
219 * allocated in the same process otherwise 0 will be returned.
220 */
221 uint64_t virtual_mc_base_address;
222
223 /** Heap where to allocate memory. */
224 uint32_t preferred_heap;
225
226 /** Additional allocation flags. */
227 uint64_t alloc_flags;
228
229 /** Metadata associated with buffer if any. */
230 struct amdgpu_bo_metadata metadata;
231};
232
233/**
234 * Structure with information about "imported" buffer
235 *
236 * \sa amdgpu_bo_import()
237 *
238 */
239struct amdgpu_bo_import_result {
240 /** Handle of memory/buffer to use */
Christian König558e1292015-06-30 16:04:44 +0200241 amdgpu_bo_handle buf_handle;
Alex Deucher09361392015-04-20 12:04:22 -0400242
243 /** Buffer size */
244 uint64_t alloc_size;
245
246 /** Assigned virtual MC Base Address */
247 uint64_t virtual_mc_base_address;
248};
249
Alex Deucher09361392015-04-20 12:04:22 -0400250/**
251 *
252 * Structure to describe GDS partitioning information.
253 * \note OA and GWS resources are asscoiated with GDS partition
254 *
255 * \sa amdgpu_gpu_resource_query_gds_info
256 *
257*/
258struct amdgpu_gds_resource_info {
Christian König558e1292015-06-30 16:04:44 +0200259 uint32_t gds_gfx_partition_size;
260 uint32_t compute_partition_size;
261 uint32_t gds_total_size;
262 uint32_t gws_per_gfx_partition;
263 uint32_t gws_per_compute_partition;
264 uint32_t oa_per_gfx_partition;
265 uint32_t oa_per_compute_partition;
Alex Deucher09361392015-04-20 12:04:22 -0400266};
267
Alex Deucher09361392015-04-20 12:04:22 -0400268/**
Christian König5463d2e2015-07-09 11:48:32 +0200269 * Structure describing CS fence
Christian König0f37bc92015-06-24 14:17:57 +0200270 *
Christian König5463d2e2015-07-09 11:48:32 +0200271 * \sa amdgpu_cs_query_fence_status(), amdgpu_cs_request, amdgpu_cs_submit()
Christian König0f37bc92015-06-24 14:17:57 +0200272 *
273*/
Christian König5463d2e2015-07-09 11:48:32 +0200274struct amdgpu_cs_fence {
275
276 /** In which context IB was sent to execution */
Christian König558e1292015-06-30 16:04:44 +0200277 amdgpu_context_handle context;
Christian König0f37bc92015-06-24 14:17:57 +0200278
279 /** To which HW IP type the fence belongs */
Christian König558e1292015-06-30 16:04:44 +0200280 uint32_t ip_type;
Christian König0f37bc92015-06-24 14:17:57 +0200281
282 /** IP instance index if there are several IPs of the same type. */
Christian König558e1292015-06-30 16:04:44 +0200283 uint32_t ip_instance;
Christian König0f37bc92015-06-24 14:17:57 +0200284
285 /** Ring index of the HW IP */
Christian König558e1292015-06-30 16:04:44 +0200286 uint32_t ring;
Christian König0f37bc92015-06-24 14:17:57 +0200287
Christian König558e1292015-06-30 16:04:44 +0200288 /** Specify fence for which we need to check submission status.*/
289 uint64_t fence;
Christian König0f37bc92015-06-24 14:17:57 +0200290};
291
292/**
Alex Deucher09361392015-04-20 12:04:22 -0400293 * Structure describing IB
294 *
295 * \sa amdgpu_cs_request, amdgpu_cs_submit()
296 *
297*/
298struct amdgpu_cs_ib_info {
299 /** Special flags */
Christian König558e1292015-06-30 16:04:44 +0200300 uint64_t flags;
Alex Deucher09361392015-04-20 12:04:22 -0400301
Marek Olšák76af5c22015-06-02 13:05:41 +0200302 /** Virtual MC address of the command buffer */
Christian König558e1292015-06-30 16:04:44 +0200303 uint64_t ib_mc_address;
Alex Deucher09361392015-04-20 12:04:22 -0400304
305 /**
306 * Size of Command Buffer to be submitted.
307 * - The size is in units of dwords (4 bytes).
Alex Deucher09361392015-04-20 12:04:22 -0400308 * - Could be 0
309 */
Christian König558e1292015-06-30 16:04:44 +0200310 uint32_t size;
Alex Deucher09361392015-04-20 12:04:22 -0400311};
312
313/**
Ken Wang926c8052015-07-10 22:22:27 +0800314 * Structure describing fence information
315 *
316 * \sa amdgpu_cs_request, amdgpu_cs_query_fence,
317 * amdgpu_cs_submit(), amdgpu_cs_query_fence_status()
318*/
319struct amdgpu_cs_fence_info {
320 /** buffer object for the fence */
321 amdgpu_bo_handle handle;
322
323 /** fence offset in the unit of sizeof(uint64_t) */
324 uint64_t offset;
325};
326
327/**
Alex Deucher09361392015-04-20 12:04:22 -0400328 * Structure describing submission request
329 *
330 * \note We could have several IBs as packet. e.g. CE, CE, DE case for gfx
331 *
332 * \sa amdgpu_cs_submit()
333*/
334struct amdgpu_cs_request {
335 /** Specify flags with additional information */
Christian König558e1292015-06-30 16:04:44 +0200336 uint64_t flags;
Alex Deucher09361392015-04-20 12:04:22 -0400337
338 /** Specify HW IP block type to which to send the IB. */
Christian König558e1292015-06-30 16:04:44 +0200339 unsigned ip_type;
Alex Deucher09361392015-04-20 12:04:22 -0400340
341 /** IP instance index if there are several IPs of the same type. */
Christian König558e1292015-06-30 16:04:44 +0200342 unsigned ip_instance;
Alex Deucher09361392015-04-20 12:04:22 -0400343
344 /**
345 * Specify ring index of the IP. We could have several rings
346 * in the same IP. E.g. 0 for SDMA0 and 1 for SDMA1.
347 */
Christian König558e1292015-06-30 16:04:44 +0200348 uint32_t ring;
Alex Deucher09361392015-04-20 12:04:22 -0400349
350 /**
Christian König6dc2eaf2015-04-22 14:52:34 +0200351 * List handle with resources used by this request.
Alex Deucher09361392015-04-20 12:04:22 -0400352 */
Christian König6dc2eaf2015-04-22 14:52:34 +0200353 amdgpu_bo_list_handle resources;
Alex Deucher09361392015-04-20 12:04:22 -0400354
Christian König0f37bc92015-06-24 14:17:57 +0200355 /**
356 * Number of dependencies this Command submission needs to
357 * wait for before starting execution.
358 */
359 uint32_t number_of_dependencies;
360
361 /**
362 * Array of dependencies which need to be met before
363 * execution can start.
364 */
Christian König5463d2e2015-07-09 11:48:32 +0200365 struct amdgpu_cs_fence *dependencies;
Christian König0f37bc92015-06-24 14:17:57 +0200366
Alex Deucher09361392015-04-20 12:04:22 -0400367 /** Number of IBs to submit in the field ibs. */
368 uint32_t number_of_ibs;
369
370 /**
371 * IBs to submit. Those IBs will be submit together as single entity
372 */
373 struct amdgpu_cs_ib_info *ibs;
Ken Wang926c8052015-07-10 22:22:27 +0800374
375 /**
376 * The returned sequence number for the command submission
377 */
378 uint64_t seq_no;
379
380 /**
381 * The fence information
382 */
383 struct amdgpu_cs_fence_info fence_info;
Alex Deucher09361392015-04-20 12:04:22 -0400384};
385
386/**
Alex Deucher09361392015-04-20 12:04:22 -0400387 * Structure which provide information about GPU VM MC Address space
388 * alignments requirements
389 *
390 * \sa amdgpu_query_buffer_size_alignment
391 */
392struct amdgpu_buffer_size_alignments {
393 /** Size alignment requirement for allocation in
394 * local memory */
395 uint64_t size_local;
396
397 /**
398 * Size alignment requirement for allocation in remote memory
399 */
400 uint64_t size_remote;
401};
402
Alex Deucher09361392015-04-20 12:04:22 -0400403/**
404 * Structure which provide information about heap
405 *
406 * \sa amdgpu_query_heap_info()
407 *
408 */
409struct amdgpu_heap_info {
410 /** Theoretical max. available memory in the given heap */
Christian König558e1292015-06-30 16:04:44 +0200411 uint64_t heap_size;
Alex Deucher09361392015-04-20 12:04:22 -0400412
413 /**
414 * Number of bytes allocated in the heap. This includes all processes
415 * and private allocations in the kernel. It changes when new buffers
416 * are allocated, freed, and moved. It cannot be larger than
417 * heap_size.
418 */
Christian König558e1292015-06-30 16:04:44 +0200419 uint64_t heap_usage;
Alex Deucher09361392015-04-20 12:04:22 -0400420
421 /**
422 * Theoretical possible max. size of buffer which
423 * could be allocated in the given heap
424 */
Christian König558e1292015-06-30 16:04:44 +0200425 uint64_t max_allocation;
Alex Deucher09361392015-04-20 12:04:22 -0400426};
427
Alex Deucher09361392015-04-20 12:04:22 -0400428/**
429 * Describe GPU h/w info needed for UMD correct initialization
430 *
431 * \sa amdgpu_query_gpu_info()
432*/
433struct amdgpu_gpu_info {
434 /** Asic id */
435 uint32_t asic_id;
Christian König558e1292015-06-30 16:04:44 +0200436 /** Chip revision */
Alex Deucher09361392015-04-20 12:04:22 -0400437 uint32_t chip_rev;
438 /** Chip external revision */
439 uint32_t chip_external_rev;
440 /** Family ID */
441 uint32_t family_id;
442 /** Special flags */
443 uint64_t ids_flags;
444 /** max engine clock*/
445 uint64_t max_engine_clk;
Ken Wangfc9fc7d2015-06-03 17:07:44 +0800446 /** max memory clock */
447 uint64_t max_memory_clk;
Alex Deucher09361392015-04-20 12:04:22 -0400448 /** number of shader engines */
449 uint32_t num_shader_engines;
450 /** number of shader arrays per engine */
451 uint32_t num_shader_arrays_per_engine;
452 /** Number of available good shader pipes */
453 uint32_t avail_quad_shader_pipes;
454 /** Max. number of shader pipes.(including good and bad pipes */
455 uint32_t max_quad_shader_pipes;
456 /** Number of parameter cache entries per shader quad pipe */
457 uint32_t cache_entries_per_quad_pipe;
458 /** Number of available graphics context */
459 uint32_t num_hw_gfx_contexts;
460 /** Number of render backend pipes */
461 uint32_t rb_pipes;
Alex Deucher09361392015-04-20 12:04:22 -0400462 /** Enabled render backend pipe mask */
463 uint32_t enabled_rb_pipes_mask;
464 /** Frequency of GPU Counter */
465 uint32_t gpu_counter_freq;
466 /** CC_RB_BACKEND_DISABLE.BACKEND_DISABLE per SE */
467 uint32_t backend_disable[4];
468 /** Value of MC_ARB_RAMCFG register*/
469 uint32_t mc_arb_ramcfg;
470 /** Value of GB_ADDR_CONFIG */
471 uint32_t gb_addr_cfg;
472 /** Values of the GB_TILE_MODE0..31 registers */
473 uint32_t gb_tile_mode[32];
474 /** Values of GB_MACROTILE_MODE0..15 registers */
475 uint32_t gb_macro_tile_mode[16];
476 /** Value of PA_SC_RASTER_CONFIG register per SE */
477 uint32_t pa_sc_raster_cfg[4];
478 /** Value of PA_SC_RASTER_CONFIG_1 register per SE */
479 uint32_t pa_sc_raster_cfg1[4];
480 /* CU info */
481 uint32_t cu_active_number;
482 uint32_t cu_ao_mask;
483 uint32_t cu_bitmap[4][4];
Ken Wang4bf29412015-06-03 17:15:29 +0800484 /* video memory type info*/
485 uint32_t vram_type;
486 /* video memory bit width*/
487 uint32_t vram_bit_width;
Ken Wangcdd1edc2015-06-03 17:21:27 +0800488 /** constant engine ram size*/
489 uint32_t ce_ram_size;
Alex Deucher09361392015-04-20 12:04:22 -0400490};
491
492
493/*--------------------------------------------------------------------------*/
494/*------------------------- Functions --------------------------------------*/
495/*--------------------------------------------------------------------------*/
496
497/*
498 * Initialization / Cleanup
499 *
500*/
501
Alex Deucher09361392015-04-20 12:04:22 -0400502/**
503 *
504 * \param fd - \c [in] File descriptor for AMD GPU device
505 * received previously as the result of
506 * e.g. drmOpen() call.
Christian König558e1292015-06-30 16:04:44 +0200507 * For legacy fd type, the DRI2/DRI3
508 * authentication should be done before
509 * calling this function.
Alex Deucher09361392015-04-20 12:04:22 -0400510 * \param major_version - \c [out] Major version of library. It is assumed
511 * that adding new functionality will cause
512 * increase in major version
513 * \param minor_version - \c [out] Minor version of library
514 * \param device_handle - \c [out] Pointer to opaque context which should
515 * be passed as the first parameter on each
516 * API call
517 *
518 *
519 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400520 * <0 - Negative POSIX Error code
521 *
522 *
523 * \sa amdgpu_device_deinitialize()
524*/
525int amdgpu_device_initialize(int fd,
526 uint32_t *major_version,
527 uint32_t *minor_version,
528 amdgpu_device_handle *device_handle);
529
Alex Deucher09361392015-04-20 12:04:22 -0400530/**
531 *
532 * When access to such library does not needed any more the special
533 * function must be call giving opportunity to clean up any
534 * resources if needed.
535 *
536 * \param device_handle - \c [in] Context associated with file
537 * descriptor for AMD GPU device
538 * received previously as the
539 * result e.g. of drmOpen() call.
540 *
541 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400542 * <0 - Negative POSIX Error code
543 *
544 * \sa amdgpu_device_initialize()
545 *
546*/
547int amdgpu_device_deinitialize(amdgpu_device_handle device_handle);
548
Alex Deucher09361392015-04-20 12:04:22 -0400549/*
550 * Memory Management
551 *
552*/
553
554/**
555 * Allocate memory to be used by UMD for GPU related operations
556 *
557 * \param dev - \c [in] Device handle.
558 * See #amdgpu_device_initialize()
559 * \param alloc_buffer - \c [in] Pointer to the structure describing an
560 * allocation request
561 * \param info - \c [out] Pointer to structure which return
562 * information about allocated memory
563 *
564 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400565 * <0 - Negative POSIX Error code
566 *
567 * \sa amdgpu_bo_free()
568*/
569int amdgpu_bo_alloc(amdgpu_device_handle dev,
570 struct amdgpu_bo_alloc_request *alloc_buffer,
571 struct amdgpu_bo_alloc_result *info);
572
573/**
574 * Associate opaque data with buffer to be queried by another UMD
575 *
576 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
577 * \param buf_handle - \c [in] Buffer handle
578 * \param info - \c [in] Metadata to associated with buffer
579 *
580 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400581 * <0 - Negative POSIX Error code
582*/
583int amdgpu_bo_set_metadata(amdgpu_bo_handle buf_handle,
584 struct amdgpu_bo_metadata *info);
585
586/**
587 * Query buffer information including metadata previusly associated with
588 * buffer.
589 *
590 * \param dev - \c [in] Device handle.
591 * See #amdgpu_device_initialize()
592 * \param buf_handle - \c [in] Buffer handle
593 * \param info - \c [out] Structure describing buffer
594 *
595 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400596 * <0 - Negative POSIX Error code
597 *
598 * \sa amdgpu_bo_set_metadata(), amdgpu_bo_alloc()
599*/
600int amdgpu_bo_query_info(amdgpu_bo_handle buf_handle,
601 struct amdgpu_bo_info *info);
602
603/**
604 * Allow others to get access to buffer
605 *
606 * \param dev - \c [in] Device handle.
607 * See #amdgpu_device_initialize()
608 * \param buf_handle - \c [in] Buffer handle
609 * \param type - \c [in] Type of handle requested
610 * \param shared_handle - \c [out] Special "shared" handle
611 *
612 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400613 * <0 - Negative POSIX Error code
614 *
615 * \sa amdgpu_bo_import()
616 *
617*/
618int amdgpu_bo_export(amdgpu_bo_handle buf_handle,
619 enum amdgpu_bo_handle_type type,
620 uint32_t *shared_handle);
621
622/**
623 * Request access to "shared" buffer
624 *
625 * \param dev - \c [in] Device handle.
626 * See #amdgpu_device_initialize()
627 * \param type - \c [in] Type of handle requested
628 * \param shared_handle - \c [in] Shared handle received as result "import"
629 * operation
630 * \param output - \c [out] Pointer to structure with information
631 * about imported buffer
632 *
633 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400634 * <0 - Negative POSIX Error code
635 *
636 * \note Buffer must be "imported" only using new "fd" (different from
637 * one used by "exporter").
638 *
639 * \sa amdgpu_bo_export()
640 *
641*/
642int amdgpu_bo_import(amdgpu_device_handle dev,
643 enum amdgpu_bo_handle_type type,
644 uint32_t shared_handle,
645 struct amdgpu_bo_import_result *output);
646
647/**
Christian König558e1292015-06-30 16:04:44 +0200648 * Request GPU access to user allocated memory e.g. via "malloc"
649 *
650 * \param dev - [in] Device handle. See #amdgpu_device_initialize()
651 * \param cpu - [in] CPU address of user allocated memory which we
652 * want to map to GPU address space (make GPU accessible)
653 * (This address must be correctly aligned).
654 * \param size - [in] Size of allocation (must be correctly aligned)
655 * \param amdgpu_bo_alloc_result - [out] Handle of allocation to be passed as
656 * resource on submission and be used in other operations.
657 *
658 *
Christian König28462eb2015-06-30 16:27:27 +0200659 * \return 0 on success\n
660 * <0 - Negative POSIX Error code
Christian König558e1292015-06-30 16:04:44 +0200661 *
662 * \note
663 * This call doesn't guarantee that such memory will be persistently
664 * "locked" / make non-pageable. The purpose of this call is to provide
665 * opportunity for GPU get access to this resource during submission.
666 *
667 * The maximum amount of memory which could be mapped in this call depends
668 * if overcommit is disabled or not. If overcommit is disabled than the max.
669 * amount of memory to be pinned will be limited by left "free" size in total
670 * amount of memory which could be locked simultaneously ("GART" size).
671 *
672 * Supported (theoretical) max. size of mapping is restricted only by
673 * "GART" size.
674 *
675 * It is responsibility of caller to correctly specify access rights
676 * on VA assignment.
677*/
678int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
679 void *cpu, uint64_t size,
680 struct amdgpu_bo_alloc_result *info);
681
682/**
Alex Deucher09361392015-04-20 12:04:22 -0400683 * Free previosuly allocated memory
684 *
685 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
686 * \param buf_handle - \c [in] Buffer handle to free
687 *
688 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400689 * <0 - Negative POSIX Error code
690 *
691 * \note In the case of memory shared between different applications all
692 * resources will be “physically” freed only all such applications
693 * will be terminated
694 * \note If is UMD responsibility to ‘free’ buffer only when there is no
695 * more GPU access
696 *
697 * \sa amdgpu_bo_set_metadata(), amdgpu_bo_alloc()
698 *
699*/
700int amdgpu_bo_free(amdgpu_bo_handle buf_handle);
701
702/**
703 * Request CPU access to GPU accessable memory
704 *
705 * \param buf_handle - \c [in] Buffer handle
706 * \param cpu - \c [out] CPU address to be used for access
707 *
708 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400709 * <0 - Negative POSIX Error code
710 *
711 * \sa amdgpu_bo_cpu_unmap()
712 *
713*/
714int amdgpu_bo_cpu_map(amdgpu_bo_handle buf_handle, void **cpu);
715
716/**
717 * Release CPU access to GPU memory
718 *
719 * \param buf_handle - \c [in] Buffer handle
720 *
721 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400722 * <0 - Negative POSIX Error code
723 *
724 * \sa amdgpu_bo_cpu_map()
725 *
726*/
727int amdgpu_bo_cpu_unmap(amdgpu_bo_handle buf_handle);
728
Alex Deucher09361392015-04-20 12:04:22 -0400729/**
730 * Wait until a buffer is not used by the device.
731 *
732 * \param dev - \c [in] Device handle. See #amdgpu_lib_initialize()
733 * \param buf_handle - \c [in] Buffer handle.
734 * \param timeout_ns - Timeout in nanoseconds.
735 * \param buffer_busy - 0 if buffer is idle, all GPU access was completed
736 * and no GPU access is scheduled.
737 * 1 GPU access is in fly or scheduled
738 *
739 * \return 0 - on success
Christian König558e1292015-06-30 16:04:44 +0200740 * <0 - Negative POSIX Error code
Alex Deucher09361392015-04-20 12:04:22 -0400741 */
742int amdgpu_bo_wait_for_idle(amdgpu_bo_handle buf_handle,
743 uint64_t timeout_ns,
744 bool *buffer_busy);
745
Christian König6dc2eaf2015-04-22 14:52:34 +0200746/**
747 * Creates a BO list handle for command submission.
748 *
749 * \param dev - \c [in] Device handle.
750 * See #amdgpu_device_initialize()
751 * \param number_of_resources - \c [in] Number of BOs in the list
752 * \param resources - \c [in] List of BO handles
753 * \param resource_prios - \c [in] Optional priority for each handle
754 * \param result - \c [out] Created BO list handle
755 *
756 * \return 0 on success\n
Christian König6dc2eaf2015-04-22 14:52:34 +0200757 * <0 - Negative POSIX Error code
758 *
759 * \sa amdgpu_bo_list_destroy()
760*/
761int amdgpu_bo_list_create(amdgpu_device_handle dev,
762 uint32_t number_of_resources,
763 amdgpu_bo_handle *resources,
764 uint8_t *resource_prios,
765 amdgpu_bo_list_handle *result);
766
767/**
768 * Destroys a BO list handle.
769 *
770 * \param handle - \c [in] BO list handle.
771 *
772 * \return 0 on success\n
Christian König6dc2eaf2015-04-22 14:52:34 +0200773 * <0 - Negative POSIX Error code
774 *
775 * \sa amdgpu_bo_list_create()
776*/
777int amdgpu_bo_list_destroy(amdgpu_bo_list_handle handle);
Alex Deucher09361392015-04-20 12:04:22 -0400778
Jammy Zhou72446982015-05-18 20:27:24 +0800779/**
780 * Update resources for existing BO list
781 *
782 * \param handle - \c [in] BO list handle
783 * \param number_of_resources - \c [in] Number of BOs in the list
784 * \param resources - \c [in] List of BO handles
785 * \param resource_prios - \c [in] Optional priority for each handle
786 *
787 * \return 0 on success\n
Jammy Zhou72446982015-05-18 20:27:24 +0800788 * <0 - Negative POSIX Error code
789 *
790 * \sa amdgpu_bo_list_update()
791*/
792int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
793 uint32_t number_of_resources,
794 amdgpu_bo_handle *resources,
795 uint8_t *resource_prios);
796
Alex Deucher09361392015-04-20 12:04:22 -0400797/*
Alex Deucher09361392015-04-20 12:04:22 -0400798 * GPU Execution context
799 *
800*/
801
802/**
803 * Create GPU execution Context
804 *
805 * For the purpose of GPU Scheduler and GPU Robustness extensions it is
806 * necessary to have information/identify rendering/compute contexts.
807 * It also may be needed to associate some specific requirements with such
808 * contexts. Kernel driver will guarantee that submission from the same
809 * context will always be executed in order (first come, first serve).
810 *
811 *
812 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
813 * \param context - \c [out] GPU Context handle
814 *
815 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400816 * <0 - Negative POSIX Error code
817 *
818 * \sa amdgpu_cs_ctx_free()
819 *
820*/
821int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
822 amdgpu_context_handle *context);
823
824/**
825 *
826 * Destroy GPU execution context when not needed any more
827 *
Alex Deucher09361392015-04-20 12:04:22 -0400828 * \param context - \c [in] GPU Context handle
829 *
830 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400831 * <0 - Negative POSIX Error code
832 *
833 * \sa amdgpu_cs_ctx_create()
834 *
835*/
Christian König9c2afff2015-04-22 12:21:13 +0200836int amdgpu_cs_ctx_free(amdgpu_context_handle context);
Alex Deucher09361392015-04-20 12:04:22 -0400837
838/**
839 * Query reset state for the specific GPU Context
840 *
Alex Deucher09361392015-04-20 12:04:22 -0400841 * \param context - \c [in] GPU Context handle
Marek Olšák4b39a8e2015-05-05 21:23:02 +0200842 * \param state - \c [out] One of AMDGPU_CTX_*_RESET
843 * \param hangs - \c [out] Number of hangs caused by the context.
Alex Deucher09361392015-04-20 12:04:22 -0400844 *
845 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400846 * <0 - Negative POSIX Error code
847 *
848 * \sa amdgpu_cs_ctx_create()
849 *
850*/
Christian König9c2afff2015-04-22 12:21:13 +0200851int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
Marek Olšák4b39a8e2015-05-05 21:23:02 +0200852 uint32_t *state, uint32_t *hangs);
Alex Deucher09361392015-04-20 12:04:22 -0400853
Alex Deucher09361392015-04-20 12:04:22 -0400854/*
855 * Command Buffers Management
856 *
857*/
858
Alex Deucher09361392015-04-20 12:04:22 -0400859/**
860 * Send request to submit command buffers to hardware.
861 *
862 * Kernel driver could use GPU Scheduler to make decision when physically
863 * sent this request to the hardware. Accordingly this request could be put
864 * in queue and sent for execution later. The only guarantee is that request
865 * from the same GPU context to the same ip:ip_instance:ring will be executed in
866 * order.
867 *
Ken Wang926c8052015-07-10 22:22:27 +0800868 * The caller can specify the user fence buffer/location with the fence_info in the
869 * cs_request.The sequence number is returned via the 'seq_no' paramter
870 * in ibs_request structure.
871 *
Alex Deucher09361392015-04-20 12:04:22 -0400872 *
873 * \param dev - \c [in] Device handle.
874 * See #amdgpu_device_initialize()
875 * \param context - \c [in] GPU Context
876 * \param flags - \c [in] Global submission flags
Ken Wang926c8052015-07-10 22:22:27 +0800877 * \param ibs_request - \c [in/out] Pointer to submission requests.
Alex Deucher09361392015-04-20 12:04:22 -0400878 * We could submit to the several
879 * engines/rings simulteniously as
880 * 'atomic' operation
881 * \param number_of_requests - \c [in] Number of submission requests
Alex Deucher09361392015-04-20 12:04:22 -0400882 *
883 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400884 * <0 - Negative POSIX Error code
885 *
Alex Deucher09361392015-04-20 12:04:22 -0400886 * \note It is required to pass correct resource list with buffer handles
887 * which will be accessible by command buffers from submission
888 * This will allow kernel driver to correctly implement "paging".
889 * Failure to do so will have unpredictable results.
890 *
891 * \sa amdgpu_command_buffer_alloc(), amdgpu_command_buffer_free(),
892 * amdgpu_cs_query_fence_status()
893 *
894*/
Christian König9c2afff2015-04-22 12:21:13 +0200895int amdgpu_cs_submit(amdgpu_context_handle context,
Alex Deucher09361392015-04-20 12:04:22 -0400896 uint64_t flags,
897 struct amdgpu_cs_request *ibs_request,
Ken Wang926c8052015-07-10 22:22:27 +0800898 uint32_t number_of_requests);
Alex Deucher09361392015-04-20 12:04:22 -0400899
900/**
901 * Query status of Command Buffer Submission
902 *
Alex Deucher09361392015-04-20 12:04:22 -0400903 * \param fence - \c [in] Structure describing fence to query
Jammy Zhouf91b56d2015-07-09 13:51:13 +0800904 * \param timeout_ns - \c [in] Timeout value to wait
905 * \param flags - \c [in] Flags for the query
Alex Deucher09361392015-04-20 12:04:22 -0400906 * \param expired - \c [out] If fence expired or not.\n
907 * 0 – if fence is not expired\n
908 * !0 - otherwise
909 *
910 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400911 * <0 - Negative POSIX Error code
912 *
913 * \note If UMD wants only to check operation status and returned immediately
914 * then timeout value as 0 must be passed. In this case success will be
915 * returned in the case if submission was completed or timeout error
916 * code.
917 *
918 * \sa amdgpu_cs_submit()
919*/
Christian König5463d2e2015-07-09 11:48:32 +0200920int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence,
Jammy Zhouf91b56d2015-07-09 13:51:13 +0800921 uint64_t timeout_ns,
922 uint64_t flags,
Alex Deucher09361392015-04-20 12:04:22 -0400923 uint32_t *expired);
924
Alex Deucher09361392015-04-20 12:04:22 -0400925/*
926 * Query / Info API
927 *
928*/
929
Alex Deucher09361392015-04-20 12:04:22 -0400930/**
931 * Query allocation size alignments
932 *
933 * UMD should query information about GPU VM MC size alignments requirements
934 * to be able correctly choose required allocation size and implement
935 * internal optimization if needed.
936 *
937 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
938 * \param info - \c [out] Pointer to structure to get size alignment
939 * requirements
940 *
941 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400942 * <0 - Negative POSIX Error code
943 *
944*/
945int amdgpu_query_buffer_size_alignment(amdgpu_device_handle dev,
Christian König558e1292015-06-30 16:04:44 +0200946 struct amdgpu_buffer_size_alignments
947 *info);
Alex Deucher09361392015-04-20 12:04:22 -0400948
949/**
950 * Query firmware versions
951 *
952 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
953 * \param fw_type - \c [in] AMDGPU_INFO_FW_*
954 * \param ip_instance - \c [in] Index of the IP block of the same type.
955 * \param index - \c [in] Index of the engine. (for SDMA and MEC)
956 * \param version - \c [out] Pointer to to the "version" return value
957 * \param feature - \c [out] Pointer to to the "feature" return value
958 *
959 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400960 * <0 - Negative POSIX Error code
961 *
962*/
963int amdgpu_query_firmware_version(amdgpu_device_handle dev, unsigned fw_type,
964 unsigned ip_instance, unsigned index,
965 uint32_t *version, uint32_t *feature);
966
Alex Deucher09361392015-04-20 12:04:22 -0400967/**
968 * Query the number of HW IP instances of a certain type.
969 *
970 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
971 * \param type - \c [in] Hardware IP block type = AMDGPU_HW_IP_*
972 * \param count - \c [out] Pointer to structure to get information
973 *
974 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400975 * <0 - Negative POSIX Error code
976*/
977int amdgpu_query_hw_ip_count(amdgpu_device_handle dev, unsigned type,
978 uint32_t *count);
979
Alex Deucher09361392015-04-20 12:04:22 -0400980/**
981 * Query engine information
982 *
983 * This query allows UMD to query information different engines and their
984 * capabilities.
985 *
986 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
987 * \param type - \c [in] Hardware IP block type = AMDGPU_HW_IP_*
988 * \param ip_instance - \c [in] Index of the IP block of the same type.
989 * \param info - \c [out] Pointer to structure to get information
990 *
991 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -0400992 * <0 - Negative POSIX Error code
993*/
994int amdgpu_query_hw_ip_info(amdgpu_device_handle dev, unsigned type,
995 unsigned ip_instance,
996 struct drm_amdgpu_info_hw_ip *info);
997
Alex Deucher09361392015-04-20 12:04:22 -0400998/**
999 * Query heap information
1000 *
1001 * This query allows UMD to query potentially available memory resources and
1002 * adjust their logic if necessary.
1003 *
1004 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
1005 * \param heap - \c [in] Heap type
1006 * \param info - \c [in] Pointer to structure to get needed information
1007 *
1008 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -04001009 * <0 - Negative POSIX Error code
1010 *
1011*/
Christian König558e1292015-06-30 16:04:44 +02001012int amdgpu_query_heap_info(amdgpu_device_handle dev, uint32_t heap,
1013 uint32_t flags, struct amdgpu_heap_info *info);
Alex Deucher09361392015-04-20 12:04:22 -04001014
1015/**
1016 * Get the CRTC ID from the mode object ID
1017 *
1018 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
1019 * \param id - \c [in] Mode object ID
1020 * \param result - \c [in] Pointer to the CRTC ID
1021 *
1022 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -04001023 * <0 - Negative POSIX Error code
1024 *
1025*/
1026int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
1027 int32_t *result);
1028
Alex Deucher09361392015-04-20 12:04:22 -04001029/**
1030 * Query GPU H/w Info
1031 *
1032 * Query hardware specific information
1033 *
1034 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
1035 * \param heap - \c [in] Heap type
1036 * \param info - \c [in] Pointer to structure to get needed information
1037 *
1038 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -04001039 * <0 - Negative POSIX Error code
1040 *
1041*/
1042int amdgpu_query_gpu_info(amdgpu_device_handle dev,
1043 struct amdgpu_gpu_info *info);
1044
Alex Deucher09361392015-04-20 12:04:22 -04001045/**
1046 * Query hardware or driver information.
1047 *
1048 * The return size is query-specific and depends on the "info_id" parameter.
1049 * No more than "size" bytes is returned.
1050 *
1051 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
1052 * \param info_id - \c [in] AMDGPU_INFO_*
1053 * \param size - \c [in] Size of the returned value.
1054 * \param value - \c [out] Pointer to the return value.
1055 *
1056 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -04001057 * <0 - Negative POSIX error code
1058 *
1059*/
1060int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
1061 unsigned size, void *value);
1062
Christian König558e1292015-06-30 16:04:44 +02001063/**
1064 * Query information about GDS
1065 *
1066 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
1067 * \param gds_info - \c [out] Pointer to structure to get GDS information
1068 *
1069 * \return 0 on success\n
Christian König558e1292015-06-30 16:04:44 +02001070 * <0 - Negative POSIX Error code
1071 *
1072*/
1073int amdgpu_query_gds_info(amdgpu_device_handle dev,
1074 struct amdgpu_gds_resource_info *gds_info);
Alex Deucher09361392015-04-20 12:04:22 -04001075
1076/**
1077 * Read a set of consecutive memory-mapped registers.
1078 * Not all registers are allowed to be read by userspace.
1079 *
1080 * \param dev - \c [in] Device handle. See #amdgpu_device_initialize(
1081 * \param dword_offset - \c [in] Register offset in dwords
1082 * \param count - \c [in] The number of registers to read starting
1083 * from the offset
1084 * \param instance - \c [in] GRBM_GFX_INDEX selector. It may have other
1085 * uses. Set it to 0xffffffff if unsure.
1086 * \param flags - \c [in] Flags with additional information.
1087 * \param values - \c [out] The pointer to return values.
1088 *
1089 * \return 0 on success\n
Alex Deucher09361392015-04-20 12:04:22 -04001090 * <0 - Negative POSIX error code
1091 *
1092*/
1093int amdgpu_read_mm_registers(amdgpu_device_handle dev, unsigned dword_offset,
1094 unsigned count, uint32_t instance, uint32_t flags,
1095 uint32_t *values);
1096
Sabre Shao23fab592015-07-09 13:50:36 +08001097/**
1098 * Allocate virtual address range
1099 *
1100 * \param dev - [in] Device handle. See #amdgpu_device_initialize()
1101 * \param va_range_type - \c [in] Type of MC va range from which to allocate
1102 * \param size - \c [in] Size of range. Size must be correctly* aligned.
1103 * It is client responsibility to correctly aligned size based on the future
1104 * usage of allocated range.
1105 * \param va_base_alignment - \c [in] Overwrite base address alignment
1106 * requirement for GPU VM MC virtual
1107 * address assignment. Must be multiple of size alignments received as
1108 * 'amdgpu_buffer_size_alignments'.
1109 * If 0 use the default one.
1110 * \param va_base_required - \c [in] Specified required va base address.
1111 * If 0 then library choose available one.
1112 * If !0 value will be passed and those value already "in use" then
1113 * corresponding error status will be returned.
1114 * \param va_base_allocated - \c [out] On return: Allocated VA base to be used
1115 * by client.
1116 * \param va_range_handle - \c [out] On return: Handle assigned to allocation
Jammy Zhou95d0f352015-07-16 10:29:58 +08001117 * \param flags - \c [in] flags for special VA range
Sabre Shao23fab592015-07-09 13:50:36 +08001118 *
1119 * \return 0 on success\n
1120 * >0 - AMD specific error code\n
1121 * <0 - Negative POSIX Error code
1122 *
1123 * \notes \n
1124 * It is client responsibility to correctly handle VA assignments and usage.
1125 * Neither kernel driver nor libdrm_amdpgu are able to prevent and
1126 * detect wrong va assignemnt.
1127 *
1128 * It is client responsibility to correctly handle multi-GPU cases and to pass
1129 * the corresponding arrays of all devices handles where corresponding VA will
1130 * be used.
1131 *
1132*/
1133int amdgpu_va_range_alloc(amdgpu_device_handle dev,
1134 enum amdgpu_gpu_va_range va_range_type,
1135 uint64_t size,
1136 uint64_t va_base_alignment,
1137 uint64_t va_base_required,
1138 uint64_t *va_base_allocated,
Jammy Zhou95d0f352015-07-16 10:29:58 +08001139 amdgpu_va_handle *va_range_handle,
1140 uint64_t flags);
Sabre Shao23fab592015-07-09 13:50:36 +08001141
1142/**
1143 * Free previously allocated virtual address range
1144 *
1145 *
1146 * \param va_range_handle - \c [in] Handle assigned to VA allocation
1147 *
1148 * \return 0 on success\n
1149 * >0 - AMD specific error code\n
1150 * <0 - Negative POSIX Error code
1151 *
1152*/
1153int amdgpu_va_range_free(amdgpu_va_handle va_range_handle);
1154
Sabre Shao12802da2015-07-09 13:53:24 +08001155/**
1156* Query virtual address range
1157*
1158* UMD can query GPU VM range supported by each device
1159* to initialize its own VAM accordingly.
1160*
1161* \param dev - [in] Device handle. See #amdgpu_device_initialize()
1162* \param type - \c [in] Type of virtual address range
1163* \param offset - \c [out] Start offset of virtual address range
1164* \param size - \c [out] Size of virtual address range
1165*
1166* \return 0 on success\n
1167* <0 - Negative POSIX Error code
1168*
1169*/
1170
1171int amdgpu_va_range_query(amdgpu_device_handle dev,
1172 enum amdgpu_gpu_va_range type,
1173 uint64_t *start,
1174 uint64_t *end);
1175
Alex Deucher09361392015-04-20 12:04:22 -04001176#endif /* #ifdef _AMDGPU_H_ */