| 1 |
/* |
| 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 |
|
| 40 |
#ifdef __cplusplus |
| 41 |
extern "C" { |
| 42 |
#endif |
| 43 |
|
| 44 |
struct drm_amdgpu_info_hw_ip; |
| 45 |
struct drm_amdgpu_info_uq_fw_areas; |
| 46 |
struct drm_amdgpu_bo_list_entry; |
| 47 |
struct drm_amdgpu_userq_signal; |
| 48 |
struct drm_amdgpu_userq_wait; |
| 49 |
|
| 50 |
/*--------------------------------------------------------------------------*/ |
| 51 |
/* --------------------------- Defines ------------------------------------ */ |
| 52 |
/*--------------------------------------------------------------------------*/ |
| 53 |
|
| 54 |
/** |
| 55 |
* Define max. number of Command Buffers (IB) which could be sent to the single |
| 56 |
* hardware IP to accommodate CE/DE requirements |
| 57 |
* |
| 58 |
* \sa amdgpu_cs_ib_info |
| 59 |
*/ |
| 60 |
#define AMDGPU_CS_MAX_IBS_PER_SUBMIT 4 |
| 61 |
|
| 62 |
/** |
| 63 |
* Special timeout value meaning that the timeout is infinite. |
| 64 |
*/ |
| 65 |
#define AMDGPU_TIMEOUT_INFINITE 0xffffffffffffffffull |
| 66 |
|
| 67 |
/** |
| 68 |
* Used in amdgpu_cs_query_fence_status(), meaning that the given timeout |
| 69 |
* is absolute. |
| 70 |
*/ |
| 71 |
#define AMDGPU_QUERY_FENCE_TIMEOUT_IS_ABSOLUTE (1 << 0) |
| 72 |
|
| 73 |
/*--------------------------------------------------------------------------*/ |
| 74 |
/* ----------------------------- Enums ------------------------------------ */ |
| 75 |
/*--------------------------------------------------------------------------*/ |
| 76 |
|
| 77 |
/** |
| 78 |
* Enum describing possible handle types |
| 79 |
* |
| 80 |
* \sa amdgpu_bo_import, amdgpu_bo_export |
| 81 |
* |
| 82 |
*/ |
| 83 |
enum amdgpu_bo_handle_type { |
| 84 |
/** GEM flink name (needs DRM authentication, used by DRI2) */ |
| 85 |
amdgpu_bo_handle_type_gem_flink_name = 0, |
| 86 |
|
| 87 |
/** KMS handle which is used by all driver ioctls */ |
| 88 |
amdgpu_bo_handle_type_kms = 1, |
| 89 |
|
| 90 |
/** DMA-buf fd handle */ |
| 91 |
amdgpu_bo_handle_type_dma_buf_fd = 2, |
| 92 |
|
| 93 |
/** Deprecated in favour of and same behaviour as |
| 94 |
* amdgpu_bo_handle_type_kms, use that instead of this |
| 95 |
*/ |
| 96 |
amdgpu_bo_handle_type_kms_noimport = 3, |
| 97 |
}; |
| 98 |
|
| 99 |
/** Define known types of GPU VM VA ranges */ |
| 100 |
enum amdgpu_gpu_va_range |
| 101 |
{ |
| 102 |
/** Allocate from "normal"/general range */ |
| 103 |
amdgpu_gpu_va_range_general = 0 |
| 104 |
}; |
| 105 |
|
| 106 |
enum amdgpu_sw_info { |
| 107 |
amdgpu_sw_info_address32_hi = 0, |
| 108 |
/** Query the PRT control bit when the half VA range is reserved for |
| 109 |
* PRT when the device is initialized. This depends on the GFX version. |
| 110 |
* A return value of ~0 should be ignored. |
| 111 |
*/ |
| 112 |
amdgpu_sw_info_address_prt_wa_control_bit = 1, |
| 113 |
}; |
| 114 |
|
| 115 |
enum amdgpu_va_manager_sw_info { |
| 116 |
/** Query the PRT control bit when the half VA range is reserved for |
| 117 |
* PRT with AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT. The default value of |
| 118 |
* ~0 shouldn't be considered a valid value. |
| 119 |
*/ |
| 120 |
amdgpu_va_manager_sw_info_address_prt_wa_control_bit = 0, |
| 121 |
}; |
| 122 |
|
| 123 |
/*--------------------------------------------------------------------------*/ |
| 124 |
/* -------------------------- Datatypes ----------------------------------- */ |
| 125 |
/*--------------------------------------------------------------------------*/ |
| 126 |
|
| 127 |
/** |
| 128 |
* Define opaque pointer to context associated with fd. |
| 129 |
* This context will be returned as the result of |
| 130 |
* "initialize" function and should be pass as the first |
| 131 |
* parameter to any API call |
| 132 |
*/ |
| 133 |
typedef struct amdgpu_device *amdgpu_device_handle; |
| 134 |
|
| 135 |
/** |
| 136 |
* Define GPU Context type as pointer to opaque structure |
| 137 |
* Example of GPU Context is the "rendering" context associated |
| 138 |
* with OpenGL context (glCreateContext) |
| 139 |
*/ |
| 140 |
typedef struct amdgpu_context *amdgpu_context_handle; |
| 141 |
|
| 142 |
/** |
| 143 |
* Define handle for amdgpu resources: buffer, GDS, etc. |
| 144 |
*/ |
| 145 |
typedef struct amdgpu_bo *amdgpu_bo_handle; |
| 146 |
|
| 147 |
/** |
| 148 |
* Define handle for list of BOs |
| 149 |
*/ |
| 150 |
typedef struct amdgpu_bo_list *amdgpu_bo_list_handle; |
| 151 |
|
| 152 |
/** |
| 153 |
* Define handle to be used to work with VA allocated ranges |
| 154 |
*/ |
| 155 |
typedef struct amdgpu_va *amdgpu_va_handle; |
| 156 |
|
| 157 |
/** |
| 158 |
* Define handle dealing with VA allocation. An amdgpu_device |
| 159 |
* owns one of these, but they can also be used without a device. |
| 160 |
*/ |
| 161 |
typedef struct amdgpu_va_manager *amdgpu_va_manager_handle; |
| 162 |
|
| 163 |
/** |
| 164 |
* Define handle for semaphore |
| 165 |
*/ |
| 166 |
typedef struct amdgpu_semaphore *amdgpu_semaphore_handle; |
| 167 |
|
| 168 |
/*--------------------------------------------------------------------------*/ |
| 169 |
/* -------------------------- Structures ---------------------------------- */ |
| 170 |
/*--------------------------------------------------------------------------*/ |
| 171 |
|
| 172 |
/** |
| 173 |
* Structure describing memory allocation request |
| 174 |
* |
| 175 |
* \sa amdgpu_bo_alloc() |
| 176 |
* |
| 177 |
*/ |
| 178 |
struct amdgpu_bo_alloc_request { |
| 179 |
/** Allocation request. It must be aligned correctly. */ |
| 180 |
uint64_t alloc_size; |
| 181 |
|
| 182 |
/** |
| 183 |
* It may be required to have some specific alignment requirements |
| 184 |
* for physical back-up storage (e.g. for displayable surface). |
| 185 |
* If 0 there is no special alignment requirement |
| 186 |
*/ |
| 187 |
uint64_t phys_alignment; |
| 188 |
|
| 189 |
/** |
| 190 |
* UMD should specify where to allocate memory and how it |
| 191 |
* will be accessed by the CPU. |
| 192 |
*/ |
| 193 |
uint32_t preferred_heap; |
| 194 |
|
| 195 |
/** Additional flags passed on allocation */ |
| 196 |
uint64_t flags; |
| 197 |
}; |
| 198 |
|
| 199 |
/** |
| 200 |
* Special UMD specific information associated with buffer. |
| 201 |
* |
| 202 |
* It may be need to pass some buffer charactersitic as part |
| 203 |
* of buffer sharing. Such information are defined UMD and |
| 204 |
* opaque for libdrm_amdgpu as well for kernel driver. |
| 205 |
* |
| 206 |
* \sa amdgpu_bo_set_metadata(), amdgpu_bo_query_info, |
| 207 |
* amdgpu_bo_import(), amdgpu_bo_export |
| 208 |
* |
| 209 |
*/ |
| 210 |
struct amdgpu_bo_metadata { |
| 211 |
/** Special flag associated with surface */ |
| 212 |
uint64_t flags; |
| 213 |
|
| 214 |
/** |
| 215 |
* ASIC-specific tiling information (also used by DCE). |
| 216 |
* The encoding is defined by the AMDGPU_TILING_* definitions. |
| 217 |
*/ |
| 218 |
uint64_t tiling_info; |
| 219 |
|
| 220 |
/** Size of metadata associated with the buffer, in bytes. */ |
| 221 |
uint32_t size_metadata; |
| 222 |
|
| 223 |
/** UMD specific metadata. Opaque for kernel */ |
| 224 |
uint32_t umd_metadata[64]; |
| 225 |
}; |
| 226 |
|
| 227 |
/** |
| 228 |
* Structure describing allocated buffer. Client may need |
| 229 |
* to query such information as part of 'sharing' buffers mechanism |
| 230 |
* |
| 231 |
* \sa amdgpu_bo_set_metadata(), amdgpu_bo_query_info(), |
| 232 |
* amdgpu_bo_import(), amdgpu_bo_export() |
| 233 |
*/ |
| 234 |
struct amdgpu_bo_info { |
| 235 |
/** Allocated memory size */ |
| 236 |
uint64_t alloc_size; |
| 237 |
|
| 238 |
/** |
| 239 |
* It may be required to have some specific alignment requirements |
| 240 |
* for physical back-up storage. |
| 241 |
*/ |
| 242 |
uint64_t phys_alignment; |
| 243 |
|
| 244 |
/** Heap where to allocate memory. */ |
| 245 |
uint32_t preferred_heap; |
| 246 |
|
| 247 |
/** Additional allocation flags. */ |
| 248 |
uint64_t alloc_flags; |
| 249 |
|
| 250 |
/** Metadata associated with buffer if any. */ |
| 251 |
struct amdgpu_bo_metadata metadata; |
| 252 |
}; |
| 253 |
|
| 254 |
/** |
| 255 |
* Structure with information about "imported" buffer |
| 256 |
* |
| 257 |
* \sa amdgpu_bo_import() |
| 258 |
* |
| 259 |
*/ |
| 260 |
struct amdgpu_bo_import_result { |
| 261 |
/** Handle of memory/buffer to use */ |
| 262 |
amdgpu_bo_handle buf_handle; |
| 263 |
|
| 264 |
/** Buffer size */ |
| 265 |
uint64_t alloc_size; |
| 266 |
}; |
| 267 |
|
| 268 |
/** |
| 269 |
* |
| 270 |
* Structure to describe GDS partitioning information. |
| 271 |
* \note OA and GWS resources are asscoiated with GDS partition |
| 272 |
* |
| 273 |
* \sa amdgpu_gpu_resource_query_gds_info |
| 274 |
* |
| 275 |
*/ |
| 276 |
struct amdgpu_gds_resource_info { |
| 277 |
uint32_t gds_gfx_partition_size; |
| 278 |
uint32_t compute_partition_size; |
| 279 |
uint32_t gds_total_size; |
| 280 |
uint32_t gws_per_gfx_partition; |
| 281 |
uint32_t gws_per_compute_partition; |
| 282 |
uint32_t oa_per_gfx_partition; |
| 283 |
uint32_t oa_per_compute_partition; |
| 284 |
}; |
| 285 |
|
| 286 |
/** |
| 287 |
* Structure describing CS fence |
| 288 |
* |
| 289 |
* \sa amdgpu_cs_query_fence_status(), amdgpu_cs_request, amdgpu_cs_submit() |
| 290 |
* |
| 291 |
*/ |
| 292 |
struct amdgpu_cs_fence { |
| 293 |
|
| 294 |
/** In which context IB was sent to execution */ |
| 295 |
amdgpu_context_handle context; |
| 296 |
|
| 297 |
/** To which HW IP type the fence belongs */ |
| 298 |
uint32_t ip_type; |
| 299 |
|
| 300 |
/** IP instance index if there are several IPs of the same type. */ |
| 301 |
uint32_t ip_instance; |
| 302 |
|
| 303 |
/** Ring index of the HW IP */ |
| 304 |
uint32_t ring; |
| 305 |
|
| 306 |
/** Specify fence for which we need to check submission status.*/ |
| 307 |
uint64_t fence; |
| 308 |
}; |
| 309 |
|
| 310 |
/** |
| 311 |
* Structure describing IB |
| 312 |
* |
| 313 |
* \sa amdgpu_cs_request, amdgpu_cs_submit() |
| 314 |
* |
| 315 |
*/ |
| 316 |
struct amdgpu_cs_ib_info { |
| 317 |
/** Special flags */ |
| 318 |
uint64_t flags; |
| 319 |
|
| 320 |
/** Virtual MC address of the command buffer */ |
| 321 |
uint64_t ib_mc_address; |
| 322 |
|
| 323 |
/** |
| 324 |
* Size of Command Buffer to be submitted. |
| 325 |
* - The size is in units of dwords (4 bytes). |
| 326 |
* - Could be 0 |
| 327 |
*/ |
| 328 |
uint32_t size; |
| 329 |
}; |
| 330 |
|
| 331 |
/** |
| 332 |
* Structure describing fence information |
| 333 |
* |
| 334 |
* \sa amdgpu_cs_request, amdgpu_cs_query_fence, |
| 335 |
* amdgpu_cs_submit(), amdgpu_cs_query_fence_status() |
| 336 |
*/ |
| 337 |
struct amdgpu_cs_fence_info { |
| 338 |
/** buffer object for the fence */ |
| 339 |
amdgpu_bo_handle handle; |
| 340 |
|
| 341 |
/** fence offset in the unit of sizeof(uint64_t) */ |
| 342 |
uint64_t offset; |
| 343 |
}; |
| 344 |
|
| 345 |
/** |
| 346 |
* Structure describing submission request |
| 347 |
* |
| 348 |
* \note We could have several IBs as packet. e.g. CE, CE, DE case for gfx |
| 349 |
* |
| 350 |
* \sa amdgpu_cs_submit() |
| 351 |
*/ |
| 352 |
struct amdgpu_cs_request { |
| 353 |
/** Specify flags with additional information */ |
| 354 |
uint64_t flags; |
| 355 |
|
| 356 |
/** Specify HW IP block type to which to send the IB. */ |
| 357 |
unsigned ip_type; |
| 358 |
|
| 359 |
/** IP instance index if there are several IPs of the same type. */ |
| 360 |
unsigned ip_instance; |
| 361 |
|
| 362 |
/** |
| 363 |
* Specify ring index of the IP. We could have several rings |
| 364 |
* in the same IP. E.g. 0 for SDMA0 and 1 for SDMA1. |
| 365 |
*/ |
| 366 |
uint32_t ring; |
| 367 |
|
| 368 |
/** |
| 369 |
* List handle with resources used by this request. |
| 370 |
*/ |
| 371 |
amdgpu_bo_list_handle resources; |
| 372 |
|
| 373 |
/** |
| 374 |
* Number of dependencies this Command submission needs to |
| 375 |
* wait for before starting execution. |
| 376 |
*/ |
| 377 |
uint32_t number_of_dependencies; |
| 378 |
|
| 379 |
/** |
| 380 |
* Array of dependencies which need to be met before |
| 381 |
* execution can start. |
| 382 |
*/ |
| 383 |
struct amdgpu_cs_fence *dependencies; |
| 384 |
|
| 385 |
/** Number of IBs to submit in the field ibs. */ |
| 386 |
uint32_t number_of_ibs; |
| 387 |
|
| 388 |
/** |
| 389 |
* IBs to submit. Those IBs will be submit together as single entity |
| 390 |
*/ |
| 391 |
struct amdgpu_cs_ib_info *ibs; |
| 392 |
|
| 393 |
/** |
| 394 |
* The returned sequence number for the command submission |
| 395 |
*/ |
| 396 |
uint64_t seq_no; |
| 397 |
|
| 398 |
/** |
| 399 |
* The fence information |
| 400 |
*/ |
| 401 |
struct amdgpu_cs_fence_info fence_info; |
| 402 |
}; |
| 403 |
|
| 404 |
/** |
| 405 |
* Structure which provide information about GPU VM MC Address space |
| 406 |
* alignments requirements |
| 407 |
* |
| 408 |
* \sa amdgpu_query_buffer_size_alignment |
| 409 |
*/ |
| 410 |
struct amdgpu_buffer_size_alignments { |
| 411 |
/** Size alignment requirement for allocation in |
| 412 |
* local memory */ |
| 413 |
uint64_t size_local; |
| 414 |
|
| 415 |
/** |
| 416 |
* Size alignment requirement for allocation in remote memory |
| 417 |
*/ |
| 418 |
uint64_t size_remote; |
| 419 |
}; |
| 420 |
|
| 421 |
/** |
| 422 |
* Structure which provide information about heap |
| 423 |
* |
| 424 |
* \sa amdgpu_query_heap_info() |
| 425 |
* |
| 426 |
*/ |
| 427 |
struct amdgpu_heap_info { |
| 428 |
/** Theoretical max. available memory in the given heap */ |
| 429 |
uint64_t heap_size; |
| 430 |
|
| 431 |
/** |
| 432 |
* Number of bytes allocated in the heap. This includes all processes |
| 433 |
* and private allocations in the kernel. It changes when new buffers |
| 434 |
* are allocated, freed, and moved. It cannot be larger than |
| 435 |
* heap_size. |
| 436 |
*/ |
| 437 |
uint64_t heap_usage; |
| 438 |
|
| 439 |
/** |
| 440 |
* Theoretical possible max. size of buffer which |
| 441 |
* could be allocated in the given heap |
| 442 |
*/ |
| 443 |
uint64_t max_allocation; |
| 444 |
}; |
| 445 |
|
| 446 |
/** |
| 447 |
* Describe GPU h/w info needed for UMD correct initialization |
| 448 |
* |
| 449 |
* \sa amdgpu_query_gpu_info() |
| 450 |
*/ |
| 451 |
struct amdgpu_gpu_info { |
| 452 |
/** Asic id */ |
| 453 |
uint32_t asic_id; |
| 454 |
/** Chip revision */ |
| 455 |
uint32_t chip_rev; |
| 456 |
/** Chip external revision */ |
| 457 |
uint32_t chip_external_rev; |
| 458 |
/** Family ID */ |
| 459 |
uint32_t family_id; |
| 460 |
/** Special flags */ |
| 461 |
uint64_t ids_flags; |
| 462 |
/** max engine clock*/ |
| 463 |
uint64_t max_engine_clk; |
| 464 |
/** max memory clock */ |
| 465 |
uint64_t max_memory_clk; |
| 466 |
/** number of shader engines */ |
| 467 |
uint32_t num_shader_engines; |
| 468 |
/** number of shader arrays per engine */ |
| 469 |
uint32_t num_shader_arrays_per_engine; |
| 470 |
/** Number of available good shader pipes */ |
| 471 |
uint32_t avail_quad_shader_pipes; |
| 472 |
/** Max. number of shader pipes.(including good and bad pipes */ |
| 473 |
uint32_t max_quad_shader_pipes; |
| 474 |
/** Number of parameter cache entries per shader quad pipe */ |
| 475 |
uint32_t cache_entries_per_quad_pipe; |
| 476 |
/** Number of available graphics context */ |
| 477 |
uint32_t num_hw_gfx_contexts; |
| 478 |
/** Number of render backend pipes */ |
| 479 |
uint32_t rb_pipes; |
| 480 |
/** Enabled render backend pipe mask */ |
| 481 |
uint32_t enabled_rb_pipes_mask; |
| 482 |
/** Frequency of GPU Counter */ |
| 483 |
uint32_t gpu_counter_freq; |
| 484 |
/** CC_RB_BACKEND_DISABLE.BACKEND_DISABLE per SE */ |
| 485 |
uint32_t backend_disable[4]; |
| 486 |
/** Value of MC_ARB_RAMCFG register*/ |
| 487 |
uint32_t mc_arb_ramcfg; |
| 488 |
/** Value of GB_ADDR_CONFIG */ |
| 489 |
uint32_t gb_addr_cfg; |
| 490 |
/** Values of the GB_TILE_MODE0..31 registers */ |
| 491 |
uint32_t gb_tile_mode[32]; |
| 492 |
/** Values of GB_MACROTILE_MODE0..15 registers */ |
| 493 |
uint32_t gb_macro_tile_mode[16]; |
| 494 |
/** Value of PA_SC_RASTER_CONFIG register per SE */ |
| 495 |
uint32_t pa_sc_raster_cfg[4]; |
| 496 |
/** Value of PA_SC_RASTER_CONFIG_1 register per SE */ |
| 497 |
uint32_t pa_sc_raster_cfg1[4]; |
| 498 |
/* CU info */ |
| 499 |
uint32_t cu_active_number; |
| 500 |
uint32_t cu_ao_mask; |
| 501 |
uint32_t cu_bitmap[4][4]; |
| 502 |
/* video memory type info*/ |
| 503 |
uint32_t vram_type; |
| 504 |
/* video memory bit width*/ |
| 505 |
uint32_t vram_bit_width; |
| 506 |
/** constant engine ram size*/ |
| 507 |
uint32_t ce_ram_size; |
| 508 |
/* vce harvesting instance */ |
| 509 |
uint32_t vce_harvest_config; |
| 510 |
/* PCI revision ID */ |
| 511 |
uint32_t pci_rev_id; |
| 512 |
}; |
| 513 |
|
| 514 |
|
| 515 |
/*--------------------------------------------------------------------------*/ |
| 516 |
/*------------------------- Functions --------------------------------------*/ |
| 517 |
/*--------------------------------------------------------------------------*/ |
| 518 |
|
| 519 |
/* |
| 520 |
* Initialization / Cleanup |
| 521 |
* |
| 522 |
*/ |
| 523 |
|
| 524 |
/** |
| 525 |
* |
| 526 |
* \param fd - \c [in] File descriptor for AMD GPU device |
| 527 |
* received previously as the result of |
| 528 |
* e.g. drmOpen() call. |
| 529 |
* For legacy fd type, the DRI2/DRI3 |
| 530 |
* authentication should be done before |
| 531 |
* calling this function. |
| 532 |
* \param major_version - \c [out] Major version of library. It is assumed |
| 533 |
* that adding new functionality will cause |
| 534 |
* increase in major version |
| 535 |
* \param minor_version - \c [out] Minor version of library |
| 536 |
* \param device_handle - \c [out] Pointer to opaque context which should |
| 537 |
* be passed as the first parameter on each |
| 538 |
* API call |
| 539 |
* |
| 540 |
* |
| 541 |
* \return 0 on success\n |
| 542 |
* <0 - Negative POSIX Error code |
| 543 |
* |
| 544 |
* |
| 545 |
* \sa amdgpu_device_deinitialize() |
| 546 |
*/ |
| 547 |
int amdgpu_device_initialize(int fd, |
| 548 |
uint32_t *major_version, |
| 549 |
uint32_t *minor_version, |
| 550 |
amdgpu_device_handle *device_handle); |
| 551 |
|
| 552 |
/** |
| 553 |
* Same as amdgpu_device_initialize() except when deduplicate_device |
| 554 |
* is false *and* fd points to a device that was already initialized. |
| 555 |
* In this case, amdgpu_device_initialize would return the same |
| 556 |
* amdgpu_device_handle while here amdgpu_device_initialize2 would |
| 557 |
* return a new handle. |
| 558 |
* amdgpu_device_initialize() should be preferred in most situations; |
| 559 |
* the only use-case where not-deduplicating devices make sense is |
| 560 |
* when one wants to have isolated device handles in the same process. |
| 561 |
*/ |
| 562 |
int amdgpu_device_initialize2(int fd, bool deduplicate_device, |
| 563 |
uint32_t *major_version, |
| 564 |
uint32_t *minor_version, |
| 565 |
amdgpu_device_handle *device_handle); |
| 566 |
/** |
| 567 |
* |
| 568 |
* When access to such library does not needed any more the special |
| 569 |
* function must be call giving opportunity to clean up any |
| 570 |
* resources if needed. |
| 571 |
* |
| 572 |
* \param device_handle - \c [in] Context associated with file |
| 573 |
* descriptor for AMD GPU device |
| 574 |
* received previously as the |
| 575 |
* result e.g. of drmOpen() call. |
| 576 |
* |
| 577 |
* \return 0 on success\n |
| 578 |
* <0 - Negative POSIX Error code |
| 579 |
* |
| 580 |
* \sa amdgpu_device_initialize() |
| 581 |
* |
| 582 |
*/ |
| 583 |
int amdgpu_device_deinitialize(amdgpu_device_handle device_handle); |
| 584 |
|
| 585 |
/** |
| 586 |
* |
| 587 |
* /param device_handle - \c [in] Device handle. |
| 588 |
* See #amdgpu_device_initialize() |
| 589 |
* |
| 590 |
* \return Returns the drm fd used for operations on this |
| 591 |
* device. This is still owned by the library and hence |
| 592 |
* should not be closed. Guaranteed to be valid until |
| 593 |
* #amdgpu_device_deinitialize gets called. |
| 594 |
* |
| 595 |
*/ |
| 596 |
int amdgpu_device_get_fd(amdgpu_device_handle device_handle); |
| 597 |
|
| 598 |
/* |
| 599 |
* Memory Management |
| 600 |
* |
| 601 |
*/ |
| 602 |
|
| 603 |
/** |
| 604 |
* Allocate memory to be used by UMD for GPU related operations |
| 605 |
* |
| 606 |
* \param dev - \c [in] Device handle. |
| 607 |
* See #amdgpu_device_initialize() |
| 608 |
* \param alloc_buffer - \c [in] Pointer to the structure describing an |
| 609 |
* allocation request |
| 610 |
* \param buf_handle - \c [out] Allocated buffer handle |
| 611 |
* |
| 612 |
* \return 0 on success\n |
| 613 |
* <0 - Negative POSIX Error code |
| 614 |
* |
| 615 |
* \sa amdgpu_bo_free() |
| 616 |
*/ |
| 617 |
int amdgpu_bo_alloc(amdgpu_device_handle dev, |
| 618 |
struct amdgpu_bo_alloc_request *alloc_buffer, |
| 619 |
amdgpu_bo_handle *buf_handle); |
| 620 |
|
| 621 |
/** |
| 622 |
* Associate opaque data with buffer to be queried by another UMD |
| 623 |
* |
| 624 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 625 |
* \param buf_handle - \c [in] Buffer handle |
| 626 |
* \param info - \c [in] Metadata to associated with buffer |
| 627 |
* |
| 628 |
* \return 0 on success\n |
| 629 |
* <0 - Negative POSIX Error code |
| 630 |
*/ |
| 631 |
int amdgpu_bo_set_metadata(amdgpu_bo_handle buf_handle, |
| 632 |
struct amdgpu_bo_metadata *info); |
| 633 |
|
| 634 |
/** |
| 635 |
* Query buffer information including metadata previusly associated with |
| 636 |
* buffer. |
| 637 |
* |
| 638 |
* \param dev - \c [in] Device handle. |
| 639 |
* See #amdgpu_device_initialize() |
| 640 |
* \param buf_handle - \c [in] Buffer handle |
| 641 |
* \param info - \c [out] Structure describing buffer |
| 642 |
* |
| 643 |
* \return 0 on success\n |
| 644 |
* <0 - Negative POSIX Error code |
| 645 |
* |
| 646 |
* \sa amdgpu_bo_set_metadata(), amdgpu_bo_alloc() |
| 647 |
*/ |
| 648 |
int amdgpu_bo_query_info(amdgpu_bo_handle buf_handle, |
| 649 |
struct amdgpu_bo_info *info); |
| 650 |
|
| 651 |
/** |
| 652 |
* Allow others to get access to buffer |
| 653 |
* |
| 654 |
* \param dev - \c [in] Device handle. |
| 655 |
* See #amdgpu_device_initialize() |
| 656 |
* \param buf_handle - \c [in] Buffer handle |
| 657 |
* \param type - \c [in] Type of handle requested |
| 658 |
* \param shared_handle - \c [out] Special "shared" handle |
| 659 |
* |
| 660 |
* \return 0 on success\n |
| 661 |
* <0 - Negative POSIX Error code |
| 662 |
* |
| 663 |
* \sa amdgpu_bo_import() |
| 664 |
* |
| 665 |
*/ |
| 666 |
int amdgpu_bo_export(amdgpu_bo_handle buf_handle, |
| 667 |
enum amdgpu_bo_handle_type type, |
| 668 |
uint32_t *shared_handle); |
| 669 |
|
| 670 |
/** |
| 671 |
* Request access to "shared" buffer |
| 672 |
* |
| 673 |
* \param dev - \c [in] Device handle. |
| 674 |
* See #amdgpu_device_initialize() |
| 675 |
* \param type - \c [in] Type of handle requested |
| 676 |
* \param shared_handle - \c [in] Shared handle received as result "import" |
| 677 |
* operation |
| 678 |
* \param output - \c [out] Pointer to structure with information |
| 679 |
* about imported buffer |
| 680 |
* |
| 681 |
* \return 0 on success\n |
| 682 |
* <0 - Negative POSIX Error code |
| 683 |
* |
| 684 |
* \note Buffer must be "imported" only using new "fd" (different from |
| 685 |
* one used by "exporter"). |
| 686 |
* |
| 687 |
* \sa amdgpu_bo_export() |
| 688 |
* |
| 689 |
*/ |
| 690 |
int amdgpu_bo_import(amdgpu_device_handle dev, |
| 691 |
enum amdgpu_bo_handle_type type, |
| 692 |
uint32_t shared_handle, |
| 693 |
struct amdgpu_bo_import_result *output); |
| 694 |
|
| 695 |
/** |
| 696 |
* Request GPU access to user allocated memory e.g. via "malloc" |
| 697 |
* |
| 698 |
* \param dev - [in] Device handle. See #amdgpu_device_initialize() |
| 699 |
* \param cpu - [in] CPU address of user allocated memory which we |
| 700 |
* want to map to GPU address space (make GPU accessible) |
| 701 |
* (This address must be correctly aligned). |
| 702 |
* \param size - [in] Size of allocation (must be correctly aligned) |
| 703 |
* \param buf_handle - [out] Buffer handle for the userptr memory |
| 704 |
* resource on submission and be used in other operations. |
| 705 |
* |
| 706 |
* |
| 707 |
* \return 0 on success\n |
| 708 |
* <0 - Negative POSIX Error code |
| 709 |
* |
| 710 |
* \note |
| 711 |
* This call doesn't guarantee that such memory will be persistently |
| 712 |
* "locked" / make non-pageable. The purpose of this call is to provide |
| 713 |
* opportunity for GPU get access to this resource during submission. |
| 714 |
* |
| 715 |
* The maximum amount of memory which could be mapped in this call depends |
| 716 |
* if overcommit is disabled or not. If overcommit is disabled than the max. |
| 717 |
* amount of memory to be pinned will be limited by left "free" size in total |
| 718 |
* amount of memory which could be locked simultaneously ("GART" size). |
| 719 |
* |
| 720 |
* Supported (theoretical) max. size of mapping is restricted only by |
| 721 |
* "GART" size. |
| 722 |
* |
| 723 |
* It is responsibility of caller to correctly specify access rights |
| 724 |
* on VA assignment. |
| 725 |
*/ |
| 726 |
int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev, |
| 727 |
void *cpu, uint64_t size, |
| 728 |
amdgpu_bo_handle *buf_handle); |
| 729 |
|
| 730 |
/** |
| 731 |
* Validate if the user memory comes from BO |
| 732 |
* |
| 733 |
* \param dev - [in] Device handle. See #amdgpu_device_initialize() |
| 734 |
* \param cpu - [in] CPU address of user allocated memory which we |
| 735 |
* want to map to GPU address space (make GPU accessible) |
| 736 |
* (This address must be correctly aligned). |
| 737 |
* \param size - [in] Size of allocation (must be correctly aligned) |
| 738 |
* \param buf_handle - [out] Buffer handle for the userptr memory |
| 739 |
* if the user memory is not from BO, the buf_handle will be NULL. |
| 740 |
* \param offset_in_bo - [out] offset in this BO for this user memory |
| 741 |
* |
| 742 |
* |
| 743 |
* \return 0 on success\n |
| 744 |
* <0 - Negative POSIX Error code |
| 745 |
* |
| 746 |
*/ |
| 747 |
int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, |
| 748 |
void *cpu, |
| 749 |
uint64_t size, |
| 750 |
amdgpu_bo_handle *buf_handle, |
| 751 |
uint64_t *offset_in_bo); |
| 752 |
|
| 753 |
/** |
| 754 |
* Free previously allocated memory |
| 755 |
* |
| 756 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 757 |
* \param buf_handle - \c [in] Buffer handle to free |
| 758 |
* |
| 759 |
* \return 0 on success\n |
| 760 |
* <0 - Negative POSIX Error code |
| 761 |
* |
| 762 |
* \note In the case of memory shared between different applications all |
| 763 |
* resources will be “physically” freed only all such applications |
| 764 |
* will be terminated |
| 765 |
* \note If is UMD responsibility to ‘free’ buffer only when there is no |
| 766 |
* more GPU access |
| 767 |
* |
| 768 |
* \sa amdgpu_bo_set_metadata(), amdgpu_bo_alloc() |
| 769 |
* |
| 770 |
*/ |
| 771 |
int amdgpu_bo_free(amdgpu_bo_handle buf_handle); |
| 772 |
|
| 773 |
/** |
| 774 |
* Increase the reference count of a buffer object |
| 775 |
* |
| 776 |
* \param bo - \c [in] Buffer object handle to increase the reference count |
| 777 |
* |
| 778 |
* \sa amdgpu_bo_alloc(), amdgpu_bo_free() |
| 779 |
* |
| 780 |
*/ |
| 781 |
void amdgpu_bo_inc_ref(amdgpu_bo_handle bo); |
| 782 |
|
| 783 |
/** |
| 784 |
* Request CPU access to GPU accessible memory |
| 785 |
* |
| 786 |
* \param buf_handle - \c [in] Buffer handle |
| 787 |
* \param cpu - \c [out] CPU address to be used for access |
| 788 |
* |
| 789 |
* \return 0 on success\n |
| 790 |
* <0 - Negative POSIX Error code |
| 791 |
* |
| 792 |
* \sa amdgpu_bo_cpu_unmap() |
| 793 |
* |
| 794 |
*/ |
| 795 |
int amdgpu_bo_cpu_map(amdgpu_bo_handle buf_handle, void **cpu); |
| 796 |
|
| 797 |
/** |
| 798 |
* Release CPU access to GPU memory |
| 799 |
* |
| 800 |
* \param buf_handle - \c [in] Buffer handle |
| 801 |
* |
| 802 |
* \return 0 on success\n |
| 803 |
* <0 - Negative POSIX Error code |
| 804 |
* |
| 805 |
* \sa amdgpu_bo_cpu_map() |
| 806 |
* |
| 807 |
*/ |
| 808 |
int amdgpu_bo_cpu_unmap(amdgpu_bo_handle buf_handle); |
| 809 |
|
| 810 |
/** |
| 811 |
* Wait until a buffer is not used by the device. |
| 812 |
* |
| 813 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 814 |
* \param buf_handle - \c [in] Buffer handle. |
| 815 |
* \param timeout_ns - Timeout in nanoseconds. |
| 816 |
* \param buffer_busy - 0 if buffer is idle, all GPU access was completed |
| 817 |
* and no GPU access is scheduled. |
| 818 |
* 1 GPU access is in fly or scheduled |
| 819 |
* |
| 820 |
* \return 0 - on success |
| 821 |
* <0 - Negative POSIX Error code |
| 822 |
*/ |
| 823 |
int amdgpu_bo_wait_for_idle(amdgpu_bo_handle buf_handle, |
| 824 |
uint64_t timeout_ns, |
| 825 |
bool *buffer_busy); |
| 826 |
|
| 827 |
/** |
| 828 |
* Creates a BO list handle for command submission. |
| 829 |
* |
| 830 |
* \param dev - \c [in] Device handle. |
| 831 |
* See #amdgpu_device_initialize() |
| 832 |
* \param number_of_buffers - \c [in] Number of BOs in the list |
| 833 |
* \param buffers - \c [in] List of BO handles |
| 834 |
* \param result - \c [out] Created BO list handle |
| 835 |
* |
| 836 |
* \return 0 on success\n |
| 837 |
* <0 - Negative POSIX Error code |
| 838 |
* |
| 839 |
* \sa amdgpu_bo_list_destroy_raw(), amdgpu_cs_submit_raw2() |
| 840 |
*/ |
| 841 |
int amdgpu_bo_list_create_raw(amdgpu_device_handle dev, |
| 842 |
uint32_t number_of_buffers, |
| 843 |
struct drm_amdgpu_bo_list_entry *buffers, |
| 844 |
uint32_t *result); |
| 845 |
|
| 846 |
/** |
| 847 |
* Destroys a BO list handle. |
| 848 |
* |
| 849 |
* \param bo_list - \c [in] BO list handle. |
| 850 |
* |
| 851 |
* \return 0 on success\n |
| 852 |
* <0 - Negative POSIX Error code |
| 853 |
* |
| 854 |
* \sa amdgpu_bo_list_create_raw(), amdgpu_cs_submit_raw2() |
| 855 |
*/ |
| 856 |
int amdgpu_bo_list_destroy_raw(amdgpu_device_handle dev, uint32_t bo_list); |
| 857 |
|
| 858 |
/** |
| 859 |
* Creates a BO list handle for command submission. |
| 860 |
* |
| 861 |
* \param dev - \c [in] Device handle. |
| 862 |
* See #amdgpu_device_initialize() |
| 863 |
* \param number_of_resources - \c [in] Number of BOs in the list |
| 864 |
* \param resources - \c [in] List of BO handles |
| 865 |
* \param resource_prios - \c [in] Optional priority for each handle |
| 866 |
* \param result - \c [out] Created BO list handle |
| 867 |
* |
| 868 |
* \return 0 on success\n |
| 869 |
* <0 - Negative POSIX Error code |
| 870 |
* |
| 871 |
* \sa amdgpu_bo_list_destroy() |
| 872 |
*/ |
| 873 |
int amdgpu_bo_list_create(amdgpu_device_handle dev, |
| 874 |
uint32_t number_of_resources, |
| 875 |
amdgpu_bo_handle *resources, |
| 876 |
uint8_t *resource_prios, |
| 877 |
amdgpu_bo_list_handle *result); |
| 878 |
|
| 879 |
/** |
| 880 |
* Destroys a BO list handle. |
| 881 |
* |
| 882 |
* \param handle - \c [in] BO list handle. |
| 883 |
* |
| 884 |
* \return 0 on success\n |
| 885 |
* <0 - Negative POSIX Error code |
| 886 |
* |
| 887 |
* \sa amdgpu_bo_list_create() |
| 888 |
*/ |
| 889 |
int amdgpu_bo_list_destroy(amdgpu_bo_list_handle handle); |
| 890 |
|
| 891 |
/** |
| 892 |
* Update resources for existing BO list |
| 893 |
* |
| 894 |
* \param handle - \c [in] BO list handle |
| 895 |
* \param number_of_resources - \c [in] Number of BOs in the list |
| 896 |
* \param resources - \c [in] List of BO handles |
| 897 |
* \param resource_prios - \c [in] Optional priority for each handle |
| 898 |
* |
| 899 |
* \return 0 on success\n |
| 900 |
* <0 - Negative POSIX Error code |
| 901 |
* |
| 902 |
* \sa amdgpu_bo_list_update() |
| 903 |
*/ |
| 904 |
int amdgpu_bo_list_update(amdgpu_bo_list_handle handle, |
| 905 |
uint32_t number_of_resources, |
| 906 |
amdgpu_bo_handle *resources, |
| 907 |
uint8_t *resource_prios); |
| 908 |
|
| 909 |
/* |
| 910 |
* GPU Execution context |
| 911 |
* |
| 912 |
*/ |
| 913 |
|
| 914 |
/** |
| 915 |
* Create GPU execution Context |
| 916 |
* |
| 917 |
* For the purpose of GPU Scheduler and GPU Robustness extensions it is |
| 918 |
* necessary to have information/identify rendering/compute contexts. |
| 919 |
* It also may be needed to associate some specific requirements with such |
| 920 |
* contexts. Kernel driver will guarantee that submission from the same |
| 921 |
* context will always be executed in order (first come, first serve). |
| 922 |
* |
| 923 |
* |
| 924 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 925 |
* \param priority - \c [in] Context creation flags. See AMDGPU_CTX_PRIORITY_* |
| 926 |
* \param context - \c [out] GPU Context handle |
| 927 |
* |
| 928 |
* \return 0 on success\n |
| 929 |
* <0 - Negative POSIX Error code |
| 930 |
* |
| 931 |
* \sa amdgpu_cs_ctx_free() |
| 932 |
* |
| 933 |
*/ |
| 934 |
int amdgpu_cs_ctx_create2(amdgpu_device_handle dev, |
| 935 |
uint32_t priority, |
| 936 |
amdgpu_context_handle *context); |
| 937 |
/** |
| 938 |
* Create GPU execution Context |
| 939 |
* |
| 940 |
* Refer to amdgpu_cs_ctx_create2 for full documentation. This call |
| 941 |
* is missing the priority parameter. |
| 942 |
* |
| 943 |
* \sa amdgpu_cs_ctx_create2() |
| 944 |
* |
| 945 |
*/ |
| 946 |
int amdgpu_cs_ctx_create(amdgpu_device_handle dev, |
| 947 |
amdgpu_context_handle *context); |
| 948 |
|
| 949 |
/** |
| 950 |
* |
| 951 |
* Destroy GPU execution context when not needed any more |
| 952 |
* |
| 953 |
* \param context - \c [in] GPU Context handle |
| 954 |
* |
| 955 |
* \return 0 on success\n |
| 956 |
* <0 - Negative POSIX Error code |
| 957 |
* |
| 958 |
* \sa amdgpu_cs_ctx_create() |
| 959 |
* |
| 960 |
*/ |
| 961 |
int amdgpu_cs_ctx_free(amdgpu_context_handle context); |
| 962 |
|
| 963 |
/** |
| 964 |
* Override the submission priority for the given context using a master fd. |
| 965 |
* |
| 966 |
* \param dev - \c [in] device handle |
| 967 |
* \param context - \c [in] context handle for context id |
| 968 |
* \param master_fd - \c [in] The master fd to authorize the override. |
| 969 |
* \param priority - \c [in] The priority to assign to the context. |
| 970 |
* |
| 971 |
* \return 0 on success or a a negative Posix error code on failure. |
| 972 |
*/ |
| 973 |
int amdgpu_cs_ctx_override_priority(amdgpu_device_handle dev, |
| 974 |
amdgpu_context_handle context, |
| 975 |
int master_fd, |
| 976 |
unsigned priority); |
| 977 |
|
| 978 |
/** |
| 979 |
* Set or query the stable power state for GPU profiling. |
| 980 |
* |
| 981 |
* \param dev - \c [in] device handle |
| 982 |
* \param op - \c [in] AMDGPU_CTX_OP_{GET,SET}_STABLE_PSTATE |
| 983 |
* \param flags - \c [in] AMDGPU_CTX_STABLE_PSTATE_* |
| 984 |
* \param out_flags - \c [out] output current stable pstate |
| 985 |
* |
| 986 |
* \return 0 on success otherwise POSIX Error code. |
| 987 |
*/ |
| 988 |
int amdgpu_cs_ctx_stable_pstate(amdgpu_context_handle context, |
| 989 |
uint32_t op, |
| 990 |
uint32_t flags, |
| 991 |
uint32_t *out_flags); |
| 992 |
|
| 993 |
/** |
| 994 |
* Query reset state for the specific GPU Context |
| 995 |
* |
| 996 |
* \param context - \c [in] GPU Context handle |
| 997 |
* \param state - \c [out] One of AMDGPU_CTX_*_RESET |
| 998 |
* \param hangs - \c [out] Number of hangs caused by the context. |
| 999 |
* |
| 1000 |
* \return 0 on success\n |
| 1001 |
* <0 - Negative POSIX Error code |
| 1002 |
* |
| 1003 |
* \sa amdgpu_cs_ctx_create() |
| 1004 |
* |
| 1005 |
*/ |
| 1006 |
int amdgpu_cs_query_reset_state(amdgpu_context_handle context, |
| 1007 |
uint32_t *state, uint32_t *hangs); |
| 1008 |
|
| 1009 |
/** |
| 1010 |
* Query reset state for the specific GPU Context. |
| 1011 |
* |
| 1012 |
* \param context - \c [in] GPU Context handle |
| 1013 |
* \param flags - \c [out] A combination of AMDGPU_CTX_QUERY2_FLAGS_* |
| 1014 |
* |
| 1015 |
* \return 0 on success\n |
| 1016 |
* <0 - Negative POSIX Error code |
| 1017 |
* |
| 1018 |
* \sa amdgpu_cs_ctx_create() |
| 1019 |
* |
| 1020 |
*/ |
| 1021 |
int amdgpu_cs_query_reset_state2(amdgpu_context_handle context, |
| 1022 |
uint64_t *flags); |
| 1023 |
|
| 1024 |
/* |
| 1025 |
* Command Buffers Management |
| 1026 |
* |
| 1027 |
*/ |
| 1028 |
|
| 1029 |
/** |
| 1030 |
* Send request to submit command buffers to hardware. |
| 1031 |
* |
| 1032 |
* Kernel driver could use GPU Scheduler to make decision when physically |
| 1033 |
* sent this request to the hardware. Accordingly this request could be put |
| 1034 |
* in queue and sent for execution later. The only guarantee is that request |
| 1035 |
* from the same GPU context to the same ip:ip_instance:ring will be executed in |
| 1036 |
* order. |
| 1037 |
* |
| 1038 |
* The caller can specify the user fence buffer/location with the fence_info in the |
| 1039 |
* cs_request.The sequence number is returned via the 'seq_no' parameter |
| 1040 |
* in ibs_request structure. |
| 1041 |
* |
| 1042 |
* |
| 1043 |
* \param dev - \c [in] Device handle. |
| 1044 |
* See #amdgpu_device_initialize() |
| 1045 |
* \param context - \c [in] GPU Context |
| 1046 |
* \param flags - \c [in] Global submission flags |
| 1047 |
* \param ibs_request - \c [in/out] Pointer to submission requests. |
| 1048 |
* We could submit to the several |
| 1049 |
* engines/rings simulteniously as |
| 1050 |
* 'atomic' operation |
| 1051 |
* \param number_of_requests - \c [in] Number of submission requests |
| 1052 |
* |
| 1053 |
* \return 0 on success\n |
| 1054 |
* <0 - Negative POSIX Error code |
| 1055 |
* |
| 1056 |
* \note It is required to pass correct resource list with buffer handles |
| 1057 |
* which will be accessible by command buffers from submission |
| 1058 |
* This will allow kernel driver to correctly implement "paging". |
| 1059 |
* Failure to do so will have unpredictable results. |
| 1060 |
* |
| 1061 |
* \sa amdgpu_command_buffer_alloc(), amdgpu_command_buffer_free(), |
| 1062 |
* amdgpu_cs_query_fence_status() |
| 1063 |
* |
| 1064 |
*/ |
| 1065 |
int amdgpu_cs_submit(amdgpu_context_handle context, |
| 1066 |
uint64_t flags, |
| 1067 |
struct amdgpu_cs_request *ibs_request, |
| 1068 |
uint32_t number_of_requests); |
| 1069 |
|
| 1070 |
/** |
| 1071 |
* Query status of Command Buffer Submission |
| 1072 |
* |
| 1073 |
* \param fence - \c [in] Structure describing fence to query |
| 1074 |
* \param timeout_ns - \c [in] Timeout value to wait |
| 1075 |
* \param flags - \c [in] Flags for the query |
| 1076 |
* \param expired - \c [out] If fence expired or not.\n |
| 1077 |
* 0 – if fence is not expired\n |
| 1078 |
* !0 - otherwise |
| 1079 |
* |
| 1080 |
* \return 0 on success\n |
| 1081 |
* <0 - Negative POSIX Error code |
| 1082 |
* |
| 1083 |
* \note If UMD wants only to check operation status and returned immediately |
| 1084 |
* then timeout value as 0 must be passed. In this case success will be |
| 1085 |
* returned in the case if submission was completed or timeout error |
| 1086 |
* code. |
| 1087 |
* |
| 1088 |
* \sa amdgpu_cs_submit() |
| 1089 |
*/ |
| 1090 |
int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence, |
| 1091 |
uint64_t timeout_ns, |
| 1092 |
uint64_t flags, |
| 1093 |
uint32_t *expired); |
| 1094 |
|
| 1095 |
/** |
| 1096 |
* Wait for multiple fences |
| 1097 |
* |
| 1098 |
* \param fences - \c [in] The fence array to wait |
| 1099 |
* \param fence_count - \c [in] The fence count |
| 1100 |
* \param wait_all - \c [in] If true, wait all fences to be signaled, |
| 1101 |
* otherwise, wait at least one fence |
| 1102 |
* \param timeout_ns - \c [in] The timeout to wait, in nanoseconds |
| 1103 |
* \param status - \c [out] '1' for signaled, '0' for timeout |
| 1104 |
* \param first - \c [out] the index of the first signaled fence from @fences |
| 1105 |
* |
| 1106 |
* \return 0 on success |
| 1107 |
* <0 - Negative POSIX Error code |
| 1108 |
* |
| 1109 |
* \note Currently it supports only one amdgpu_device. All fences come from |
| 1110 |
* the same amdgpu_device with the same fd. |
| 1111 |
*/ |
| 1112 |
int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences, |
| 1113 |
uint32_t fence_count, |
| 1114 |
bool wait_all, |
| 1115 |
uint64_t timeout_ns, |
| 1116 |
uint32_t *status, uint32_t *first); |
| 1117 |
|
| 1118 |
/* |
| 1119 |
* Query / Info API |
| 1120 |
* |
| 1121 |
*/ |
| 1122 |
|
| 1123 |
/** |
| 1124 |
* Query allocation size alignments |
| 1125 |
* |
| 1126 |
* UMD should query information about GPU VM MC size alignments requirements |
| 1127 |
* to be able correctly choose required allocation size and implement |
| 1128 |
* internal optimization if needed. |
| 1129 |
* |
| 1130 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1131 |
* \param info - \c [out] Pointer to structure to get size alignment |
| 1132 |
* requirements |
| 1133 |
* |
| 1134 |
* \return 0 on success\n |
| 1135 |
* <0 - Negative POSIX Error code |
| 1136 |
* |
| 1137 |
*/ |
| 1138 |
int amdgpu_query_buffer_size_alignment(amdgpu_device_handle dev, |
| 1139 |
struct amdgpu_buffer_size_alignments |
| 1140 |
*info); |
| 1141 |
|
| 1142 |
/** |
| 1143 |
* Query firmware versions |
| 1144 |
* |
| 1145 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1146 |
* \param fw_type - \c [in] AMDGPU_INFO_FW_* |
| 1147 |
* \param ip_instance - \c [in] Index of the IP block of the same type. |
| 1148 |
* \param index - \c [in] Index of the engine. (for SDMA and MEC) |
| 1149 |
* \param version - \c [out] Pointer to to the "version" return value |
| 1150 |
* \param feature - \c [out] Pointer to to the "feature" return value |
| 1151 |
* |
| 1152 |
* \return 0 on success\n |
| 1153 |
* <0 - Negative POSIX Error code |
| 1154 |
* |
| 1155 |
*/ |
| 1156 |
int amdgpu_query_firmware_version(amdgpu_device_handle dev, unsigned fw_type, |
| 1157 |
unsigned ip_instance, unsigned index, |
| 1158 |
uint32_t *version, uint32_t *feature); |
| 1159 |
|
| 1160 |
/** |
| 1161 |
* Query the number of HW IP instances of a certain type. |
| 1162 |
* |
| 1163 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1164 |
* \param type - \c [in] Hardware IP block type = AMDGPU_HW_IP_* |
| 1165 |
* \param count - \c [out] Pointer to structure to get information |
| 1166 |
* |
| 1167 |
* \return 0 on success\n |
| 1168 |
* <0 - Negative POSIX Error code |
| 1169 |
*/ |
| 1170 |
int amdgpu_query_hw_ip_count(amdgpu_device_handle dev, unsigned type, |
| 1171 |
uint32_t *count); |
| 1172 |
|
| 1173 |
/** |
| 1174 |
* Query engine information |
| 1175 |
* |
| 1176 |
* This query allows UMD to query information different engines and their |
| 1177 |
* capabilities. |
| 1178 |
* |
| 1179 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1180 |
* \param type - \c [in] Hardware IP block type = AMDGPU_HW_IP_* |
| 1181 |
* \param ip_instance - \c [in] Index of the IP block of the same type. |
| 1182 |
* \param info - \c [out] Pointer to structure to get information |
| 1183 |
* |
| 1184 |
* \return 0 on success\n |
| 1185 |
* <0 - Negative POSIX Error code |
| 1186 |
*/ |
| 1187 |
int amdgpu_query_hw_ip_info(amdgpu_device_handle dev, unsigned type, |
| 1188 |
unsigned ip_instance, |
| 1189 |
struct drm_amdgpu_info_hw_ip *info); |
| 1190 |
|
| 1191 |
/** |
| 1192 |
* Query FW area related information. |
| 1193 |
* |
| 1194 |
* The return size is query-specific and depends on the "type" parameter. |
| 1195 |
* No more than "size" bytes is returned. |
| 1196 |
* |
| 1197 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1198 |
* \param type - \c [in] AMDGPU_HW_IP_* |
| 1199 |
* \param ip_instance - \c [in] HW IP index. |
| 1200 |
* \param info - \c [out] The pointer to return value |
| 1201 |
* |
| 1202 |
* \return 0 on success\n |
| 1203 |
* <0 - Negative POSIX error code |
| 1204 |
* |
| 1205 |
*/ |
| 1206 |
int amdgpu_query_uq_fw_area_info(amdgpu_device_handle dev, |
| 1207 |
unsigned type, |
| 1208 |
unsigned ip_instance, |
| 1209 |
struct drm_amdgpu_info_uq_fw_areas *info); |
| 1210 |
|
| 1211 |
/** |
| 1212 |
* Query heap information |
| 1213 |
* |
| 1214 |
* This query allows UMD to query potentially available memory resources and |
| 1215 |
* adjust their logic if necessary. |
| 1216 |
* |
| 1217 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1218 |
* \param heap - \c [in] Heap type |
| 1219 |
* \param info - \c [in] Pointer to structure to get needed information |
| 1220 |
* |
| 1221 |
* \return 0 on success\n |
| 1222 |
* <0 - Negative POSIX Error code |
| 1223 |
* |
| 1224 |
*/ |
| 1225 |
int amdgpu_query_heap_info(amdgpu_device_handle dev, uint32_t heap, |
| 1226 |
uint32_t flags, struct amdgpu_heap_info *info); |
| 1227 |
|
| 1228 |
/** |
| 1229 |
* Get the CRTC ID from the mode object ID |
| 1230 |
* |
| 1231 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1232 |
* \param id - \c [in] Mode object ID |
| 1233 |
* \param result - \c [in] Pointer to the CRTC ID |
| 1234 |
* |
| 1235 |
* \return 0 on success\n |
| 1236 |
* <0 - Negative POSIX Error code |
| 1237 |
* |
| 1238 |
*/ |
| 1239 |
int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id, |
| 1240 |
int32_t *result); |
| 1241 |
|
| 1242 |
/** |
| 1243 |
* Query GPU H/w Info |
| 1244 |
* |
| 1245 |
* Query hardware specific information |
| 1246 |
* |
| 1247 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1248 |
* \param heap - \c [in] Heap type |
| 1249 |
* \param info - \c [in] Pointer to structure to get needed information |
| 1250 |
* |
| 1251 |
* \return 0 on success\n |
| 1252 |
* <0 - Negative POSIX Error code |
| 1253 |
* |
| 1254 |
*/ |
| 1255 |
int amdgpu_query_gpu_info(amdgpu_device_handle dev, |
| 1256 |
struct amdgpu_gpu_info *info); |
| 1257 |
|
| 1258 |
/** |
| 1259 |
* Query hardware or driver information. |
| 1260 |
* |
| 1261 |
* The return size is query-specific and depends on the "info_id" parameter. |
| 1262 |
* No more than "size" bytes is returned. |
| 1263 |
* |
| 1264 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1265 |
* \param info_id - \c [in] AMDGPU_INFO_* |
| 1266 |
* \param size - \c [in] Size of the returned value. |
| 1267 |
* \param value - \c [out] Pointer to the return value. |
| 1268 |
* |
| 1269 |
* \return 0 on success\n |
| 1270 |
* <0 - Negative POSIX error code |
| 1271 |
* |
| 1272 |
*/ |
| 1273 |
int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id, |
| 1274 |
unsigned size, void *value); |
| 1275 |
|
| 1276 |
/** |
| 1277 |
* Query hardware or driver information. |
| 1278 |
* |
| 1279 |
* The return size is query-specific and depends on the "info_id" parameter. |
| 1280 |
* No more than "size" bytes is returned. |
| 1281 |
* |
| 1282 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1283 |
* \param info - \c [in] amdgpu_sw_info_* |
| 1284 |
* \param value - \c [out] Pointer to the return value. |
| 1285 |
* |
| 1286 |
* \return 0 on success\n |
| 1287 |
* <0 - Negative POSIX error code |
| 1288 |
* |
| 1289 |
*/ |
| 1290 |
int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info, |
| 1291 |
void *value); |
| 1292 |
|
| 1293 |
/** |
| 1294 |
* Query information about GDS |
| 1295 |
* |
| 1296 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1297 |
* \param gds_info - \c [out] Pointer to structure to get GDS information |
| 1298 |
* |
| 1299 |
* \return 0 on success\n |
| 1300 |
* <0 - Negative POSIX Error code |
| 1301 |
* |
| 1302 |
*/ |
| 1303 |
int amdgpu_query_gds_info(amdgpu_device_handle dev, |
| 1304 |
struct amdgpu_gds_resource_info *gds_info); |
| 1305 |
|
| 1306 |
/** |
| 1307 |
* Query information about sensor. |
| 1308 |
* |
| 1309 |
* The return size is query-specific and depends on the "sensor_type" |
| 1310 |
* parameter. No more than "size" bytes is returned. |
| 1311 |
* |
| 1312 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1313 |
* \param sensor_type - \c [in] AMDGPU_INFO_SENSOR_* |
| 1314 |
* \param size - \c [in] Size of the returned value. |
| 1315 |
* \param value - \c [out] Pointer to the return value. |
| 1316 |
* |
| 1317 |
* \return 0 on success\n |
| 1318 |
* <0 - Negative POSIX Error code |
| 1319 |
* |
| 1320 |
*/ |
| 1321 |
int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned sensor_type, |
| 1322 |
unsigned size, void *value); |
| 1323 |
|
| 1324 |
/** |
| 1325 |
* Query information about video capabilities |
| 1326 |
* |
| 1327 |
* The return sizeof(struct drm_amdgpu_info_video_caps) |
| 1328 |
* |
| 1329 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1330 |
* \param caps_type - \c [in] AMDGPU_INFO_VIDEO_CAPS_DECODE(ENCODE) |
| 1331 |
* \param size - \c [in] Size of the returned value. |
| 1332 |
* \param value - \c [out] Pointer to the return value. |
| 1333 |
* |
| 1334 |
* \return 0 on success\n |
| 1335 |
* <0 - Negative POSIX Error code |
| 1336 |
* |
| 1337 |
*/ |
| 1338 |
int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned cap_type, |
| 1339 |
unsigned size, void *value); |
| 1340 |
|
| 1341 |
/** |
| 1342 |
* Query information about VM faults |
| 1343 |
* |
| 1344 |
* The return sizeof(struct drm_amdgpu_info_gpuvm_fault) |
| 1345 |
* |
| 1346 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1347 |
* \param size - \c [in] Size of the returned value. |
| 1348 |
* \param value - \c [out] Pointer to the return value. |
| 1349 |
* |
| 1350 |
* \return 0 on success\n |
| 1351 |
* <0 - Negative POSIX Error code |
| 1352 |
* |
| 1353 |
*/ |
| 1354 |
int amdgpu_query_gpuvm_fault_info(amdgpu_device_handle dev, unsigned size, |
| 1355 |
void *value); |
| 1356 |
|
| 1357 |
/** |
| 1358 |
* Read a set of consecutive memory-mapped registers. |
| 1359 |
* Not all registers are allowed to be read by userspace. |
| 1360 |
* |
| 1361 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize( |
| 1362 |
* \param dword_offset - \c [in] Register offset in dwords |
| 1363 |
* \param count - \c [in] The number of registers to read starting |
| 1364 |
* from the offset |
| 1365 |
* \param instance - \c [in] GRBM_GFX_INDEX selector. It may have other |
| 1366 |
* uses. Set it to 0xffffffff if unsure. |
| 1367 |
* \param flags - \c [in] Flags with additional information. |
| 1368 |
* \param values - \c [out] The pointer to return values. |
| 1369 |
* |
| 1370 |
* \return 0 on success\n |
| 1371 |
* <0 - Negative POSIX error code |
| 1372 |
* |
| 1373 |
*/ |
| 1374 |
int amdgpu_read_mm_registers(amdgpu_device_handle dev, unsigned dword_offset, |
| 1375 |
unsigned count, uint32_t instance, uint32_t flags, |
| 1376 |
uint32_t *values); |
| 1377 |
|
| 1378 |
/** |
| 1379 |
* Flag to request VA address range in the 32bit address space |
| 1380 |
*/ |
| 1381 |
#define AMDGPU_VA_RANGE_32_BIT 0x1 |
| 1382 |
#define AMDGPU_VA_RANGE_HIGH 0x2 |
| 1383 |
#define AMDGPU_VA_RANGE_REPLAYABLE 0x4 |
| 1384 |
|
| 1385 |
/** |
| 1386 |
* Allocate virtual address range |
| 1387 |
* |
| 1388 |
* \param dev - [in] Device handle. See #amdgpu_device_initialize() |
| 1389 |
* \param va_range_type - \c [in] Type of MC va range from which to allocate |
| 1390 |
* \param size - \c [in] Size of range. Size must be correctly* aligned. |
| 1391 |
* It is client responsibility to correctly aligned size based on the future |
| 1392 |
* usage of allocated range. |
| 1393 |
* \param va_base_alignment - \c [in] Overwrite base address alignment |
| 1394 |
* requirement for GPU VM MC virtual |
| 1395 |
* address assignment. Must be multiple of size alignments received as |
| 1396 |
* 'amdgpu_buffer_size_alignments'. |
| 1397 |
* If 0 use the default one. |
| 1398 |
* \param va_base_required - \c [in] Specified required va base address. |
| 1399 |
* If 0 then library choose available one. |
| 1400 |
* If !0 value will be passed and those value already "in use" then |
| 1401 |
* corresponding error status will be returned. |
| 1402 |
* \param va_base_allocated - \c [out] On return: Allocated VA base to be used |
| 1403 |
* by client. |
| 1404 |
* \param va_range_handle - \c [out] On return: Handle assigned to allocation |
| 1405 |
* \param flags - \c [in] flags for special VA range |
| 1406 |
* |
| 1407 |
* \return 0 on success\n |
| 1408 |
* >0 - AMD specific error code\n |
| 1409 |
* <0 - Negative POSIX Error code |
| 1410 |
* |
| 1411 |
* \notes \n |
| 1412 |
* It is client responsibility to correctly handle VA assignments and usage. |
| 1413 |
* Neither kernel driver nor libdrm_amdpgu are able to prevent and |
| 1414 |
* detect wrong va assignment. |
| 1415 |
* |
| 1416 |
* It is client responsibility to correctly handle multi-GPU cases and to pass |
| 1417 |
* the corresponding arrays of all devices handles where corresponding VA will |
| 1418 |
* be used. |
| 1419 |
* |
| 1420 |
*/ |
| 1421 |
int amdgpu_va_range_alloc(amdgpu_device_handle dev, |
| 1422 |
enum amdgpu_gpu_va_range va_range_type, |
| 1423 |
uint64_t size, |
| 1424 |
uint64_t va_base_alignment, |
| 1425 |
uint64_t va_base_required, |
| 1426 |
uint64_t *va_base_allocated, |
| 1427 |
amdgpu_va_handle *va_range_handle, |
| 1428 |
uint64_t flags); |
| 1429 |
|
| 1430 |
/** |
| 1431 |
* Free previously allocated virtual address range |
| 1432 |
* |
| 1433 |
* |
| 1434 |
* \param va_range_handle - \c [in] Handle assigned to VA allocation |
| 1435 |
* |
| 1436 |
* \return 0 on success\n |
| 1437 |
* >0 - AMD specific error code\n |
| 1438 |
* <0 - Negative POSIX Error code |
| 1439 |
* |
| 1440 |
*/ |
| 1441 |
int amdgpu_va_range_free(amdgpu_va_handle va_range_handle); |
| 1442 |
|
| 1443 |
/** |
| 1444 |
* Return the starting address of the allocated virtual address range. |
| 1445 |
*/ |
| 1446 |
uint64_t amdgpu_va_get_start_addr(amdgpu_va_handle va_handle); |
| 1447 |
|
| 1448 |
/** |
| 1449 |
* Query virtual address range |
| 1450 |
* |
| 1451 |
* UMD can query GPU VM range supported by each device |
| 1452 |
* to initialize its own VAM accordingly. |
| 1453 |
* |
| 1454 |
* \param dev - [in] Device handle. See #amdgpu_device_initialize() |
| 1455 |
* \param type - \c [in] Type of virtual address range |
| 1456 |
* \param offset - \c [out] Start offset of virtual address range |
| 1457 |
* \param size - \c [out] Size of virtual address range |
| 1458 |
* |
| 1459 |
* \return 0 on success\n |
| 1460 |
* <0 - Negative POSIX Error code |
| 1461 |
* |
| 1462 |
*/ |
| 1463 |
|
| 1464 |
int amdgpu_va_range_query(amdgpu_device_handle dev, |
| 1465 |
enum amdgpu_gpu_va_range type, |
| 1466 |
uint64_t *start, |
| 1467 |
uint64_t *end); |
| 1468 |
|
| 1469 |
/** |
| 1470 |
* Allocate a amdgpu_va_manager object. |
| 1471 |
* The returned object has be initialized with the amdgpu_va_manager_init |
| 1472 |
* before use. |
| 1473 |
* On release, amdgpu_va_manager_deinit needs to be called, then the memory |
| 1474 |
* can be released using free(). |
| 1475 |
*/ |
| 1476 |
amdgpu_va_manager_handle amdgpu_va_manager_alloc(void); |
| 1477 |
|
| 1478 |
void amdgpu_va_manager_init(amdgpu_va_manager_handle va_mgr, |
| 1479 |
uint64_t low_va_offset, uint64_t low_va_max, |
| 1480 |
uint64_t high_va_offset, uint64_t high_va_max, |
| 1481 |
uint32_t virtual_address_alignment); |
| 1482 |
|
| 1483 |
#define AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT 0x1 |
| 1484 |
|
| 1485 |
void amdgpu_va_manager_init2(struct amdgpu_va_manager *va_mgr, |
| 1486 |
uint64_t low_va_offset, uint64_t low_va_max, |
| 1487 |
uint64_t high_va_offset, uint64_t high_va_max, |
| 1488 |
uint32_t virtual_address_alignment, |
| 1489 |
uint32_t flags); |
| 1490 |
|
| 1491 |
void amdgpu_va_manager_deinit(amdgpu_va_manager_handle va_mgr); |
| 1492 |
|
| 1493 |
/** |
| 1494 |
* Similar to #amdgpu_va_range_alloc() but allocates VA |
| 1495 |
* directly from an amdgpu_va_manager_handle instead of using |
| 1496 |
* the manager from an amdgpu_device. |
| 1497 |
*/ |
| 1498 |
|
| 1499 |
int amdgpu_va_range_alloc2(amdgpu_va_manager_handle va_mgr, |
| 1500 |
enum amdgpu_gpu_va_range va_range_type, |
| 1501 |
uint64_t size, |
| 1502 |
uint64_t va_base_alignment, |
| 1503 |
uint64_t va_base_required, |
| 1504 |
uint64_t *va_base_allocated, |
| 1505 |
amdgpu_va_handle *va_range_handle, |
| 1506 |
uint64_t flags); |
| 1507 |
|
| 1508 |
/** |
| 1509 |
* Query VA manager information. |
| 1510 |
* |
| 1511 |
* \param va_mgr - \c [in] VA manager |
| 1512 |
* \param info - \c [in] amdgpu_va_manager_sw_info_* |
| 1513 |
* \param value - \c [out] Pointer to the return value. |
| 1514 |
* |
| 1515 |
* \return 0 on success\n |
| 1516 |
* <0 - Negative POSIX error code |
| 1517 |
* |
| 1518 |
*/ |
| 1519 |
int amdgpu_va_manager_query_sw_info(struct amdgpu_va_manager *va_mgr, |
| 1520 |
enum amdgpu_va_manager_sw_info info, |
| 1521 |
void *value); |
| 1522 |
|
| 1523 |
/** |
| 1524 |
* VA mapping/unmapping for the buffer object |
| 1525 |
* |
| 1526 |
* \param bo - \c [in] BO handle |
| 1527 |
* \param offset - \c [in] Start offset to map |
| 1528 |
* \param size - \c [in] Size to map |
| 1529 |
* \param addr - \c [in] Start virtual address. |
| 1530 |
* \param flags - \c [in] Supported flags for mapping/unmapping |
| 1531 |
* \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP |
| 1532 |
* |
| 1533 |
* \return 0 on success\n |
| 1534 |
* <0 - Negative POSIX Error code |
| 1535 |
* |
| 1536 |
*/ |
| 1537 |
|
| 1538 |
int amdgpu_bo_va_op(amdgpu_bo_handle bo, |
| 1539 |
uint64_t offset, |
| 1540 |
uint64_t size, |
| 1541 |
uint64_t addr, |
| 1542 |
uint64_t flags, |
| 1543 |
uint32_t ops); |
| 1544 |
|
| 1545 |
/** |
| 1546 |
* VA mapping/unmapping for a buffer object or PRT region. |
| 1547 |
* |
| 1548 |
* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all |
| 1549 |
* parameters are treated "raw", i.e. size is not automatically aligned, and |
| 1550 |
* all flags must be specified explicitly. |
| 1551 |
* |
| 1552 |
* \param dev - \c [in] device handle |
| 1553 |
* \param bo - \c [in] BO handle (may be NULL) |
| 1554 |
* \param offset - \c [in] Start offset to map |
| 1555 |
* \param size - \c [in] Size to map |
| 1556 |
* \param addr - \c [in] Start virtual address. |
| 1557 |
* \param flags - \c [in] Supported flags for mapping/unmapping |
| 1558 |
* \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP |
| 1559 |
* |
| 1560 |
* \return 0 on success\n |
| 1561 |
* <0 - Negative POSIX Error code |
| 1562 |
* |
| 1563 |
*/ |
| 1564 |
|
| 1565 |
int amdgpu_bo_va_op_raw(amdgpu_device_handle dev, |
| 1566 |
amdgpu_bo_handle bo, |
| 1567 |
uint64_t offset, |
| 1568 |
uint64_t size, |
| 1569 |
uint64_t addr, |
| 1570 |
uint64_t flags, |
| 1571 |
uint32_t ops); |
| 1572 |
|
| 1573 |
/** |
| 1574 |
* VA mapping/unmapping of buffer object for usermode queue. |
| 1575 |
* |
| 1576 |
* This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all |
| 1577 |
* parameters are treated "raw2", i.e. size is not automatically aligned, and |
| 1578 |
* all flags must be specified explicitly. |
| 1579 |
* |
| 1580 |
* \param dev - \c [in] device handle |
| 1581 |
* \param bo - \c [in] BO handle (may be NULL) |
| 1582 |
* \param offset - \c [in] Start offset to map |
| 1583 |
* \param size - \c [in] Size to map |
| 1584 |
* \param addr - \c [in] Start virtual address. |
| 1585 |
* \param flags - \c [in] Supported flags for mapping/unmapping |
| 1586 |
* \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP |
| 1587 |
* \param vm_timeline_syncobj_out - \c [out] syncobj handle for PT update fence |
| 1588 |
* \param vm_timeline_point - \c [in] input timeline point |
| 1589 |
* \param input_fence_syncobj_handles - \c [in] Array of syncobj handles for bo unmap, |
| 1590 |
* clear and replace |
| 1591 |
* \param num_syncobj_handles - \c [in] Number of syncobj handles |
| 1592 |
* |
| 1593 |
* \return 0 on success\n |
| 1594 |
* <0 - Negative POSIX Error code |
| 1595 |
* |
| 1596 |
*/ |
| 1597 |
int amdgpu_bo_va_op_raw2(amdgpu_device_handle dev, |
| 1598 |
amdgpu_bo_handle bo, |
| 1599 |
uint64_t offset, |
| 1600 |
uint64_t size, |
| 1601 |
uint64_t addr, |
| 1602 |
uint64_t flags, |
| 1603 |
uint32_t ops, |
| 1604 |
uint32_t vm_timeline_syncobj_out, |
| 1605 |
uint64_t vm_timeline_point, |
| 1606 |
uint64_t input_fence_syncobj_array_in, |
| 1607 |
uint32_t num_syncobj_handles_in); |
| 1608 |
|
| 1609 |
/** |
| 1610 |
* create semaphore |
| 1611 |
* |
| 1612 |
* \param sem - \c [out] semaphore handle |
| 1613 |
* |
| 1614 |
* \return 0 on success\n |
| 1615 |
* <0 - Negative POSIX Error code |
| 1616 |
* |
| 1617 |
*/ |
| 1618 |
int amdgpu_cs_create_semaphore(amdgpu_semaphore_handle *sem); |
| 1619 |
|
| 1620 |
/** |
| 1621 |
* signal semaphore |
| 1622 |
* |
| 1623 |
* \param context - \c [in] GPU Context |
| 1624 |
* \param ip_type - \c [in] Hardware IP block type = AMDGPU_HW_IP_* |
| 1625 |
* \param ip_instance - \c [in] Index of the IP block of the same type |
| 1626 |
* \param ring - \c [in] Specify ring index of the IP |
| 1627 |
* \param sem - \c [in] semaphore handle |
| 1628 |
* |
| 1629 |
* \return 0 on success\n |
| 1630 |
* <0 - Negative POSIX Error code |
| 1631 |
* |
| 1632 |
*/ |
| 1633 |
int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx, |
| 1634 |
uint32_t ip_type, |
| 1635 |
uint32_t ip_instance, |
| 1636 |
uint32_t ring, |
| 1637 |
amdgpu_semaphore_handle sem); |
| 1638 |
|
| 1639 |
/** |
| 1640 |
* wait semaphore |
| 1641 |
* |
| 1642 |
* \param context - \c [in] GPU Context |
| 1643 |
* \param ip_type - \c [in] Hardware IP block type = AMDGPU_HW_IP_* |
| 1644 |
* \param ip_instance - \c [in] Index of the IP block of the same type |
| 1645 |
* \param ring - \c [in] Specify ring index of the IP |
| 1646 |
* \param sem - \c [in] semaphore handle |
| 1647 |
* |
| 1648 |
* \return 0 on success\n |
| 1649 |
* <0 - Negative POSIX Error code |
| 1650 |
* |
| 1651 |
*/ |
| 1652 |
int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx, |
| 1653 |
uint32_t ip_type, |
| 1654 |
uint32_t ip_instance, |
| 1655 |
uint32_t ring, |
| 1656 |
amdgpu_semaphore_handle sem); |
| 1657 |
|
| 1658 |
/** |
| 1659 |
* destroy semaphore |
| 1660 |
* |
| 1661 |
* \param sem - \c [in] semaphore handle |
| 1662 |
* |
| 1663 |
* \return 0 on success\n |
| 1664 |
* <0 - Negative POSIX Error code |
| 1665 |
* |
| 1666 |
*/ |
| 1667 |
int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem); |
| 1668 |
|
| 1669 |
/** |
| 1670 |
* Get the ASIC marketing name |
| 1671 |
* |
| 1672 |
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |
| 1673 |
* |
| 1674 |
* \return the constant string of the marketing name |
| 1675 |
* "NULL" means the ASIC is not found |
| 1676 |
*/ |
| 1677 |
const char *amdgpu_get_marketing_name(amdgpu_device_handle dev); |
| 1678 |
|
| 1679 |
/** |
| 1680 |
* Create kernel sync object |
| 1681 |
* |
| 1682 |
* \param dev - \c [in] device handle |
| 1683 |
* \param flags - \c [in] flags that affect creation |
| 1684 |
* \param syncobj - \c [out] sync object handle |
| 1685 |
* |
| 1686 |
* \return 0 on success\n |
| 1687 |
* <0 - Negative POSIX Error code |
| 1688 |
* |
| 1689 |
*/ |
| 1690 |
int amdgpu_cs_create_syncobj2(amdgpu_device_handle dev, |
| 1691 |
uint32_t flags, |
| 1692 |
uint32_t *syncobj); |
| 1693 |
|
| 1694 |
/** |
| 1695 |
* Create kernel sync object |
| 1696 |
* |
| 1697 |
* \param dev - \c [in] device handle |
| 1698 |
* \param syncobj - \c [out] sync object handle |
| 1699 |
* |
| 1700 |
* \return 0 on success\n |
| 1701 |
* <0 - Negative POSIX Error code |
| 1702 |
* |
| 1703 |
*/ |
| 1704 |
int amdgpu_cs_create_syncobj(amdgpu_device_handle dev, |
| 1705 |
uint32_t *syncobj); |
| 1706 |
/** |
| 1707 |
* Destroy kernel sync object |
| 1708 |
* |
| 1709 |
* \param dev - \c [in] device handle |
| 1710 |
* \param syncobj - \c [in] sync object handle |
| 1711 |
* |
| 1712 |
* \return 0 on success\n |
| 1713 |
* <0 - Negative POSIX Error code |
| 1714 |
* |
| 1715 |
*/ |
| 1716 |
int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev, |
| 1717 |
uint32_t syncobj); |
| 1718 |
|
| 1719 |
/** |
| 1720 |
* Reset kernel sync objects to unsignalled state. |
| 1721 |
* |
| 1722 |
* \param dev - \c [in] device handle |
| 1723 |
* \param syncobjs - \c [in] array of sync object handles |
| 1724 |
* \param syncobj_count - \c [in] number of handles in syncobjs |
| 1725 |
* |
| 1726 |
* \return 0 on success\n |
| 1727 |
* <0 - Negative POSIX Error code |
| 1728 |
* |
| 1729 |
*/ |
| 1730 |
int amdgpu_cs_syncobj_reset(amdgpu_device_handle dev, |
| 1731 |
const uint32_t *syncobjs, uint32_t syncobj_count); |
| 1732 |
|
| 1733 |
/** |
| 1734 |
* Signal kernel sync objects. |
| 1735 |
* |
| 1736 |
* \param dev - \c [in] device handle |
| 1737 |
* \param syncobjs - \c [in] array of sync object handles |
| 1738 |
* \param syncobj_count - \c [in] number of handles in syncobjs |
| 1739 |
* |
| 1740 |
* \return 0 on success\n |
| 1741 |
* <0 - Negative POSIX Error code |
| 1742 |
* |
| 1743 |
*/ |
| 1744 |
int amdgpu_cs_syncobj_signal(amdgpu_device_handle dev, |
| 1745 |
const uint32_t *syncobjs, uint32_t syncobj_count); |
| 1746 |
|
| 1747 |
/** |
| 1748 |
* Signal kernel timeline sync objects. |
| 1749 |
* |
| 1750 |
* \param dev - \c [in] device handle |
| 1751 |
* \param syncobjs - \c [in] array of sync object handles |
| 1752 |
* \param points - \c [in] array of timeline points |
| 1753 |
* \param syncobj_count - \c [in] number of handles in syncobjs |
| 1754 |
* |
| 1755 |
* \return 0 on success\n |
| 1756 |
* <0 - Negative POSIX Error code |
| 1757 |
* |
| 1758 |
*/ |
| 1759 |
int amdgpu_cs_syncobj_timeline_signal(amdgpu_device_handle dev, |
| 1760 |
const uint32_t *syncobjs, |
| 1761 |
uint64_t *points, |
| 1762 |
uint32_t syncobj_count); |
| 1763 |
|
| 1764 |
/** |
| 1765 |
* Wait for one or all sync objects to signal. |
| 1766 |
* |
| 1767 |
* \param dev - \c [in] self-explanatory |
| 1768 |
* \param handles - \c [in] array of sync object handles |
| 1769 |
* \param num_handles - \c [in] self-explanatory |
| 1770 |
* \param timeout_nsec - \c [in] self-explanatory |
| 1771 |
* \param flags - \c [in] a bitmask of DRM_SYNCOBJ_WAIT_FLAGS_* |
| 1772 |
* \param first_signaled - \c [in] self-explanatory |
| 1773 |
* |
| 1774 |
* \return 0 on success\n |
| 1775 |
* -ETIME - Timeout |
| 1776 |
* <0 - Negative POSIX Error code |
| 1777 |
* |
| 1778 |
*/ |
| 1779 |
int amdgpu_cs_syncobj_wait(amdgpu_device_handle dev, |
| 1780 |
uint32_t *handles, unsigned num_handles, |
| 1781 |
int64_t timeout_nsec, unsigned flags, |
| 1782 |
uint32_t *first_signaled); |
| 1783 |
|
| 1784 |
/** |
| 1785 |
* Wait for one or all sync objects on their points to signal. |
| 1786 |
* |
| 1787 |
* \param dev - \c [in] self-explanatory |
| 1788 |
* \param handles - \c [in] array of sync object handles |
| 1789 |
* \param points - \c [in] array of sync points to wait |
| 1790 |
* \param num_handles - \c [in] self-explanatory |
| 1791 |
* \param timeout_nsec - \c [in] self-explanatory |
| 1792 |
* \param flags - \c [in] a bitmask of DRM_SYNCOBJ_WAIT_FLAGS_* |
| 1793 |
* \param first_signaled - \c [in] self-explanatory |
| 1794 |
* |
| 1795 |
* \return 0 on success\n |
| 1796 |
* -ETIME - Timeout |
| 1797 |
* <0 - Negative POSIX Error code |
| 1798 |
* |
| 1799 |
*/ |
| 1800 |
int amdgpu_cs_syncobj_timeline_wait(amdgpu_device_handle dev, |
| 1801 |
uint32_t *handles, uint64_t *points, |
| 1802 |
unsigned num_handles, |
| 1803 |
int64_t timeout_nsec, unsigned flags, |
| 1804 |
uint32_t *first_signaled); |
| 1805 |
/** |
| 1806 |
* Query sync objects payloads. |
| 1807 |
* |
| 1808 |
* \param dev - \c [in] self-explanatory |
| 1809 |
* \param handles - \c [in] array of sync object handles |
| 1810 |
* \param points - \c [out] array of sync points returned, which presents |
| 1811 |
* syncobj payload. |
| 1812 |
* \param num_handles - \c [in] self-explanatory |
| 1813 |
* |
| 1814 |
* \return 0 on success\n |
| 1815 |
* -ETIME - Timeout |
| 1816 |
* <0 - Negative POSIX Error code |
| 1817 |
* |
| 1818 |
*/ |
| 1819 |
int amdgpu_cs_syncobj_query(amdgpu_device_handle dev, |
| 1820 |
uint32_t *handles, uint64_t *points, |
| 1821 |
unsigned num_handles); |
| 1822 |
/** |
| 1823 |
* Query sync objects last signaled or submitted point. |
| 1824 |
* |
| 1825 |
* \param dev - \c [in] self-explanatory |
| 1826 |
* \param handles - \c [in] array of sync object handles |
| 1827 |
* \param points - \c [out] array of sync points returned, which presents |
| 1828 |
* syncobj payload. |
| 1829 |
* \param num_handles - \c [in] self-explanatory |
| 1830 |
* \param flags - \c [in] a bitmask of DRM_SYNCOBJ_QUERY_FLAGS_* |
| 1831 |
* |
| 1832 |
* \return 0 on success\n |
| 1833 |
* -ETIME - Timeout |
| 1834 |
* <0 - Negative POSIX Error code |
| 1835 |
* |
| 1836 |
*/ |
| 1837 |
int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev, |
| 1838 |
uint32_t *handles, uint64_t *points, |
| 1839 |
unsigned num_handles, uint32_t flags); |
| 1840 |
|
| 1841 |
/** |
| 1842 |
* Export kernel sync object to shareable fd. |
| 1843 |
* |
| 1844 |
* \param dev - \c [in] device handle |
| 1845 |
* \param syncobj - \c [in] sync object handle |
| 1846 |
* \param shared_fd - \c [out] shared file descriptor. |
| 1847 |
* |
| 1848 |
* \return 0 on success\n |
| 1849 |
* <0 - Negative POSIX Error code |
| 1850 |
* |
| 1851 |
*/ |
| 1852 |
int amdgpu_cs_export_syncobj(amdgpu_device_handle dev, |
| 1853 |
uint32_t syncobj, |
| 1854 |
int *shared_fd); |
| 1855 |
/** |
| 1856 |
* Import kernel sync object from shareable fd. |
| 1857 |
* |
| 1858 |
* \param dev - \c [in] device handle |
| 1859 |
* \param shared_fd - \c [in] shared file descriptor. |
| 1860 |
* \param syncobj - \c [out] sync object handle |
| 1861 |
* |
| 1862 |
* \return 0 on success\n |
| 1863 |
* <0 - Negative POSIX Error code |
| 1864 |
* |
| 1865 |
*/ |
| 1866 |
int amdgpu_cs_import_syncobj(amdgpu_device_handle dev, |
| 1867 |
int shared_fd, |
| 1868 |
uint32_t *syncobj); |
| 1869 |
|
| 1870 |
/** |
| 1871 |
* Export kernel sync object to a sync_file. |
| 1872 |
* |
| 1873 |
* \param dev - \c [in] device handle |
| 1874 |
* \param syncobj - \c [in] sync object handle |
| 1875 |
* \param sync_file_fd - \c [out] sync_file file descriptor. |
| 1876 |
* |
| 1877 |
* \return 0 on success\n |
| 1878 |
* <0 - Negative POSIX Error code |
| 1879 |
* |
| 1880 |
*/ |
| 1881 |
int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev, |
| 1882 |
uint32_t syncobj, |
| 1883 |
int *sync_file_fd); |
| 1884 |
|
| 1885 |
/** |
| 1886 |
* Import kernel sync object from a sync_file. |
| 1887 |
* |
| 1888 |
* \param dev - \c [in] device handle |
| 1889 |
* \param syncobj - \c [in] sync object handle |
| 1890 |
* \param sync_file_fd - \c [in] sync_file file descriptor. |
| 1891 |
* |
| 1892 |
* \return 0 on success\n |
| 1893 |
* <0 - Negative POSIX Error code |
| 1894 |
* |
| 1895 |
*/ |
| 1896 |
int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev, |
| 1897 |
uint32_t syncobj, |
| 1898 |
int sync_file_fd); |
| 1899 |
/** |
| 1900 |
* Export kernel timeline sync object to a sync_file. |
| 1901 |
* |
| 1902 |
* \param dev - \c [in] device handle |
| 1903 |
* \param syncobj - \c [in] sync object handle |
| 1904 |
* \param point - \c [in] timeline point |
| 1905 |
* \param flags - \c [in] flags |
| 1906 |
* \param sync_file_fd - \c [out] sync_file file descriptor. |
| 1907 |
* |
| 1908 |
* \return 0 on success\n |
| 1909 |
* <0 - Negative POSIX Error code |
| 1910 |
* |
| 1911 |
*/ |
| 1912 |
int amdgpu_cs_syncobj_export_sync_file2(amdgpu_device_handle dev, |
| 1913 |
uint32_t syncobj, |
| 1914 |
uint64_t point, |
| 1915 |
uint32_t flags, |
| 1916 |
int *sync_file_fd); |
| 1917 |
|
| 1918 |
/** |
| 1919 |
* Import kernel timeline sync object from a sync_file. |
| 1920 |
* |
| 1921 |
* \param dev - \c [in] device handle |
| 1922 |
* \param syncobj - \c [in] sync object handle |
| 1923 |
* \param point - \c [in] timeline point |
| 1924 |
* \param sync_file_fd - \c [in] sync_file file descriptor. |
| 1925 |
* |
| 1926 |
* \return 0 on success\n |
| 1927 |
* <0 - Negative POSIX Error code |
| 1928 |
* |
| 1929 |
*/ |
| 1930 |
int amdgpu_cs_syncobj_import_sync_file2(amdgpu_device_handle dev, |
| 1931 |
uint32_t syncobj, |
| 1932 |
uint64_t point, |
| 1933 |
int sync_file_fd); |
| 1934 |
|
| 1935 |
/** |
| 1936 |
* transfer between syncbojs. |
| 1937 |
* |
| 1938 |
* \param dev - \c [in] device handle |
| 1939 |
* \param dst_handle - \c [in] sync object handle |
| 1940 |
* \param dst_point - \c [in] timeline point, 0 presents dst is binary |
| 1941 |
* \param src_handle - \c [in] sync object handle |
| 1942 |
* \param src_point - \c [in] timeline point, 0 presents src is binary |
| 1943 |
* \param flags - \c [in] flags |
| 1944 |
* |
| 1945 |
* \return 0 on success\n |
| 1946 |
* <0 - Negative POSIX Error code |
| 1947 |
* |
| 1948 |
*/ |
| 1949 |
int amdgpu_cs_syncobj_transfer(amdgpu_device_handle dev, |
| 1950 |
uint32_t dst_handle, |
| 1951 |
uint64_t dst_point, |
| 1952 |
uint32_t src_handle, |
| 1953 |
uint64_t src_point, |
| 1954 |
uint32_t flags); |
| 1955 |
|
| 1956 |
/** |
| 1957 |
* Export an amdgpu fence as a handle (syncobj or fd). |
| 1958 |
* |
| 1959 |
* \param what AMDGPU_FENCE_TO_HANDLE_GET_{SYNCOBJ, FD} |
| 1960 |
* \param out_handle returned handle |
| 1961 |
* |
| 1962 |
* \return 0 on success\n |
| 1963 |
* <0 - Negative POSIX Error code |
| 1964 |
*/ |
| 1965 |
int amdgpu_cs_fence_to_handle(amdgpu_device_handle dev, |
| 1966 |
struct amdgpu_cs_fence *fence, |
| 1967 |
uint32_t what, |
| 1968 |
uint32_t *out_handle); |
| 1969 |
|
| 1970 |
/** |
| 1971 |
* Submit raw command submission to kernel |
| 1972 |
* |
| 1973 |
* \param dev - \c [in] device handle |
| 1974 |
* \param context - \c [in] context handle for context id |
| 1975 |
* \param bo_list_handle - \c [in] request bo list handle (0 for none) |
| 1976 |
* \param num_chunks - \c [in] number of CS chunks to submit |
| 1977 |
* \param chunks - \c [in] array of CS chunks |
| 1978 |
* \param seq_no - \c [out] output sequence number for submission. |
| 1979 |
* |
| 1980 |
* \return 0 on success\n |
| 1981 |
* <0 - Negative POSIX Error code |
| 1982 |
* |
| 1983 |
*/ |
| 1984 |
struct drm_amdgpu_cs_chunk; |
| 1985 |
struct drm_amdgpu_cs_chunk_dep; |
| 1986 |
struct drm_amdgpu_cs_chunk_data; |
| 1987 |
|
| 1988 |
int amdgpu_cs_submit_raw(amdgpu_device_handle dev, |
| 1989 |
amdgpu_context_handle context, |
| 1990 |
amdgpu_bo_list_handle bo_list_handle, |
| 1991 |
int num_chunks, |
| 1992 |
struct drm_amdgpu_cs_chunk *chunks, |
| 1993 |
uint64_t *seq_no); |
| 1994 |
|
| 1995 |
/** |
| 1996 |
* Submit raw command submission to the kernel with a raw BO list handle. |
| 1997 |
* |
| 1998 |
* \param dev - \c [in] device handle |
| 1999 |
* \param context - \c [in] context handle for context id |
| 2000 |
* \param bo_list_handle - \c [in] raw bo list handle (0 for none) |
| 2001 |
* \param num_chunks - \c [in] number of CS chunks to submit |
| 2002 |
* \param chunks - \c [in] array of CS chunks |
| 2003 |
* \param seq_no - \c [out] output sequence number for submission. |
| 2004 |
* |
| 2005 |
* \return 0 on success\n |
| 2006 |
* <0 - Negative POSIX Error code |
| 2007 |
* |
| 2008 |
* \sa amdgpu_bo_list_create_raw(), amdgpu_bo_list_destroy_raw() |
| 2009 |
*/ |
| 2010 |
int amdgpu_cs_submit_raw2(amdgpu_device_handle dev, |
| 2011 |
amdgpu_context_handle context, |
| 2012 |
uint32_t bo_list_handle, |
| 2013 |
int num_chunks, |
| 2014 |
struct drm_amdgpu_cs_chunk *chunks, |
| 2015 |
uint64_t *seq_no); |
| 2016 |
|
| 2017 |
void amdgpu_cs_chunk_fence_to_dep(struct amdgpu_cs_fence *fence, |
| 2018 |
struct drm_amdgpu_cs_chunk_dep *dep); |
| 2019 |
void amdgpu_cs_chunk_fence_info_to_data(struct amdgpu_cs_fence_info *fence_info, |
| 2020 |
struct drm_amdgpu_cs_chunk_data *data); |
| 2021 |
|
| 2022 |
/** |
| 2023 |
* Reserve VMID |
| 2024 |
* \param context - \c [in] GPU Context |
| 2025 |
* \param flags - \c [in] TBD |
| 2026 |
* |
| 2027 |
* \return 0 on success otherwise POSIX Error code |
| 2028 |
*/ |
| 2029 |
int amdgpu_vm_reserve_vmid(amdgpu_device_handle dev, uint32_t flags); |
| 2030 |
|
| 2031 |
/** |
| 2032 |
* Free reserved VMID |
| 2033 |
* \param context - \c [in] GPU Context |
| 2034 |
* \param flags - \c [in] TBD |
| 2035 |
* |
| 2036 |
* \return 0 on success otherwise POSIX Error code |
| 2037 |
*/ |
| 2038 |
int amdgpu_vm_unreserve_vmid(amdgpu_device_handle dev, uint32_t flags); |
| 2039 |
|
| 2040 |
/** |
| 2041 |
* Create USERQUEUE |
| 2042 |
* \param dev - \c [in] device handle |
| 2043 |
* \param ip_type - \c [in] ip type |
| 2044 |
* \param doorbell_handle - \c [in] doorbell handle |
| 2045 |
* \param doorbell_offset - \c [in] doorbell index |
| 2046 |
* \param mqd_in - \c [in] MQD data |
| 2047 |
* \param queue_va - \c [in] Virtual address of queue |
| 2048 |
* \param queue_size - \c [in] userqueue size |
| 2049 |
* \param wptr_va - \c [in] Virtual address of wptr |
| 2050 |
* \param rptr_va - \c [in] Virtual address of rptr |
| 2051 |
* \param queue_id - \c [out] queue id |
| 2052 |
* |
| 2053 |
* \return 0 on success otherwise POSIX Error code |
| 2054 |
*/ |
| 2055 |
|
| 2056 |
int amdgpu_create_userqueue(amdgpu_device_handle dev, |
| 2057 |
uint32_t ip_type, |
| 2058 |
uint32_t doorbell_handle, |
| 2059 |
uint32_t doorbell_offset, |
| 2060 |
uint64_t queue_va, |
| 2061 |
uint64_t queue_size, |
| 2062 |
uint64_t wptr_va, |
| 2063 |
uint64_t rptr_va, |
| 2064 |
void *mqd_in, |
| 2065 |
uint32_t flags, |
| 2066 |
uint32_t *queue_id); |
| 2067 |
|
| 2068 |
/** |
| 2069 |
* Free USERQUEUE |
| 2070 |
* \param dev - \c [in] device handle |
| 2071 |
* \param queue_id - \c [in] queue id |
| 2072 |
* |
| 2073 |
* \return 0 on success otherwise POSIX Error code |
| 2074 |
*/ |
| 2075 |
int amdgpu_free_userqueue(amdgpu_device_handle dev, uint32_t queue_id); |
| 2076 |
|
| 2077 |
/** |
| 2078 |
* Signal USERQUEUE |
| 2079 |
* \param dev - \c [in] device handle |
| 2080 |
* \param signal_data - \c [in] pointer to struct drm_amdgpu_userq_signal |
| 2081 |
* to be filled by the caller |
| 2082 |
* |
| 2083 |
* \return 0 on success otherwise POSIX Error code |
| 2084 |
*/ |
| 2085 |
int amdgpu_userq_signal(amdgpu_device_handle dev, |
| 2086 |
struct drm_amdgpu_userq_signal *signal_data); |
| 2087 |
|
| 2088 |
/** |
| 2089 |
* Wait USERQUEUE |
| 2090 |
* \param dev - \c [in] device handle |
| 2091 |
* \param wait_data - \c [in/out] pointer to struct drm_amdgpu_userq_wait |
| 2092 |
* to be filled by the caller |
| 2093 |
* |
| 2094 |
* \return 0 on success otherwise POSIX Error code |
| 2095 |
*/ |
| 2096 |
int amdgpu_userq_wait(amdgpu_device_handle dev, |
| 2097 |
struct drm_amdgpu_userq_wait *wait_data); |
| 2098 |
|
| 2099 |
#ifdef __cplusplus |
| 2100 |
} |
| 2101 |
#endif |
| 2102 |
#endif /* #ifdef _AMDGPU_H_ */ |