1*41ec0267Sriastradh /* $NetBSD: amdgpu_gem.h,v 1.2 2021/12/18 23:44:58 riastradh Exp $ */ 24e390cabSriastradh 34e390cabSriastradh /* 44e390cabSriastradh * Copyright 2018 Advanced Micro Devices, Inc. 54e390cabSriastradh * 64e390cabSriastradh * Permission is hereby granted, free of charge, to any person obtaining a 74e390cabSriastradh * copy of this software and associated documentation files (the "Software"), 84e390cabSriastradh * to deal in the Software without restriction, including without limitation 94e390cabSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense, 104e390cabSriastradh * and/or sell copies of the Software, and to permit persons to whom the 114e390cabSriastradh * Software is furnished to do so, subject to the following conditions: 124e390cabSriastradh * 134e390cabSriastradh * The above copyright notice and this permission notice shall be included in 144e390cabSriastradh * all copies or substantial portions of the Software. 154e390cabSriastradh * 164e390cabSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 174e390cabSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 184e390cabSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 194e390cabSriastradh * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 204e390cabSriastradh * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 214e390cabSriastradh * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 224e390cabSriastradh * OTHER DEALINGS IN THE SOFTWARE. 234e390cabSriastradh * 244e390cabSriastradh */ 254e390cabSriastradh #ifndef __AMDGPU_GEM_H__ 264e390cabSriastradh #define __AMDGPU_GEM_H__ 274e390cabSriastradh 284e390cabSriastradh #include <drm/amdgpu_drm.h> 294e390cabSriastradh #include <drm/drm_gem.h> 304e390cabSriastradh 314e390cabSriastradh /* 324e390cabSriastradh * GEM. 334e390cabSriastradh */ 344e390cabSriastradh 354e390cabSriastradh #define AMDGPU_GEM_DOMAIN_MAX 0x3 364e390cabSriastradh #define gem_to_amdgpu_bo(gobj) container_of((gobj), struct amdgpu_bo, tbo.base) 374e390cabSriastradh 384e390cabSriastradh void amdgpu_gem_object_free(struct drm_gem_object *obj); 394e390cabSriastradh int amdgpu_gem_object_open(struct drm_gem_object *obj, 404e390cabSriastradh struct drm_file *file_priv); 414e390cabSriastradh void amdgpu_gem_object_close(struct drm_gem_object *obj, 424e390cabSriastradh struct drm_file *file_priv); 434e390cabSriastradh unsigned long amdgpu_gem_timeout(uint64_t timeout_ns); 444e390cabSriastradh 454e390cabSriastradh /* 464e390cabSriastradh * GEM objects. 474e390cabSriastradh */ 484e390cabSriastradh void amdgpu_gem_force_release(struct amdgpu_device *adev); 494e390cabSriastradh int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, 504e390cabSriastradh int alignment, u32 initial_domain, 514e390cabSriastradh u64 flags, enum ttm_bo_type type, 524e390cabSriastradh struct dma_resv *resv, 534e390cabSriastradh struct drm_gem_object **obj); 544e390cabSriastradh 554e390cabSriastradh int amdgpu_mode_dumb_create(struct drm_file *file_priv, 564e390cabSriastradh struct drm_device *dev, 574e390cabSriastradh struct drm_mode_create_dumb *args); 584e390cabSriastradh int amdgpu_mode_dumb_mmap(struct drm_file *filp, 594e390cabSriastradh struct drm_device *dev, 604e390cabSriastradh uint32_t handle, uint64_t *offset_p); 614e390cabSriastradh 624e390cabSriastradh int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, 634e390cabSriastradh struct drm_file *filp); 644e390cabSriastradh int amdgpu_gem_info_ioctl(struct drm_device *dev, void *data, 654e390cabSriastradh struct drm_file *filp); 664e390cabSriastradh int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, 674e390cabSriastradh struct drm_file *filp); 684e390cabSriastradh int amdgpu_gem_mmap_ioctl(struct drm_device *dev, void *data, 694e390cabSriastradh struct drm_file *filp); 704e390cabSriastradh int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, 714e390cabSriastradh struct drm_file *filp); 724e390cabSriastradh uint64_t amdgpu_gem_va_map_flags(struct amdgpu_device *adev, uint32_t flags); 734e390cabSriastradh int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, 744e390cabSriastradh struct drm_file *filp); 754e390cabSriastradh int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, 764e390cabSriastradh struct drm_file *filp); 774e390cabSriastradh 784e390cabSriastradh int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, 794e390cabSriastradh struct drm_file *filp); 804e390cabSriastradh 814e390cabSriastradh #endif 82